@pisell/private-materials 3.4.87 → 3.4.89

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 (149) 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 +2 -2
  6. package/build/lowcode/preview.js +9 -9
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +10 -10
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +11 -11
  11. package/es/components/booking/addons/model.d.ts +1 -10
  12. package/es/components/booking/components/footer/utils.js +4 -4
  13. package/es/components/booking/forms/model.d.ts +1 -10
  14. package/es/components/booking/hooks/useClearCart.d.ts +1 -1
  15. package/es/components/booking/hooks/useClearCart.js +39 -9
  16. package/es/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +1 -0
  17. package/es/components/booking/info/hooks/useInfoHolder.d.ts +1 -0
  18. package/es/components/booking/info/model.d.ts +1 -10
  19. package/es/components/booking/info/service/index.less +4 -2
  20. package/es/components/booking/info2/service/editService/index.js +36 -6
  21. package/es/components/booking/info2/service/editService/utils.d.ts +15 -0
  22. package/es/components/booking/info2/service/editService/utils.js +76 -0
  23. package/es/components/booking/locales.d.ts +20 -0
  24. package/es/components/booking/locales.js +20 -0
  25. package/es/components/booking/model.d.ts +1 -9
  26. package/es/components/booking/notes/model.d.ts +1 -10
  27. package/es/components/booking/payments/model.d.ts +1 -10
  28. package/es/components/eftposPay/tyro/hooks.d.ts +1 -0
  29. package/es/components/eventBooking/components/ErrorTip/index.d.ts +1 -0
  30. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateStatus/index.d.ts +1 -0
  31. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +1 -0
  32. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +1 -0
  33. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +1 -0
  34. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/DayItem/index.d.ts +1 -0
  35. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/index.d.ts +1 -0
  36. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Status/index.d.ts +1 -0
  37. package/es/components/pay/toC/PaymentList/payment/google_pay.svg +26 -8
  38. package/es/components/pay/toC/PaymentList/payment/google_pay2.svg +9 -0
  39. package/es/components/pay/toC/PaymentMethods/MWCreditCard/Add/index.d.ts +6 -0
  40. package/es/components/pay/toC/PaymentMethods/MWCreditCard/Add/index.js +65 -21
  41. package/es/components/pay/toC/PaymentMethods/MWCreditCard/Add/index.less +110 -9
  42. package/es/components/pay/toC/PaymentMethods/MWCreditCard/List/index.d.ts +2 -0
  43. package/es/components/pay/toC/PaymentMethods/MWCreditCard/List/index.js +28 -16
  44. package/es/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.d.ts +20 -1
  45. package/es/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.js +14 -1
  46. package/es/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.less +20 -0
  47. package/es/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/index.d.ts +7 -1
  48. package/es/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/index.js +167 -56
  49. package/es/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/index.less +47 -0
  50. package/es/components/pay/toC/PaymentMethods/MWCreditCard/components/TDSErrorModal/index.d.ts +34 -0
  51. package/es/components/pay/toC/PaymentMethods/MWCreditCard/components/TDSErrorModal/index.js +83 -0
  52. package/es/components/pay/toC/PaymentMethods/MWCreditCard/components/TDSErrorModal/index.less +52 -0
  53. package/es/components/pay/toC/PaymentMethods/MWCreditCard/index.d.ts +9 -1
  54. package/es/components/pay/toC/PaymentMethods/MWCreditCard/index.js +260 -33
  55. package/es/components/pay/toC/PaymentMethods/MWCreditCard/tds2.d.ts +23 -3
  56. package/es/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +292 -115
  57. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/Finish/index.d.ts +1 -0
  58. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +1 -0
  59. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/PageLoading/index.d.ts +1 -0
  60. package/es/components/pay/toC/PaymentMethods/index.js +12 -2
  61. package/es/components/pay/toC/index.js +53 -18
  62. package/es/components/pay/toC/locales.d.ts +115 -0
  63. package/es/components/pay/toC/locales.js +143 -18
  64. package/es/components/pay/toC/model.d.ts +1 -9
  65. package/es/components/pay/toC/serve.d.ts +10 -0
  66. package/es/components/pay/toC/serve.js +40 -1
  67. package/es/components/pay/toC/utils.d.ts +5 -0
  68. package/es/components/pay/toC/utils.js +10 -0
  69. package/es/components/schedules/model.d.ts +1 -9
  70. package/es/components/shoppingCart/components/Cart/index.less +1 -0
  71. package/es/components/shoppingCart/components/Empty/index.d.ts +1 -0
  72. package/es/components/shoppingCart/hooks/useClearCart.d.ts +1 -1
  73. package/es/components/shoppingCart/hooks/useClearCart.js +41 -11
  74. package/es/plus/selectHolder/components/ErrorTip/index.d.ts +1 -0
  75. package/es/plus/walletPassGallery/components/recharge/index.js +13 -5
  76. package/es/plus/walletPassGallery/components/recharge/index.less +70 -1
  77. package/es/plus/walletPassGallery/locales.d.ts +10 -0
  78. package/es/plus/walletPassGallery/locales.js +26 -5
  79. package/lib/components/booking/addons/model.d.ts +1 -10
  80. package/lib/components/booking/components/footer/utils.js +2 -2
  81. package/lib/components/booking/forms/model.d.ts +1 -10
  82. package/lib/components/booking/hooks/useClearCart.d.ts +1 -1
  83. package/lib/components/booking/hooks/useClearCart.js +28 -6
  84. package/lib/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +1 -0
  85. package/lib/components/booking/info/hooks/useInfoHolder.d.ts +1 -0
  86. package/lib/components/booking/info/model.d.ts +1 -10
  87. package/lib/components/booking/info/service/index.less +4 -2
  88. package/lib/components/booking/info2/service/editService/index.js +24 -1
  89. package/lib/components/booking/info2/service/editService/utils.d.ts +15 -0
  90. package/lib/components/booking/info2/service/editService/utils.js +38 -2
  91. package/lib/components/booking/locales.d.ts +20 -0
  92. package/lib/components/booking/locales.js +20 -0
  93. package/lib/components/booking/model.d.ts +1 -9
  94. package/lib/components/booking/notes/model.d.ts +1 -10
  95. package/lib/components/booking/payments/model.d.ts +1 -10
  96. package/lib/components/eftposPay/tyro/hooks.d.ts +1 -0
  97. package/lib/components/eventBooking/components/ErrorTip/index.d.ts +1 -0
  98. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateStatus/index.d.ts +1 -0
  99. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +1 -0
  100. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +1 -0
  101. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +1 -0
  102. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/DayItem/index.d.ts +1 -0
  103. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/index.d.ts +1 -0
  104. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Status/index.d.ts +1 -0
  105. package/lib/components/pay/toC/PaymentList/payment/google_pay.svg +26 -8
  106. package/lib/components/pay/toC/PaymentList/payment/google_pay2.svg +9 -0
  107. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/Add/index.d.ts +6 -0
  108. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/Add/index.js +40 -17
  109. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/Add/index.less +110 -9
  110. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/List/index.d.ts +2 -0
  111. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/List/index.js +17 -5
  112. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.d.ts +20 -1
  113. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.js +8 -2
  114. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.less +20 -0
  115. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/index.d.ts +7 -1
  116. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/index.js +98 -24
  117. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/index.less +47 -0
  118. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/components/TDSErrorModal/index.d.ts +34 -0
  119. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/components/TDSErrorModal/index.js +107 -0
  120. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/components/TDSErrorModal/index.less +52 -0
  121. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/index.d.ts +9 -1
  122. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/index.js +149 -5
  123. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/tds2.d.ts +23 -3
  124. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +99 -16
  125. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/Finish/index.d.ts +1 -0
  126. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +1 -0
  127. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/PageLoading/index.d.ts +1 -0
  128. package/lib/components/pay/toC/PaymentMethods/index.js +19 -14
  129. package/lib/components/pay/toC/index.js +34 -3
  130. package/lib/components/pay/toC/locales.d.ts +115 -0
  131. package/lib/components/pay/toC/locales.js +133 -18
  132. package/lib/components/pay/toC/model.d.ts +1 -9
  133. package/lib/components/pay/toC/serve.d.ts +10 -0
  134. package/lib/components/pay/toC/serve.js +10 -0
  135. package/lib/components/pay/toC/utils.d.ts +5 -0
  136. package/lib/components/pay/toC/utils.js +17 -0
  137. package/lib/components/schedules/model.d.ts +1 -9
  138. package/lib/components/shoppingCart/components/Cart/index.less +1 -0
  139. package/lib/components/shoppingCart/components/Empty/index.d.ts +1 -0
  140. package/lib/components/shoppingCart/hooks/useClearCart.d.ts +1 -1
  141. package/lib/components/shoppingCart/hooks/useClearCart.js +42 -11
  142. package/lib/plus/selectHolder/components/ErrorTip/index.d.ts +1 -0
  143. package/lib/plus/walletPassGallery/components/recharge/index.js +7 -5
  144. package/lib/plus/walletPassGallery/components/recharge/index.less +70 -1
  145. package/lib/plus/walletPassGallery/locales.d.ts +10 -0
  146. package/lib/plus/walletPassGallery/locales.js +20 -5
  147. package/lowcode/eco-cup-list/meta.ts +20 -56
  148. package/lowcode/eco-customer-list/meta.ts +20 -56
  149. package/package.json +3 -3
