@pisell/private-materials 6.3.109 → 6.3.111

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 (85) 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 +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/forms/sendModal/useSendModal.d.ts +1 -0
  12. package/es/components/eftposPay/hooks.d.ts +1 -1
  13. package/es/components/eftposPay/store/index.d.ts +3 -3
  14. package/es/components/eventBooking/components/ErrorTip/index.d.ts +1 -0
  15. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +1 -0
  16. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +1 -0
  17. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +1 -0
  18. package/es/components/pay/toC/PaymentMethods/MWCreditCard/Add/index.d.ts +6 -0
  19. package/es/components/pay/toC/PaymentMethods/MWCreditCard/Add/index.js +65 -21
  20. package/es/components/pay/toC/PaymentMethods/MWCreditCard/Add/index.less +110 -9
  21. package/es/components/pay/toC/PaymentMethods/MWCreditCard/List/index.d.ts +2 -0
  22. package/es/components/pay/toC/PaymentMethods/MWCreditCard/List/index.js +28 -16
  23. package/es/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.d.ts +20 -1
  24. package/es/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.js +14 -1
  25. package/es/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.less +20 -0
  26. package/es/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/index.d.ts +7 -1
  27. package/es/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/index.js +167 -56
  28. package/es/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/index.less +47 -0
  29. package/es/components/pay/toC/PaymentMethods/MWCreditCard/components/TDSErrorModal/index.d.ts +34 -0
  30. package/es/components/pay/toC/PaymentMethods/MWCreditCard/components/TDSErrorModal/index.js +83 -0
  31. package/es/components/pay/toC/PaymentMethods/MWCreditCard/components/TDSErrorModal/index.less +52 -0
  32. package/es/components/pay/toC/PaymentMethods/MWCreditCard/index.d.ts +9 -1
  33. package/es/components/pay/toC/PaymentMethods/MWCreditCard/index.js +260 -33
  34. package/es/components/pay/toC/PaymentMethods/MWCreditCard/tds2.d.ts +23 -3
  35. package/es/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +292 -115
  36. package/es/components/pay/toC/PaymentMethods/index.js +12 -2
  37. package/es/components/pay/toC/index.js +53 -18
  38. package/es/components/pay/toC/locales.d.ts +115 -0
  39. package/es/components/pay/toC/locales.js +143 -18
  40. package/es/components/pay/toC/serve.d.ts +10 -0
  41. package/es/components/pay/toC/serve.js +40 -1
  42. package/es/components/pay/toC/utils.d.ts +5 -0
  43. package/es/components/pay/toC/utils.js +10 -0
  44. package/es/plus/pisellSalesManagement/config/booking.d.ts +6 -6
  45. package/es/plus/selectHolder/components/ErrorTip/index.d.ts +1 -0
  46. package/es/plus/walletEditor/components/ImageUpload/index.d.ts +1 -1
  47. package/es/pro/Selector/Selector.d.ts +1 -1
  48. package/lib/components/booking/forms/sendModal/useSendModal.d.ts +1 -0
  49. package/lib/components/eftposPay/hooks.d.ts +1 -1
  50. package/lib/components/eftposPay/store/index.d.ts +3 -3
  51. package/lib/components/eventBooking/components/ErrorTip/index.d.ts +1 -0
  52. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +1 -0
  53. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +1 -0
  54. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +1 -0
  55. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/Add/index.d.ts +6 -0
  56. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/Add/index.js +40 -17
  57. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/Add/index.less +110 -9
  58. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/List/index.d.ts +2 -0
  59. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/List/index.js +17 -5
  60. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.d.ts +20 -1
  61. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.js +8 -2
  62. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.less +20 -0
  63. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/index.d.ts +7 -1
  64. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/index.js +98 -24
  65. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/index.less +47 -0
  66. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/components/TDSErrorModal/index.d.ts +34 -0
  67. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/components/TDSErrorModal/index.js +107 -0
  68. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/components/TDSErrorModal/index.less +52 -0
  69. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/index.d.ts +9 -1
  70. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/index.js +149 -5
  71. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/tds2.d.ts +23 -3
  72. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +99 -16
  73. package/lib/components/pay/toC/PaymentMethods/index.js +17 -12
  74. package/lib/components/pay/toC/index.js +34 -3
  75. package/lib/components/pay/toC/locales.d.ts +115 -0
  76. package/lib/components/pay/toC/locales.js +133 -18
  77. package/lib/components/pay/toC/serve.d.ts +10 -0
  78. package/lib/components/pay/toC/serve.js +10 -0
  79. package/lib/components/pay/toC/utils.d.ts +5 -0
  80. package/lib/components/pay/toC/utils.js +17 -0
  81. package/lib/plus/pisellSalesManagement/config/booking.d.ts +6 -6
  82. package/lib/plus/selectHolder/components/ErrorTip/index.d.ts +1 -0
  83. package/lib/plus/walletEditor/components/ImageUpload/index.d.ts +1 -1
  84. package/lib/pro/Selector/Selector.d.ts +1 -1
  85. package/package.json +4 -4
