@pisell/private-materials 6.3.14 → 6.3.15

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 (104) 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/components/TabProduct/tabs/index.js +1 -5
  10. package/es/components/booking/components/browserSelect/index.js +1 -1
  11. package/es/components/booking/forms/model.js +5 -5
  12. package/es/components/booking/forms/sendModal/useSendModal.d.ts +1 -1
  13. package/es/components/booking/info/service/addService/utils.d.ts +1 -1
  14. package/es/components/booking/info/service/like/index.js +1 -1
  15. package/es/components/booking/info/service2/utils.d.ts +1 -1
  16. package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
  17. package/es/components/booking/notes/NoteBlock/NoteItem/index.js +1 -1
  18. package/es/components/booking/notes/NoteBlock/index.js +11 -11
  19. package/es/components/booking/notes/model.js +5 -5
  20. package/es/components/booking/payments/model.js +5 -5
  21. package/es/components/eftposPay/amount.d.ts +1 -1
  22. package/es/components/eftposPay/device.d.ts +1 -1
  23. package/es/components/eftposPay/hooks.d.ts +1 -1
  24. package/es/components/eftposPay/store/index.d.ts +2 -2
  25. package/es/components/listComponent/index.js +5 -5
  26. package/es/components/pay/toC/PaymentMethods/ApplePay/index.js +52 -6
  27. package/es/components/pay/toC/PaymentMethods/BankDeposit/index.js +58 -8
  28. package/es/components/pay/toC/PaymentMethods/CashManual/index.js +74 -12
  29. package/es/components/pay/toC/PaymentMethods/CustomPayment/index.js +73 -12
  30. package/es/components/pay/toC/PaymentMethods/GlobePayAliPayH5/index.js +93 -11
  31. package/es/components/pay/toC/PaymentMethods/GlobePayPaypalH5/index.js +90 -12
  32. package/es/components/pay/toC/PaymentMethods/GlobePayQrcode/index.js +46 -7
  33. package/es/components/pay/toC/PaymentMethods/GlobePayWxH5/index.js +90 -12
  34. package/es/components/pay/toC/PaymentMethods/GooglePay/index.js +64 -13
  35. package/es/components/pay/toC/PaymentMethods/OfflinePayment/index.js +73 -8
  36. package/es/components/pay/toC/PaymentMethods/StripePay/index.js +68 -17
  37. package/es/components/pay/toC/PaymentMethods/SuperPayAliPayH5/index.js +86 -14
  38. package/es/components/pay/toC/PaymentMethods/SuperPayWxPayH5/index.js +89 -15
  39. package/es/components/pay/toC/index.js +278 -118
  40. package/es/components/productExtension/card/index.js +3 -3
  41. package/es/components/productExtension/fields/Actor/CutOffTime/index.js +1 -1
  42. package/es/components/productExtension/fields/Forms/index.js +12 -12
  43. package/es/components/productExtension/fields/SelectProducts/ProductItemPreview/index.js +1 -1
  44. package/es/components/productExtension/fields/SelectProducts/server.js +2 -2
  45. package/es/components/productExtension/fields/SelectResourcesTable/server.js +2 -2
  46. package/es/components/productExtension/server.js +2 -2
  47. package/es/components/ruleSetting/ruleBorder/index.js +1 -1
  48. package/es/components/schedules/calendar/index.js +4 -4
  49. package/es/components/schedules/calendar/serve.js +2 -2
  50. package/es/components/schedules/components/CurrentDay/index.js +5 -5
  51. package/es/components/schedules/components/CurrentDay/serve.js +2 -2
  52. package/es/components/schedules/components/DropdownSort/index.js +1 -1
  53. package/es/components/schedules/components/ResourceList/index.js +1 -1
  54. package/es/components/schedules/components/Search/index.js +5 -5
  55. package/es/components/schedules/model.js +5 -5
  56. package/es/components/schedules/openHours/index.js +1 -1
  57. package/es/components/schedules/openHours/serve.js +2 -2
  58. package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/MaxParticipantsModule/index.js +1 -1
  59. package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/ResourcesModule/index.js +5 -5
  60. package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/SchedulesModule/index.js +4 -4
  61. package/es/components/schedules/products/ProductDetailDrawer/index.js +3 -3
  62. package/es/components/schedules/products/serve.js +2 -2
  63. package/es/components/schedules/products/utils.js +5 -5
  64. package/es/components/schedules/resources/detail/detailContent.js +2 -2
  65. package/es/components/schedules/resources/detail/index.js +10 -10
  66. package/es/components/schedules/resources/list/index.js +2 -2
  67. package/es/components/schedules/resources/relationProduct/index.js +1 -1
  68. package/es/components/schedules/resources/serve.js +2 -2
  69. package/es/components/schedules/schedules/ScheduleDetailDrawer/index.js +9 -9
  70. package/es/components/schedules/utils.d.ts +1 -1
  71. package/es/components/schedules/utils.js +4 -4
  72. package/es/components/selectModal/index.js +2 -2
  73. package/es/hooks/useComponents.js +1 -1
  74. package/es/hooks/usePaymentLogger.d.ts +22 -0
  75. package/es/hooks/usePaymentLogger.js +78 -0
  76. package/es/utils/index.d.ts +1 -1
  77. package/lib/components/booking/forms/sendModal/useSendModal.d.ts +1 -1
  78. package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
  79. package/lib/components/booking/info/service2/utils.d.ts +1 -1
  80. package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
  81. package/lib/components/eftposPay/amount.d.ts +1 -1
  82. package/lib/components/eftposPay/device.d.ts +1 -1
  83. package/lib/components/eftposPay/hooks.d.ts +1 -1
  84. package/lib/components/eftposPay/store/index.d.ts +2 -2
  85. package/lib/components/pay/toC/PaymentMethods/ApplePay/index.js +42 -3
  86. package/lib/components/pay/toC/PaymentMethods/BankDeposit/index.js +52 -15
  87. package/lib/components/pay/toC/PaymentMethods/CashManual/index.js +60 -2
  88. package/lib/components/pay/toC/PaymentMethods/CustomPayment/index.js +60 -2
  89. package/lib/components/pay/toC/PaymentMethods/GlobePayAliPayH5/index.js +66 -2
  90. package/lib/components/pay/toC/PaymentMethods/GlobePayPaypalH5/index.js +61 -0
  91. package/lib/components/pay/toC/PaymentMethods/GlobePayQrcode/index.js +29 -0
  92. package/lib/components/pay/toC/PaymentMethods/GlobePayWxH5/index.js +61 -0
  93. package/lib/components/pay/toC/PaymentMethods/GooglePay/index.js +50 -6
  94. package/lib/components/pay/toC/PaymentMethods/OfflinePayment/index.js +72 -10
  95. package/lib/components/pay/toC/PaymentMethods/StripePay/index.js +47 -5
  96. package/lib/components/pay/toC/PaymentMethods/SuperPayAliPayH5/index.js +61 -3
  97. package/lib/components/pay/toC/PaymentMethods/SuperPayWxPayH5/index.js +63 -3
  98. package/lib/components/pay/toC/index.js +183 -48
  99. package/lib/components/schedules/utils.d.ts +1 -1
  100. package/lib/components/schedules/utils.js +1 -1
  101. package/lib/hooks/usePaymentLogger.d.ts +22 -0
  102. package/lib/hooks/usePaymentLogger.js +69 -0
  103. package/lib/utils/index.d.ts +1 -1
  104. package/package.json +4 -4
