@pisell/private-materials 3.4.35 → 3.4.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +146 -146
  7. package/build/lowcode/render/default/view.js +7 -7
  8. package/build/lowcode/view.js +8 -8
  9. package/es/components/booking/addons/model.d.ts +10 -1
  10. package/es/components/booking/forms/model.d.ts +10 -1
  11. package/es/components/booking/info/model.d.ts +10 -1
  12. package/es/components/booking/info/service/addService/utils.d.ts +1 -1
  13. package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
  14. package/es/components/booking/model.d.ts +9 -1
  15. package/es/components/booking/notes/model.d.ts +10 -1
  16. package/es/components/booking/payments/model.d.ts +10 -1
  17. package/es/components/booking/utils.d.ts +2 -2
  18. package/es/components/eftposPay/amount.d.ts +1 -1
  19. package/es/components/eftposPay/device.d.ts +1 -1
  20. package/es/components/eftposPay/hooks.d.ts +1 -1
  21. package/es/components/eftposPay/linkly/hooks/useTimeQuery.js +35 -13
  22. package/es/components/eftposPay/payo/config.js +10 -10
  23. package/es/components/eftposPay/store/index.d.ts +2 -2
  24. package/es/components/pay/toC/PaymentMethods/ApplePay/index.js +52 -6
  25. package/es/components/pay/toC/PaymentMethods/BankDeposit/index.js +58 -8
  26. package/es/components/pay/toC/PaymentMethods/CashManual/index.js +74 -12
  27. package/es/components/pay/toC/PaymentMethods/CustomPayment/index.js +73 -12
  28. package/es/components/pay/toC/PaymentMethods/GlobePayAliPayH5/index.js +93 -11
  29. package/es/components/pay/toC/PaymentMethods/GlobePayPaypalH5/index.js +90 -12
  30. package/es/components/pay/toC/PaymentMethods/GlobePayQrcode/index.js +46 -7
  31. package/es/components/pay/toC/PaymentMethods/GlobePayWxH5/index.js +90 -12
  32. package/es/components/pay/toC/PaymentMethods/GooglePay/index.js +64 -13
  33. package/es/components/pay/toC/PaymentMethods/OfflinePayment/index.js +73 -8
  34. package/es/components/pay/toC/PaymentMethods/StripePay/index.js +68 -17
  35. package/es/components/pay/toC/PaymentMethods/SuperPayAliPayH5/index.js +86 -14
  36. package/es/components/pay/toC/PaymentMethods/SuperPayWxPayH5/index.js +89 -15
  37. package/es/components/pay/toC/index.js +278 -118
  38. package/es/components/pay/toC/model.d.ts +9 -1
  39. package/es/components/schedules/model.d.ts +9 -1
  40. package/es/components/wallet/Detail/model.d.ts +13 -1
  41. package/es/components/wallet/DiscountCard/model.d.ts +14 -1
  42. package/es/components/wallet/PointCard/model.d.ts +13 -1
  43. package/es/components/wallet/RechargeableCard/model.d.ts +29 -1
  44. package/es/components/wallet/Voucher/model.d.ts +13 -1
  45. package/es/components/wallet/model.d.ts +9 -1
  46. package/es/hooks/usePaymentLogger.d.ts +22 -0
  47. package/es/hooks/usePaymentLogger.js +78 -0
  48. package/lib/components/booking/addons/model.d.ts +10 -1
  49. package/lib/components/booking/forms/model.d.ts +10 -1
  50. package/lib/components/booking/info/model.d.ts +10 -1
  51. package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
  52. package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
  53. package/lib/components/booking/model.d.ts +9 -1
  54. package/lib/components/booking/notes/model.d.ts +10 -1
  55. package/lib/components/booking/payments/model.d.ts +10 -1
  56. package/lib/components/booking/utils.d.ts +2 -2
  57. package/lib/components/eftposPay/amount.d.ts +1 -1
  58. package/lib/components/eftposPay/device.d.ts +1 -1
  59. package/lib/components/eftposPay/hooks.d.ts +1 -1
  60. package/lib/components/eftposPay/linkly/hooks/useTimeQuery.js +43 -11
  61. package/lib/components/eftposPay/payo/config.js +9 -9
  62. package/lib/components/eftposPay/store/index.d.ts +2 -2
  63. package/lib/components/pay/toC/PaymentMethods/ApplePay/index.js +42 -3
  64. package/lib/components/pay/toC/PaymentMethods/BankDeposit/index.js +52 -15
  65. package/lib/components/pay/toC/PaymentMethods/CashManual/index.js +60 -2
  66. package/lib/components/pay/toC/PaymentMethods/CustomPayment/index.js +60 -2
  67. package/lib/components/pay/toC/PaymentMethods/GlobePayAliPayH5/index.js +66 -2
  68. package/lib/components/pay/toC/PaymentMethods/GlobePayPaypalH5/index.js +61 -0
  69. package/lib/components/pay/toC/PaymentMethods/GlobePayQrcode/index.js +29 -0
  70. package/lib/components/pay/toC/PaymentMethods/GlobePayWxH5/index.js +61 -0
  71. package/lib/components/pay/toC/PaymentMethods/GooglePay/index.js +50 -6
  72. package/lib/components/pay/toC/PaymentMethods/OfflinePayment/index.js +72 -10
  73. package/lib/components/pay/toC/PaymentMethods/StripePay/index.js +47 -5
  74. package/lib/components/pay/toC/PaymentMethods/SuperPayAliPayH5/index.js +61 -3
  75. package/lib/components/pay/toC/PaymentMethods/SuperPayWxPayH5/index.js +63 -3
  76. package/lib/components/pay/toC/index.js +183 -48
  77. package/lib/components/pay/toC/model.d.ts +9 -1
  78. package/lib/components/schedules/model.d.ts +9 -1
  79. package/lib/components/wallet/Detail/model.d.ts +13 -1
  80. package/lib/components/wallet/DiscountCard/model.d.ts +14 -1
  81. package/lib/components/wallet/PointCard/model.d.ts +13 -1
  82. package/lib/components/wallet/RechargeableCard/model.d.ts +29 -1
  83. package/lib/components/wallet/Voucher/model.d.ts +13 -1
  84. package/lib/components/wallet/model.d.ts +9 -1
  85. package/lib/hooks/usePaymentLogger.d.ts +22 -0
  86. package/lib/hooks/usePaymentLogger.js +69 -0
  87. package/package.json +4 -4