@@ -11,17 +11,24 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
11
  import React, { useState, useEffect, useContext, useRef, useImperativeHandle, forwardRef } from 'react';
12
12
  import MWCreditCardList from "./List";
13
13
  import AddMWCreditCard from "./Add";
14
+ import { fastPayNew } from "./List/serve";
14
15
  import TDSPay from "./TDSPay";
15
16
  import { Context } from "../../model";
17
+ import { preCheckEnrollment } from "./tds2";
18
+ import { getPayGroupParamsFromStorage, setPayNumber } from "../../payGroup";
19
+ import { locales } from '@pisell/utils';
20
+ import { PisellToast } from '@pisell/materials';
21
+ import TDSErrorModal from "./components/TDSErrorModal";
16
22
  import "./index.less";
23
+ import useEngineContext from "../../../../../hooks/useEngineContext";
17
24
  /**
18
25
  * @title: 信用卡支付
19
- * @description:
20
- * @param {any} props
26
+ * @description: 整合信用卡列表、添加卡、3DS 验证,
27
+ * onChange/onAdd 时前置执行 3DS 预检查,
28
+ * 失败时弹出 TDSErrorModal 阻断支付。
29
+ * @param {MWCreditCardProps} props
21
30
  * @param {any} ref
22
31
  * @return {*}
23
- * @Author: zhiwei.Wang
24
- * @Date: 2024-08-16 11:02
25
32
  */
