@pisell/private-materials 3.4.93 → 3.4.94
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.js +10 -10
- package/build/lowcode/view.js +10 -10
- package/es/components/booking/addons/model.d.ts +1 -10
- package/es/components/booking/forms/model.d.ts +1 -10
- package/es/components/booking/info/model.d.ts +1 -10
- package/es/components/booking/model.d.ts +1 -9
- package/es/components/booking/notes/model.d.ts +1 -10
- package/es/components/booking/payments/model.d.ts +1 -10
- package/es/components/eftposPay/hooks.d.ts +1 -1
- package/es/components/eftposPay/store/index.d.ts +1 -1
- package/es/components/pay/toC/PaymentMethods/GlobePayAliPayH5/index.js +52 -44
- package/es/components/pay/toC/PaymentMethods/GlobePayPaypalH5/index.js +51 -43
- package/es/components/pay/toC/PaymentMethods/GlobePayWxH5/index.js +51 -43
- package/es/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/index.js +24 -15
- package/es/components/pay/toC/PaymentMethods/MWCreditCard/index.js +19 -19
- package/es/components/pay/toC/PaymentMethods/MWCreditCard/tds2.d.ts +3 -1
- package/es/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +32 -27
- package/es/components/pay/toC/PaymentMethods/SuperPayAliPayH5/index.js +17 -16
- package/es/components/pay/toC/PaymentMethods/SuperPayWxPayH5/index.js +47 -42
- package/es/components/pay/toC/PaymentMethods/WalletPass/index.js +2 -2
- package/es/components/pay/toC/PaymentMethods/WalletPass/utils.d.ts +7 -0
- package/es/components/pay/toC/PaymentMethods/WalletPass/utils.js +18 -1
- package/es/components/pay/toC/PaymentMethods/index.js +116 -90
- package/es/components/pay/toC/index.js +4 -1
- package/es/components/pay/toC/locales.d.ts +5 -0
- package/es/components/pay/toC/locales.js +5 -0
- package/es/components/pay/toC/model.d.ts +1 -9
- package/es/components/pay/toC/payGroup.d.ts +14 -3
- package/es/components/pay/toC/payGroup.js +174 -15
- package/es/components/pay/toC/serve.d.ts +13 -0
- package/es/components/pay/toC/serve.js +30 -0
- package/es/components/pay/toC/utils.d.ts +3 -0
- package/es/components/pay/toC/utils.js +5 -1
- package/es/components/schedules/model.d.ts +1 -9
- package/lib/components/booking/addons/model.d.ts +1 -10
- package/lib/components/booking/forms/model.d.ts +1 -10
- package/lib/components/booking/info/model.d.ts +1 -10
- package/lib/components/booking/model.d.ts +1 -9
- package/lib/components/booking/notes/model.d.ts +1 -10
- package/lib/components/booking/payments/model.d.ts +1 -10
- package/lib/components/eftposPay/hooks.d.ts +1 -1
- package/lib/components/eftposPay/store/index.d.ts +1 -1
- package/lib/components/pay/toC/PaymentMethods/GlobePayAliPayH5/index.js +7 -3
- package/lib/components/pay/toC/PaymentMethods/GlobePayPaypalH5/index.js +7 -3
- package/lib/components/pay/toC/PaymentMethods/GlobePayWxH5/index.js +7 -3
- package/lib/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/index.js +19 -7
- package/lib/components/pay/toC/PaymentMethods/MWCreditCard/index.js +15 -9
- package/lib/components/pay/toC/PaymentMethods/MWCreditCard/tds2.d.ts +3 -1
- package/lib/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +10 -6
- package/lib/components/pay/toC/PaymentMethods/SuperPayAliPayH5/index.js +3 -3
- package/lib/components/pay/toC/PaymentMethods/SuperPayWxPayH5/index.js +3 -3
- package/lib/components/pay/toC/PaymentMethods/WalletPass/index.js +1 -1
- package/lib/components/pay/toC/PaymentMethods/WalletPass/utils.d.ts +7 -0
- package/lib/components/pay/toC/PaymentMethods/WalletPass/utils.js +16 -0
- package/lib/components/pay/toC/PaymentMethods/index.js +12 -7
- package/lib/components/pay/toC/index.js +5 -1
- package/lib/components/pay/toC/locales.d.ts +5 -0
- package/lib/components/pay/toC/locales.js +5 -0
- package/lib/components/pay/toC/model.d.ts +1 -9
- package/lib/components/pay/toC/payGroup.d.ts +14 -3
- package/lib/components/pay/toC/payGroup.js +60 -4
- package/lib/components/pay/toC/serve.d.ts +13 -0
- package/lib/components/pay/toC/serve.js +12 -2
- package/lib/components/pay/toC/utils.d.ts +3 -0
- package/lib/components/pay/toC/utils.js +5 -1
- package/lib/components/schedules/model.d.ts +1 -9
- package/package.json +3 -3
|
@@ -51,6 +51,7 @@ var MWCreditCard = (props, ref) => {
|
|
|
51
51
|
const TDSPayRef2 = (0, import_react.useRef)();
|
|
52
52
|
const context = (0, import_useEngineContext.default)();
|
|
53
53
|
const utils = context.appHelper.utils || {};
|
|
54
|
+
const { token } = utils;
|
|
54
55
|
const [order, setOrder] = (0, import_react.useState)(null);
|
|
55
56
|
const [tdsErrorVisible, setTdsErrorVisible] = (0, import_react.useState)(false);
|
|
56
57
|
const [bankVerifyFailVisible, setBankVerifyFailVisible] = (0, import_react.useState)(false);
|
|
@@ -67,7 +68,7 @@ var MWCreditCard = (props, ref) => {
|
|
|
67
68
|
(_b = AddMWCreditCardRef2.current) == null ? void 0 : _b.close();
|
|
68
69
|
};
|
|
69
70
|
const fastPay = async (card) => {
|
|
70
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
71
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
71
72
|
try {
|
|
72
73
|
setLoading(true);
|
|
73
74
|
(_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);
|
|
@@ -90,13 +91,17 @@ var MWCreditCard = (props, ref) => {
|
|
|
90
91
|
order_id: (_e = state.payGroup) == null ? void 0 : _e.order_id,
|
|
91
92
|
params
|
|
92
93
|
});
|
|
93
|
-
(0, import_payGroup.setPayNumber)(
|
|
94
|
+
await (0, import_payGroup.setPayNumber)(
|
|
95
|
+
(_f = state.payGroup) == null ? void 0 : _f.order_id,
|
|
96
|
+
data == null ? void 0 : data.pay_number,
|
|
97
|
+
(_g = token == null ? void 0 : token.get) == null ? void 0 : _g.call(token)
|
|
98
|
+
);
|
|
94
99
|
if ((data == null ? void 0 : data.type) === "token") {
|
|
95
|
-
(
|
|
100
|
+
(_h = TDSPayRef2.current) == null ? void 0 : _h.init(card, order, data);
|
|
96
101
|
return;
|
|
97
102
|
}
|
|
98
103
|
if ((data == null ? void 0 : data.type) === "3ds") {
|
|
99
|
-
(
|
|
104
|
+
(_i = TDSPayRef2.current) == null ? void 0 : _i.init(card, order, data);
|
|
100
105
|
return;
|
|
101
106
|
}
|
|
102
107
|
} catch (e) {
|
|
@@ -107,11 +112,11 @@ var MWCreditCard = (props, ref) => {
|
|
|
107
112
|
}
|
|
108
113
|
} finally {
|
|
109
114
|
setLoading(false);
|
|
110
|
-
(
|
|
115
|
+
(_k = (_j = utils == null ? void 0 : utils.Toast) == null ? void 0 : _j.hide) == null ? void 0 : _k.call(_j);
|
|
111
116
|
}
|
|
112
117
|
};
|
|
113
118
|
const onCreate = async (res) => {
|
|
114
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
119
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
115
120
|
try {
|
|
116
121
|
setLoading(true);
|
|
117
122
|
(_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);
|
|
@@ -140,9 +145,10 @@ var MWCreditCard = (props, ref) => {
|
|
|
140
145
|
}
|
|
141
146
|
const preCheckData = await (0, import_tds2.preCheckEnrollment)(
|
|
142
147
|
(_e = state.payGroup) == null ? void 0 : _e.order_id,
|
|
143
|
-
_cardInfo
|
|
148
|
+
_cardInfo,
|
|
149
|
+
(_f = token == null ? void 0 : token.get) == null ? void 0 : _f.call(token)
|
|
144
150
|
);
|
|
145
|
-
(
|
|
151
|
+
(_g = TDSPayRef2.current) == null ? void 0 : _g.init(res, order, preCheckData);
|
|
146
152
|
} catch (e) {
|
|
147
153
|
if ((e == null ? void 0 : e.code) === 700500) {
|
|
148
154
|
setTdsErrorVisible(true);
|
|
@@ -151,7 +157,7 @@ var MWCreditCard = (props, ref) => {
|
|
|
151
157
|
}
|
|
152
158
|
} finally {
|
|
153
159
|
setLoading(false);
|
|
154
|
-
(
|
|
160
|
+
(_i = (_h = utils == null ? void 0 : utils.Toast) == null ? void 0 : _h.hide) == null ? void 0 : _i.call(_h);
|
|
155
161
|
}
|
|
156
162
|
};
|
|
157
163
|
const handleTDSPayChange = (res) => {
|
|
@@ -7,6 +7,8 @@ export declare const cancelCurrentPayment: () => void;
|
|
|
7
7
|
interface PaymentOptions {
|
|
8
8
|
callback?: (res: any) => void;
|
|
9
9
|
isCancelled?: () => boolean;
|
|
10
|
+
/** 引擎 token.get(),供 setPayNumber 写入 stash */
|
|
11
|
+
stashAuthToken?: string;
|
|
10
12
|
}
|
|
11
13
|
/**
|
|
12
14
|
* @title: 点击支付
|
|
@@ -25,7 +27,7 @@ export declare const startPayment: ({ orderId, cardInfo, payData }: any, options
|
|
|
25
27
|
* @param {any} cardInfo 卡信息
|
|
26
28
|
* @return {Promise<any>} 返回后端数据(含 pay_info),失败则 throw
|
|
27
29
|
*/
|
|
28
|
-
export declare const preCheckEnrollment: (orderId: string, cardInfo: any) => Promise<any>;
|
|
30
|
+
export declare const preCheckEnrollment: (orderId: string, cardInfo: any, stashAuthToken?: string) => Promise<any>;
|
|
29
31
|
/*******
|
|
30
32
|
* @title: 步骤2
|
|
31
33
|
* @description: 提交卡信息到后端
|
|
@@ -93,7 +93,7 @@ var getCurrentTime = () => {
|
|
|
93
93
|
return (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss");
|
|
94
94
|
};
|
|
95
95
|
var startPayment = async ({ orderId, cardInfo, payData }, options) => {
|
|
96
|
-
const { callback, isCancelled } = options || {};
|
|
96
|
+
const { callback, isCancelled, stashAuthToken } = options || {};
|
|
97
97
|
let paymentInfo2 = {
|
|
98
98
|
amount: 0,
|
|
99
99
|
order_id: 0
|
|
@@ -110,7 +110,11 @@ var startPayment = async ({ orderId, cardInfo, payData }, options) => {
|
|
|
110
110
|
payDataOrderId: payData == null ? void 0 : payData.order_id,
|
|
111
111
|
payDataPayNumber: payData == null ? void 0 : payData.pay_number
|
|
112
112
|
});
|
|
113
|
-
const step2 = payData ? payData : await checkEnrollment(orderId, cardInfo, {
|
|
113
|
+
const step2 = payData ? payData : await checkEnrollment(orderId, cardInfo, {
|
|
114
|
+
callback,
|
|
115
|
+
isCancelled,
|
|
116
|
+
stashAuthToken
|
|
117
|
+
});
|
|
114
118
|
if (isCancelled == null ? void 0 : isCancelled()) {
|
|
115
119
|
closeIframe();
|
|
116
120
|
return;
|
|
@@ -238,12 +242,12 @@ var startPayment = async ({ orderId, cardInfo, payData }, options) => {
|
|
|
238
242
|
return false;
|
|
239
243
|
}
|
|
240
244
|
};
|
|
241
|
-
var preCheckEnrollment = async (orderId, cardInfo) => {
|
|
245
|
+
var preCheckEnrollment = async (orderId, cardInfo, stashAuthToken) => {
|
|
242
246
|
try {
|
|
243
247
|
const { data } = await import_utils.request.getRequest().post("/h5/pay/order/mw-3ds-pay/v2/" + orderId, {
|
|
244
248
|
...cardInfo
|
|
245
249
|
});
|
|
246
|
-
(0, import_payGroup.setPayNumber)(orderId, data == null ? void 0 : data.pay_number);
|
|
250
|
+
await (0, import_payGroup.setPayNumber)(orderId, data == null ? void 0 : data.pay_number, stashAuthToken);
|
|
247
251
|
if (!(data == null ? void 0 : data.pay_info)) {
|
|
248
252
|
throw new Error("Card does not support 3DS verification");
|
|
249
253
|
}
|
|
@@ -260,13 +264,13 @@ var preCheckEnrollment = async (orderId, cardInfo) => {
|
|
|
260
264
|
}
|
|
261
265
|
};
|
|
262
266
|
var checkEnrollment = async (orderId, cardInfo, options) => {
|
|
263
|
-
const { callback, isCancelled } = options || {};
|
|
267
|
+
const { callback, isCancelled, stashAuthToken } = options || {};
|
|
264
268
|
try {
|
|
265
269
|
let { data } = await import_utils.request.getRequest().post("/h5/pay/order/mw-3ds-pay/v2/" + orderId, {
|
|
266
270
|
...cardInfo
|
|
267
271
|
});
|
|
268
272
|
if (isCancelled == null ? void 0 : isCancelled()) return 0;
|
|
269
|
-
(0, import_payGroup.setPayNumber)(orderId, data == null ? void 0 : data.pay_number);
|
|
273
|
+
await (0, import_payGroup.setPayNumber)(orderId, data == null ? void 0 : data.pay_number, stashAuthToken);
|
|
270
274
|
if (!(data == null ? void 0 : data.pay_info)) {
|
|
271
275
|
return null;
|
|
272
276
|
}
|
|
@@ -53,7 +53,7 @@ var SuperPayAliPayH5 = (props, ref) => {
|
|
|
53
53
|
const [showSuccessBackButton, setShowSuccessBackButton] = (0, import_react.useState)(false);
|
|
54
54
|
const [statePayNumber, setStatePayNumber] = (0, import_react.useState)("");
|
|
55
55
|
const context = (0, import_useEngineContext.default)();
|
|
56
|
-
const { interaction } = (_a = context.appHelper) == null ? void 0 : _a.utils;
|
|
56
|
+
const { interaction, token } = (_a = context.appHelper) == null ? void 0 : _a.utils;
|
|
57
57
|
const paymentLogger = (0, import_usePaymentLogger.default)({
|
|
58
58
|
orderId: ((_b = state.payGroup) == null ? void 0 : _b.order_id) || "unknown",
|
|
59
59
|
step: "2"
|
|
@@ -63,7 +63,7 @@ var SuperPayAliPayH5 = (props, ref) => {
|
|
|
63
63
|
paymentType: "aliPay"
|
|
64
64
|
});
|
|
65
65
|
const init = async ({ payGroup }) => {
|
|
66
|
-
var _a2, _b2;
|
|
66
|
+
var _a2, _b2, _c2;
|
|
67
67
|
paymentLogger.addLog({
|
|
68
68
|
key: "SuperPayAliPayH5初始化开始",
|
|
69
69
|
value: ""
|
|
@@ -108,7 +108,7 @@ var SuperPayAliPayH5 = (props, ref) => {
|
|
|
108
108
|
key: "SuperPayAliPayH5获取支付链接成功",
|
|
109
109
|
value: ""
|
|
110
110
|
});
|
|
111
|
-
(0, import_payGroup.setPayNumber)(payGroup == null ? void 0 : payGroup.order_id, data == null ? void 0 : data.pay_number);
|
|
111
|
+
await (0, import_payGroup.setPayNumber)(payGroup == null ? void 0 : payGroup.order_id, data == null ? void 0 : data.pay_number, (_c2 = token == null ? void 0 : token.get) == null ? void 0 : _c2.call(token));
|
|
112
112
|
setStatePayNumber(data == null ? void 0 : data.pay_number);
|
|
113
113
|
setShowSuccessBackButton(true);
|
|
114
114
|
paymentLogger.addLog({
|
|
@@ -48,13 +48,13 @@ var SuperPayWxPayH5 = (props, ref) => {
|
|
|
48
48
|
const { state } = (0, import_react.useContext)(import_model.Context);
|
|
49
49
|
const [open, setOpen] = (0, import_react.useState)(false);
|
|
50
50
|
const context = (0, import_useEngineContext.default)();
|
|
51
|
-
const { interaction } = (_a = context.appHelper) == null ? void 0 : _a.utils;
|
|
51
|
+
const { interaction, token } = ((_a = context.appHelper) == null ? void 0 : _a.utils) || {};
|
|
52
52
|
const paymentLogger = (0, import_usePaymentLogger.default)({
|
|
53
53
|
orderId: ((_b = state.payGroup) == null ? void 0 : _b.order_id) || "unknown",
|
|
54
54
|
step: "2"
|
|
55
55
|
});
|
|
56
56
|
const init = async ({ payGroup }) => {
|
|
57
|
-
var _a2, _b2;
|
|
57
|
+
var _a2, _b2, _c;
|
|
58
58
|
paymentLogger.addLog({
|
|
59
59
|
key: "SuperPayWxPayH5初始化开始",
|
|
60
60
|
value: ""
|
|
@@ -94,7 +94,7 @@ var SuperPayWxPayH5 = (props, ref) => {
|
|
|
94
94
|
key: "SuperPayWxPayH5获取支付链接成功",
|
|
95
95
|
value: ""
|
|
96
96
|
});
|
|
97
|
-
(0, import_payGroup.setPayNumber)(payGroup == null ? void 0 : payGroup.order_id, data == null ? void 0 : data.pay_number);
|
|
97
|
+
await (0, import_payGroup.setPayNumber)(payGroup == null ? void 0 : payGroup.order_id, data == null ? void 0 : data.pay_number, (_c = token == null ? void 0 : token.get) == null ? void 0 : _c.call(token));
|
|
98
98
|
paymentLogger.addLog({
|
|
99
99
|
key: "SuperPayWxPayH5准备跳转微信支付",
|
|
100
100
|
value: ""
|
|
@@ -282,7 +282,7 @@ var WalletPass = (0, import_react.forwardRef)((props, ref) => {
|
|
|
282
282
|
changeWalletPass(cards);
|
|
283
283
|
};
|
|
284
284
|
const handleRedeem = () => {
|
|
285
|
-
onWalletPassChange == null ? void 0 : onWalletPassChange(currentWalletPass);
|
|
285
|
+
onWalletPassChange == null ? void 0 : onWalletPassChange((0, import_utils2.formatWalletPassWithUniquePaymentNumber)(currentWalletPass));
|
|
286
286
|
setOpen(false);
|
|
287
287
|
};
|
|
288
288
|
const handleWalletClose = () => {
|
|
@@ -7,3 +7,10 @@ export declare const getDataByIds: (arr: any[], ids: number[]) => any[];
|
|
|
7
7
|
* @returns
|
|
8
8
|
*/
|
|
9
9
|
export declare const getIsWalletCode: (val: string) => boolean;
|
|
10
|
+
export declare const formatWalletPassWithUniquePaymentNumber: (currentWalletPass: {
|
|
11
|
+
cards: any[];
|
|
12
|
+
amount: number;
|
|
13
|
+
}) => {
|
|
14
|
+
cards: any[];
|
|
15
|
+
amount: number;
|
|
16
|
+
};
|
|
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
var utils_exports = {};
|
|
21
21
|
__export(utils_exports, {
|
|
22
22
|
formatMachineCodeServer2CardList: () => formatMachineCodeServer2CardList,
|
|
23
|
+
formatWalletPassWithUniquePaymentNumber: () => formatWalletPassWithUniquePaymentNumber,
|
|
23
24
|
getDataByIds: () => getDataByIds,
|
|
24
25
|
getIsWalletCode: () => getIsWalletCode
|
|
25
26
|
});
|
|
@@ -70,9 +71,24 @@ var getDataByIds = (arr, ids) => {
|
|
|
70
71
|
var getIsWalletCode = (val) => {
|
|
71
72
|
return val.startsWith("WL");
|
|
72
73
|
};
|
|
74
|
+
var formatWalletPassWithUniquePaymentNumber = (currentWalletPass) => {
|
|
75
|
+
return {
|
|
76
|
+
...currentWalletPass,
|
|
77
|
+
cards: ((currentWalletPass == null ? void 0 : currentWalletPass.cards) || []).map((item) => {
|
|
78
|
+
return {
|
|
79
|
+
...item,
|
|
80
|
+
metadata: {
|
|
81
|
+
...item.metadata || {},
|
|
82
|
+
unique_payment_number: (0, import_utils.getUniqueId)()
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
})
|
|
86
|
+
};
|
|
87
|
+
};
|
|
73
88
|
// Annotate the CommonJS export names for ESM import in node:
|
|
74
89
|
0 && (module.exports = {
|
|
75
90
|
formatMachineCodeServer2CardList,
|
|
91
|
+
formatWalletPassWithUniquePaymentNumber,
|
|
76
92
|
getDataByIds,
|
|
77
93
|
getIsWalletCode
|
|
78
94
|
});
|
|
@@ -81,7 +81,7 @@ var PaymentMethods = (props, ref) => {
|
|
|
81
81
|
const GlobePayWxH5Ref2 = (0, import_react.useRef)(null);
|
|
82
82
|
const GlobePayQrcodeRef2 = (0, import_react.useRef)(null);
|
|
83
83
|
const context = (0, import_useEngineContext.default)();
|
|
84
|
-
const { interaction } = (_a = context.appHelper) == null ? void 0 : _a.utils;
|
|
84
|
+
const { interaction, token } = ((_a = context.appHelper) == null ? void 0 : _a.utils) || {};
|
|
85
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
86
|
const shop = ((_g = (_f = dvaStore == null ? void 0 : dvaStore.core) == null ? void 0 : _f.core) == null ? void 0 : _g.shop) || {};
|
|
87
87
|
const shopName = (shop == null ? void 0 : shop.name) || "";
|
|
@@ -103,6 +103,7 @@ var PaymentMethods = (props, ref) => {
|
|
|
103
103
|
if (cards && (waitAmount <= 0 || isOfflinePayment(type))) {
|
|
104
104
|
try {
|
|
105
105
|
await (0, import_serve.walletPassPay)((0, import_utils.formatWalletPassParams)(payGroup));
|
|
106
|
+
await (0, import_payGroup.clearStashPayGroup)(payGroup.order_id);
|
|
106
107
|
(0, import_payGroup.syncPayGroupToStorage)({
|
|
107
108
|
...payGroup,
|
|
108
109
|
walletPass: {
|
|
@@ -133,6 +134,7 @@ var PaymentMethods = (props, ref) => {
|
|
|
133
134
|
if (waitAmount <= 0) {
|
|
134
135
|
try {
|
|
135
136
|
(0, import_payGroup.removePayGroupFromStorage)(payGroup.order_id);
|
|
137
|
+
await (0, import_payGroup.clearStashPayGroup)(payGroup.order_id);
|
|
136
138
|
props.payCallback({ key: "success" });
|
|
137
139
|
} catch (err) {
|
|
138
140
|
(0, import_utils2.sendWarningLog)({
|
|
@@ -157,12 +159,15 @@ var PaymentMethods = (props, ref) => {
|
|
|
157
159
|
if (!(0, import_utils2.isJson)(strResult)) return;
|
|
158
160
|
const result = JSON.parse(strResult);
|
|
159
161
|
const { type, pay_number, order_id } = result;
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
162
|
+
void (async () => {
|
|
163
|
+
var _a3;
|
|
164
|
+
if (type && order_id && pay_number) {
|
|
165
|
+
await (0, import_payGroup.setPayNumber)(order_id, pay_number, (_a3 = token == null ? void 0 : token.get) == null ? void 0 : _a3.call(token));
|
|
166
|
+
}
|
|
167
|
+
props.payCallback({
|
|
168
|
+
key: "success"
|
|
169
|
+
});
|
|
170
|
+
})();
|
|
166
171
|
});
|
|
167
172
|
}
|
|
168
173
|
}, []);
|
|
@@ -197,7 +197,11 @@ var ToCPay = (props, ref) => {
|
|
|
197
197
|
(item) => {
|
|
198
198
|
return {
|
|
199
199
|
...item,
|
|
200
|
-
customer_id: customer_id || item.customer_id
|
|
200
|
+
customer_id: customer_id || item.customer_id,
|
|
201
|
+
metadata: {
|
|
202
|
+
...item.metadata || {},
|
|
203
|
+
unique_payment_number: (0, import_utils.getUniqueId)()
|
|
204
|
+
}
|
|
201
205
|
};
|
|
202
206
|
}
|
|
203
207
|
);
|
|
@@ -53,6 +53,7 @@ declare const _default: {
|
|
|
53
53
|
'tocPay.text.continuePay': string;
|
|
54
54
|
'tocPay.text.leave': string;
|
|
55
55
|
'tocPay.text.getParamsFail': string;
|
|
56
|
+
'tocPay.text.payGroupStashFail': string;
|
|
56
57
|
'tocPay.text.checkingCard': string;
|
|
57
58
|
'tocPay.text.processingPayment': string;
|
|
58
59
|
'tocPay.text.securityCheckRequired': string;
|
|
@@ -178,6 +179,7 @@ declare const _default: {
|
|
|
178
179
|
'tocPay.text.continuePay': string;
|
|
179
180
|
'tocPay.text.leave': string;
|
|
180
181
|
'tocPay.text.getParamsFail': string;
|
|
182
|
+
'tocPay.text.payGroupStashFail': string;
|
|
181
183
|
'tocPay.text.checkingCard': string;
|
|
182
184
|
'tocPay.text.processingPayment': string;
|
|
183
185
|
'tocPay.text.securityCheckRequired': string;
|
|
@@ -302,6 +304,7 @@ declare const _default: {
|
|
|
302
304
|
'tocPay.text.continuePay': string;
|
|
303
305
|
'tocPay.text.leave': string;
|
|
304
306
|
'tocPay.text.getParamsFail': string;
|
|
307
|
+
'tocPay.text.payGroupStashFail': string;
|
|
305
308
|
'tocPay.text.checkingCard': string;
|
|
306
309
|
'tocPay.text.processingPayment': string;
|
|
307
310
|
'tocPay.text.securityCheckRequired': string;
|
|
@@ -426,6 +429,7 @@ declare const _default: {
|
|
|
426
429
|
'tocPay.text.continuePay': string;
|
|
427
430
|
'tocPay.text.leave': string;
|
|
428
431
|
'tocPay.text.getParamsFail': string;
|
|
432
|
+
'tocPay.text.payGroupStashFail': string;
|
|
429
433
|
'tocPay.text.checkingCard': string;
|
|
430
434
|
'tocPay.text.processingPayment': string;
|
|
431
435
|
'tocPay.text.securityCheckRequired': string;
|
|
@@ -551,6 +555,7 @@ declare const _default: {
|
|
|
551
555
|
'tocPay.text.continuePay': string;
|
|
552
556
|
'tocPay.text.leave': string;
|
|
553
557
|
'tocPay.text.getParamsFail': string;
|
|
558
|
+
'tocPay.text.payGroupStashFail': string;
|
|
554
559
|
'tocPay.text.checkingCard': string;
|
|
555
560
|
'tocPay.text.processingPayment': string;
|
|
556
561
|
'tocPay.text.securityCheckRequired': string;
|
|
@@ -77,6 +77,7 @@ var locales_default = {
|
|
|
77
77
|
"tocPay.text.continuePay": "Continue to pay",
|
|
78
78
|
"tocPay.text.leave": "Leave",
|
|
79
79
|
"tocPay.text.getParamsFail": "Failed to obtain payment parameters",
|
|
80
|
+
"tocPay.text.payGroupStashFail": "Failed to sync payment information. Please try again.",
|
|
80
81
|
"tocPay.text.checkingCard": "Checking your card...",
|
|
81
82
|
"tocPay.text.processingPayment": "Processing your payment…",
|
|
82
83
|
"tocPay.text.securityCheckRequired": "A security check may be required.",
|
|
@@ -202,6 +203,7 @@ var locales_default = {
|
|
|
202
203
|
"tocPay.text.continuePay": "继续支付",
|
|
203
204
|
"tocPay.text.leave": "离开",
|
|
204
205
|
"tocPay.text.getParamsFail": "获取支付参数失败",
|
|
206
|
+
"tocPay.text.payGroupStashFail": "支付信息同步失败,请重试",
|
|
205
207
|
"tocPay.text.checkingCard": "正在检查您的卡片…",
|
|
206
208
|
"tocPay.text.processingPayment": "正在处理中…",
|
|
207
209
|
"tocPay.text.securityCheckRequired": "可能需要完成银行安全验证。",
|
|
@@ -326,6 +328,7 @@ var locales_default = {
|
|
|
326
328
|
"tocPay.text.continuePay": "繼續支付",
|
|
327
329
|
"tocPay.text.leave": "離開",
|
|
328
330
|
"tocPay.text.getParamsFail": "取得支付參數失敗",
|
|
331
|
+
"tocPay.text.payGroupStashFail": "支付資料同步失敗,請重試",
|
|
329
332
|
"tocPay.text.checkingCard": "正在檢查您的卡片…",
|
|
330
333
|
"tocPay.text.processingPayment": "正在處理中…",
|
|
331
334
|
"tocPay.text.securityCheckRequired": "可能需要完成銀行安全驗證。",
|
|
@@ -450,6 +453,7 @@ var locales_default = {
|
|
|
450
453
|
"tocPay.text.continuePay": "支払いを続行",
|
|
451
454
|
"tocPay.text.leave": "離れる",
|
|
452
455
|
"tocPay.text.getParamsFail": "支払いパラメータの取得に失敗しました",
|
|
456
|
+
"tocPay.text.payGroupStashFail": "支払い情報の同期に失敗しました。もう一度お試しください。",
|
|
453
457
|
"tocPay.text.checkingCard": "カードを確認しています…",
|
|
454
458
|
"tocPay.text.processingPayment": "お支払いを処理中…",
|
|
455
459
|
"tocPay.text.securityCheckRequired": "セキュリティチェックが必要になる場合があります。",
|
|
@@ -575,6 +579,7 @@ var locales_default = {
|
|
|
575
579
|
"tocPay.text.continuePay": "Continuar a pagar",
|
|
576
580
|
"tocPay.text.leave": "Sair",
|
|
577
581
|
"tocPay.text.getParamsFail": "Falha ao obter parâmetros de pagamento",
|
|
582
|
+
"tocPay.text.payGroupStashFail": "Falha ao sincronizar as informações de pagamento. Tente novamente.",
|
|
578
583
|
"tocPay.text.checkingCard": "Verificando seu cartão...",
|
|
579
584
|
"tocPay.text.processingPayment": "Processando seu pagamento…",
|
|
580
585
|
"tocPay.text.securityCheckRequired": "Uma verificação de segurança pode ser necessária.",
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
export interface FormState {
|
|
3
2
|
platform: 'pc' | 'h5' | '' | undefined;
|
|
4
3
|
order: any;
|
|
@@ -30,11 +29,4 @@ export interface PayGroup {
|
|
|
30
29
|
_order: any;
|
|
31
30
|
front_order_uuid?: string;
|
|
32
31
|
}
|
|
33
|
-
export declare const Provider:
|
|
34
|
-
state: FormState;
|
|
35
|
-
} & {
|
|
36
|
-
dispatch: (params: {
|
|
37
|
-
type: string;
|
|
38
|
-
payload: any;
|
|
39
|
-
}) => void;
|
|
40
|
-
}>;
|
|
32
|
+
export declare const Provider: any, Context: any;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { PayGroup } from './model';
|
|
2
|
+
/**
|
|
3
|
+
* 生成 `/h5/core/stash` 的 token:前缀 + 订单号
|
|
4
|
+
*/
|
|
5
|
+
export declare const buildPayGroupStashToken: (orderId: string) => string;
|
|
2
6
|
/**
|
|
3
7
|
* @title: 同步交易组到storage
|
|
4
8
|
* @description:
|
|
@@ -38,11 +42,18 @@ export declare const removePayGroupFromStorage: (orderId: string) => void;
|
|
|
38
42
|
export declare const getPayGroupParamsFromStorage: (orderId: string, rest?: any) => any;
|
|
39
43
|
/**
|
|
40
44
|
* @title: 通过订单id设置交易号
|
|
41
|
-
* @description:
|
|
45
|
+
* @description: 合并 pay_number 后调用 `/h5/core/stash` 最多 3 次;无论 stash 成败均写入 localStorage
|
|
42
46
|
* @param {string} orderId
|
|
43
47
|
* @param {string} payNumber
|
|
44
|
-
* @
|
|
48
|
+
* @param {string} [token] 引擎 utils.token.get(),写入 stash 的 data.token
|
|
45
49
|
* @Author: zhiwei.Wang
|
|
46
50
|
* @Date: 2024-08-16 10:41
|
|
47
51
|
*/
|
|
48
|
-
export declare const setPayNumber: (orderId: string, payNumber: string) => void
|
|
52
|
+
export declare const setPayNumber: (orderId: string, payNumber: string, token?: string) => Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* @title: 清除服务端暂存
|
|
55
|
+
* @description:
|
|
56
|
+
* @param {string} orderId
|
|
57
|
+
* @return {*}
|
|
58
|
+
*/
|
|
59
|
+
export declare const clearStashPayGroup: (orderId: string) => Promise<void>;
|
|
@@ -19,6 +19,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
// src/components/pay/toC/payGroup.ts
|
|
20
20
|
var payGroup_exports = {};
|
|
21
21
|
__export(payGroup_exports, {
|
|
22
|
+
buildPayGroupStashToken: () => buildPayGroupStashToken,
|
|
23
|
+
clearStashPayGroup: () => clearStashPayGroup,
|
|
22
24
|
getPayGroupFromStorage: () => getPayGroupFromStorage,
|
|
23
25
|
getPayGroupParamsFromStorage: () => getPayGroupParamsFromStorage,
|
|
24
26
|
removePayGroupFromStorage: () => removePayGroupFromStorage,
|
|
@@ -26,10 +28,50 @@ __export(payGroup_exports, {
|
|
|
26
28
|
syncPayGroupToStorage: () => syncPayGroupToStorage
|
|
27
29
|
});
|
|
28
30
|
module.exports = __toCommonJS(payGroup_exports);
|
|
31
|
+
var import_serve = require("./serve");
|
|
29
32
|
var STORAGE_KEY = "payGroup";
|
|
33
|
+
var STASH_RETRY_DELAY_MS = 400;
|
|
34
|
+
var STASH_MAX_ATTEMPTS = 3;
|
|
35
|
+
var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
30
36
|
var createPayGroupKey = (orderId) => {
|
|
31
37
|
return `${STORAGE_KEY}_${orderId}`;
|
|
32
38
|
};
|
|
39
|
+
var buildPayGroupStashToken = (orderId) => {
|
|
40
|
+
return `payGroup_stash_${orderId}`;
|
|
41
|
+
};
|
|
42
|
+
var formatWalletCards = (cards) => {
|
|
43
|
+
return cards.map((card) => {
|
|
44
|
+
return {
|
|
45
|
+
id: card.id,
|
|
46
|
+
available_max_amount: card.actualDeduction ?? card.available_max_amount,
|
|
47
|
+
available_max_par_value: card.available_max_par_value,
|
|
48
|
+
tag: card.tag,
|
|
49
|
+
wallet_pass_usage_unit: card.wallet_pass_usage_unit,
|
|
50
|
+
metadata: card.metadata
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
var stashPayGroupWithRetry = async (payGroup, orderId, tokenStr) => {
|
|
55
|
+
var _a;
|
|
56
|
+
const token = buildPayGroupStashToken(orderId);
|
|
57
|
+
for (let attempt = 0; attempt < STASH_MAX_ATTEMPTS; attempt++) {
|
|
58
|
+
try {
|
|
59
|
+
await (0, import_serve.postCoreStash)({ token, data: { ...payGroup, token: tokenStr, orderDetail: void 0, otherPayment: void 0, walletPass: {
|
|
60
|
+
...(payGroup == null ? void 0 : payGroup.walletPass) || {},
|
|
61
|
+
noApplicableVoucher: [],
|
|
62
|
+
transformList: [],
|
|
63
|
+
cards: formatWalletCards(((_a = payGroup == null ? void 0 : payGroup.walletPass) == null ? void 0 : _a.cards) || [])
|
|
64
|
+
} }, ttl: 3600 });
|
|
65
|
+
return true;
|
|
66
|
+
} catch {
|
|
67
|
+
if (attempt === STASH_MAX_ATTEMPTS - 1) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
await delay(STASH_RETRY_DELAY_MS);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return false;
|
|
74
|
+
};
|
|
33
75
|
var syncPayGroupToStorage = (payGroup) => {
|
|
34
76
|
localStorage.setItem(createPayGroupKey(payGroup.order_id), JSON.stringify(payGroup));
|
|
35
77
|
};
|
|
@@ -60,15 +102,29 @@ var getPayGroupParamsFromStorage = (orderId, rest) => {
|
|
|
60
102
|
}
|
|
61
103
|
return null;
|
|
62
104
|
};
|
|
63
|
-
var setPayNumber = (orderId, payNumber) => {
|
|
105
|
+
var setPayNumber = async (orderId, payNumber, token) => {
|
|
64
106
|
const payGroup = getPayGroupFromStorage(orderId);
|
|
65
|
-
if (payGroup) {
|
|
66
|
-
|
|
67
|
-
|
|
107
|
+
if (!payGroup || !orderId) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const merged = { ...payGroup, pay_number: payNumber };
|
|
111
|
+
await stashPayGroupWithRetry(merged, orderId, token);
|
|
112
|
+
syncPayGroupToStorage(merged);
|
|
113
|
+
};
|
|
114
|
+
var clearStashPayGroup = async (orderId) => {
|
|
115
|
+
const token = buildPayGroupStashToken(orderId);
|
|
116
|
+
try {
|
|
117
|
+
await (0, import_serve.postCoreStash)({ token, data: {
|
|
118
|
+
status: "done"
|
|
119
|
+
}, ttl: 3600 });
|
|
120
|
+
} catch (err) {
|
|
121
|
+
console.error("清除服务端暂存失败", err);
|
|
68
122
|
}
|
|
69
123
|
};
|
|
70
124
|
// Annotate the CommonJS export names for ESM import in node:
|
|
71
125
|
0 && (module.exports = {
|
|
126
|
+
buildPayGroupStashToken,
|
|
127
|
+
clearStashPayGroup,
|
|
72
128
|
getPayGroupFromStorage,
|
|
73
129
|
getPayGroupParamsFromStorage,
|
|
74
130
|
removePayGroupFromStorage,
|
|
@@ -72,3 +72,16 @@ export declare const checkPendingPayment: (values: {
|
|
|
72
72
|
}) => Promise<{
|
|
73
73
|
has_pending: boolean;
|
|
74
74
|
}>;
|
|
75
|
+
/** `/h5/core/stash` 请求体 */
|
|
76
|
+
export interface CoreStashParams {
|
|
77
|
+
/** 缓存 key,由前端生成 */
|
|
78
|
+
token: string;
|
|
79
|
+
/** 暂存数据,如完整 PayGroup */
|
|
80
|
+
data: unknown;
|
|
81
|
+
/** 生命周期(秒),默认 86400(1 天) */
|
|
82
|
+
ttl?: number;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* 调用服务端暂存接口,写入 payGroup 等数据。
|
|
86
|
+
*/
|
|
87
|
+
export declare const postCoreStash: (params: CoreStashParams) => Promise<void>;
|
|
@@ -24,7 +24,8 @@ __export(serve_exports, {
|
|
|
24
24
|
getPaymentList: () => getPaymentList,
|
|
25
25
|
getPaymentResult: () => getPaymentResult,
|
|
26
26
|
getPaymentsAndWalletPass: () => getPaymentsAndWalletPass,
|
|
27
|
-
getWalletNameAndPopupStatus: () => getWalletNameAndPopupStatus
|
|
27
|
+
getWalletNameAndPopupStatus: () => getWalletNameAndPopupStatus,
|
|
28
|
+
postCoreStash: () => postCoreStash
|
|
28
29
|
});
|
|
29
30
|
module.exports = __toCommonJS(serve_exports);
|
|
30
31
|
var import_utils = require("../../../utils");
|
|
@@ -86,6 +87,14 @@ var checkPendingPayment = async (values) => {
|
|
|
86
87
|
}
|
|
87
88
|
return { has_pending: false };
|
|
88
89
|
};
|
|
90
|
+
var postCoreStash = async (params) => {
|
|
91
|
+
const body = {
|
|
92
|
+
token: params.token,
|
|
93
|
+
data: params.data,
|
|
94
|
+
ttl: params.ttl ?? 86400
|
|
95
|
+
};
|
|
96
|
+
await import_utils.request.getRequest().post("/h5/core/stash", body, {});
|
|
97
|
+
};
|
|
89
98
|
// Annotate the CommonJS export names for ESM import in node:
|
|
90
99
|
0 && (module.exports = {
|
|
91
100
|
checkPendingPayment,
|
|
@@ -93,5 +102,6 @@ var checkPendingPayment = async (values) => {
|
|
|
93
102
|
getPaymentList,
|
|
94
103
|
getPaymentResult,
|
|
95
104
|
getPaymentsAndWalletPass,
|
|
96
|
-
getWalletNameAndPopupStatus
|
|
105
|
+
getWalletNameAndPopupStatus,
|
|
106
|
+
postCoreStash
|
|
97
107
|
});
|
|
@@ -60,12 +60,16 @@ var formatWalletPassList2PreparePayments = (list) => {
|
|
|
60
60
|
var formatWalletPassParams = (payGroup) => {
|
|
61
61
|
const { order_id, payment_group_id, walletPass } = payGroup;
|
|
62
62
|
const payments = (walletPass == null ? void 0 : walletPass.cards.map((item) => {
|
|
63
|
+
var _a;
|
|
63
64
|
return {
|
|
64
65
|
amount: getAvailableMaxAmount(item),
|
|
65
66
|
wallet_pass_use_value: item.recommended_usage_par_value,
|
|
66
67
|
voucher_id: item.id,
|
|
67
68
|
tag: item.tag,
|
|
68
|
-
wallet_pass_usage_unit: item.wallet_pass_usage_unit
|
|
69
|
+
wallet_pass_usage_unit: item.wallet_pass_usage_unit,
|
|
70
|
+
metadata: {
|
|
71
|
+
unique_payment_number: (_a = item.metadata) == null ? void 0 : _a.unique_payment_number
|
|
72
|
+
}
|
|
69
73
|
};
|
|
70
74
|
})) || [];
|
|
71
75
|
return {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { CalendarDataItem, ScheduleItem } from "./type";
|
|
3
2
|
import dayjs from "dayjs";
|
|
4
3
|
export interface FormState {
|
|
@@ -69,11 +68,4 @@ export interface FormState {
|
|
|
69
68
|
};
|
|
70
69
|
setGlobalState: Function | null;
|
|
71
70
|
}
|
|
72
|
-
export declare const Provider:
|
|
73
|
-
state: FormState;
|
|
74
|
-
} & {
|
|
75
|
-
dispatch: (params: {
|
|
76
|
-
type: string;
|
|
77
|
-
payload: any;
|
|
78
|
-
}) => void;
|
|
79
|
-
}>;
|
|
71
|
+
export declare const Provider: any, Context: any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pisell/private-materials",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.94",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"module": "./es/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -77,9 +77,9 @@
|
|
|
77
77
|
"react-resizable": "^3.0.5",
|
|
78
78
|
"styled-components": "^6.0.0-rc.3",
|
|
79
79
|
"@pisell/utils": "3.0.2",
|
|
80
|
+
"@pisell/icon": "0.0.11",
|
|
80
81
|
"@pisell/materials": "3.3.92",
|
|
81
|
-
"@pisell/date-picker": "3.0.4"
|
|
82
|
-
"@pisell/icon": "0.0.11"
|
|
82
|
+
"@pisell/date-picker": "3.0.4"
|
|
83
83
|
},
|
|
84
84
|
"peerDependencies": {
|
|
85
85
|
"react": "^18.0.0",
|