@pisell/private-materials 6.3.14 → 6.3.16

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 (83) 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 +13 -13
  7. package/build/lowcode/render/default/view.js +9 -9
  8. package/build/lowcode/view.js +9 -9
  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/model.d.ts +9 -1
  13. package/es/components/booking/notes/model.d.ts +10 -1
  14. package/es/components/booking/payments/model.d.ts +10 -1
  15. package/es/components/eftposPay/hooks.d.ts +1 -1
  16. package/es/components/eftposPay/store/index.d.ts +1 -1
  17. package/es/components/pay/toC/PaymentMethods/ApplePay/index.js +52 -6
  18. package/es/components/pay/toC/PaymentMethods/BankDeposit/index.js +58 -8
  19. package/es/components/pay/toC/PaymentMethods/CashManual/index.js +74 -12
  20. package/es/components/pay/toC/PaymentMethods/CustomPayment/index.js +73 -12
  21. package/es/components/pay/toC/PaymentMethods/GlobePayAliPayH5/index.js +93 -11
  22. package/es/components/pay/toC/PaymentMethods/GlobePayPaypalH5/index.js +90 -12
  23. package/es/components/pay/toC/PaymentMethods/GlobePayQrcode/index.js +46 -7
  24. package/es/components/pay/toC/PaymentMethods/GlobePayWxH5/index.js +90 -12
  25. package/es/components/pay/toC/PaymentMethods/GooglePay/index.js +64 -13
  26. package/es/components/pay/toC/PaymentMethods/OfflinePayment/index.js +73 -8
  27. package/es/components/pay/toC/PaymentMethods/StripePay/index.js +68 -17
  28. package/es/components/pay/toC/PaymentMethods/SuperPayAliPayH5/index.js +86 -14
  29. package/es/components/pay/toC/PaymentMethods/SuperPayWxPayH5/index.js +89 -15
  30. package/es/components/pay/toC/index.js +278 -118
  31. package/es/components/pay/toC/model.d.ts +9 -1
  32. package/es/components/schedules/model.d.ts +9 -1
  33. package/es/components/schedules/utils.d.ts +1 -1
  34. package/es/components/ticketBooking/components/ticketBooking/index.js +2 -0
  35. package/es/components/wallet/Detail/index.js +3 -1
  36. package/es/components/wallet/Detail/model.d.ts +13 -1
  37. package/es/components/wallet/DiscountCard/model.d.ts +14 -1
  38. package/es/components/wallet/PointCard/model.d.ts +13 -1
  39. package/es/components/wallet/RechargeableCard/model.d.ts +29 -1
  40. package/es/components/wallet/Voucher/model.d.ts +13 -1
  41. package/es/components/wallet/components/WalletCard.js +8 -3
  42. package/es/components/wallet/model.d.ts +9 -1
  43. package/es/hooks/usePaymentLogger.d.ts +22 -0
  44. package/es/hooks/usePaymentLogger.js +78 -0
  45. package/es/utils/index.d.ts +1 -1
  46. package/lib/components/booking/addons/model.d.ts +10 -1
  47. package/lib/components/booking/forms/model.d.ts +10 -1
  48. package/lib/components/booking/info/model.d.ts +10 -1
  49. package/lib/components/booking/model.d.ts +9 -1
  50. package/lib/components/booking/notes/model.d.ts +10 -1
  51. package/lib/components/booking/payments/model.d.ts +10 -1
  52. package/lib/components/eftposPay/hooks.d.ts +1 -1
  53. package/lib/components/eftposPay/store/index.d.ts +1 -1
  54. package/lib/components/pay/toC/PaymentMethods/ApplePay/index.js +42 -3
  55. package/lib/components/pay/toC/PaymentMethods/BankDeposit/index.js +52 -15
  56. package/lib/components/pay/toC/PaymentMethods/CashManual/index.js +60 -2
  57. package/lib/components/pay/toC/PaymentMethods/CustomPayment/index.js +60 -2
  58. package/lib/components/pay/toC/PaymentMethods/GlobePayAliPayH5/index.js +66 -2
  59. package/lib/components/pay/toC/PaymentMethods/GlobePayPaypalH5/index.js +61 -0
  60. package/lib/components/pay/toC/PaymentMethods/GlobePayQrcode/index.js +29 -0
  61. package/lib/components/pay/toC/PaymentMethods/GlobePayWxH5/index.js +61 -0
  62. package/lib/components/pay/toC/PaymentMethods/GooglePay/index.js +50 -6
  63. package/lib/components/pay/toC/PaymentMethods/OfflinePayment/index.js +72 -10
  64. package/lib/components/pay/toC/PaymentMethods/StripePay/index.js +47 -5
  65. package/lib/components/pay/toC/PaymentMethods/SuperPayAliPayH5/index.js +61 -3
  66. package/lib/components/pay/toC/PaymentMethods/SuperPayWxPayH5/index.js +63 -3
  67. package/lib/components/pay/toC/index.js +183 -48
  68. package/lib/components/pay/toC/model.d.ts +9 -1
  69. package/lib/components/schedules/model.d.ts +9 -1
  70. package/lib/components/schedules/utils.d.ts +1 -1
  71. package/lib/components/ticketBooking/components/ticketBooking/index.js +1 -0
  72. package/lib/components/wallet/Detail/index.js +18 -5
  73. package/lib/components/wallet/Detail/model.d.ts +13 -1
  74. package/lib/components/wallet/DiscountCard/model.d.ts +14 -1
  75. package/lib/components/wallet/PointCard/model.d.ts +13 -1
  76. package/lib/components/wallet/RechargeableCard/model.d.ts +29 -1
  77. package/lib/components/wallet/Voucher/model.d.ts +13 -1
  78. package/lib/components/wallet/components/WalletCard.js +3 -1
  79. package/lib/components/wallet/model.d.ts +9 -1
  80. package/lib/hooks/usePaymentLogger.d.ts +22 -0
  81. package/lib/hooks/usePaymentLogger.js +69 -0
  82. package/lib/utils/index.d.ts +1 -1
  83. package/package.json +3 -3