26
33
  var MWCreditCard = function MWCreditCard(props, ref) {
27
34
  // 信用卡列表
@@ -30,21 +37,35 @@ var MWCreditCard = function MWCreditCard(props, ref) {
30
37
  var AddMWCreditCardRef = useRef();
31
38
  // 3ds验证
32
39
  var TDSPayRef = useRef();
40
+ var context = useEngineContext();
41
+ var utils = context.appHelper.utils || {};
42
+
33
43
  // 订单信息
34
44
  var _useState = useState(null),
35
45
  _useState2 = _slicedToArray(_useState, 2),
36
46
  order = _useState2[0],
37
47
  setOrder = _useState2[1];
48
+ // 3DS 错误弹窗可见性(预检查:卡不支持 3DS)
49
+ var _useState3 = useState(false),
50
+ _useState4 = _slicedToArray(_useState3, 2),
51
+ tdsErrorVisible = _useState4[0],
52
+ setTdsErrorVisible = _useState4[1];
53
+ // 银行验证失败弹窗可见性(700500:银行安全验证未通过)
54
+ var _useState5 = useState(false),
55
+ _useState6 = _slicedToArray(_useState5, 2),
56
+ bankVerifyFailVisible = _useState6[0],
57
+ setBankVerifyFailVisible = _useState6[1];
58
+ // 预检查 loading
59
+ var _useState7 = useState(false),
60
+ _useState8 = _slicedToArray(_useState7, 2),
61
+ loading = _useState8[0],
62
+ setLoading = _useState8[1];
38
63
  var _useContext = useContext(Context),
39
64
  state = _useContext.state;
40
65
 
41
66
  /**
42
67
  * @title: 初始化
43
- * @description:
44
- * @param {any} res
45
- * @return {*}
46
- * @Author: zhiwei.Wang
47
- * @Date: 2024-08-16 11:02
68
+ * @description: 展示信用卡列表
48
69
  */
49
70
  var init = /*#__PURE__*/function () {
50
71
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(res) {
@@ -67,25 +88,101 @@ var MWCreditCard = function MWCreditCard(props, ref) {
67
88
  }();
68
89
 
69
90
  /**
70
- * @title: 3ds验证
71
- * @description:
72
- * @param {any} card
73
- * @return {*}
74
- * @Author: zhiwei.Wang
75
- * @Date: 2024-08-16 11:02
91
+ * @title: 关闭所有弹窗
92
+ * @description: 关闭 List + Add 弹窗(供"使用其他支付方式"按钮调用)
93
+ */
94
+ var closeAll = function closeAll() {
95
+ var _MWCreditCardListRef$2, _AddMWCreditCardRef$c;
96
+ (_MWCreditCardListRef$2 = MWCreditCardListRef.current) === null || _MWCreditCardListRef$2 === void 0 || _MWCreditCardListRef$2.close();
97
+ (_AddMWCreditCardRef$c = AddMWCreditCardRef.current) === null || _AddMWCreditCardRef$c === void 0 || _AddMWCreditCardRef$c.close();
98
+ };
99
+
100
+ /**
101
+ * @title: 已保存卡的 3DS 验证(含预检查)
102
+ * @description: 选择已保存卡时,先调用 fastPayNew API,
103
+ * 若返回 type=3ds 则执行 preCheckEnrollment 前置检查,
104
+ * 失败时弹出 TDSErrorModal;成功时传入 TDSPay.init。
105
+ * @param {any} card 已保存的卡信息
76
106
  */
77
107
  var fastPay = /*#__PURE__*/function () {
78
108
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(card) {
79
- var _TDSPayRef$current;
109
+ var _utils$Toast, _utils$Toast$loading, _state$payGroup, _state$payGroup2, _state$payGroup3, params, _state$payCallback, _yield$fastPayNew, data, _TDSPayRef$current, _TDSPayRef$current2, _utils$Toast2, _utils$Toast2$hide;
80
110
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
81
111
  while (1) switch (_context2.prev = _context2.next) {
82
112
  case 0:
83
- (_TDSPayRef$current = TDSPayRef.current) === null || _TDSPayRef$current === void 0 || _TDSPayRef$current.init(card, order);
84
- case 1:
113
+ _context2.prev = 0;
114
+ setLoading(true);
115
+ utils === null || utils === void 0 || (_utils$Toast = utils.Toast) === null || _utils$Toast === void 0 || (_utils$Toast$loading = _utils$Toast.loading) === null || _utils$Toast$loading === void 0 || _utils$Toast$loading.call(_utils$Toast, locales.getText('tocPay.text.checkingCard'), 0, undefined, true);
116
+
117
+ // 获取交易组
118
+ params = getPayGroupParamsFromStorage((_state$payGroup = state.payGroup) === null || _state$payGroup === void 0 ? void 0 : _state$payGroup.order_id, {
119
+ card_id: card.id
120
+ });
121
+ if (params) {
122
+ _context2.next = 7;
123
+ break;
124
+ }
125
+ (_state$payCallback = state.payCallback) === null || _state$payCallback === void 0 || _state$payCallback.call(state, {
126
+ key: 'fail',
127
+ data: {
128
+ res: card,
129
+ fn: 'MWCreditCard.fastPay.noParams',
130
+ message: locales.getText('tocPay.text.getParamsFail')
131
+ }
132
+ });
133
+ return _context2.abrupt("return");
134
+ case 7:
135
+ _context2.next = 9;
136
+ return fastPayNew({
137
+ order_id: (_state$payGroup2 = state.payGroup) === null || _state$payGroup2 === void 0 ? void 0 : _state$payGroup2.order_id,
138
+ params: params
139
+ });
140
+ case 9:
141
+ _yield$fastPayNew = _context2.sent;
142
+ data = _yield$fastPayNew.data;
143
+ // 设置交易号
144
+ setPayNumber((_state$payGroup3 = state.payGroup) === null || _state$payGroup3 === void 0 ? void 0 : _state$payGroup3.order_id, data === null || data === void 0 ? void 0 : data.pay_number);
145
+
146
+ // token 类型直接走 TDSPay(不需要 3DS 验证)
147
+ if (!((data === null || data === void 0 ? void 0 : data.type) === 'token')) {
148
+ _context2.next = 15;
149
+ break;
150
+ }
151
+ (_TDSPayRef$current = TDSPayRef.current) === null || _TDSPayRef$current === void 0 || _TDSPayRef$current.init(card, order, data);
152
+ return _context2.abrupt("return");
153
+ case 15:
154
+ if (!((data === null || data === void 0 ? void 0 : data.type) === '3ds')) {
155
+ _context2.next = 18;
156
+ break;
157
+ }
158
+ // 数据已经包含 pay_info,说明 fastPayNew 返回的就是 checkEnrollment 的结果
159
+ // 直接传给 TDSPay(跳过内部 checkEnrollment)
160
+ (_TDSPayRef$current2 = TDSPayRef.current) === null || _TDSPayRef$current2 === void 0 || _TDSPayRef$current2.init(card, order, data);
161
+ return _context2.abrupt("return");
162
+ case 18:
163
+ _context2.next = 23;
164
+ break;
165
+ case 20:
166
+ _context2.prev = 20;
167
+ _context2.t0 = _context2["catch"](0);
168
+ if ((_context2.t0 === null || _context2.t0 === void 0 ? void 0 : _context2.t0.code) === 700500) {
169
+ setTdsErrorVisible(true);
170
+ } else {
171
+ PisellToast({
172
+ content: (_context2.t0 === null || _context2.t0 === void 0 ? void 0 : _context2.t0.message) || '',
173
+ duration: 2
174
+ });
175
+ }
176
+ case 23:
177
+ _context2.prev = 23;
178
+ setLoading(false);
179
+ utils === null || utils === void 0 || (_utils$Toast2 = utils.Toast) === null || _utils$Toast2 === void 0 || (_utils$Toast2$hide = _utils$Toast2.hide) === null || _utils$Toast2$hide === void 0 || _utils$Toast2$hide.call(_utils$Toast2);
180
+ return _context2.finish(23);
181
+ case 27:
85
182
  case "end":
86
183
  return _context2.stop();
87
184
  }
88
- }, _callee2);
185
+ }, _callee2, null, [[0, 20, 23, 27]]);
89
186
  }));