@@ -1 +1,10 @@
1
- export declare const Provider: any, Context: any;
1
+ /// <reference types="react" />
2
+ import { FormState } from "../model";
3
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
4
+ state: FormState;
5
+ } & {
6
+ dispatch: (params: {
7
+ type: string;
8
+ payload: any;
9
+ }) => void;
10
+ }>;
@@ -1 +1,10 @@
1
- export declare const Provider: any, Context: any;
1
+ /// <reference types="react" />
2
+ import { FormState } from "../model";
3
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
4
+ state: FormState;
5
+ } & {
6
+ dispatch: (params: {
7
+ type: string;
8
+ payload: any;
9
+ }) => void;
10
+ }>;
@@ -1,5 +1,14 @@
1
+ /// <reference types="react" />
2
+ import { FormState } from '../model';
1
3
  export declare const walkInData: {
2
4
  id: number;
3
5
  nickname: string;
4
6
  };
5
- export declare const Provider: any, Context: any;
7
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
8
+ state: FormState;
9
+ } & {
10
+ dispatch: (params: {
11
+ type: string;
12
+ payload: any;
13
+ }) => void;
14
+ }>;
@@ -6,7 +6,7 @@ export declare const getDurationProps: ({ cacheItem, useStartTime, currentResour
6
6
  type: string;
7
7
  value: number;
8
8
  };
9
- locale: any;
9
+ locale: string;
10
10
  slice: any;
11
11
  selectProps: {
12
12
  size: string;
@@ -7,7 +7,7 @@ export declare const getDurationProps: ({ cacheItem, useStartTime, currentResour
7
7
  type: string;
8
8
  value: number;
9
9
  };
10
- locale: any;
10
+ locale: string;
11
11
  slice: any;
12
12
  selectProps: {
13
13
  size: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export interface FormState {
2
3
  amountSymbol: string;
3
4
  apis: {
@@ -104,4 +105,11 @@ export declare const walkInData: {
104
105
  id: number;
105
106
  nickname: string;
106
107
  };
107
- export declare const Provider: any, Context: any;
108
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
109
+ state: FormState;
110
+ } & {
111
+ dispatch: (params: {
112
+ type: string;
113
+ payload: any;
114
+ }) => void;
115
+ }>;
@@ -1 +1,10 @@
1
- export declare const Provider: any, Context: any;
1
+ /// <reference types="react" />
2
+ import { FormState } from "../model";
3
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
4
+ state: FormState;
5
+ } & {
6
+ dispatch: (params: {
7
+ type: string;
8
+ payload: any;
9
+ }) => void;
10
+ }>;
@@ -1 +1,10 @@
1
- export declare const Provider: any, Context: any;
1
+ /// <reference types="react" />
2
+ import { FormState } from "../model";
3
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
4
+ state: FormState;
5
+ } & {
6
+ dispatch: (params: {
7
+ type: string;
8
+ payload: any;
9
+ }) => void;
10
+ }>;
@@ -165,10 +165,10 @@ export declare const getProductTotalPrice: (item: any) => number;
165
165
  export declare const getDuration: (duration: number | {
166
166
  type: string;
167
167
  value: number;
168
- }) => number | {
168
+ }) => number | "flexible" | {
169
169
  type: string;
170
170
  value: number;
171
- } | "flexible";
171
+ };
172
172
  export declare const isWalkIn: (customer_id?: number | string) => boolean;
173
173
  export declare const getIsEdit: (state: any) => boolean;
174
174
  export {};
@@ -8,7 +8,7 @@ import { PosProps } from './const';
8
8
  */
9
9
  declare const _default: ({ className, onChange, onClose, formatAmount, isMobile, net, client }: {
10
10
  className?: string | undefined;
11
- onChange?: ((status: "success" | "page" | "print" | "fail" | "mark_tx_processed", params?: string | {
11
+ onChange?: ((status: "page" | "success" | "print" | "fail" | "mark_tx_processed", params?: string | {
12
12
  [keys: string]: unknown;
13
13
  } | undefined, other?: any) => void) | undefined;
14
14
  onClose: () => void;
@@ -10,7 +10,7 @@ import './device.less';
10
10
  declare const _default: ({ api, onChange, onClose, className, device_number, isMobile, net, client, formatAmount, }: {
11
11
  api: PayProps['api'];
12
12
  className?: string | undefined;
13
- onChange?: ((status: "success" | "page" | "print" | "fail" | "mark_tx_processed", params?: string | {
13
+ onChange?: ((status: "page" | "success" | "print" | "fail" | "mark_tx_processed", params?: string | {
14
14
  [keys: string]: unknown;
15
15
  } | undefined, other?: any) => void) | undefined;
16
16
  onClose: () => void;
@@ -15,7 +15,7 @@ export declare const useStoreRef: <T extends {
15
15
  readonly numRef: React.MutableRefObject<string | number | undefined>;
16
16
  readonly orderIdRef: React.MutableRefObject<string | number>;
17
17
  readonly modeRef: React.MutableRefObject<ModeEnum>;
18
- readonly statusRef: React.MutableRefObject<"loading" | "warn" | "success" | "fail" | "pedding" | "resove" | "reject" | "question">;
18
+ readonly statusRef: React.MutableRefObject<"loading" | "success" | "warn" | "fail" | "pedding" | "resove" | "reject" | "question">;
19
19
  readonly netRef: React.MutableRefObject<boolean | undefined>;
20
20
  readonly symbolRef: React.MutableRefObject<string>;
21
21
  readonly amountRef: React.MutableRefObject<string | number>;
@@ -4,13 +4,14 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
4
4
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
5
5
  import { useRef } from 'react';
6
6
  import { getUniqueId, locales, sendWarningLog } from '@pisell/utils';
7
+ import dayjs from 'dayjs';
7
8
  import { useDispatch, updateCustom, updateStatus, updateState } from "../../store";
8
9
  import { useFail, useStoreRef } from "../../hooks";
9
10
  import { ModeEnum, PayStatus, StatusEnum } from "../../const";
10
11
  import { LinklyActionStatus } from "../const";
11
12
 
12
13
  // 全局超时时间
13
- var GlobalTimeout = 1000 * 60;
14
+ var GlobalTimeout = 1000 * 60 * 2;
14
15
  // 单次请求超时时间
15
16
  var RequestTimeout = 1000 * 5;
16
17
  export var useTimeResultQuery = function useTimeResultQuery(api, resultCheck, handleLinklySuccess) {
@@ -18,7 +19,8 @@ export var useTimeResultQuery = function useTimeResultQuery(api, resultCheck, ha
18
19
  var _useStoreRef = useStoreRef(),
19
20
  numRef = _useStoreRef.numRef,
20
21
  modeRef = _useStoreRef.modeRef,
21
- deviceRef = _useStoreRef.deviceRef;
22
+ deviceRef = _useStoreRef.deviceRef,
23
+ orderIdRef = _useStoreRef.orderIdRef;
22
24
  var fail = useFail(0);
23
25
  var failRef = useRef(fail);
24
26
  var isPay = modeRef.current === ModeEnum.Pay || modeRef.current === ModeEnum.FullPay;
@@ -82,7 +84,6 @@ export var useTimeResultQuery = function useTimeResultQuery(api, resultCheck, ha
82
84
  console.log('Success: 全局超时或不需要处理结果,终止查询');
83
85
  return;
84
86
  }
85
- _log("Success", result);
86
87
  isQueryFinishedRef.current = true;
87
88
  var data = (result === null || result === void 0 ? void 0 : result.data) || {};
88
89
  // 交易成功,终止查询
@@ -103,8 +104,11 @@ export var useTimeResultQuery = function useTimeResultQuery(api, resultCheck, ha
103
104
  // 交易状态为0,且不需要签名,则继续查询
104
105
  if ((data === null || data === void 0 ? void 0 : data.status) == 0 && (data === null || data === void 0 ? void 0 : data.signature_flag) != 1) {
105
106
  console.log('交易状态为0需要继续查询');
107
+ _log("Querying", result);
106
108
  isQueryFinishedRef.current = false;
107
- _resultQuery();
109
+ setTimeout(function () {
110
+ _resultQuery();
111
+ }, 1500);
108
112
  return;
109
113
  }
110
114
 
@@ -153,7 +157,20 @@ export var useTimeResultQuery = function useTimeResultQuery(api, resultCheck, ha
153
157
  _log("AbortError");
154
158
  console.log('Error: 请求被取消,将继续查询');
155
159
  isQueryFinishedRef.current = false;
156
- _resultQuery();
160
+ setTimeout(function () {
161
+ _resultQuery();
162
+ }, 1500);
163
+ return;
164
+ }
165
+
166
+ // 网关类报错,继续查询
167
+ if (!(error !== null && error !== void 0 && error.code) || "".concat(error.code) === PayStatus.Timeout) {
168
+ _log("NetworkError");
169
+ console.log('Error: 网关类报错,将继续查询');
170
+ isQueryFinishedRef.current = false;
171
+ setTimeout(function () {
172
+ _resultQuery();
173
+ }, 1500);
157
174
  return;
158
175
  }
159
176
  _log("Error", error);
@@ -243,20 +260,25 @@ export var useTimeResultQuery = function useTimeResultQuery(api, resultCheck, ha
243
260
  session_id: numRef.current
244
261
  };
245
262
  var content = [{
246
- key: 'queryId',
247
- value: JSON.stringify(queryIdRef.current)
263
+ key: 'description',
264
+ value: JSON.stringify({
265
+ queryId: queryIdRef.current,
266
+ orderId: orderIdRef.current,
267
+ type: type,
268
+ date: dayjs().format('YYYY-MM-DD HH:mm:ss')
269
+ })
248
270
  }, {
249
271
  key: 'params',
250
272
  value: JSON.stringify(params)
251
273
  }];
252
- if (type === "Success") {
274
+ if (type === "Error") {
253
275
  content.push({
254
- key: 'response',
276
+ key: 'error',
255
277
  value: JSON.stringify(res)
256
278
  });
257
- } else if (type === "Error") {
279
+ } else {
258
280
  content.push({
259
- key: 'error',
281
+ key: 'response',
260
282
  value: JSON.stringify(res)
261
283
  });
262
284
  }
@@ -268,8 +290,6 @@ export var useTimeResultQuery = function useTimeResultQuery(api, resultCheck, ha
268
290
  var run = function run() {
269
291
  // 重置状态
270
292
  reset();
271
- console.log('开始查询linkly结果---->>>>>>>');
272
- _log("Start");
273
293
 
274
294
  // 设置全局超时定时器
275
295
  globalTimeoutIdRef.current = setTimeout(function () {
@@ -285,6 +305,8 @@ export var useTimeResultQuery = function useTimeResultQuery(api, resultCheck, ha
285
305
  startTimeRef.current = Date.now();
286
306
  isQueryFinishedRef.current = false;
287
307
  queryIdRef.current = getUniqueId();
308
+ console.log('开始查询linkly结果---->>>>>>>');
309
+ _log("Start");
288
310
  return _resultQuery();
289
311
  };
290
312
  return {
@@ -152,15 +152,15 @@ export var POS = function POS(_ref) {
152
152
  controllerRef.current = new AbortController();
153
153
  // 支付 or 退款
154
154
  var resultPromise = modeRef.current === ModeEnum.Pay || modeRef.current === ModeEnum.FullPay ? api.pay(_objectSpread(_objectSpread({}, custom !== null && custom !== void 0 && custom.platform ? {
155
- "operator_id": custom.operator_id,
156
- "operator_type": custom.operator_type,
157
- "platform": custom.platform,
158
- "custom_payment_id": custom.custom_payment_id,
159
- "service_charge": {
160
- "amount": payRef.current.surMoney,
161
- "percentage": payRef.current.surPercentRate
155
+ operator_id: custom.operator_id,
156
+ operator_type: custom.operator_type,
157
+ platform: custom.platform,
158
+ custom_payment_id: custom.custom_payment_id,
159
+ service_charge: {
160
+ amount: payRef.current.surMoney,
161
+ percentage: payRef.current.surPercentRate
162
162
  },
163
- "original_amount": payRef.current.amount
163
+ original_amount: payRef.current.amount
164
164
  } : {}), {}, {
165
165
  order_id: orderIdRef.current,
166
166
  amount: payRef.current.total,
@@ -199,8 +199,8 @@ export var POS = function POS(_ref) {
199
199
  if (unloadRef.current || !netRef.current) {
200
200
  return;
201
201
  }
202
- // 支付接口超时 进行支付状态查询
203
- if (err && "".concat(err.code) === PayStatus.Timeout) {
202
+ // 支付接口超时 进行支付状态查询(超时或者其它错误)
203
+ if (!(err !== null && err !== void 0 && err.code) || "".concat(err.code) === PayStatus.Timeout) {
204
204
  checkApi();
205
205
  return;
206
206
  }
@@ -174,7 +174,7 @@ export declare const updateCustom: (payload: {
174
174
  export declare const updateStatus: (status: 'loading' | 'warn' | 'fail' | 'success' | 'question') => {
175
175
  type: EActionTypes;
176
176
  payload: {
177
- status: "loading" | "warn" | "success" | "fail" | "question";
177
+ status: "loading" | "success" | "warn" | "fail" | "question";
178
178
  };
179
179
  };
180
180
  /**
@@ -308,7 +308,7 @@ export declare const backUpFree: (payload: Partial<State>) => {
308
308
  net?: boolean | undefined;
309
309
  component?: string | undefined;
310
310
  form?: string | undefined;
311
- status?: "loading" | "warn" | "success" | "fail" | "pedding" | "resove" | "reject" | "question" | undefined;
311
+ status?: "loading" | "success" | "warn" | "fail" | "pedding" | "resove" | "reject" | "question" | undefined;
312
312
  warn?: string | undefined;
313
313
  steps?: {
314
314
  /** 用于重置当前步骤 */
@@ -15,6 +15,7 @@ import { Context } from "../../model";
15
15
  import { locales } from '@pisell/utils';
16
16
  import { getPayGroupParamsFromStorage } from "../../payGroup";
17
17
  import useEngineContext from "../../../../../hooks/useEngineContext";
18
+ import usePaymentLogger from "../../../../../hooks/usePaymentLogger";
18
19
  import "./index.less";
19
20
  import { formatFranchiseeRoute } from "../../utils";
20
21
  /**
@@ -27,7 +28,7 @@ import { formatFranchiseeRoute } from "../../utils";
27
28
  * @Date: 2024-08-16 10:58
28
29
  */
29
30
  var ApplePay = function ApplePay(props, ref) {
30
- var _context$appHelper;
31
+ var _context$appHelper, _state$payGroup;
31
32
  var _useContext = useContext(Context),
32
33
  state = _useContext.state;
33
34
  var _useState = useState(false),
@@ -38,6 +39,12 @@ var ApplePay = function ApplePay(props, ref) {
38
39
  var _ref = ((_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.constants) || {},
39
40
  config = _ref.config;
40
41
 
42
+ // ApplePay支付日志记录器
43
+ var paymentLogger = usePaymentLogger({
44
+ orderId: ((_state$payGroup = state.payGroup) === null || _state$payGroup === void 0 ? void 0 : _state$payGroup.order_id) || 'unknown',
45
+ step: '2'
46
+ });
47
+
41
48
  /**
42
49
  * @title: 初始化
43
50
  * @description:
@@ -49,23 +56,45 @@ var ApplePay = function ApplePay(props, ref) {
49
56
  var init = /*#__PURE__*/function () {
50
57
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref2) {
51
58
  var _utils$getStore;
52
- var payGroup, utils, dvaStore, values, _dvaStore$core, _dvaStore$core2, _state$payGroup, locale, shopId, currentURL, linkElement, shop_domain, _href;
59
+ var payGroup, utils, dvaStore, values, _dvaStore$core, _dvaStore$core2, _state$payGroup2, locale, shopId, currentURL, linkElement, shop_domain, _href;
53
60
  return _regeneratorRuntime().wrap(function _callee$(_context) {
54
61
  while (1) switch (_context.prev = _context.next) {
55
62
  case 0:
56
63
  payGroup = _ref2.payGroup;
64
+ // 记录ApplePay初始化开始
65
+ paymentLogger.addLog({
66
+ key: 'ApplePay初始化开始',
67
+ value: ""
68
+ });
69
+
57
70
  // 打开loading
58
71
  setOpen(true);
59
72
  utils = context.appHelper.utils || {};
60
73
  dvaStore = utils === null || utils === void 0 || (_utils$getStore = utils.getStore) === null || _utils$getStore === void 0 || (_utils$getStore = _utils$getStore.call(utils)) === null || _utils$getStore === void 0 ? void 0 : _utils$getStore.getState(); // 获取交易组
61
74
  values = getPayGroupParamsFromStorage(payGroup.order_id);
62
75
  if (values) {
63
- _context.next = 8;
76
+ _context.next = 11;
64
77
  break;
65
78
  }
79
+ // 记录获取支付参数失败
80
+ paymentLogger.addLog({
81
+ key: 'ApplePay获取支付参数失败',
82
+ value: {
83
+ title: "\u8BA2\u5355".concat(payGroup === null || payGroup === void 0 ? void 0 : payGroup.order_id, " \u672A\u627E\u5230\u5B58\u50A8\u7684\u652F\u4ED8\u53C2\u6570"),
84
+ data: {
85
+ payGroup: payGroup
86
+ }
87
+ }
88
+ });
89
+ paymentLogger.sendLogs('ApplePay获取支付参数失败');
66
90
  setOpen(false);
67
91
  return _context.abrupt("return");
68
- case 8:
92
+ case 11:
93
+ // 记录获取支付参数成功
94
+ paymentLogger.addLog({
95
+ key: 'ApplePay获取支付参数成功',
96
+ value: ""
97
+ });
69
98
  try {
70
99
  // 语言
71
100
  locale = ((_dvaStore$core = dvaStore.core) === null || _dvaStore$core === void 0 ? void 0 : _dvaStore$core.translateLocale) || 'en'; // 店铺id
@@ -76,12 +105,29 @@ var ApplePay = function ApplePay(props, ref) {
76
105
 
77
106
  // 提取域名
78
107
  shop_domain = linkElement.hostname;
79
- _href = "".concat(config.pay).concat(formatFranchiseeRoute("/apple-pay?order_id=".concat((_state$payGroup = state.payGroup) === null || _state$payGroup === void 0 ? void 0 : _state$payGroup.order_id, "&shop_id=").concat(shopId, "&locale=").concat(locale, "&shop_domain=").concat(shop_domain, "&total_amount=").concat(values.amount, "&payment_group_id=").concat(values.payment_group_id), state.history));
108
+ _href = "".concat(config.pay).concat(formatFranchiseeRoute("/apple-pay?order_id=".concat((_state$payGroup2 = state.payGroup) === null || _state$payGroup2 === void 0 ? void 0 : _state$payGroup2.order_id, "&shop_id=").concat(shopId, "&locale=").concat(locale, "&shop_domain=").concat(shop_domain, "&total_amount=").concat(values.amount, "&payment_group_id=").concat(values.payment_group_id), state.history)); // 记录即将跳转到ApplePay
109
+ paymentLogger.addLog({
110
+ key: 'ApplePay准备跳转',
111
+ value: ""
112
+ });
113
+ paymentLogger.sendLogs('ApplePay跳转成功');
80
114
  window.location.href = _href;
81
115
  } catch (err) {
116
+ // 记录ApplePay处理错误
117
+ paymentLogger.addLog({
118
+ key: 'ApplePay处理错误',
119
+ value: {
120
+ title: "\u8BA2\u5355".concat(payGroup === null || payGroup === void 0 ? void 0 : payGroup.order_id, " ApplePay\u5904\u7406\u5931\u8D25: ").concat((err === null || err === void 0 ? void 0 : err.message) || '未知错误'),
121
+ data: {
122
+ payGroup: payGroup,
123
+ values: values
124
+ }
125
+ }
126
+ });
127
+ paymentLogger.sendLogs('ApplePay处理失败', err);
82
128
  setOpen(false);
83
129
  }
84
- case 9:
130
+ case 13:
85
131
  case "end":
86
132
  return _context.stop();
87
133
  }
@@ -5,6 +5,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
5
5
  import { useImperativeHandle, forwardRef, useContext } from 'react';
6
6
  import { Context } from "../../model";
7
7
  import useEngineContext from "../../../../../hooks/useEngineContext";
8
+ import usePaymentLogger from "../../../../../hooks/usePaymentLogger";
8
9
  import { formatFranchiseeRoute } from "../../utils";
9
10
  import "./index.less";
10
11
  /**
@@ -17,10 +18,17 @@ import "./index.less";
17
18
  * @Date: 2024-08-16 10:59
18
19
  */
19
20
  var BankDeposit = function BankDeposit(props, ref) {
21
+ var _state$payGroup;
20
22
  var _useContext = useContext(Context),
21
23
  state = _useContext.state;
22
24
  var context = useEngineContext();
23
25
 
26
+ // BankDeposit支付日志记录器
27
+ var paymentLogger = usePaymentLogger({
28
+ orderId: ((_state$payGroup = state.payGroup) === null || _state$payGroup === void 0 ? void 0 : _state$payGroup.order_id) || 'unknown',
29
+ step: '2'
30
+ });
31
+
24
32
  /**
25
33
  * @title: 初始化
26
34
  * @description:
@@ -31,19 +39,35 @@ var BankDeposit = function BankDeposit(props, ref) {
31
39
  */
32
40
  var init = /*#__PURE__*/function () {
33
41
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
34
- var _context$appHelper;
35
- var payGroup, platform, _item, _href;
42
+ var payGroup, _context$appHelper, platform, _item, _href;
36
43
  return _regeneratorRuntime().wrap(function _callee$(_context) {
37
44
  while (1) switch (_context.prev = _context.next) {
38
45
  case 0:
39
46
  payGroup = _ref.payGroup;
47
+ // 记录BankDeposit初始化开始
48
+ paymentLogger.addLog({
49
+ key: 'BankDeposit初始化开始',
50
+ value: ""
51
+ });
52
+ _context.prev = 2;
40
53
  // 当前设备类型
41
54
  platform = ((_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.constants) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.platform) || 'h5';
42
- _item = payGroup === null || payGroup === void 0 ? void 0 : payGroup.otherPayment; // pc的话打开stripe弹窗
55
+ _item = payGroup === null || payGroup === void 0 ? void 0 : payGroup.otherPayment; // 记录平台检测结果
56
+ paymentLogger.addLog({
57
+ key: 'BankDeposit平台检测',
58
+ value: ""
59
+ });
60
+
61
+ // pc的话打开stripe弹窗
43
62
  if (!(platform === 'pc')) {
44
- _context.next = 6;
63
+ _context.next = 11;
45
64
  break;
46
65
  }
66
+ // 记录PC平台处理
67
+ paymentLogger.addLog({
68
+ key: 'BankDepositPC处理',
69
+ value: ""
70
+ });
47
71
  state.payCallback({
48
72
  key: _item.service,
49
73
  data: {
@@ -51,15 +75,41 @@ var BankDeposit = function BankDeposit(props, ref) {
51
75
  payment_method: _item.title
52
76
  }
53
77
  });
78
+ paymentLogger.sendLogs('BankDepositPC处理成功');
54
79
  return _context.abrupt("return");
55
- case 6:
56
- _href = "".concat(formatFranchiseeRoute("/pay/manual-transfer?id=".concat((payGroup === null || payGroup === void 0 ? void 0 : payGroup.order_id) || (payGroup === null || payGroup === void 0 ? void 0 : payGroup.order_id)), state.history)); // h5打开银行转账页面
80
+ case 11:
81
+ _href = "".concat(formatFranchiseeRoute("/pay/manual-transfer?id=".concat((payGroup === null || payGroup === void 0 ? void 0 : payGroup.order_id) || (payGroup === null || payGroup === void 0 ? void 0 : payGroup.order_id)), state.history)); // 记录H5跳转准备
82
+ paymentLogger.addLog({
83
+ key: 'BankDepositH5准备跳转',
84
+ value: ""
85
+ });
86
+
87
+ // 在跳转前发送日志
88
+ paymentLogger.sendLogs('BankDepositH5跳转成功');
89
+
90
+ // h5打开银行转账页面
57
91
  state.history.push(_href);
58
- case 8:
92
+ _context.next = 21;
93
+ break;
94
+ case 17:
95
+ _context.prev = 17;
96
+ _context.t0 = _context["catch"](2);
97
+ // 记录BankDeposit处理错误
98
+ paymentLogger.addLog({
99
+ key: 'BankDeposit处理错误',
100
+ value: {
101
+ title: "\u8BA2\u5355".concat(payGroup === null || payGroup === void 0 ? void 0 : payGroup.order_id, " BankDeposit\u5904\u7406\u5931\u8D25: ").concat((_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message) || '未知错误'),
102
+ data: {
103
+ payGroup: payGroup
104
+ }
105
+ }
106
+ });
107
+ paymentLogger.sendLogs('BankDeposit处理失败', _context.t0);
108
+ case 21:
59
109
  case "end":
60
110
  return _context.stop();
61
111
  }
62
- }, _callee);
112
+ }, _callee, null, [[2, 17]]);
63
113
  }));
64
114
  return function init(_x) {
65
115
  return _ref2.apply(this, arguments);