@@ -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
+ }>;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export interface FormState {
2
3
  amountSymbol: string;
3
4
  apis: {
@@ -105,4 +106,11 @@ export declare const walkInData: {
105
106
  id: number;
106
107
  nickname: string;
107
108
  };
108
- export declare const Provider: any, Context: any;
109
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
110
+ state: FormState;
111
+ } & {
112
+ dispatch: (params: {
113
+ type: string;
114
+ payload: any;
115
+ }) => void;
116
+ }>;
@@ -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
+ }>;
@@ -19,7 +19,7 @@ export declare const useStoreRef: <T extends {
19
19
  readonly netRef: React.MutableRefObject<boolean | undefined>;
20
20
  readonly symbolRef: React.MutableRefObject<string>;
21
21
  readonly amountRef: React.MutableRefObject<string | number>;
22
- readonly eftposRef: React.MutableRefObject<"stripe" | "payo" | "tyro" | "windcave" | "linkly">;
22
+ readonly eftposRef: React.MutableRefObject<"stripe" | "tyro" | "windcave" | "payo" | "linkly">;
23
23
  readonly clientRef: React.MutableRefObject<ClientEnum>;
24
24
  readonly dataRef: React.MutableRefObject<import("./store").State>;
25
25
  };
@@ -297,7 +297,7 @@ export declare const backUpFree: (payload: Partial<State>) => {
297
297
  amount?: string | number | undefined;
298
298
  mode?: "refund" | "pay" | "fullPay" | "query" | undefined;
299
299
  order_id?: string | number | undefined;
300
- eftpos?: "stripe" | "payo" | "tyro" | "windcave" | "linkly" | undefined;
300
+ eftpos?: "stripe" | "tyro" | "windcave" | "payo" | "linkly" | undefined;
301
301
  action?: "amount" | "pay" | "deviceList" | undefined;
302
302
  key?: number | undefined;
303
303
  step?: number | undefined;
@@ -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);
@@ -11,6 +11,7 @@ import { useImperativeHandle, forwardRef, useContext } from 'react';
11
11
  import { customPaymentApi } from "./serve";