@@ -1,3 +1,13 @@
1
+ /**
2
+ * 取消当前支付流程中残留的 message 监听器和定时器,
3
+ * 并 reject 挂起的 Promise 使 startPayment 的 await 结束。
4
+ * reject 值为 0,startPayment catch 中 `if (err === 0) return` 会静默处理。
5
+ */
6
+ export declare const cancelCurrentPayment: () => void;
7
+ interface PaymentOptions {
8
+ callback?: (res: any) => void;
9
+ isCancelled?: () => boolean;
10
+ }
1
11
  /**
2
12
  * @title: 点击支付
3
13
  * @description:
@@ -6,7 +16,16 @@
6
16
  * @Author: Wzw
7
17
  * @Date: 2022-10-22 10:05
8
18
  */
9
- export declare const startPayment: ({ orderId, cardInfo, payData }: any, callback?: any) => Promise<boolean | undefined>;
19
+ export declare const startPayment: ({ orderId, cardInfo, payData }: any, options?: PaymentOptions) => Promise<boolean | undefined>;
20
+ /**
21
+ * @title: 前置检查 - 提交卡信息到后端(预检查版本)
22
+ * @description: 与 checkEnrollment 调用相同 API,但不包含 Toast/callback/closeIframe 等副作用。
23
+ * 失败时直接 throw error,由调用方(MWCreditCard)捕获并展示 3DS 错误弹窗。
24
+ * @param {string} orderId 订单ID
25
+ * @param {any} cardInfo 卡信息
26
+ * @return {Promise<any>} 返回后端数据(含 pay_info),失败则 throw
27
+ */
28
+ export declare const preCheckEnrollment: (orderId: string, cardInfo: any) => Promise<any>;
10
29
  /*******
11
30
  * @title: 步骤2
12
31
  * @description: 提交卡信息到后端
@@ -14,7 +33,7 @@ export declare const startPayment: ({ orderId, cardInfo, payData }: any, callbac
14
33
  * @Author: Wzw
15
34
  * @Date: 2022-10-18 10:26
16
35
  */
