@pisell/private-materials 3.4.88 → 3.4.90
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/addons/model.d.ts +10 -1
- package/es/components/booking/components/footer/utils.js +24 -11
- package/es/components/booking/forms/model.d.ts +10 -1
- package/es/components/booking/forms/sendModal/useSendModal.d.ts +0 -1
- package/es/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +0 -1
- package/es/components/booking/info/hooks/useInfoHolder.d.ts +0 -1
- package/es/components/booking/info/model.d.ts +10 -1
- package/es/components/booking/info/service/addService/utils.d.ts +1 -1
- package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
- package/es/components/booking/info2/service/editService/index.js +36 -6
- package/es/components/booking/info2/service/editService/utils.d.ts +15 -0
- package/es/components/booking/info2/service/editService/utils.js +76 -0
- package/es/components/booking/model.d.ts +9 -1
- package/es/components/booking/notes/model.d.ts +10 -1
- package/es/components/booking/payments/model.d.ts +10 -1
- package/es/components/booking/utils.d.ts +2 -2
- package/es/components/eftpos/hooks.d.ts +0 -1
- 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 +6 -6
- package/es/components/eftposPay/tyro/hooks.d.ts +0 -1
- package/es/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateStatus/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/DayItem/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Status/index.d.ts +0 -1
- package/es/components/pay/toC/PaymentList/payment/google_pay.svg +26 -8
- package/es/components/pay/toC/PaymentList/payment/google_pay2.svg +9 -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/StripePay/Stripe/Finish/index.d.ts +0 -1
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +0 -1
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/PageLoading/index.d.ts +0 -1
- 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/model.d.ts +9 -1
- 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/components/schedules/model.d.ts +9 -1
- package/es/components/shoppingCart/components/Empty/index.d.ts +0 -1
- package/es/hooks/usePaymentLogger.d.ts +0 -1
- package/es/plus/pisellSalesManagement/config/booking.d.ts +6 -7
- package/es/plus/selectHolder/components/ErrorTip/index.d.ts +0 -1
- package/es/plus/walletEditor/components/ImageUpload/index.d.ts +1 -1
- package/es/pro/Selector/Selector.d.ts +1 -1
- package/lib/components/booking/addons/model.d.ts +10 -1
- package/lib/components/booking/components/footer/utils.js +15 -3
- package/lib/components/booking/forms/model.d.ts +10 -1
- package/lib/components/booking/forms/sendModal/useSendModal.d.ts +0 -1
- package/lib/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +0 -1
- package/lib/components/booking/info/hooks/useInfoHolder.d.ts +0 -1
- package/lib/components/booking/info/model.d.ts +10 -1
- package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
- package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
- package/lib/components/booking/info2/service/editService/index.js +24 -1
- package/lib/components/booking/info2/service/editService/utils.d.ts +15 -0
- package/lib/components/booking/info2/service/editService/utils.js +38 -2
- package/lib/components/booking/model.d.ts +9 -1
- package/lib/components/booking/notes/model.d.ts +10 -1
- package/lib/components/booking/payments/model.d.ts +10 -1
- package/lib/components/booking/utils.d.ts +2 -2
- package/lib/components/eftpos/hooks.d.ts +0 -1
- 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 +6 -6
- package/lib/components/eftposPay/tyro/hooks.d.ts +0 -1
- package/lib/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateStatus/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/DayItem/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Status/index.d.ts +0 -1
- package/lib/components/pay/toC/PaymentList/payment/google_pay.svg +26 -8
- package/lib/components/pay/toC/PaymentList/payment/google_pay2.svg +9 -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/StripePay/Stripe/Finish/index.d.ts +0 -1
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +0 -1
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/PageLoading/index.d.ts +0 -1
- package/lib/components/pay/toC/PaymentMethods/index.js +19 -14
- 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/model.d.ts +9 -1
- 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/components/schedules/model.d.ts +9 -1
- package/lib/components/shoppingCart/components/Empty/index.d.ts +0 -1
- package/lib/hooks/usePaymentLogger.d.ts +0 -1
- package/lib/plus/pisellSalesManagement/config/booking.d.ts +6 -7
- package/lib/plus/selectHolder/components/ErrorTip/index.d.ts +0 -1
- package/lib/plus/walletEditor/components/ImageUpload/index.d.ts +1 -1
- package/lib/pro/Selector/Selector.d.ts +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/pay/toC/PaymentMethods/MWCreditCard/components/TDSErrorModal/index.tsx
|
|
30
|
+
var TDSErrorModal_exports = {};
|
|
31
|
+
__export(TDSErrorModal_exports, {
|
|
32
|
+
default: () => TDSErrorModal_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(TDSErrorModal_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_antd = require("antd");
|
|
37
|
+
var import_materials = require("@pisell/materials");
|
|
38
|
+
var import_utils = require("@pisell/utils");
|
|
39
|
+
var import_index = require("./index.less");
|
|
40
|
+
var TEXT_KEY_MAP = {
|
|
41
|
+
/** 预检查:卡不支持 3DS 验证 */
|
|
42
|
+
"tds-not-supported": {
|
|
43
|
+
title: "tocPay.text.tdsErrorTitle",
|
|
44
|
+
desc: "tocPay.text.tdsErrorDesc"
|
|
45
|
+
},
|
|
46
|
+
/** 支付中:银行安全验证失败(700500) */
|
|
47
|
+
"bank-verify-failed": {
|
|
48
|
+
title: "tocPay.text.bankVerifyFailedTitle",
|
|
49
|
+
desc: "tocPay.text.bankVerifyFailedDesc"
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var TDSErrorModal = ({
|
|
53
|
+
open,
|
|
54
|
+
type = "tds-not-supported",
|
|
55
|
+
shopPhone,
|
|
56
|
+
shopEmail,
|
|
57
|
+
onUseAnotherCard,
|
|
58
|
+
onUseAnotherPayment,
|
|
59
|
+
onPayLater
|
|
60
|
+
}) => {
|
|
61
|
+
const showContact = !!(shopPhone || shopEmail);
|
|
62
|
+
const textKeys = (0, import_react.useMemo)(() => TEXT_KEY_MAP[type], [type]);
|
|
63
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
64
|
+
import_materials.PisellModal,
|
|
65
|
+
{
|
|
66
|
+
open,
|
|
67
|
+
closable: false,
|
|
68
|
+
footer: null,
|
|
69
|
+
header: false,
|
|
70
|
+
mobileModalHeight: "auto",
|
|
71
|
+
headerDivider: false,
|
|
72
|
+
footerDivider: false,
|
|
73
|
+
bodyStyle: { padding: 24 },
|
|
74
|
+
transitionName: "pisell-move-down"
|
|
75
|
+
},
|
|
76
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: "tds-error-modal" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "tds-error-modal-title" }, import_utils.locales.getText(textKeys.title)), /* @__PURE__ */ import_react.default.createElement("div", { className: "tds-error-modal-desc" }, import_utils.locales.getText(textKeys.desc)), /* @__PURE__ */ import_react.default.createElement("div", { className: "tds-error-modal-actions" }, /* @__PURE__ */ import_react.default.createElement(
|
|
77
|
+
import_antd.Button,
|
|
78
|
+
{
|
|
79
|
+
type: "primary",
|
|
80
|
+
block: true,
|
|
81
|
+
className: "tds-error-modal-btn-primary",
|
|
82
|
+
onClick: onUseAnotherCard
|
|
83
|
+
},
|
|
84
|
+
import_utils.locales.getText("tocPay.text.useAnotherCard")
|
|
85
|
+
), /* @__PURE__ */ import_react.default.createElement(
|
|
86
|
+
import_antd.Button,
|
|
87
|
+
{
|
|
88
|
+
block: true,
|
|
89
|
+
className: "tds-error-modal-btn-secondary",
|
|
90
|
+
onClick: onUseAnotherPayment
|
|
91
|
+
},
|
|
92
|
+
import_utils.locales.getText("tocPay.text.useAnotherPayment")
|
|
93
|
+
), /* @__PURE__ */ import_react.default.createElement(
|
|
94
|
+
import_antd.Button,
|
|
95
|
+
{
|
|
96
|
+
block: true,
|
|
97
|
+
className: "tds-error-modal-btn-secondary",
|
|
98
|
+
onClick: onPayLater
|
|
99
|
+
},
|
|
100
|
+
import_utils.locales.getText("tocPay.text.payLater")
|
|
101
|
+
)), showContact && /* @__PURE__ */ import_react.default.createElement("div", { className: "tds-error-modal-contact" }, import_utils.locales.getText("tocPay.text.paymentTroubleContact")(
|
|
102
|
+
shopPhone || "",
|
|
103
|
+
shopEmail || ""
|
|
104
|
+
)))
|
|
105
|
+
);
|
|
106
|
+
};
|
|
107
|
+
var TDSErrorModal_default = TDSErrorModal;
|
package/lib/components/pay/toC/PaymentMethods/MWCreditCard/components/TDSErrorModal/index.less
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
.tds-error-modal {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: 0;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.tds-error-modal-title {
|
|
8
|
+
color: var(--Gray-900, #101828);
|
|
9
|
+
font-size: 20px;
|
|
10
|
+
font-weight: 600;
|
|
11
|
+
line-height: 28px;
|
|
12
|
+
margin-bottom: 8px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.tds-error-modal-desc {
|
|
16
|
+
color: var(--Gray-600, #475467);
|
|
17
|
+
font-size: 14px;
|
|
18
|
+
font-weight: 400;
|
|
19
|
+
line-height: 20px;
|
|
20
|
+
margin-bottom: 24px;
|
|
21
|
+
white-space: pre-line;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.tds-error-modal-actions {
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
gap: 12px;
|
|
28
|
+
margin-bottom: 16px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.tds-error-modal-btn-primary {
|
|
32
|
+
font-size: 16px;
|
|
33
|
+
font-weight: 500;
|
|
34
|
+
border-radius: 8px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.tds-error-modal-btn-secondary {
|
|
38
|
+
font-size: 16px;
|
|
39
|
+
font-weight: 500;
|
|
40
|
+
border-radius: 8px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.tds-error-modal-contact {
|
|
44
|
+
color: var(--Gray-500, #667085);
|
|
45
|
+
font-size: 12px;
|
|
46
|
+
font-weight: 400;
|
|
47
|
+
line-height: 18px;
|
|
48
|
+
text-align: center;
|
|
49
|
+
padding-top: 8px;
|
|
50
|
+
border-top: 1px solid var(--Gray-200, #eaecf0);
|
|
51
|
+
word-break: break-word;
|
|
52
|
+
}
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import './index.less';
|
|
3
|
+
interface MWCreditCardProps {
|
|
4
|
+
/** 店铺名称,用于授权说明文案 */
|
|
5
|
+
shopName?: string;
|
|
6
|
+
/** 商家联系电话(用于 3DS 错误弹窗联系方式) */
|
|
7
|
+
shopPhone?: string;
|
|
8
|
+
/** 商家联系邮箱(用于 3DS 错误弹窗联系方式) */
|
|
9
|
+
shopEmail?: string;
|
|
10
|
+
}
|
|
3
11
|
export interface MWCreditCardRef {
|
|
4
12
|
init: (res: any) => void;
|
|
5
13
|
}
|
|
6
|
-
declare const _default: React.ForwardRefExoticComponent<
|
|
14
|
+
declare const _default: React.ForwardRefExoticComponent<MWCreditCardProps & React.RefAttributes<unknown>>;
|
|
7
15
|
export default _default;
|
|
@@ -35,27 +35,148 @@ module.exports = __toCommonJS(MWCreditCard_exports);
|
|
|
35
35
|
var import_react = __toESM(require("react"));
|
|
36
36
|
var import_List = __toESM(require("./List"));
|
|
37
37
|
var import_Add = __toESM(require("./Add"));
|
|
38
|
+
var import_serve = require("./List/serve");
|
|
38
39
|
var import_TDSPay = __toESM(require("./TDSPay"));
|
|
39
40
|
var import_model = require("../../model");
|
|
41
|
+
var import_tds2 = require("./tds2");
|
|
42
|
+
var import_payGroup = require("../../payGroup");
|
|
43
|
+
var import_utils = require("@pisell/utils");
|
|
44
|
+
var import_materials = require("@pisell/materials");
|
|
45
|
+
var import_TDSErrorModal = __toESM(require("./components/TDSErrorModal"));
|
|
40
46
|
var import_index = require("./index.less");
|
|
47
|
+
var import_useEngineContext = __toESM(require("../../../../../hooks/useEngineContext"));
|
|
41
48
|
var MWCreditCard = (props, ref) => {
|
|
42
49
|
const MWCreditCardListRef2 = (0, import_react.useRef)();
|
|
43
50
|
const AddMWCreditCardRef2 = (0, import_react.useRef)();
|
|
44
51
|
const TDSPayRef2 = (0, import_react.useRef)();
|
|
52
|
+
const context = (0, import_useEngineContext.default)();
|
|
53
|
+
const utils = context.appHelper.utils || {};
|
|
45
54
|
const [order, setOrder] = (0, import_react.useState)(null);
|
|
55
|
+
const [tdsErrorVisible, setTdsErrorVisible] = (0, import_react.useState)(false);
|
|
56
|
+
const [bankVerifyFailVisible, setBankVerifyFailVisible] = (0, import_react.useState)(false);
|
|
57
|
+
const [loading, setLoading] = (0, import_react.useState)(false);
|
|
46
58
|
const { state } = (0, import_react.useContext)(import_model.Context);
|
|
47
59
|
const init = async (res) => {
|
|
48
60
|
var _a;
|
|
49
61
|
setOrder(res.order);
|
|
50
62
|
(_a = MWCreditCardListRef2.current) == null ? void 0 : _a.init(order);
|
|
51
63
|
};
|
|
64
|
+
const closeAll = () => {
|
|
65
|
+
var _a, _b;
|
|
66
|
+
(_a = MWCreditCardListRef2.current) == null ? void 0 : _a.close();
|
|
67
|
+
(_b = AddMWCreditCardRef2.current) == null ? void 0 : _b.close();
|
|
68
|
+
};
|
|
52
69
|
const fastPay = async (card) => {
|
|
70
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
71
|
+
try {
|
|
72
|
+
setLoading(true);
|
|
73
|
+
(_b = (_a = utils == null ? void 0 : utils.Toast) == null ? void 0 : _a.loading) == null ? void 0 : _b.call(_a, import_utils.locales.getText("tocPay.text.checkingCard"), 0, void 0, true);
|
|
74
|
+
const params = (0, import_payGroup.getPayGroupParamsFromStorage)(
|
|
75
|
+
(_c = state.payGroup) == null ? void 0 : _c.order_id,
|
|
76
|
+
{ card_id: card.id }
|
|
77
|
+
);
|
|
78
|
+
if (!params) {
|
|
79
|
+
(_d = state.payCallback) == null ? void 0 : _d.call(state, {
|
|
80
|
+
key: "fail",
|
|
81
|
+
data: {
|
|
82
|
+
res: card,
|
|
83
|
+
fn: "MWCreditCard.fastPay.noParams",
|
|
84
|
+
message: import_utils.locales.getText("tocPay.text.getParamsFail")
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const { data } = await (0, import_serve.fastPayNew)({
|
|
90
|
+
order_id: (_e = state.payGroup) == null ? void 0 : _e.order_id,
|
|
91
|
+
params
|
|
92
|
+
});
|
|
93
|
+
(0, import_payGroup.setPayNumber)((_f = state.payGroup) == null ? void 0 : _f.order_id, data == null ? void 0 : data.pay_number);
|
|
94
|
+
if ((data == null ? void 0 : data.type) === "token") {
|
|
95
|
+
(_g = TDSPayRef2.current) == null ? void 0 : _g.init(card, order, data);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
if ((data == null ? void 0 : data.type) === "3ds") {
|
|
99
|
+
(_h = TDSPayRef2.current) == null ? void 0 : _h.init(card, order, data);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
} catch (e) {
|
|
103
|
+
if ((e == null ? void 0 : e.code) === 700500) {
|
|
104
|
+
setTdsErrorVisible(true);
|
|
105
|
+
} else {
|
|
106
|
+
(0, import_materials.PisellToast)({ content: (e == null ? void 0 : e.message) || "", duration: 2 });
|
|
107
|
+
}
|
|
108
|
+
} finally {
|
|
109
|
+
setLoading(false);
|
|
110
|
+
(_j = (_i = utils == null ? void 0 : utils.Toast) == null ? void 0 : _i.hide) == null ? void 0 : _j.call(_i);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
const onCreate = async (res) => {
|
|
114
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
115
|
+
try {
|
|
116
|
+
setLoading(true);
|
|
117
|
+
(_b = (_a = utils == null ? void 0 : utils.Toast) == null ? void 0 : _a.loading) == null ? void 0 : _b.call(_a, import_utils.locales.getText("tocPay.text.checkingCard"), 0, void 0, true);
|
|
118
|
+
let _cardInfo = {
|
|
119
|
+
card_name: res.card_name,
|
|
120
|
+
card_number: res.card_number,
|
|
121
|
+
card_expiry_month: res.date.format("MM"),
|
|
122
|
+
card_expiry_year: res.date.format("YY"),
|
|
123
|
+
card_ccv: res.card_ccv,
|
|
124
|
+
is_save: res.is_save ? 1 : 0
|
|
125
|
+
};
|
|
126
|
+
_cardInfo = (0, import_payGroup.getPayGroupParamsFromStorage)(
|
|
127
|
+
(_c = state.payGroup) == null ? void 0 : _c.order_id,
|
|
128
|
+
_cardInfo
|
|
129
|
+
);
|
|
130
|
+
if (!_cardInfo) {
|
|
131
|
+
(_d = state.payCallback) == null ? void 0 : _d.call(state, {
|
|
132
|
+
key: "fail",
|
|
133
|
+
data: {
|
|
134
|
+
_cardInfo,
|
|
135
|
+
message: import_utils.locales.getText("tocPay.text.getParamsFail"),
|
|
136
|
+
fn: "MWCreditCard.onCreate.noCardInfo"
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
const preCheckData = await (0, import_tds2.preCheckEnrollment)(
|
|
142
|
+
(_e = state.payGroup) == null ? void 0 : _e.order_id,
|
|
143
|
+
_cardInfo
|
|
144
|
+
);
|
|
145
|
+
(_f = TDSPayRef2.current) == null ? void 0 : _f.init(res, order, preCheckData);
|
|
146
|
+
} catch (e) {
|
|
147
|
+
if ((e == null ? void 0 : e.code) === 700500) {
|
|
148
|
+
setTdsErrorVisible(true);
|
|
149
|
+
} else {
|
|
150
|
+
(0, import_materials.PisellToast)({ content: (e == null ? void 0 : e.message) || "", duration: 2 });
|
|
151
|
+
}
|
|
152
|
+
} finally {
|
|
153
|
+
setLoading(false);
|
|
154
|
+
(_h = (_g = utils == null ? void 0 : utils.Toast) == null ? void 0 : _g.hide) == null ? void 0 : _h.call(_g);
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
const handleTDSPayChange = (res) => {
|
|
53
158
|
var _a;
|
|
54
|
-
(
|
|
159
|
+
if ((res == null ? void 0 : res.key) === "bankVerifyFailed") {
|
|
160
|
+
setBankVerifyFailVisible(true);
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
(_a = state.payCallback) == null ? void 0 : _a.call(state, res);
|
|
55
164
|
};
|
|
56
|
-
const
|
|
165
|
+
const handleUseAnotherCard = () => {
|
|
166
|
+
setTdsErrorVisible(false);
|
|
167
|
+
setBankVerifyFailVisible(false);
|
|
168
|
+
};
|
|
169
|
+
const handleUseAnotherPayment = () => {
|
|
170
|
+
setTdsErrorVisible(false);
|
|
171
|
+
setBankVerifyFailVisible(false);
|
|
172
|
+
closeAll();
|
|
173
|
+
};
|
|
174
|
+
const handlePayLater = () => {
|
|
57
175
|
var _a;
|
|
58
|
-
(
|
|
176
|
+
setTdsErrorVisible(false);
|
|
177
|
+
setBankVerifyFailVisible(false);
|
|
178
|
+
closeAll();
|
|
179
|
+
(_a = state.payCallback) == null ? void 0 : _a.call(state, { key: "cancel" });
|
|
59
180
|
};
|
|
60
181
|
(0, import_react.useImperativeHandle)(
|
|
61
182
|
ref,
|
|
@@ -73,8 +194,31 @@ var MWCreditCard = (props, ref) => {
|
|
|
73
194
|
var _a;
|
|
74
195
|
(_a = AddMWCreditCardRef2.current) == null ? void 0 : _a.init();
|
|
75
196
|
},
|
|
76
|
-
onChange: fastPay
|
|
197
|
+
onChange: fastPay,
|
|
198
|
+
btnLoading: loading
|
|
199
|
+
}
|
|
200
|
+
), /* @__PURE__ */ import_react.default.createElement(import_Add.default, { ref: AddMWCreditCardRef2, onCreate, shopName: props.shopName, btnLoading: loading }), /* @__PURE__ */ import_react.default.createElement(import_TDSPay.default, { ref: TDSPayRef2, onChange: handleTDSPayChange, closeAll }), /* @__PURE__ */ import_react.default.createElement(
|
|
201
|
+
import_TDSErrorModal.default,
|
|
202
|
+
{
|
|
203
|
+
open: tdsErrorVisible,
|
|
204
|
+
type: "tds-not-supported",
|
|
205
|
+
shopPhone: props.shopPhone,
|
|
206
|
+
shopEmail: props.shopEmail,
|
|
207
|
+
onUseAnotherCard: handleUseAnotherCard,
|
|
208
|
+
onUseAnotherPayment: handleUseAnotherPayment,
|
|
209
|
+
onPayLater: handlePayLater
|
|
210
|
+
}
|
|
211
|
+
), /* @__PURE__ */ import_react.default.createElement(
|
|
212
|
+
import_TDSErrorModal.default,
|
|
213
|
+
{
|
|
214
|
+
open: bankVerifyFailVisible,
|
|
215
|
+
type: "bank-verify-failed",
|
|
216
|
+
shopPhone: props.shopPhone,
|
|
217
|
+
shopEmail: props.shopEmail,
|
|
218
|
+
onUseAnotherCard: handleUseAnotherCard,
|
|
219
|
+
onUseAnotherPayment: handleUseAnotherPayment,
|
|
220
|
+
onPayLater: handlePayLater
|
|
77
221
|
}
|
|
78
|
-
)
|
|
222
|
+
));
|
|
79
223
|
};
|
|
80
224
|
var MWCreditCard_default = (0, import_react.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,
|
|
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,
|
|
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,
|
|
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 },
|
|
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
|
});
|