@pisell/private-materials 6.3.109 → 6.3.110
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.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +9 -9
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +10 -10
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +11 -11
- package/es/components/booking/forms/sendModal/useSendModal.d.ts +1 -0
- package/es/components/eftposPay/amount.d.ts +1 -1
- package/es/components/eftposPay/device.d.ts +1 -1
- package/es/components/eftposPay/hooks.d.ts +2 -2
- package/es/components/eftposPay/store/index.d.ts +5 -5
- package/es/components/eventBooking/components/ErrorTip/index.d.ts +1 -0
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +1 -0
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +1 -0
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +1 -0
- package/es/components/pay/toC/PaymentMethods/MWCreditCard/Add/index.d.ts +6 -0
- package/es/components/pay/toC/PaymentMethods/MWCreditCard/Add/index.js +65 -21
- package/es/components/pay/toC/PaymentMethods/MWCreditCard/Add/index.less +110 -9
- package/es/components/pay/toC/PaymentMethods/MWCreditCard/List/index.d.ts +2 -0
- package/es/components/pay/toC/PaymentMethods/MWCreditCard/List/index.js +28 -16
- package/es/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.d.ts +20 -1
- package/es/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.js +14 -1
- package/es/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.less +20 -0
- package/es/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/index.d.ts +7 -1
- package/es/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/index.js +167 -56
- package/es/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/index.less +47 -0
- package/es/components/pay/toC/PaymentMethods/MWCreditCard/components/TDSErrorModal/index.d.ts +34 -0
- package/es/components/pay/toC/PaymentMethods/MWCreditCard/components/TDSErrorModal/index.js +83 -0
- package/es/components/pay/toC/PaymentMethods/MWCreditCard/components/TDSErrorModal/index.less +52 -0
- package/es/components/pay/toC/PaymentMethods/MWCreditCard/index.d.ts +9 -1
- package/es/components/pay/toC/PaymentMethods/MWCreditCard/index.js +260 -33
- package/es/components/pay/toC/PaymentMethods/MWCreditCard/tds2.d.ts +23 -3
- package/es/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +292 -115
- package/es/components/pay/toC/PaymentMethods/index.js +12 -2
- package/es/components/pay/toC/index.js +53 -18
- package/es/components/pay/toC/locales.d.ts +115 -0
- package/es/components/pay/toC/locales.js +143 -18
- package/es/components/pay/toC/serve.d.ts +10 -0
- package/es/components/pay/toC/serve.js +40 -1
- package/es/components/pay/toC/utils.d.ts +5 -0
- package/es/components/pay/toC/utils.js +10 -0
- package/es/plus/pisellSalesManagement/config/booking.d.ts +6 -6
- package/es/plus/selectHolder/components/ErrorTip/index.d.ts +1 -0
- package/es/plus/walletEditor/components/ImageUpload/index.d.ts +1 -1
- package/es/pro/Selector/Selector.d.ts +1 -1
- package/lib/components/booking/forms/sendModal/useSendModal.d.ts +1 -0
- package/lib/components/eftposPay/amount.d.ts +1 -1
- package/lib/components/eftposPay/device.d.ts +1 -1
- package/lib/components/eftposPay/hooks.d.ts +2 -2
- package/lib/components/eftposPay/store/index.d.ts +5 -5
- package/lib/components/eventBooking/components/ErrorTip/index.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +1 -0
- package/lib/components/pay/toC/PaymentMethods/MWCreditCard/Add/index.d.ts +6 -0
- package/lib/components/pay/toC/PaymentMethods/MWCreditCard/Add/index.js +40 -17
- package/lib/components/pay/toC/PaymentMethods/MWCreditCard/Add/index.less +110 -9
- package/lib/components/pay/toC/PaymentMethods/MWCreditCard/List/index.d.ts +2 -0
- package/lib/components/pay/toC/PaymentMethods/MWCreditCard/List/index.js +17 -5
- package/lib/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.d.ts +20 -1
- package/lib/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.js +8 -2
- package/lib/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.less +20 -0
- package/lib/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/index.d.ts +7 -1
- package/lib/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/index.js +98 -24
- package/lib/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/index.less +47 -0
- package/lib/components/pay/toC/PaymentMethods/MWCreditCard/components/TDSErrorModal/index.d.ts +34 -0
- package/lib/components/pay/toC/PaymentMethods/MWCreditCard/components/TDSErrorModal/index.js +107 -0
- package/lib/components/pay/toC/PaymentMethods/MWCreditCard/components/TDSErrorModal/index.less +52 -0
- package/lib/components/pay/toC/PaymentMethods/MWCreditCard/index.d.ts +9 -1
- package/lib/components/pay/toC/PaymentMethods/MWCreditCard/index.js +149 -5
- package/lib/components/pay/toC/PaymentMethods/MWCreditCard/tds2.d.ts +23 -3
- package/lib/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +99 -16
- package/lib/components/pay/toC/PaymentMethods/index.js +17 -12
- package/lib/components/pay/toC/index.js +34 -3
- package/lib/components/pay/toC/locales.d.ts +115 -0
- package/lib/components/pay/toC/locales.js +133 -18
- package/lib/components/pay/toC/serve.d.ts +10 -0
- package/lib/components/pay/toC/serve.js +10 -0
- package/lib/components/pay/toC/utils.d.ts +5 -0
- package/lib/components/pay/toC/utils.js +17 -0
- package/lib/plus/pisellSalesManagement/config/booking.d.ts +6 -6
- package/lib/plus/selectHolder/components/ErrorTip/index.d.ts +1 -0
- package/lib/plus/walletEditor/components/ImageUpload/index.d.ts +1 -1
- package/lib/pro/Selector/Selector.d.ts +1 -1
- package/package.json +2 -2
|
@@ -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 },
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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,
|
|
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 *
|
|
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
|
});
|
|
@@ -65,7 +65,7 @@ var isOfflinePayment = (type) => {
|
|
|
65
65
|
].includes(type);
|
|
66
66
|
};
|
|
67
67
|
var PaymentMethods = (props, ref) => {
|
|
68
|
-
var _a, _b, _c;
|
|
68
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
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,6 +82,11 @@ 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
91
|
var _a2, _b2;
|
|
87
92
|
const waitAmount = (payGroup == null ? void 0 : payGroup.wait_amount) || 0;
|
|
@@ -143,11 +148,11 @@ var PaymentMethods = (props, ref) => {
|
|
|
143
148
|
}
|
|
144
149
|
await onPayByType({ type, payGroup });
|
|
145
150
|
};
|
|
146
|
-
console.log("paymentResult isAppEnv", (
|
|
151
|
+
console.log("paymentResult isAppEnv", (_i = (_h = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _h.isAppEnv) == null ? void 0 : _i.call(_h), interaction, context);
|
|
147
152
|
(0, import_react.useEffect)(() => {
|
|
148
|
-
var _a2, _b2, _c2,
|
|
153
|
+
var _a2, _b2, _c2, _d2;
|
|
149
154
|
console.log("paymentResult isAppEnv", (_b2 = (_a2 = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _a2.isAppEnv) == null ? void 0 : _b2.call(_a2));
|
|
150
|
-
if ((
|
|
155
|
+
if ((_d2 = (_c2 = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _c2.isAppEnv) == null ? void 0 : _d2.call(_c2)) {
|
|
151
156
|
interaction.utils.mountFunction("global", "paymentResult", (strResult) => {
|
|
152
157
|
console.log("paymentResult", strResult);
|
|
153
158
|
if (!(0, import_utils2.isJson)(strResult)) return;
|
|
@@ -163,7 +168,7 @@ var PaymentMethods = (props, ref) => {
|
|
|
163
168
|
}
|
|
164
169
|
}, []);
|
|
165
170
|
const onPayByType = async ({ type, payGroup }) => {
|
|
166
|
-
var _a2, _b2, _c2,
|
|
171
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j, _k, _l, _m, _n;
|
|
167
172
|
console.log(type, payGroup);
|
|
168
173
|
if (type === "mw.apple") {
|
|
169
174
|
await ((_a2 = ApplePayRef2.current) == null ? void 0 : _a2.init({ payGroup }));
|
|
@@ -178,27 +183,27 @@ var PaymentMethods = (props, ref) => {
|
|
|
178
183
|
return;
|
|
179
184
|
}
|
|
180
185
|
if (type === "superpay.alipay.h5") {
|
|
181
|
-
await ((
|
|
186
|
+
await ((_d2 = SuperPayAliPayH5Ref2.current) == null ? void 0 : _d2.init({ payGroup }));
|
|
182
187
|
return;
|
|
183
188
|
}
|
|
184
189
|
if (type === "superpay.wechat.h5") {
|
|
185
|
-
await ((
|
|
190
|
+
await ((_e2 = SuperPayWxPayH5Ref2.current) == null ? void 0 : _e2.init({ payGroup }));
|
|
186
191
|
return;
|
|
187
192
|
}
|
|
188
193
|
if (type === "stripe") {
|
|
189
|
-
(
|
|
194
|
+
(_f2 = StripePayRef2.current) == null ? void 0 : _f2.init({ payGroup });
|
|
190
195
|
return;
|
|
191
196
|
}
|
|
192
197
|
if (type === "pisell.offline_payment") {
|
|
193
|
-
await ((
|
|
198
|
+
await ((_g2 = OfflinePaymentRef2.current) == null ? void 0 : _g2.init({ payGroup }));
|
|
194
199
|
return;
|
|
195
200
|
}
|
|
196
201
|
if (type === "pisell.bank_deposit") {
|
|
197
|
-
await ((
|
|
202
|
+
await ((_h2 = BankDepositRef2.current) == null ? void 0 : _h2.init({ payGroup }));
|
|
198
203
|
return;
|
|
199
204
|
}
|
|
200
205
|
if (type === "pisell.other.cashmanual") {
|
|
201
|
-
await ((
|
|
206
|
+
await ((_i2 = CashManualRef2.current) == null ? void 0 : _i2.init({ payGroup }));
|
|
202
207
|
return;
|
|
203
208
|
}
|
|
204
209
|
if (type === "globepay.alipay.h5") {
|
|
@@ -228,6 +233,6 @@ var PaymentMethods = (props, ref) => {
|
|
|
228
233
|
onPay: init
|
|
229
234
|
})
|
|
230
235
|
);
|
|
231
|
-
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 }));
|
|
236
|
+
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 }));
|
|
232
237
|
};
|
|
233
238
|
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
|
|
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: `订单${(
|
|
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
|
{
|