90
187
  return function fastPay(_x2) {
91
188
  return _ref2.apply(this, arguments);
@@ -93,16 +190,126 @@ var MWCreditCard = function MWCreditCard(props, ref) {
93
190
  }();
94
191
 
95
192
  /**
96
- * @title: 添加卡并3ds验证
97
- * @description:
98
- * @param {any} res
99
- * @return {*}
100
- * @Author: zhiwei.Wang
101
- * @Date: 2024-08-16 11:02
193
+ * @title: 新卡支付(含 3DS 预检查)
194
+ * @description: 添加新卡时,先构建 cardInfo 并执行 preCheckEnrollment,
195
+ * 失败时弹出 TDSErrorModal;成功时传入 TDSPay.init。
196
+ * @param {any} res 新卡表单数据
197
+ */
198
+ var onCreate = /*#__PURE__*/function () {
199
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(res) {
200
+ var _utils$Toast3, _utils$Toast3$loading, _state$payGroup4, _state$payGroup5, _TDSPayRef$current3, _cardInfo, _state$payCallback2, preCheckData, _utils$Toast4, _utils$Toast4$hide;
201
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
202
+ while (1) switch (_context3.prev = _context3.next) {
203
+ case 0:
204
+ _context3.prev = 0;
205
+ setLoading(true);
206
+ utils === null || utils === void 0 || (_utils$Toast3 = utils.Toast) === null || _utils$Toast3 === void 0 || (_utils$Toast3$loading = _utils$Toast3.loading) === null || _utils$Toast3$loading === void 0 || _utils$Toast3$loading.call(_utils$Toast3, locales.getText('tocPay.text.checkingCard'), 0, undefined, true);
207
+
208
+ // 构建卡信息
209
+ _cardInfo = {
210
+ card_name: res.card_name,
211
+ card_number: res.card_number,
212
+ card_expiry_month: res.date.format('MM'),
213
+ card_expiry_year: res.date.format('YY'),
214
+ card_ccv: res.card_ccv,
215
+ is_save: res.is_save ? 1 : 0
216
+ }; // 补全交易组信息
217
+ _cardInfo = getPayGroupParamsFromStorage((_state$payGroup4 = state.payGroup) === null || _state$payGroup4 === void 0 ? void 0 : _state$payGroup4.order_id, _cardInfo);
218
+ if (_cardInfo) {
219
+ _context3.next = 8;
220
+ break;
221
+ }
222
+ (_state$payCallback2 = state.payCallback) === null || _state$payCallback2 === void 0 || _state$payCallback2.call(state, {
223
+ key: 'fail',
224
+ data: {
225
+ _cardInfo: _cardInfo,
226
+ message: locales.getText('tocPay.text.getParamsFail'),
227
+ fn: 'MWCreditCard.onCreate.noCardInfo'
228
+ }
229
+ });
230
+ return _context3.abrupt("return");
231
+ case 8:
232
+ _context3.next = 10;
233
+ return preCheckEnrollment((_state$payGroup5 = state.payGroup) === null || _state$payGroup5 === void 0 ? void 0 : _state$payGroup5.order_id, _cardInfo);
234
+ case 10:
235
+ preCheckData = _context3.sent;
236
+ // 预检查通过,传入 TDSPay(跳过内部 checkEnrollment)
237
+ (_TDSPayRef$current3 = TDSPayRef.current) === null || _TDSPayRef$current3 === void 0 || _TDSPayRef$current3.init(res, order, preCheckData);
238
+ _context3.next = 17;
239
+ break;
240
+ case 14:
241
+ _context3.prev = 14;
242
+ _context3.t0 = _context3["catch"](0);
243
+ if ((_context3.t0 === null || _context3.t0 === void 0 ? void 0 : _context3.t0.code) === 700500) {
244
+ setTdsErrorVisible(true);
245
+ } else {
246
+ PisellToast({
247
+ content: (_context3.t0 === null || _context3.t0 === void 0 ? void 0 : _context3.t0.message) || '',
248
+ duration: 2
249
+ });
250
+ }
251
+ case 17:
252
+ _context3.prev = 17;
253
+ setLoading(false);
254
+ utils === null || utils === void 0 || (_utils$Toast4 = utils.Toast) === null || _utils$Toast4 === void 0 || (_utils$Toast4$hide = _utils$Toast4.hide) === null || _utils$Toast4$hide === void 0 || _utils$Toast4$hide.call(_utils$Toast4);
255
+ return _context3.finish(17);
256
+ case 21:
257
+ case "end":
258
+ return _context3.stop();
259
+ }
260
+ }, _callee3, null, [[0, 14, 17, 21]]);
261
+ }));
262
+ return function onCreate(_x3) {
263
+ return _ref3.apply(this, arguments);
264
+ };
265
+ }();
266
+
267
+ /**
268
+ * @title: TDSPay 支付回调包装
269
+ * @description: 拦截 bankVerifyFailed 信号弹出银行验证失败弹窗,
270
+ * 其余 key 正常透传给全局 payCallback。
271
+ * @param {any} res TDSPay 回调结果
272
+ */
273
+ var handleTDSPayChange = function handleTDSPayChange(res) {
274
+ var _state$payCallback3;
275
+ if ((res === null || res === void 0 ? void 0 : res.key) === 'bankVerifyFailed') {
276
+ setBankVerifyFailVisible(true);
277
+ return;
278
+ }
279
+ (_state$payCallback3 = state.payCallback) === null || _state$payCallback3 === void 0 || _state$payCallback3.call(state, res);
280
+ };
281
+
282
+ /**
283
+ * @title: TDS 错误弹窗 - 更换卡片
284
+ * @description: 关闭错误弹窗,留在选择卡片页面
285
+ */
286
+ var handleUseAnotherCard = function handleUseAnotherCard() {
287
+ setTdsErrorVisible(false);
288
+ setBankVerifyFailVisible(false);
289
+ };
290
+
291
+ /**
292
+ * @title: TDS 错误弹窗 - 使用其他支付方式
293
+ * @description: 关闭所有弹窗,返回支付方式列表
294
+ */
295
+ var handleUseAnotherPayment = function handleUseAnotherPayment() {
296
+ setTdsErrorVisible(false);
297
+ setBankVerifyFailVisible(false);
298
+ closeAll();
299
+ };
300
+
301
+ /**
302
+ * @title: TDS 错误弹窗 - 稍后支付
303
+ * @description: 关闭弹窗,触发 payCallback cancel 跳转至订单详情页
102
304
  */