@@ -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);
@@ -15,6 +15,7 @@ import ThreedsLoading from "../MWCreditCard/TDSPay/ThreedsLoading";
15
15
  import { Context } from "../../model";
16
16
  import { getPayGroupParamsFromStorage } from "../../payGroup";
17
17
  import useEngineContext from "../../../../../hooks/useEngineContext";
18
+ import usePaymentLogger from "../../../../../hooks/usePaymentLogger";
18
19
  import { clientPayment, formatFranchiseeRoute } from "../../utils";
19
20
  /**
20
21
  * @title: 谷歌支付
@@ -26,7 +27,7 @@ import { clientPayment, formatFranchiseeRoute } from "../../utils";
26
27
  * @Date: 2024-08-16 11:01
27
28
  */
28
29
  var GooglePay = function GooglePay(props, ref) {
29
- var _context$appHelper, _context$appHelper2;
30
+ var _context$appHelper, _context$appHelper2, _state$payGroup;
30
31
  var _useContext = useContext(Context),
31
32
  state = _useContext.state;
32
33
  var _useState = useState(false),
@@ -39,6 +40,12 @@ var GooglePay = function GooglePay(props, ref) {
39
40
  var _context$appHelper$ut = (_context$appHelper2 = context.appHelper) === null || _context$appHelper2 === void 0 ? void 0 : _context$appHelper2.utils,
40
41
  interaction = _context$appHelper$ut.interaction;
41
42
 
43
+ // GooglePay支付日志记录器
44
+ var paymentLogger = usePaymentLogger({
45
+ orderId: ((_state$payGroup = state.payGroup) === null || _state$payGroup === void 0 ? void 0 : _state$payGroup.order_id) || 'unknown',
46
+ step: '2'
47
+ });
48
+
42
49
  /**
43
50
  * @title: 初始化
44
51
  * @description:
@@ -50,33 +57,60 @@ var GooglePay = function GooglePay(props, ref) {
50
57
  var init = /*#__PURE__*/function () {
51
58
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref2) {
52
59
  var _utils$getStore, _interaction$utils, _interaction$utils$is, _interaction$utils2, _interaction$utils2$i;
53
- var payGroup, utils, dvaStore, values, _dvaStore$core, _dvaStore$core2, _state$payGroup, locale, shopId, currentURL, linkElement, shop_domain, _href;
60
+ var payGroup, utils, dvaStore, values, _dvaStore$core, _dvaStore$core2, _state$payGroup2, locale, shopId, currentURL, linkElement, shop_domain, _href;
54
61
  return _regeneratorRuntime().wrap(function _callee$(_context) {
55
62
  while (1) switch (_context.prev = _context.next) {
56
63
  case 0:
57
64
  payGroup = _ref2.payGroup;
65
+ // 记录GooglePay初始化开始
66
+ paymentLogger.addLog({
67
+ key: 'GooglePay初始化开始',
68
+ value: ""
69
+ });
58
70
  utils = context.appHelper.utils || {};
59
71
  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(); // 获取交易组
60
72
  values = getPayGroupParamsFromStorage(payGroup.order_id);
73
+ if (values) {
74
+ _context.next = 10;
75
+ break;
76
+ }
77
+ // 记录获取支付参数失败
78
+ paymentLogger.addLog({
79
+ key: 'GooglePay获取支付参数失败',
80
+ value: {
81
+ title: "\u8BA2\u5355".concat(payGroup === null || payGroup === void 0 ? void 0 : payGroup.order_id, " \u672A\u627E\u5230\u5B58\u50A8\u7684\u652F\u4ED8\u53C2\u6570"),
82
+ data: {
83
+ payGroup: payGroup
84
+ }
85
+ }
86
+ });
87
+ paymentLogger.sendLogs('GooglePay获取支付参数失败');
88
+ setOpen(false);
89
+ return _context.abrupt("return");
90
+ case 10:
91
+ // 记录获取支付参数成功
92
+ paymentLogger.addLog({
93
+ key: 'GooglePay获取支付参数成功',
94
+ value: ""
95
+ });
61
96
  if (!(interaction !== null && interaction !== void 0 && (_interaction$utils = interaction.utils) !== null && _interaction$utils !== void 0 && (_interaction$utils$is = _interaction$utils.isAppEnv) !== null && _interaction$utils$is !== void 0 && _interaction$utils$is.call(_interaction$utils) && (interaction === null || interaction === void 0 || (_interaction$utils2 = interaction.utils) === null || _interaction$utils2 === void 0 || (_interaction$utils2$i = _interaction$utils2.isAndroid_ios) === null || _interaction$utils2$i === void 0 ? void 0 : _interaction$utils2$i.call(_interaction$utils2)) === 'android')) {
62
- _context.next = 6;
97
+ _context.next = 15;
63
98
  break;
64
99
  }
100
+ // 记录Android客户端支付
101
+ paymentLogger.addLog({
102
+ key: 'GooglePay使用Android客户端支付',
103
+ value: ""
104
+ });
105
+ paymentLogger.sendLogs('GooglePay客户端支付');
65
106
  return _context.abrupt("return", clientPayment({
66
107
  order_id: payGroup.order_id,
67
108
  type: 'google_pay',
68
109
  values: values,
69
110
  interaction: interaction
70
111
  }));
71
- case 6:
112
+ case 15:
72
113
  setOpen(true);
73
- if (values) {
74
- _context.next = 10;
75
- break;
76
- }
77
- setOpen(false);
78
- return _context.abrupt("return");
79
- case 10:
80
114
  try {
81
115
  locale = ((_dvaStore$core = dvaStore.core) === null || _dvaStore$core === void 0 ? void 0 : _dvaStore$core.translateLocale) || 'en';
82
116
  shopId = (_dvaStore$core2 = dvaStore.core) === null || _dvaStore$core2 === void 0 || (_dvaStore$core2 = _dvaStore$core2.core) === null || _dvaStore$core2 === void 0 || (_dvaStore$core2 = _dvaStore$core2.shop) === null || _dvaStore$core2 === void 0 ? void 0 : _dvaStore$core2.id;
@@ -86,12 +120,29 @@ var GooglePay = function GooglePay(props, ref) {
86
120
 
87
121
  // 提取域名
88
122
  shop_domain = linkElement.hostname;
89
- _href = "".concat(config.pay).concat(formatFranchiseeRoute("/google-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));
123
+ _href = "".concat(config.pay).concat(formatFranchiseeRoute("/google-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)); // 记录即将跳转到GooglePay
124
+ paymentLogger.addLog({
125
+ key: 'GooglePay准备跳转',
126
+ value: ""
127
+ });
128
+ paymentLogger.sendLogs('GooglePay跳转成功');
90
129
  window.location.href = _href;
91
130
  } catch (err) {
131
+ // 记录GooglePay处理错误
132
+ paymentLogger.addLog({
133
+ key: 'GooglePay处理错误',
134
+ value: {
135
+ title: "\u8BA2\u5355".concat(payGroup === null || payGroup === void 0 ? void 0 : payGroup.order_id, " GooglePay\u5904\u7406\u5931\u8D25: ").concat((err === null || err === void 0 ? void 0 : err.message) || '未知错误'),
136
+ data: {
137
+ payGroup: payGroup,
138
+ values: values
139
+ }
140
+ }
141
+ });
142
+ paymentLogger.sendLogs('GooglePay处理失败', err);
92
143
  setOpen(false);
93
144
  }
94
- case 11:
145
+ case 17:
95
146
  case "end":
96
147
  return _context.stop();
97
148
  }
@@ -6,6 +6,7 @@ import { useImperativeHandle, forwardRef, useContext } from 'react';
6
6
  import { offlinePayment } from "./serve";
7
7
  import { Context } from "../../model";
8
8
  import { getPayGroupParamsFromStorage } from "../../payGroup";
9
+ import usePaymentLogger from "../../../../../hooks/usePaymentLogger";
9
10
  import "./index.less";
10
11
  /**
11
12
  * @title: 线下支付
@@ -17,9 +18,16 @@ import "./index.less";
17
18
  * @Date: 2024-08-16 11:16
18
19
  */
19
20
  var OfflinePayment = function OfflinePayment(props, ref) {
21
+ var _state$payGroup;
20
22
  var _useContext = useContext(Context),
21
23
  state = _useContext.state;
22
24
 
25
+ // OfflinePayment支付日志记录器
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:
@@ -30,34 +38,91 @@ var OfflinePayment = function OfflinePayment(props, ref) {
30
38
  */
31
39
  var init = /*#__PURE__*/function () {
32
40
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
33
- var _item$params;
34
- var payGroup, _item, params;
41
+ var payGroup, _item$params, _item$params2, _item, params;
35
42
  return _regeneratorRuntime().wrap(function _callee$(_context) {
36
43
  while (1) switch (_context.prev = _context.next) {
37
44
  case 0:
38
45
  payGroup = _ref.payGroup;
46
+ _context.prev = 1;
47
+ // 记录OfflinePayment初始化开始
48
+ paymentLogger.addLog({
49
+ key: 'OfflinePayment初始化开始',
50
+ value: ""
51
+ });
39
52
  _item = payGroup === null || payGroup === void 0 ? void 0 : payGroup.otherPayment; // 获取交易组信息
40
53
  params = getPayGroupParamsFromStorage(payGroup === null || payGroup === void 0 ? void 0 : payGroup.order_id, {
41
54
  order_id: payGroup === null || payGroup === void 0 ? void 0 : payGroup.order_id,
42
55
  payment_method: _item === null || _item === void 0 || (_item$params = _item.params) === null || _item$params === void 0 ? void 0 : _item$params.payment_method
43
56
  });
44
57
  if (params) {
45
- _context.next = 5;
58
+ _context.next = 9;
46
59
  break;
47
60
  }
61
+ // 记录获取支付参数失败
62
+ paymentLogger.addLog({
63
+ key: 'OfflinePayment获取支付参数失败',
64
+ value: {
65
+ title: "\u8BA2\u5355".concat(payGroup === null || payGroup === void 0 ? void 0 : payGroup.order_id, " \u672A\u627E\u5230\u5B58\u50A8\u7684\u652F\u4ED8\u53C2\u6570"),
66
+ data: {
67
+ payGroup: payGroup
68
+ }
69
+ }
70
+ });
71
+ paymentLogger.sendLogs('OfflinePayment获取支付参数失败');
48
72
  return _context.abrupt("return");
49
- case 5:
50
- _context.next = 7;
73
+ case 9:
74
+ // 记录获取支付参数成功
75
+ paymentLogger.addLog({
76
+ key: 'OfflinePayment获取支付参数成功',
77
+ value: ""
78
+ });
79
+
80
+ // 记录开始执行线下支付
81
+ paymentLogger.addLog({
82
+ key: 'OfflinePayment开始执行支付',
83
+ value: {
84
+ title: "\u8BA2\u5355".concat(payGroup === null || payGroup === void 0 ? void 0 : payGroup.order_id, " \u5F00\u59CB\u6267\u884C\u7EBF\u4E0B\u652F\u4ED8"),
85
+ data: {
86
+ params: params,
87
+ paymentMethod: _item === null || _item === void 0 || (_item$params2 = _item.params) === null || _item$params2 === void 0 ? void 0 : _item$params2.payment_method
88
+ }
89
+ }
90
+ });
91
+
92
+ // 支付
93
+ _context.next = 13;
51
94
  return offlinePayment(params);
52
- case 7:
95
+ case 13:
96
+ // 记录支付成功
97
+ paymentLogger.addLog({
98
+ key: 'OfflinePayment支付成功',
99
+ value: ""
100
+ });
101
+ paymentLogger.sendLogs('OfflinePayment支付成功');
53
102
  state.payCallback({
54
103
  key: 'success'
55
104
  });
56
- case 8:
105
+ _context.next = 22;
106
+ break;
107
+ case 18:
108
+ _context.prev = 18;
109
+ _context.t0 = _context["catch"](1);
110
+ // 记录OfflinePayment处理错误
111
+ paymentLogger.addLog({
112
+ key: 'OfflinePayment处理错误',
113
+ value: {
114
+ title: "\u8BA2\u5355".concat(payGroup === null || payGroup === void 0 ? void 0 : payGroup.order_id, " OfflinePayment\u5904\u7406\u5931\u8D25: ").concat((_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message) || '未知错误'),
115
+ data: {
116
+ payGroup: payGroup
117
+ }
118
+ }
119
+ });
120
+ paymentLogger.sendLogs('OfflinePayment处理失败', _context.t0);
121
+ case 22:
57
122
  case "end":
58
123
  return _context.stop();
59
124
  }
60
- }, _callee);
125
+ }, _callee, null, [[1, 18]]);
61
126
  }));
62
127
  return function init(_x) {
63
128
  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: StripePay
@@ -16,10 +17,17 @@ import "./index.less";
16
17
  * @Date: 2024-08-16 11:17
17
18
  */
18
19
  var StripePay = function StripePay(props, ref) {
19
- var _useContext = useContext(Context),
20
- state = _useContext.state;
20
+ var _state$payGroup;
21
+ var _ref = useContext(Context),
22
+ state = _ref.state;
21
23
  var context = useEngineContext();
22
24
 
25
+ // StripePay支付日志记录器
26
+ var paymentLogger = usePaymentLogger({
27
+ orderId: (state === null || state === void 0 || (_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:
@@ -29,19 +37,42 @@ var StripePay = function StripePay(props, ref) {
29
37
  * @Date: 2024-08-16 11:17
30
38
  */
31
39
  var init = /*#__PURE__*/function () {
32
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
33
- var payGroup, _context$appHelper, _item, platform;
40
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref2) {
41
+ var payGroup, _context$appHelper, _item, platform, redirectUrl;
34
42
  return _regeneratorRuntime().wrap(function _callee$(_context) {
35
43
  while (1) switch (_context.prev = _context.next) {
36
44
  case 0:
37
- payGroup = _ref.payGroup;
38
- _context.prev = 1;
45
+ payGroup = _ref2.payGroup;
46
+ // 记录StripePay初始化开始
47
+ paymentLogger.addLog({
48
+ key: 'StripePay初始化开始',
49
+ value: ""
50
+ });
51
+ _context.prev = 2;
39
52
  _item = payGroup === null || payGroup === void 0 ? void 0 : payGroup.otherPayment;
40
- 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'; // pc打开弹窗
53
+ 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'; // 记录平台信息
54
+ paymentLogger.addLog({
55
+ key: 'StripePay平台检测',
56
+ value: {
57
+ platform: platform,
58
+ paymentItem: _item
59
+ }
60
+ });
61
+
62
+ // pc打开弹窗
41
63
  if (!(platform === 'pc')) {
42
- _context.next = 7;
64
+ _context.next = 11;
43
65
  break;
44
66
  }
67
+ // 记录PC端回调准备
68
+ paymentLogger.addLog({
69
+ key: 'StripePay PC端回调准备',
70
+ value: {
71
+ service: _item.service,
72
+ orderId: payGroup.order_id,
73
+ paymentMethod: _item.title
74
+ }
75
+ });
45
76
  state.payCallback({
46
77
  key: _item.service,
47
78
  data: {
@@ -49,23 +80,43 @@ var StripePay = function StripePay(props, ref) {
49
80
  payment_method: _item.title
50
81
  }
51
82
  });
83
+ paymentLogger.sendLogs('StripePay PC端回调成功');
52
84
  return _context.abrupt("return");
53
- case 7:
85
+ case 11:
54
86
  // h5跳转页面
55
- state.history.push("/pay/stripe?order_id=".concat(payGroup.order_id, "&payment_method=").concat(encodeURIComponent(_item.title)));
56
- _context.next = 12;
87
+ redirectUrl = "/pay/stripe?order_id=".concat(payGroup.order_id, "&payment_method=").concat(encodeURIComponent(_item.title)); // 记录H5端跳转准备
88
+ paymentLogger.addLog({
89
+ key: 'StripePay H5端跳转准备',
90
+ value: {
91
+ redirectUrl: redirectUrl
92
+ }
93
+ });
94
+ state.history.push(redirectUrl);
95
+ paymentLogger.sendLogs('StripePay H5端跳转成功');
96
+ _context.next = 21;
57
97
  break;
58
- case 10:
59
- _context.prev = 10;
60
- _context.t0 = _context["catch"](1);
61
- case 12:
98
+ case 17:
99
+ _context.prev = 17;
100
+ _context.t0 = _context["catch"](2);
101
+ // 记录StripePay处理错误
102
+ paymentLogger.addLog({
103
+ key: 'StripePay处理错误',
104
+ value: {
105
+ title: "\u8BA2\u5355".concat(payGroup === null || payGroup === void 0 ? void 0 : payGroup.order_id, " StripePay\u5904\u7406\u5931\u8D25: ").concat((_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message) || '未知错误'),
106
+ data: {
107
+ payGroup: payGroup
108
+ }
109
+ }
110
+ });
111
+ paymentLogger.sendLogs('StripePay处理失败', _context.t0);
112
+ case 21:
62
113
  case "end":
63
114
  return _context.stop();
64
115
  }
65
- }, _callee, null, [[1, 10]]);
116
+ }, _callee, null, [[2, 17]]);
66
117
  }));
67
118
  return function init(_x) {
68
- return _ref2.apply(this, arguments);
119
+ return _ref3.apply(this, arguments);
69
120
  };
70
121
  }();
71
122
  useImperativeHandle(ref, function () {