17
- export declare const checkEnrollment: (orderId: string, cardInfo: any, callback: any) => Promise<any>;
36
+ export declare const checkEnrollment: (orderId: string, cardInfo: any, options?: PaymentOptions) => Promise<any>;
18
37
  /**
19
38
  * @title: 步骤3
20
39
  * @description: 创建iframe, 监听
@@ -32,7 +51,7 @@ export declare const createThreeDSMethodIframe: (threeDSMethodData: any, callbac
32
51
  * @Author: Wzw
33
52
  * @Date: 2022-10-18 10:43
34
53
  */
35
- export declare const checkTDSAuth: (step2: any, step3: any, callback?: any) => Promise<any>;
54
+ export declare const checkTDSAuth: (step2: any, step3: any, options?: PaymentOptions) => Promise<any>;
36
55
  /**
37
56
  * @title: 步骤5
38
57
  * @description: 监听
@@ -59,3 +78,4 @@ export declare const checkPARes: (step2: any, step4: any, step5: any) => Promise
59
78
  * @Date: 2022-10-18 14:28
60
79
  */
61
80
  export declare const paymentEnd: (props: any, callback: any) => void;
81
+ export {};
@@ -29,12 +29,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
29
29
  // src/components/pay/toC/PaymentMethods/MWCreditCard/tds2.tsx
30
30
  var tds2_exports = {};
31
31
  __export(tds2_exports, {
32
+ cancelCurrentPayment: () => cancelCurrentPayment,
32
33
  checkEnrollment: () => checkEnrollment,
33
34
  checkPARes: () => checkPARes,
34
35
  checkTDSAuth: () => checkTDSAuth,
35
36
  createChallengeIframe: () => createChallengeIframe,
36
37
  createThreeDSMethodIframe: () => createThreeDSMethodIframe,
37
38
  paymentEnd: () => paymentEnd,
39
+ preCheckEnrollment: () => preCheckEnrollment,
38
40
  startPayment: () => startPayment
39
41
  });
40
42
  module.exports = __toCommonJS(tds2_exports);
@@ -43,6 +45,7 @@ var import_dayjs = __toESM(require("dayjs"));
43
45
  var import_utils2 = require("@pisell/utils");
44
46
  var import_materials = require("@pisell/materials");
45
47
  var import_payGroup = require("../../payGroup");
48
+ var import_utils3 = require("../../utils");
46
49
  var { REACT_APP_API_ENV } = process.env;
