@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
@@ -15,6 +15,7 @@ import ThreedsLoading from "../MWCreditCard/TDSPay/ThreedsLoading";
15
15
  import { getAliPayUrl } from "./serve";
16
16
  import { Context } from "../../model";
17
17
  import { getPayGroupParamsFromStorage, setPayNumber } from "../../payGroup";
18
+ import usePaymentLogger from "../../../../../hooks/usePaymentLogger";
18
19
  import "./index.less";
19
20
  /**
20
21
  * @title: 支付宝支付
@@ -24,6 +25,7 @@ import "./index.less";
24
25
  * @Date: 2024-08-16 11:18
25
26
  */
26
27
  var GlobePayAliPayH5 = function GlobePayAliPayH5(props, ref) {
28
+ var _state$payGroup;
27
29
  var _useContext = useContext(Context),
28
30
  state = _useContext.state;
29
31
  var onChange = props.onChange;
@@ -36,6 +38,12 @@ var GlobePayAliPayH5 = function GlobePayAliPayH5(props, ref) {
36
38
  showSuccessBackButton = _useState4[0],
37
39
  setShowSuccessBackButton = _useState4[1];
38
40
 
41
+ // GlobePayAliPayH5支付日志记录器
42
+ var paymentLogger = usePaymentLogger({
43
+ orderId: ((_state$payGroup = state.payGroup) === null || _state$payGroup === void 0 ? void 0 : _state$payGroup.order_id) || 'unknown',
44
+ step: '2'
45
+ });
46
+
39
47
  /**
40
48
  * @title: 初始化
41
49
  * @description:
@@ -51,43 +59,111 @@ var GlobePayAliPayH5 = function GlobePayAliPayH5(props, ref) {
51
59
  while (1) switch (_context.prev = _context.next) {
52
60
  case 0:
53
61
  payGroup = _ref.payGroup;
62
+ // 记录GlobePayAliPayH5初始化开始
63
+ paymentLogger.addLog({
64
+ key: 'GlobePayAliPayH5初始化开始',
65
+ value: ""
66
+ });
54
67
  setOpen(true);
55
68
 
56
69
  // 交易组
57
70
  values = getPayGroupParamsFromStorage(payGroup.order_id);
58
71
  if (values) {
59
- _context.next = 6;
72
+ _context.next = 9;
60
73
  break;
61
74
  }
75
+ // 记录获取支付参数失败
76
+ paymentLogger.addLog({
77
+ key: 'GlobePayAliPayH5获取支付参数失败',
78
+ value: {
79
+ title: "\u8BA2\u5355".concat(payGroup === null || payGroup === void 0 ? void 0 : payGroup.order_id, " \u672A\u627E\u5230\u5B58\u50A8\u7684\u652F\u4ED8\u53C2\u6570"),
80
+ data: {
81
+ payGroup: payGroup
82
+ }
83
+ }
84
+ });
85
+ paymentLogger.sendLogs('GlobePayAliPayH5获取支付参数失败');
62
86
  setOpen(false);
63
87
  return _context.abrupt("return");
64
- case 6:
65
- _context.prev = 6;
66
- _context.next = 9;
67
- return getAliPayUrl(payGroup.order_id, values);
68
88
  case 9:
89
+ // 记录获取支付参数成功
90
+ paymentLogger.addLog({
91
+ key: 'GlobePayAliPayH5获取支付参数成功',
92
+ value: ""
93
+ });
94
+ _context.prev = 10;
95
+ // 记录开始获取支付宝支付链接
96
+ paymentLogger.addLog({
97
+ key: 'GlobePayAliPayH5开始获取支付链接',
98
+ value: ""
99
+ });
100
+
101
+ // 获取支付宝支付链接
102
+ _context.next = 14;
103
+ return getAliPayUrl(payGroup.order_id, values);
104
+ case 14:
69
105
  data = _context.sent;
70
106
  url = data.url || (data === null || data === void 0 ? void 0 : data.pay_url);
71
107
  if (url) {
108
+ // 记录获取支付链接成功
109
+ paymentLogger.addLog({
110
+ key: 'GlobePayAliPayH5获取支付链接成功',
111
+ value: ""
112
+ });
113
+
72
114
  // 设置交易号
73
115
  setPayNumber(payGroup === null || payGroup === void 0 ? void 0 : payGroup.order_id, data === null || data === void 0 ? void 0 : data.pay_number);
116
+
117
+ // 记录准备跳转支付宝
118
+ paymentLogger.addLog({
119
+ key: 'GlobePayAliPayH5准备跳转支付宝',
120
+ value: ""
121
+ });
74
122
  setShowSuccessBackButton(true);
123
+
124
+ // 在跳转前发送日志
125
+ paymentLogger.sendLogs('GlobePayAliPayH5跳转成功');
126
+
75
127
  // 跳转
76
128
  window.location.href = url;
77
129
  } else {
130
+ // 记录未获取到支付链接
131
+ paymentLogger.addLog({
132
+ key: 'GlobePayAliPayH5未获取到支付链接',
133
+ value: {
134
+ title: "\u8BA2\u5355".concat(payGroup === null || payGroup === void 0 ? void 0 : payGroup.order_id, " \u672A\u83B7\u53D6\u5230\u6709\u6548\u7684\u652F\u4ED8\u94FE\u63A5"),
135
+ data: {
136
+ payGroup: payGroup,
137
+ response: data
138
+ }
139
+ }
140
+ });
141
+ paymentLogger.sendLogs('GlobePayAliPayH5未获取到支付链接');
78
142
  setOpen(false);
79
143
  }
80
- _context.next = 17;
144
+ _context.next = 24;
81
145
  break;
82
- case 14:
83
- _context.prev = 14;
84
- _context.t0 = _context["catch"](6);
146
+ case 19:
147
+ _context.prev = 19;
148
+ _context.t0 = _context["catch"](10);
149
+ // 记录GlobePayAliPayH5处理错误
150
+ paymentLogger.addLog({
151
+ key: 'GlobePayAliPayH5处理错误',
152
+ value: {
153
+ title: "\u8BA2\u5355".concat(payGroup === null || payGroup === void 0 ? void 0 : payGroup.order_id, " GlobePayAliPayH5\u5904\u7406\u5931\u8D25: ").concat((_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message) || '未知错误'),
154
+ data: {
155
+ payGroup: payGroup,
156
+ values: values
157
+ }
158
+ }
159
+ });
160
+ paymentLogger.sendLogs('GlobePayAliPayH5处理失败', _context.t0);
85
161
  setOpen(false);
86
- case 17:
162
+ case 24:
87
163
  case "end":
88
164
  return _context.stop();
89
165
  }
90
- }, _callee, null, [[6, 14]]);
166
+ }, _callee, null, [[10, 19]]);
91
167
  }));
92
168
  return function init(_x) {
93
169
  return _ref2.apply(this, arguments);
@@ -100,6 +176,12 @@ var GlobePayAliPayH5 = function GlobePayAliPayH5(props, ref) {
100
176
  });
101
177
  var handleSuccessBack = function handleSuccessBack() {
102
178
  var _state$payCallback;
179
+ // 记录用户从支付宝返回并确认成功
180
+ paymentLogger.addLog({
181
+ key: 'GlobePayAliPayH5用户确认支付成功',
182
+ value: ""
183
+ });
184
+ paymentLogger.sendLogs('GlobePayAliPayH5支付成功');
103
185
  (_state$payCallback = state.payCallback) === null || _state$payCallback === void 0 || _state$payCallback.call(state, {
104
186
  key: 'success'
105
187
  });
@@ -8,12 +8,14 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
8
8
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
9
9
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
10
10
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
- import React, { useState, useImperativeHandle, forwardRef } from 'react';
11
+ import React, { useState, useImperativeHandle, forwardRef, useContext } from 'react';
12
12
  import { PisellModal } from '@pisell/materials';
13
13
  import { locales } from '@pisell/utils';
14
14
  import ThreedsLoading from "../MWCreditCard/TDSPay/ThreedsLoading";
15
15
  import { getAliPayUrl } from "./serve";
16
+ import { Context } from "../../model";
16
17
  import { getPayGroupParamsFromStorage, setPayNumber } from "../../payGroup";
18
+ import usePaymentLogger from "../../../../../hooks/usePaymentLogger";
17
19
  import "./index.less";
18
20
  /**
19
21
  * @title: Paypal支付
@@ -23,12 +25,21 @@ import "./index.less";
23
25
  * @Date: 2024-08-16 11:18
24
26
  */
25
27
  var GlobePayPaypalH5 = function GlobePayPaypalH5(props, ref) {
28
+ var _state$payGroup;
29
+ var _useContext = useContext(Context),
30
+ state = _useContext.state;
26
31
  var onChange = props.onChange;
27
32
  var _useState = useState(false),
28
33
  _useState2 = _slicedToArray(_useState, 2),
29
34
  open = _useState2[0],
30
35
  setOpen = _useState2[1];
31
36
 
37
+ // GlobePayPaypalH5支付日志记录器
38
+ var paymentLogger = usePaymentLogger({
39
+ orderId: ((_state$payGroup = state.payGroup) === null || _state$payGroup === void 0 ? void 0 : _state$payGroup.order_id) || 'unknown',
40
+ step: '2'
41
+ });
42
+
32
43
  /**
33
44
  * @title: 初始化
34
45
  * @description:
@@ -44,43 +55,110 @@ var GlobePayPaypalH5 = function GlobePayPaypalH5(props, ref) {
44
55
  while (1) switch (_context.prev = _context.next) {
45
56
  case 0:
46
57
  payGroup = _ref.payGroup;
58
+ // 记录GlobePayPaypalH5初始化开始
59
+ paymentLogger.addLog({
60
+ key: 'GlobePayPaypalH5初始化开始',
61
+ value: ""
62
+ });
47
63
  setOpen(true);
48
64
 
49
65
  // 交易组
50
66
  values = getPayGroupParamsFromStorage(payGroup.order_id);
51
67
  if (values) {
52
- _context.next = 6;
68
+ _context.next = 9;
53
69
  break;
54
70
  }
71
+ // 记录获取支付参数失败
72
+ paymentLogger.addLog({
73
+ key: 'GlobePayPaypalH5获取支付参数失败',
74
+ value: {
75
+ title: "\u8BA2\u5355".concat(payGroup === null || payGroup === void 0 ? void 0 : payGroup.order_id, " \u672A\u627E\u5230\u5B58\u50A8\u7684\u652F\u4ED8\u53C2\u6570"),
76
+ data: {
77
+ payGroup: payGroup
78
+ }
79
+ }
80
+ });
81
+ paymentLogger.sendLogs('GlobePayPaypalH5获取支付参数失败');
55
82
  setOpen(false);
56
83
  return _context.abrupt("return");
57
- case 6:
58
- _context.prev = 6;
59
- _context.next = 9;
60
- return getAliPayUrl(payGroup.order_id, values);
61
84
  case 9:
85
+ // 记录获取支付参数成功
86
+ paymentLogger.addLog({
87
+ key: 'GlobePayPaypalH5获取支付参数成功',
88
+ value: ""
89
+ });
90
+ _context.prev = 10;
91
+ // 记录开始获取Paypal支付链接
92
+ paymentLogger.addLog({
93
+ key: 'GlobePayPaypalH5开始获取支付链接',
94
+ value: ""
95
+ });
96
+
97
+ // 获取Paypal支付链接
98
+ _context.next = 14;
99
+ return getAliPayUrl(payGroup.order_id, values);
100
+ case 14:
62
101
  data = _context.sent;
63
102
  url = data.url || (data === null || data === void 0 ? void 0 : data.pay_url);
64
103
  if (url) {
104
+ // 记录获取支付链接成功
105
+ paymentLogger.addLog({
106
+ key: 'GlobePayPaypalH5获取支付链接成功',
107
+ value: ""
108
+ });
109
+
65
110
  // 设置交易号
66
111
  setPayNumber(payGroup === null || payGroup === void 0 ? void 0 : payGroup.order_id, data === null || data === void 0 ? void 0 : data.pay_number);
67
112
 
113
+ // 记录准备跳转Paypal
114
+ paymentLogger.addLog({
115
+ key: 'GlobePayPaypalH5准备跳转Paypal',
116
+ value: ""
117
+ });
118
+
119
+ // 在跳转前发送日志
120
+ paymentLogger.sendLogs('GlobePayPaypalH5跳转成功');
121
+
68
122
  // 跳转
69
123
  window.location.href = url;
70
124
  } else {
125
+ // 记录未获取到支付链接
126
+ paymentLogger.addLog({
127
+ key: 'GlobePayPaypalH5未获取到支付链接',
128
+ value: {
129
+ title: "\u8BA2\u5355".concat(payGroup === null || payGroup === void 0 ? void 0 : payGroup.order_id, " \u672A\u83B7\u53D6\u5230\u6709\u6548\u7684\u652F\u4ED8\u94FE\u63A5"),
130
+ data: {
131
+ payGroup: payGroup,
132
+ response: data
133
+ }
134
+ }
135
+ });
136
+ paymentLogger.sendLogs('GlobePayPaypalH5未获取到支付链接');
71
137
  setOpen(false);
72
138
  }
73
- _context.next = 17;
139
+ _context.next = 24;
74
140
  break;
75
- case 14:
76
- _context.prev = 14;
77
- _context.t0 = _context["catch"](6);
141
+ case 19:
142
+ _context.prev = 19;
143
+ _context.t0 = _context["catch"](10);
144
+ // 记录GlobePayPaypalH5处理错误
145
+ paymentLogger.addLog({
146
+ key: 'GlobePayPaypalH5处理错误',
147
+ value: {
148
+ title: "\u8BA2\u5355".concat(payGroup === null || payGroup === void 0 ? void 0 : payGroup.order_id, " GlobePayPaypalH5\u5904\u7406\u5931\u8D25: ").concat((_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message) || '未知错误'),
149
+ data: {
150
+ payGroup: payGroup,
151
+ values: values
152
+ }
153
+ }
154
+ });
155
+ paymentLogger.sendLogs('GlobePayPaypalH5处理失败', _context.t0);
78
156
  setOpen(false);
79
- case 17:
157
+ case 24:
80
158
  case "end":
81
159
  return _context.stop();
82
160
  }
83
- }, _callee, null, [[6, 14]]);
161
+ }, _callee, null, [[10, 19]]);
84
162
  }));
85
163
  return function init(_x) {
86
164
  return _ref2.apply(this, arguments);
@@ -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 "./index.less";
9
10
  /**
10
11
  * @title: GlobePayQrcode
@@ -16,10 +17,17 @@ import "./index.less";
16
17
  * @Date: 2024-08-16 11:17
17
18
  */
18
19
  var GlobePayQrcode = function GlobePayQrcode(props, ref) {
20
+ var _state$payGroup;
19
21
  var _useContext = useContext(Context),
20
22
  state = _useContext.state;
21
23
  var context = useEngineContext();
22
24
 
25
+ // GlobePayQrcode支付日志记录器
26
+ var paymentLogger = usePaymentLogger({
27
+ orderId: ((_state$payGroup = state.payGroup) === null || _state$payGroup === void 0 ? void 0 : _state$payGroup.order_id) || 'unknown',
28
+ step: '2'
29
+ });
30
+
23
31
  /**
24
32
  * @title: 初始化
25
33
  * @description:
@@ -35,21 +43,52 @@ var GlobePayQrcode = function GlobePayQrcode(props, ref) {
35
43
  while (1) switch (_context.prev = _context.next) {
36
44
  case 0:
37
45
  payGroup = _ref.payGroup;
38
- _context.prev = 1;
39
- _item = payGroup === null || payGroup === void 0 ? void 0 : payGroup.otherPayment; // const platform = context.appHelper?.constants?.platform || 'h5';
46
+ // 记录GlobePayQrcode初始化开始
47
+ paymentLogger.addLog({
48
+ key: 'GlobePayQrcode初始化开始',
49
+ value: ""
50
+ });
51
+ _context.prev = 2;
52
+ _item = payGroup === null || payGroup === void 0 ? void 0 : payGroup.otherPayment; // 记录获取支付配置
53
+ paymentLogger.addLog({
54
+ key: 'GlobePayQrcode获取支付配置',
55
+ value: ""
56
+ });
57
+
58
+ // const platform = context.appHelper?.constants?.platform || 'h5';
59
+
60
+ // 记录准备回调
61
+ paymentLogger.addLog({
62
+ key: 'GlobePayQrcode准备回调',
63
+ value: ""
64
+ });
65
+
66
+ // 在回调前发送成功日志
67
+ paymentLogger.sendLogs('GlobePayQrcode处理成功');
40
68
  state.payCallback({
41
69
  key: _item.service,
42
70
  data: payGroup
43
71
  });
44
72
  return _context.abrupt("return");
45
- case 7:
46
- _context.prev = 7;
47
- _context.t0 = _context["catch"](1);
48
- case 9:
73
+ case 11:
74
+ _context.prev = 11;
75
+ _context.t0 = _context["catch"](2);
76
+ // 记录GlobePayQrcode处理错误
77
+ paymentLogger.addLog({
78
+ key: 'GlobePayQrcode处理错误',
79
+ value: {
80
+ title: "\u8BA2\u5355".concat(payGroup === null || payGroup === void 0 ? void 0 : payGroup.order_id, " GlobePayQrcode\u5904\u7406\u5931\u8D25: ").concat((_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message) || '未知错误'),
81
+ data: {
82
+ payGroup: payGroup
83
+ }
84
+ }
85
+ });
86
+ paymentLogger.sendLogs('GlobePayQrcode处理失败', _context.t0);
87
+ case 15:
49
88
  case "end":
50
89
  return _context.stop();
51
90
  }
52
- }, _callee, null, [[1, 7]]);
91
+ }, _callee, null, [[2, 11]]);
53
92
  }));
54
93
  return function init(_x) {
55
94
  return _ref2.apply(this, arguments);
@@ -8,12 +8,14 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
8
8
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
9
9
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
10
10
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
- import React, { useState, useImperativeHandle, forwardRef } from 'react';
11
+ import React, { useState, useImperativeHandle, forwardRef, useContext } from 'react';
12
12
  import { PisellModal } from '@pisell/materials';
13
13
  import { locales } from '@pisell/utils';
14
14
  import ThreedsLoading from "../MWCreditCard/TDSPay/ThreedsLoading";
15
15
  import { getAliPayUrl } from "./serve";
16
+ import { Context } from "../../model";
16
17
  import { getPayGroupParamsFromStorage, setPayNumber } from "../../payGroup";
18
+ import usePaymentLogger from "../../../../../hooks/usePaymentLogger";
17
19
  import "./index.less";
18
20
  /**
19
21
  * @title: Globe微信支付
@@ -23,12 +25,21 @@ import "./index.less";
23
25
  * @Date: 2024-08-16 11:18
24
26
  */
25
27
  var GlobePayWxH5 = function GlobePayWxH5(props, ref) {
28
+ var _state$payGroup;
29
+ var _useContext = useContext(Context),
30
+ state = _useContext.state;
26
31
  var onChange = props.onChange;
27
32
  var _useState = useState(false),
28
33
  _useState2 = _slicedToArray(_useState, 2),
29
34
  open = _useState2[0],
30
35
  setOpen = _useState2[1];
31
36
 
37
+ // GlobePayWxH5支付日志记录器
38
+ var paymentLogger = usePaymentLogger({
39
+ orderId: ((_state$payGroup = state.payGroup) === null || _state$payGroup === void 0 ? void 0 : _state$payGroup.order_id) || 'unknown',
40
+ step: '2'
41
+ });
42
+
32
43
  /**
33
44
  * @title: 初始化
34
45
  * @description:
@@ -44,43 +55,110 @@ var GlobePayWxH5 = function GlobePayWxH5(props, ref) {
44
55
  while (1) switch (_context.prev = _context.next) {
45
56
  case 0:
46
57
  payGroup = _ref.payGroup;
58
+ // 记录GlobePayWxH5初始化开始
59
+ paymentLogger.addLog({
60
+ key: 'GlobePayWxH5初始化开始',
61
+ value: ""
62
+ });
47
63
  setOpen(true);
48
64
 
49
65
  // 交易组
50
66
  values = getPayGroupParamsFromStorage(payGroup.order_id);
51
67
  if (values) {
52
- _context.next = 6;
68
+ _context.next = 9;
53
69
  break;
54
70
  }
71
+ // 记录获取支付参数失败
72
+ paymentLogger.addLog({
73
+ key: 'GlobePayWxH5获取支付参数失败',
74
+ value: {
75
+ title: "\u8BA2\u5355".concat(payGroup === null || payGroup === void 0 ? void 0 : payGroup.order_id, " \u672A\u627E\u5230\u5B58\u50A8\u7684\u652F\u4ED8\u53C2\u6570"),
76
+ data: {
77
+ payGroup: payGroup
78
+ }
79
+ }
80
+ });
81
+ paymentLogger.sendLogs('GlobePayWxH5获取支付参数失败');
55
82
  setOpen(false);
56
83
  return _context.abrupt("return");
57
- case 6:
58
- _context.prev = 6;
59
- _context.next = 9;
60
- return getAliPayUrl(payGroup.order_id, values);
61
84
  case 9:
85
+ // 记录获取支付参数成功
86
+ paymentLogger.addLog({
87
+ key: 'GlobePayWxH5获取支付参数成功',
88
+ value: ""
89
+ });
90
+ _context.prev = 10;
91
+ // 记录开始获取微信支付链接
92
+ paymentLogger.addLog({
93
+ key: 'GlobePayWxH5开始获取支付链接',
94
+ value: ""
95
+ });
96
+
97
+ // 获取微信支付链接
98
+ _context.next = 14;
99
+ return getAliPayUrl(payGroup.order_id, values);
100
+ case 14:
62
101
  data = _context.sent;
63
102
  url = data.url || (data === null || data === void 0 ? void 0 : data.pay_url);
64
103
  if (url) {
104
+ // 记录获取支付链接成功
105
+ paymentLogger.addLog({
106
+ key: 'GlobePayWxH5获取支付链接成功',
107
+ value: ""
108
+ });
109
+
65
110
  // 设置交易号
66
111
  setPayNumber(payGroup === null || payGroup === void 0 ? void 0 : payGroup.order_id, data === null || data === void 0 ? void 0 : data.pay_number);
67
112
 
113
+ // 记录准备跳转微信
114
+ paymentLogger.addLog({
115
+ key: 'GlobePayWxH5准备跳转微信',
116
+ value: ""
117
+ });
118
+
119
+ // 在跳转前发送日志
120
+ paymentLogger.sendLogs('GlobePayWxH5跳转成功');
121
+
68
122
  // 跳转
69
123
  window.location.href = url;
70
124
  } else {
125
+ // 记录未获取到支付链接
126
+ paymentLogger.addLog({
127
+ key: 'GlobePayWxH5未获取到支付链接',
128
+ value: {
129
+ title: "\u8BA2\u5355".concat(payGroup === null || payGroup === void 0 ? void 0 : payGroup.order_id, " \u672A\u83B7\u53D6\u5230\u6709\u6548\u7684\u652F\u4ED8\u94FE\u63A5"),
130
+ data: {
131
+ payGroup: payGroup,
132
+ response: data
133
+ }
134
+ }
135
+ });
136
+ paymentLogger.sendLogs('GlobePayWxH5未获取到支付链接');
71
137
  setOpen(false);
72
138
  }
73
- _context.next = 17;
139
+ _context.next = 24;
74
140
  break;
75
- case 14:
76
- _context.prev = 14;
77
- _context.t0 = _context["catch"](6);
141
+ case 19:
142
+ _context.prev = 19;
143
+ _context.t0 = _context["catch"](10);
144
+ // 记录GlobePayWxH5处理错误
145
+ paymentLogger.addLog({
146
+ key: 'GlobePayWxH5处理错误',
147
+ value: {
148
+ title: "\u8BA2\u5355".concat(payGroup === null || payGroup === void 0 ? void 0 : payGroup.order_id, " GlobePayWxH5\u5904\u7406\u5931\u8D25: ").concat((_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message) || '未知错误'),
149
+ data: {
150
+ payGroup: payGroup,
151
+ values: values
152
+ }
153
+ }
154
+ });
155
+ paymentLogger.sendLogs('GlobePayWxH5处理失败', _context.t0);
78
156
  setOpen(false);
79
- case 17:
157
+ case 24:
80
158
  case "end":
81
159
  return _context.stop();
82
160
  }
83
- }, _callee, null, [[6, 14]]);
161
+ }, _callee, null, [[10, 19]]);
84
162
  }));
85
163
  return function init(_x) {
86
164
  return _ref2.apply(this, arguments);