12
12
  import { Context } from "../../model";
13
13
  import { getPayGroupParamsFromStorage } from "../../payGroup";
14
+ import usePaymentLogger from "../../../../../hooks/usePaymentLogger";
14
15
  import "./index.less";
15
16
  /**
16
17
  * @title: cash 支付
@@ -22,9 +23,16 @@ import "./index.less";
22
23
  * @Date: 2024-08-16 11:00
23
24
  */
24
25
  var CashManual = function CashManual(props, ref) {
26
+ var _state$payGroup;
25
27
  var _useContext = useContext(Context),
26
28
  state = _useContext.state;
27
29
 
30
+ // CashManual支付日志记录器
31
+ var paymentLogger = usePaymentLogger({
32
+ orderId: ((_state$payGroup = state.payGroup) === null || _state$payGroup === void 0 ? void 0 : _state$payGroup.order_id) || 'unknown',
33
+ step: '2'
34
+ });
35
+
28
36
  /**
29
37
  * @title: 初始化
30
38
  * @description:
@@ -35,35 +43,89 @@ var CashManual = function CashManual(props, ref) {
35
43
  */
36
44
  var init = /*#__PURE__*/function () {
37
45
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
38
- var _state$payGroup, _state$payGroup2;
46
+ var _state$payGroup2, _state$payGroup3;
39
47
  var payGroup, current, orderId, values;
40
48
  return _regeneratorRuntime().wrap(function _callee$(_context) {
41
49
  while (1) switch (_context.prev = _context.next) {
42
50
  case 0:
43
51
  payGroup = _ref.payGroup;
44
- current = ((_state$payGroup = state.payGroup) === null || _state$payGroup === void 0 ? void 0 : _state$payGroup.otherPayment) || {};
45
- orderId = (payGroup === null || payGroup === void 0 ? void 0 : payGroup.order_id) || ((_state$payGroup2 = state.payGroup) === null || _state$payGroup2 === void 0 ? void 0 : _state$payGroup2.order_id); // 交易组信息
52
+ // 记录CashManual初始化开始
53
+ paymentLogger.addLog({
54
+ key: 'CashManual初始化开始',
55
+ value: ""
56
+ });
57
+ current = ((_state$payGroup2 = state.payGroup) === null || _state$payGroup2 === void 0 ? void 0 : _state$payGroup2.otherPayment) || {};
58
+ orderId = (payGroup === null || payGroup === void 0 ? void 0 : payGroup.order_id) || ((_state$payGroup3 = state.payGroup) === null || _state$payGroup3 === void 0 ? void 0 : _state$payGroup3.order_id); // 交易组信息
46
59
  values = getPayGroupParamsFromStorage(orderId);
47
- _context.prev = 4;
48
- _context.next = 7;
60
+ if (values) {
61
+ _context.next = 9;
62
+ break;
63
+ }
64
+ // 记录获取支付参数失败
65
+ paymentLogger.addLog({
66
+ key: 'CashManual获取支付参数失败',
67
+ value: {
68
+ title: "\u8BA2\u5355".concat(orderId, " \u672A\u627E\u5230\u5B58\u50A8\u7684\u652F\u4ED8\u53C2\u6570"),
69
+ data: {
70
+ payGroup: payGroup
71
+ }
72
+ }
73
+ });
74
+ paymentLogger.sendLogs('CashManual获取支付参数失败');
75
+ return _context.abrupt("return");
76
+ case 9:
77
+ // 记录获取支付参数成功
78
+ paymentLogger.addLog({
79
+ key: 'CashManual获取支付参数成功',
80
+ value: ""
81
+ });
82
+ _context.prev = 10;
83
+ // 记录开始调用支付API
84
+ paymentLogger.addLog({
85
+ key: 'CashManual开始支付API调用',
86
+ value: ""
87
+ });
88
+
89
+ // 支付
90
+ _context.next = 14;
49
91
  return customPaymentApi(orderId, _objectSpread({
50
92
  params: current.params
51
93
  }, values));
52
- case 7:
94
+ case 14:
95
+ // 记录支付API调用成功
96
+ paymentLogger.addLog({
97
+ key: 'CashManual支付API调用成功',
98
+ value: ""
99
+ });
100
+ paymentLogger.sendLogs('CashManual支付成功');
101
+
53
102
  // 回调
54
103
  state.payCallback({
55
104
  key: 'success'
56
105
  });
57
- _context.next = 12;
106
+ _context.next = 23;
58
107
  break;
59
- case 10:
60
- _context.prev = 10;
61
- _context.t0 = _context["catch"](4);
62
- case 12:
108
+ case 19:
109
+ _context.prev = 19;
110
+ _context.t0 = _context["catch"](10);
111
+ // 记录CashManual支付错误
112
+ paymentLogger.addLog({
113
+ key: 'CashManual支付错误',
114
+ value: {
115
+ title: "\u8BA2\u5355".concat(orderId, " CashManual\u652F\u4ED8\u5931\u8D25: ").concat((_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message) || '未知错误'),
116
+ data: {
117
+ payGroup: payGroup,
118
+ current: current,
119
+ values: values
120
+ }
121
+ }
122
+ });
123
+ paymentLogger.sendLogs('CashManual支付失败', _context.t0);
124
+ case 23:
63
125
  case "end":
64
126
  return _context.stop();
65
127
  }
66
- }, _callee, null, [[4, 10]]);
128
+ }, _callee, null, [[10, 19]]);
67
129
  }));