47
50
  var paymentInfo = {
48
51
  transactionInfo: {
@@ -61,6 +64,11 @@ var paymentInfo = {
61
64
  };
62
65
  var paymentData = {};
63
66
  var postmessageUrl = "merchantwarrior";
67
+ var activeCleanup = null;
68
+ var cancelCurrentPayment = () => {
69
+ activeCleanup == null ? void 0 : activeCleanup();
70
+ activeCleanup = null;
71
+ };
64
72
  var log = (data) => {
65
73
  let _template = {
66
74
  module,
@@ -84,7 +92,8 @@ var setHistoryLog = (log2) => {
84
92
  var getCurrentTime = () => {
85
93
  return (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss");
86
94
  };
87
- var startPayment = async ({ orderId, cardInfo, payData }, callback) => {
95
+ var startPayment = async ({ orderId, cardInfo, payData }, options) => {
96
+ const { callback, isCancelled } = options || {};
88
97
  let paymentInfo2 = {
89
98
  amount: 0,
90
99
  order_id: 0
@@ -101,7 +110,11 @@ var startPayment = async ({ orderId, cardInfo, payData }, callback) => {
101
110
  payDataOrderId: payData == null ? void 0 : payData.order_id,
102
111
  payDataPayNumber: payData == null ? void 0 : payData.pay_number
103
112
  });
104
- const step2 = payData ? payData : await checkEnrollment(orderId, cardInfo, callback);
113
+ const step2 = payData ? payData : await checkEnrollment(orderId, cardInfo, { callback, isCancelled });
114
+ if (isCancelled == null ? void 0 : isCancelled()) {
115
+ closeIframe();
116
+ return;
117
+ }
105
118
  setHistoryLog({
106
119
  msg: "步骤2完成: 提交卡信息到后端",
107
120
  time: getCurrentTime(),
@@ -119,6 +132,10 @@ var startPayment = async ({ orderId, cardInfo, payData }, callback) => {
119
132
  time: getCurrentTime()
120
133
  });
121
134
  let step3 = await createThreeDSMethodIframe(step2, callback);
135
+ if (isCancelled == null ? void 0 : isCancelled()) {
136
+ closeIframe();
137
+ return;
138
+ }
122
139
  paymentData.step3 = step3;
123
140
  setHistoryLog({
124
141
  msg: "步骤3完成: iframe监听结束",
@@ -134,7 +151,11 @@ var startPayment = async ({ orderId, cardInfo, payData }, callback) => {
134
151
  order_id: step2 == null ? void 0 : step2.order_id,
135
152
  pay_number: step2 == null ? void 0 : step2.pay_number
136
153
  });
137
- const step4 = await checkTDSAuth(step2, step3, callback);
154
+ const step4 = await checkTDSAuth(step2, step3, { callback, isCancelled });
155
+ if (isCancelled == null ? void 0 : isCancelled()) {
156
+ closeIframe();
157
+ return;
158
+ }
138
159
  setHistoryLog({
139
160
  msg: "步骤4完成: checkTDSAuth 返回",
140
161
  time: getCurrentTime(),
@@ -150,6 +171,10 @@ var startPayment = async ({ orderId, cardInfo, payData }, callback) => {
150
171
  time: getCurrentTime()
151
172
  });
152
173
  const step5 = await createChallengeIframe(step4, callback);
174
+ if (isCancelled == null ? void 0 : isCancelled()) {
175
+ closeIframe();
176
+ return;
177
+ }
153
178
  paymentData.step5 = step5;
154
179
  setHistoryLog({
155
180
  msg: "步骤5完成: challenge iframe结束",
@@ -160,12 +185,20 @@ var startPayment = async ({ orderId, cardInfo, payData }, callback) => {
160
185
  time: getCurrentTime()
161
186
  });
162
187
  await checkPARes(step2, step4, step5);
188
+ if (isCancelled == null ? void 0 : isCancelled()) {
189
+ closeIframe();
190
+ return;
191
+ }
163
192
  setHistoryLog({
164
193
  msg: "步骤6完成: check_pares接口返回",
165
194
  time: getCurrentTime()
166
195
  });
167
196
  }
168
- callback({ key: "hideModal" });
197
+ if (isCancelled == null ? void 0 : isCancelled()) {
198
+ closeIframe();
199
+ return;
200
+ }
201
+ callback == null ? void 0 : callback({ key: "hideModal" });
169
202
  setHistoryLog({
170
203
  msg: "支付成功",
171
204
  time: getCurrentTime()
@@ -183,11 +216,17 @@ var startPayment = async ({ orderId, cardInfo, payData }, callback) => {
183
216
  setHistoryLog({
184
217
  msg: "支付异常",
185
218
  time: getCurrentTime(),
186
- error: err
219
+ error: err,
220
+ errorCode: err == null ? void 0 : err.code
187
221
  });
188
- callback({ key: "hideModal" });
189
222
  closeIframe();
223
+ if (isCancelled == null ? void 0 : isCancelled()) return;
224
+ callback == null ? void 0 : callback({ key: "hideModal" });
190
225
  if (err === 0) return;
226
+ if ((err == null ? void 0 : err.code) === 700500) {
227
+ callback == null ? void 0 : callback({ key: "bankVerifyFailed" });
228
+ return false;
229
+ }
191
230
  paymentData.error = err;
192
231
  paymentEnd(
193
232
  {
@@ -199,11 +238,34 @@ var startPayment = async ({ orderId, cardInfo, payData }, callback) => {
199
238
  return false;
200
239
  }
201
240
  };
202
- var checkEnrollment = async (orderId, cardInfo, callback) => {
241
+ var preCheckEnrollment = async (orderId, cardInfo) => {
242
+ try {
243
+ const { data } = await import_utils.request.getRequest().post("/h5/pay/order/mw-3ds-pay/v2/" + orderId, {
244
+ ...cardInfo
245
+ });
246
+ (0, import_payGroup.setPayNumber)(orderId, data == null ? void 0 : data.pay_number);
247
+ if (!(data == null ? void 0 : data.pay_info)) {
248
+ throw new Error("Card does not support 3DS verification");
249
+ }
250
+ return data;
251
+ } catch (err) {
252
+ log({
253
+ msg: err,
254
+ data: {
255
+ orderId,
256
+ cardInfo
257
+ }
258
+ });
259
+ throw err;
260
+ }
261
+ };
262
+ var checkEnrollment = async (orderId, cardInfo, options) => {
263
+ const { callback, isCancelled } = options || {};
203
264
  try {
204
265
  let { data } = await import_utils.request.getRequest().post("/h5/pay/order/mw-3ds-pay/v2/" + orderId, {
205
266
  ...cardInfo
206
267
  });
268
+ if (isCancelled == null ? void 0 : isCancelled()) return 0;
207
269
  (0, import_payGroup.setPayNumber)(orderId, data == null ? void 0 : data.pay_number);
208
270
  if (!(data == null ? void 0 : data.pay_info)) {
209
271
  return null;
@@ -217,7 +279,8 @@ var checkEnrollment = async (orderId, cardInfo, callback) => {
217
279
  cardInfo
218
280
  }
219
281
  });
220
- callback({ key: "hideModal" });
282
+ if (isCancelled == null ? void 0 : isCancelled()) return 0;
283
+ callback == null ? void 0 : callback({ key: "hideModal" });
221
284
  closeIframe();
222
285
  (0, import_materials.PisellToast)({
223
286
  content: (err == null ? void 0 : err.message) || "",
@@ -291,9 +354,15 @@ var createThreeDSMethodIframe = async (threeDSMethodData, callback) => {
291
354
  });
292
355
  }, ((_a2 = threeDSMethodData == null ? void 0 : threeDSMethodData.pay_info) == null ? void 0 : _a2.tdsMethodTimeoutMS) || 1e4);
293
356
  window.addEventListener("message", handleMessage, false);
357
+ activeCleanup = () => {
358
+ window.removeEventListener("message", handleMessage);
359
+ if (timer) clearTimeout(timer);
360
+ rej(0);
361
+ };
294
362
  });
295
363
  };
296
- var checkTDSAuth = async (step2, step3, callback) => {
364
+ var checkTDSAuth = async (step2, step3, options) => {
365
+ const { callback, isCancelled } = options || {};
297
366
  try {
298
367
  const { pay_number, order_id, pay_info, amount, notifyURL } = step2;
299
368
  const { threeDSServerTransID, threeDSCompInd } = step3;
@@ -302,15 +371,18 @@ var checkTDSAuth = async (step2, step3, callback) => {
302
371
  if (REACT_APP_API_ENV === "pre" && pay_info.check_tds_auth.card_name === "aa bb") {
303
372
  isPre = true;
304
373
  }
374
+ const request_unique_idempotency_token = (0, import_utils3.getUniqueIdempotencyToken)();
305
375
  setHistoryLog({
306
376
  msg: "步骤4开始: 调用tds_auth_pay接口",
307
377
  time: getCurrentTime(),
308
378
  order_id,
309
- pay_number
379
+ pay_number,
380
+ request_unique_idempotency_token
310
381
  });
311
382
  let { data } = await import_utils.request.getRequest().post("/h5/pay/order/mw-3ds-pay/v2/tds_auth_pay", {
312
383
  order_id,
313
384
  pay_number,
385
+ request_unique_idempotency_token,
314
386
  mw_data: {
315
387
  accessToken: pay_info.check_tds_auth.access_token,
316
388
  method: "checkTDSAuth",
@@ -357,20 +429,23 @@ var checkTDSAuth = async (step2, step3, callback) => {
357
429
  } catch (err) {
358
430
  setHistoryLog({
359
431
  msg: "步骤4异常",
360
- time: getCurrentTime()
432
+ time: getCurrentTime(),
433
+ errorCode: err == null ? void 0 : err.code
361
434
  });
362
435
  log({
363
436
  msg: err,
364
437
  data: paymentData
365
438
  });
439
+ if (isCancelled == null ? void 0 : isCancelled()) return 0;
440
+ if ((err == null ? void 0 : err.code) === 700500) {
441
+ throw err;
442
+ }
366
443
  (0, import_materials.PisellToast)({
367
444
  content: (err == null ? void 0 : err.message) || "",
368
- duration: 1e3 * 200,
369
- onClose() {
370
- callback({ key: "hideModal" });
371
- closeIframe();
372
- }
445
+ duration: 1e3 * 2
373
446
  });
447
+ callback == null ? void 0 : callback({ key: "hideModal" });
448
+ closeIframe();
374
449
  return 0;
375
450
  }
376
451
  };
@@ -406,6 +481,7 @@ var createChallengeIframe = (challengeData, callback) => {
406
481
  if (timer) {
407
482
  clearTimeout(timer);
408
483
  }
484
+ window.removeEventListener("message", handleMessage);
409
485
  res(event.data.cres);
410
486
  closeIframe();
411
487
  }
@@ -424,6 +500,11 @@ var createChallengeIframe = (challengeData, callback) => {
424
500
  handleMessage,
425
501
  false
426
502
  );
503
+ activeCleanup = () => {
504
+ window.removeEventListener("message", handleMessage);
505
+ if (timer) clearTimeout(timer);
506
+ rej(0);
507
+ };
427
508
  });
428
509
  };
429
510
  var checkPARes = async (step2, step4, step5) => {
@@ -464,11 +545,13 @@ var closeIframe = () => {
464
545
  };
465
546
  // Annotate the CommonJS export names for ESM import in node:
466
547
  0 && (module.exports = {
548
+ cancelCurrentPayment,
467
549
  checkEnrollment,
468
550
  checkPARes,
469
551
  checkTDSAuth,
470
552
  createChallengeIframe,
471
553
  createThreeDSMethodIframe,
472
554
  paymentEnd,
555
+ preCheckEnrollment,
473
556
  startPayment
474
557
  });
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  declare const StripePayment: () => import("react").JSX.Element;
2
3
  export default StripePayment;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  declare const StripeSDK: ({ public_key, client_secret, children, lang, }: {
2
3
  public_key: string;
3
4
  client_secret?: string | undefined;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  declare const PageLoading: () => import("react").JSX.Element;
2
3
  export default PageLoading;
@@ -65,7 +65,7 @@ var isOfflinePayment = (type) => {
65
65
  ].includes(type);
66
66
  };
67
67
  var PaymentMethods = (props, ref) => {
68
- var _a;
68
+ var _a, _b, _c, _d, _e, _f, _g;
69
69
  const MWCreditCardRef2 = (0, import_react.useRef)(null);
70
70
  const SuperPayAliPayH5Ref2 = (0, import_react.useRef)(null);
71
71
  const StripePayRef2 = (0, import_react.useRef)(null);
@@ -82,10 +82,15 @@ var PaymentMethods = (props, ref) => {
82
82
  const GlobePayQrcodeRef2 = (0, import_react.useRef)(null);
83
83
  const context = (0, import_useEngineContext.default)();
84
84
  const { interaction } = (_a = context.appHelper) == null ? void 0 : _a.utils;
85
+ const dvaStore = (_e = (_d = (_c = (_b = context.appHelper) == null ? void 0 : _b.utils) == null ? void 0 : _c.getStore) == null ? void 0 : _d.call(_c)) == null ? void 0 : _e.getState();
86
+ const shop = ((_g = (_f = dvaStore == null ? void 0 : dvaStore.core) == null ? void 0 : _f.core) == null ? void 0 : _g.shop) || {};
87
+ const shopName = (shop == null ? void 0 : shop.name) || "";
88
+ const shopPhone = (shop == null ? void 0 : shop.phone) || "";
89
+ const shopEmail = (shop == null ? void 0 : shop.contact_email) || "";
85
90
  const init = async ({ type, payGroup }) => {
86
- var _a2, _b;
91
+ var _a2, _b2;
87
92
  const waitAmount = (payGroup == null ? void 0 : payGroup.wait_amount) || 0;
88
- const cards = (_b = (_a2 = payGroup == null ? void 0 : payGroup.walletPass) == null ? void 0 : _a2.cards) == null ? void 0 : _b.length;
93
+ const cards = (_b2 = (_a2 = payGroup == null ? void 0 : payGroup.walletPass) == null ? void 0 : _a2.cards) == null ? void 0 : _b2.length;
89
94
  (0, import_utils2.sendWarningLog)({
90
95
  title: "支付初始化",
91
96
  content: [
@@ -144,9 +149,9 @@ var PaymentMethods = (props, ref) => {
144
149
  await onPayByType({ type, payGroup });
145
150
  };
146
151
  (0, import_react.useEffect)(() => {
147
- var _a2, _b, _c, _d;
148
- console.log("paymentResult isAppEnv", (_b = (_a2 = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _a2.isAppEnv) == null ? void 0 : _b.call(_a2));
149
- if ((_d = (_c = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _c.isAppEnv) == null ? void 0 : _d.call(_c)) {
152
+ var _a2, _b2, _c2, _d2;
153
+ console.log("paymentResult isAppEnv", (_b2 = (_a2 = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _a2.isAppEnv) == null ? void 0 : _b2.call(_a2));
154
+ if ((_d2 = (_c2 = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _c2.isAppEnv) == null ? void 0 : _d2.call(_c2)) {
150
155
  interaction.utils.mountFunction("global", "paymentResult", (strResult) => {
151
156
  console.log("paymentResult", strResult);
152
157
  if (!(0, import_utils2.isJson)(strResult)) return;
@@ -162,34 +167,34 @@ var PaymentMethods = (props, ref) => {
162
167
  }
163
168
  }, []);
164
169
  const onPayByType = async ({ type, payGroup }) => {
165
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
170
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h, _i, _j, _k, _l, _m, _n;
166
171
  console.log(type, payGroup);
167
172
  if (type === "mw.apple") {
168
173
  await ((_a2 = ApplePayRef2.current) == null ? void 0 : _a2.init({ payGroup }));
169
174
  return;
170
175
  }
171
176
  if (type === "mw.google") {
172
- await ((_b = GooglePayRef2.current) == null ? void 0 : _b.init({ payGroup }));
177
+ await ((_b2 = GooglePayRef2.current) == null ? void 0 : _b2.init({ payGroup }));
173
178
  return;
174
179
  }
175
180
  if (type === "mw.credit_card") {
176
- (_c = MWCreditCardRef2.current) == null ? void 0 : _c.init({ payGroup });
181
+ (_c2 = MWCreditCardRef2.current) == null ? void 0 : _c2.init({ payGroup });
177
182
  return;
178
183
  }
179
184
  if (type === "superpay.alipay.h5") {
180
- await ((_d = SuperPayAliPayH5Ref2.current) == null ? void 0 : _d.init({ payGroup }));
185
+ await ((_d2 = SuperPayAliPayH5Ref2.current) == null ? void 0 : _d2.init({ payGroup }));
181
186
  return;
182
187
  }
183
188
  if (type === "superpay.wechat.h5") {
184
- await ((_e = SuperPayWxPayH5Ref2.current) == null ? void 0 : _e.init({ payGroup }));
189
+ await ((_e2 = SuperPayWxPayH5Ref2.current) == null ? void 0 : _e2.init({ payGroup }));
185
190
  return;
186
191
  }
187
192
  if (type === "stripe") {
188
- (_f = StripePayRef2.current) == null ? void 0 : _f.init({ payGroup });
193
+ (_f2 = StripePayRef2.current) == null ? void 0 : _f2.init({ payGroup });
189
194
  return;
190
195
  }
191
196
  if (type === "pisell.offline_payment") {
192
- await ((_g = OfflinePaymentRef2.current) == null ? void 0 : _g.init({ payGroup }));
197
+ await ((_g2 = OfflinePaymentRef2.current) == null ? void 0 : _g2.init({ payGroup }));
193
198
  return;
194
199
  }
195
200
  if (type === "pisell.bank_deposit") {
@@ -227,6 +232,6 @@ var PaymentMethods = (props, ref) => {
227
232
  onPay: init
228
233
  })
229
234
  );
230
- return /* @__PURE__ */ import_react.default.createElement("div", { className: "" }, /* @__PURE__ */ import_react.default.createElement(import_MWCreditCard.default, { ref: MWCreditCardRef2 }), /* @__PURE__ */ import_react.default.createElement(import_SuperPayAliPayH5.default, { ref: SuperPayAliPayH5Ref2 }), /* @__PURE__ */ import_react.default.createElement(import_StripePay.default, { ref: StripePayRef2 }), /* @__PURE__ */ import_react.default.createElement(import_OfflinePayment.default, { ref: OfflinePaymentRef2 }), /* @__PURE__ */ import_react.default.createElement(import_BankDeposit.default, { ref: BankDepositRef2 }), /* @__PURE__ */ import_react.default.createElement(import_SuperPayWxPayH5.default, { ref: SuperPayWxPayH5Ref2 }), /* @__PURE__ */ import_react.default.createElement(import_CustomPayment.default, { ref: CustomPaymentRef2 }), /* @__PURE__ */ import_react.default.createElement(import_ApplePay.default, { ref: ApplePayRef2 }), /* @__PURE__ */ import_react.default.createElement(import_GooglePay.default, { ref: GooglePayRef2 }), /* @__PURE__ */ import_react.default.createElement(import_CashManual.default, { ref: CashManualRef2 }), /* @__PURE__ */ import_react.default.createElement(import_GlobePayAliPayH5.default, { ref: GlobePayAliPayH5Ref2 }), /* @__PURE__ */ import_react.default.createElement(import_GlobePayWxH5.default, { ref: GlobePayWxH5Ref2 }), /* @__PURE__ */ import_react.default.createElement(import_GlobePayPaypalH5.default, { ref: GlobePayPaypalH5Ref2 }), /* @__PURE__ */ import_react.default.createElement(import_GlobePayQrcode.default, { ref: GlobePayQrcodeRef2 }));
235
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "" }, /* @__PURE__ */ import_react.default.createElement(import_MWCreditCard.default, { ref: MWCreditCardRef2, shopName, shopPhone, shopEmail }), /* @__PURE__ */ import_react.default.createElement(import_SuperPayAliPayH5.default, { ref: SuperPayAliPayH5Ref2 }), /* @__PURE__ */ import_react.default.createElement(import_StripePay.default, { ref: StripePayRef2 }), /* @__PURE__ */ import_react.default.createElement(import_OfflinePayment.default, { ref: OfflinePaymentRef2 }), /* @__PURE__ */ import_react.default.createElement(import_BankDeposit.default, { ref: BankDepositRef2 }), /* @__PURE__ */ import_react.default.createElement(import_SuperPayWxPayH5.default, { ref: SuperPayWxPayH5Ref2 }), /* @__PURE__ */ import_react.default.createElement(import_CustomPayment.default, { ref: CustomPaymentRef2 }), /* @__PURE__ */ import_react.default.createElement(import_ApplePay.default, { ref: ApplePayRef2 }), /* @__PURE__ */ import_react.default.createElement(import_GooglePay.default, { ref: GooglePayRef2 }), /* @__PURE__ */ import_react.default.createElement(import_CashManual.default, { ref: CashManualRef2 }), /* @__PURE__ */ import_react.default.createElement(import_GlobePayAliPayH5.default, { ref: GlobePayAliPayH5Ref2 }), /* @__PURE__ */ import_react.default.createElement(import_GlobePayWxH5.default, { ref: GlobePayWxH5Ref2 }), /* @__PURE__ */ import_react.default.createElement(import_GlobePayPaypalH5.default, { ref: GlobePayPaypalH5Ref2 }), /* @__PURE__ */ import_react.default.createElement(import_GlobePayQrcode.default, { ref: GlobePayQrcodeRef2 }));
231
236
  };
232
237
  var PaymentMethods_default = (0, import_react.forwardRef)(PaymentMethods);
@@ -69,6 +69,7 @@ var ToCPay = (props, ref) => {
69
69
  });
70
70
  const [showInformation, setShowInformation] = (0, import_react.useState)(false);
71
71
  const [showDetectIncognitoConfirm, setShowDetectIncognitoConfirm] = (0, import_react.useState)(false);
72
+ const [showPendingPayment, setShowPendingPayment] = (0, import_react.useState)(false);
72
73
  const utils = context.appHelper.utils || {};
73
74
  const dvaStore = (_d = (_c = (_b = context.appHelper.utils) == null ? void 0 : _b.getStore) == null ? void 0 : _c.call(_b)) == null ? void 0 : _d.getState();
74
75
  const customer_id = (_j = (_i = (_h = (_g = (_f = (_e = context.appHelper.utils) == null ? void 0 : _e.getStore()) == null ? void 0 : _f.getState) == null ? void 0 : _g.call(_f)) == null ? void 0 : _h.global) == null ? void 0 : _i.userInfo) == null ? void 0 : _j.id;
@@ -83,7 +84,7 @@ var ToCPay = (props, ref) => {
83
84
  ...initProps,
84
85
  status: "init",
85
86
  // 将支付回调储存在store, 方便其他模块调用
86
- payCallback: props.callback,
87
+ payCallback,
87
88
  history: (_a2 = context.appHelper.utils) == null ? void 0 : _a2.history,
88
89
  front_order_uuid: (0, import_utils.getUniqueId)("front_order_uuid_")
89
90
  // 支付组
@@ -120,7 +121,7 @@ var ToCPay = (props, ref) => {
120
121
  });
121
122
  };
122
123
  const init = async (initProps) => {
123
- var _a2;
124
+ var _a2, _b2, _c2;
124
125
  const { renderType: renderType2 } = initProps;
125
126
  paymentLogger.addLog({
126
127
  key: "初始化开始",
@@ -131,6 +132,18 @@ var ToCPay = (props, ref) => {
131
132
  setOpen(true);
132
133
  setSubmitLoading(false);
133
134
  setLoading(true);
135
+ const { has_pending } = await (0, import_serve.checkPendingPayment)({
136
+ order_id: (_a2 = initProps.order) == null ? void 0 : _a2.order_id
137
+ });
138
+ if (has_pending) {
139
+ paymentLogger.addLog({
140
+ key: "检测到处理中的交易",
141
+ value: `订单${(_b2 = initProps.order) == null ? void 0 : _b2.order_id} 存在处理中的交易,中断支付流程`
142
+ });
143
+ setLoading(false);
144
+ setShowPendingPayment(true);
145
+ return;
146
+ }
134
147
  _initStore(initProps);
135
148
  (0, import_payGroup.removePayGroupFromStorage)(initProps.order.order_id);
136
149
  await _getPaymentsAndWalletPass(initProps.order);
@@ -143,13 +156,15 @@ var ToCPay = (props, ref) => {
143
156
  paymentLogger.addLog({
144
157
  key: "初始化错误",
145
158
  value: {
146
- title: `订单${(_a2 = initProps == null ? void 0 : initProps.order) == null ? void 0 : _a2.order_id} 初始化失败: ${(error == null ? void 0 : error.message) || "未知错误"}`,
159
+ title: `订单${(_c2 = initProps == null ? void 0 : initProps.order) == null ? void 0 : _c2.order_id} 初始化失败: ${(error == null ? void 0 : error.message) || "未知错误"}`,
147
160
  data: {
148
161
  order: initProps == null ? void 0 : initProps.order
149
162
  }
150
163
  }
151
164
  });
152
165
  paymentLogger.sendLogs("支付初始化失败", error);
166
+ setOpen(false);
167
+ setLoading(false);
153
168
  throw error;
154
169
  }
155
170
  };
@@ -555,6 +570,22 @@ var ToCPay = (props, ref) => {
555
570
  }
556
571
  }
557
572
  ),
573
+ /* @__PURE__ */ import_react.default.createElement(
574
+ import_materials.PisellModal.Information,
575
+ {
576
+ open: showPendingPayment,
577
+ describe: import_utils.locales.getText("tocPay.text.pendingPaymentDesc"),
578
+ okText: import_utils.locales.getText("tocPay.text.pendingPaymentOk"),
579
+ cancelVisible: false,
580
+ closable: false,
581
+ maskClosable: false,
582
+ onOk: () => {
583
+ paymentLogger.sendLogs("此订单有一笔支付正在处理中");
584
+ setShowPendingPayment(false);
585
+ setOpen(false);
586
+ }
587
+ }
588
+ ),
558
589
  /* @__PURE__ */ import_react.default.createElement(
559
590
  import_materials.PisellModal.Information,
560
591
  {