103
- var onCreate = function onCreate(res) {
104
- var _TDSPayRef$current2;
105
- (_TDSPayRef$current2 = TDSPayRef.current) === null || _TDSPayRef$current2 === void 0 || _TDSPayRef$current2.init(res, order);
305
+ var handlePayLater = function handlePayLater() {
306
+ var _state$payCallback4;
307
+ setTdsErrorVisible(false);
308
+ setBankVerifyFailVisible(false);
309
+ closeAll();
310
+ (_state$payCallback4 = state.payCallback) === null || _state$payCallback4 === void 0 || _state$payCallback4.call(state, {
311
+ key: 'cancel'
312
+ });
106
313
  };
107
314
  useImperativeHandle(ref, function () {
108
315
  return {
@@ -115,16 +322,36 @@ var MWCreditCard = function MWCreditCard(props, ref) {
115
322
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MWCreditCardList, {
116
323
  ref: MWCreditCardListRef,
117
324
  onAdd: function onAdd() {
118
- var _AddMWCreditCardRef$c;
119
- (_AddMWCreditCardRef$c = AddMWCreditCardRef.current) === null || _AddMWCreditCardRef$c === void 0 || _AddMWCreditCardRef$c.init();
325
+ var _AddMWCreditCardRef$c2;
326
+ (_AddMWCreditCardRef$c2 = AddMWCreditCardRef.current) === null || _AddMWCreditCardRef$c2 === void 0 || _AddMWCreditCardRef$c2.init();
120
327
  },
121
- onChange: fastPay
328
+ onChange: fastPay,
329
+ btnLoading: loading
122
330
  }), /*#__PURE__*/React.createElement(AddMWCreditCard, {
123
331
  ref: AddMWCreditCardRef,
124
- onCreate: onCreate
332
+ onCreate: onCreate,
333
+ shopName: props.shopName,
334
+ btnLoading: loading
125
335
  }), /*#__PURE__*/React.createElement(TDSPay, {
126
336
  ref: TDSPayRef,
127
- onChange: state.payCallback
337
+ onChange: handleTDSPayChange,
338
+ closeAll: closeAll
339
+ }), /*#__PURE__*/React.createElement(TDSErrorModal, {
340
+ open: tdsErrorVisible,
341
+ type: "tds-not-supported",
342
+ shopPhone: props.shopPhone,
343
+ shopEmail: props.shopEmail,
344
+ onUseAnotherCard: handleUseAnotherCard,
345
+ onUseAnotherPayment: handleUseAnotherPayment,
346
+ onPayLater: handlePayLater
347
+ }), /*#__PURE__*/React.createElement(TDSErrorModal, {
348
+ open: bankVerifyFailVisible,
349
+ type: "bank-verify-failed",
350
+ shopPhone: props.shopPhone,
351
+ shopEmail: props.shopEmail,
352
+ onUseAnotherCard: handleUseAnotherCard,
353
+ onUseAnotherPayment: handleUseAnotherPayment,
354
+ onPayLater: handlePayLater
128
355
  }));
129
356
  };
130
357
  export default /*#__PURE__*/forwardRef(MWCreditCard);
@@ -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 {};