68
130
  return function init(_x) {
69
131
  return _ref2.apply(this, arguments);
@@ -11,6 +11,7 @@ import { useImperativeHandle, forwardRef, useContext } from 'react';
11
11
  import { customPaymentApi } from "./serve";
12
12
  import { Context } from "../../model";
13
13
  import { getPayGroupParamsFromStorage } from "../../payGroup";
14
+ import usePaymentLogger from "../../../../../hooks/usePaymentLogger";
14
15
  import "./index.less";
15
16
  /**
16
17
  * @title: 自定义支付
@@ -22,9 +23,16 @@ import "./index.less";
22
23
  * @Date: 2024-08-16 11:01
23
24
  */
24
25
  var CustomPayment = function CustomPayment(props, ref) {
26
+ var _state$payGroup;
25
27
  var _useContext = useContext(Context),
26
28
  state = _useContext.state;
27
29
 
30
+ // CustomPayment支付日志记录器
31
+ var paymentLogger = usePaymentLogger({
32
+ orderId: ((_state$payGroup = state.payGroup) === null || _state$payGroup === void 0 ? void 0 : _state$payGroup.order_id) || 'unknown',
33
+ step: '2'
34
+ });
35
+
28
36
  /**
29
37
  * @title: 初始化
30
38
  * @description:
@@ -35,34 +43,87 @@ var CustomPayment = function CustomPayment(props, ref) {
35
43
  */
36
44
  var init = /*#__PURE__*/function () {
37
45
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
38
- var _state$payGroup, _state$payGroup2;
46
+ var _state$payGroup2, _state$payGroup3;
39
47
  var payGroup, current, orderId, values;
40
48
  return _regeneratorRuntime().wrap(function _callee$(_context) {
41
49
  while (1) switch (_context.prev = _context.next) {
42
50
  case 0:
43
51
  payGroup = _ref.payGroup;
44
- current = ((_state$payGroup = state.payGroup) === null || _state$payGroup === void 0 ? void 0 : _state$payGroup.otherPayment) || {};
45
- orderId = (payGroup === null || payGroup === void 0 ? void 0 : payGroup.order_id) || ((_state$payGroup2 = state.payGroup) === null || _state$payGroup2 === void 0 ? void 0 : _state$payGroup2.order_id); // 获取交易组
52
+ // 记录CustomPayment初始化开始
53
+ paymentLogger.addLog({
54
+ key: 'CustomPayment初始化开始',
55
+ value: ""
56
+ });
57
+ current = ((_state$payGroup2 = state.payGroup) === null || _state$payGroup2 === void 0 ? void 0 : _state$payGroup2.otherPayment) || {};
58
+ orderId = (payGroup === null || payGroup === void 0 ? void 0 : payGroup.order_id) || ((_state$payGroup3 = state.payGroup) === null || _state$payGroup3 === void 0 ? void 0 : _state$payGroup3.order_id); // 获取交易组
46
59
  values = getPayGroupParamsFromStorage(orderId);
47
- _context.prev = 4;
48
- _context.next = 7;
60
+ if (values) {
61
+ _context.next = 9;
62
+ break;
63
+ }
64
+ // 记录获取支付参数失败
65
+ paymentLogger.addLog({
66
+ key: 'CustomPayment获取支付参数失败',
67
+ value: {
68
+ title: "\u8BA2\u5355".concat(orderId, " \u672A\u627E\u5230\u5B58\u50A8\u7684\u652F\u4ED8\u53C2\u6570"),
69
+ data: {
70
+ payGroup: payGroup
71
+ }
72
+ }
73
+ });
74
+ paymentLogger.sendLogs('CustomPayment获取支付参数失败');
75
+ return _context.abrupt("return");
76
+ case 9:
77
+ // 记录获取支付参数成功
78
+ paymentLogger.addLog({
79
+ key: 'CustomPayment获取支付参数成功',
80
+ value: ""
81
+ });
82
+ _context.prev = 10;
83
+ // 记录开始调用支付API
84
+ paymentLogger.addLog({
85
+ key: 'CustomPayment开始支付API调用',
86
+ value: ""
87
+ });
88
+ _context.next = 14;
49
89
  return customPaymentApi(orderId, _objectSpread({
50
90
  params: current.params
51
91
  }, values));
52
- case 7:
92
+ case 14:
93
+ // 记录支付API调用成功
94
+ paymentLogger.addLog({
95
+ key: 'CustomPayment支付API调用成功',
96
+ value: ""
97
+ });
98
+ paymentLogger.sendLogs('CustomPayment支付成功');
99
+
100
+ // 回调
53
101
  state.payCallback({
54
102
  key: 'success'
55
103
  });
56
- _context.next = 12;
104
+ _context.next = 23;
57
105
  break;
58
- case 10:
59
- _context.prev = 10;
60
- _context.t0 = _context["catch"](4);
61
- case 12:
106
+ case 19:
107
+ _context.prev = 19;
108
+ _context.t0 = _context["catch"](10);
109
+ // 记录CustomPayment支付错误
110
+ paymentLogger.addLog({
111
+ key: 'CustomPayment支付错误',
112
+ value: {
113
+ title: "\u8BA2\u5355".concat(orderId, " CustomPayment\u652F\u4ED8\u5931\u8D25: ").concat((_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message) || '未知错误'),
114
+ data: {
115
+ payGroup: payGroup,
116
+ current: current,
117
+ values: values
118
+ }
119
+ }
120
+ });
121
+ paymentLogger.sendLogs('CustomPayment支付失败', _context.t0);
122
+ case 23:
62
123
  case "end":
63
124
  return _context.stop();
64
125
  }
65
- }, _callee, null, [[4, 10]]);
126
+ }, _callee, null, [[10, 19]]);
66
127
  }));
67
128
  return function init(_x) {
68
129
  return _ref2.apply(this, arguments);