@pisell/private-materials 6.3.123 → 6.3.125
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 +4 -4
- package/build/lowcode/render/default/view.js +4 -4
- package/build/lowcode/view.js +4 -4
- package/es/components/booking/addons/model.d.ts +10 -1
- 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/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/eftposPay/amount.js +15 -1
- package/es/components/eftposPay/app.js +2 -1
- package/es/components/eftposPay/component/fail/failCustom.js +12 -4
- package/es/components/eftposPay/component/fail/index.js +14 -6
- package/es/components/eftposPay/component/fail/network.js +3 -0
- package/es/components/eftposPay/component/fail/unknow.js +8 -0
- package/es/components/eftposPay/component/manual/index.js +13 -1
- package/es/components/eftposPay/component/signature/index.js +3 -0
- package/es/components/eftposPay/device.js +33 -22
- package/es/components/eftposPay/index.js +48 -11
- package/es/components/eftposPay/linkly/hooks/normal.js +21 -68
- package/es/components/eftposPay/linkly/hooks/useTimeQuery.js +20 -81
- package/es/components/eftposPay/linkly/index.js +10 -23
- package/es/components/eftposPay/pay.js +14 -7
- package/es/components/eftposPay/payo/config.js +38 -5
- package/es/components/eftposPay/payo/hooks.js +3 -12
- package/es/components/eftposPay/payo/payment.js +69 -136
- package/es/components/eftposPay/tip.js +5 -0
- package/es/components/eftposPay/tyro/hooks.d.ts +0 -1
- package/es/components/eftposPay/tyro/index.js +44 -11
- package/es/components/eftposPay/utils/payLog.d.ts +81 -0
- package/es/components/eftposPay/utils/payLog.js +430 -0
- package/es/components/eftposPay/windcave/receiptAction.js +5 -0
- package/es/components/eftposPay/windcave/windcave.js +28 -29
- 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/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/WalletPass/index.d.ts +0 -5
- package/es/components/pay/toC/PaymentMethods/WalletPass/index.js +142 -165
- package/es/components/pay/toC/PaymentMethods/WalletPass/serve.d.ts +0 -6
- package/es/components/pay/toC/PaymentMethods/WalletPass/utils.js +3 -3
- package/es/components/pay/toC/WalletPassBlock/index.js +1 -3
- package/es/components/pay/toC/index.js +31 -65
- package/es/components/pay/toC/model.d.ts +9 -2
- package/es/components/pay/toC/serve.d.ts +0 -18
- package/es/components/pay/toC/serve.js +15 -42
- package/es/components/pay/toC/utils.d.ts +2 -2
- package/es/components/pay/toC/utils.js +0 -4
- 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/selectHolder/components/ErrorTip/index.d.ts +0 -1
- package/es/pro/Login2.0/components/phoneValidation.js +65 -58
- package/lib/components/booking/addons/model.d.ts +10 -1
- 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/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/eftposPay/amount.js +13 -1
- package/lib/components/eftposPay/app.js +2 -1
- package/lib/components/eftposPay/component/fail/failCustom.js +10 -2
- package/lib/components/eftposPay/component/fail/index.js +10 -2
- package/lib/components/eftposPay/component/fail/network.js +3 -0
- package/lib/components/eftposPay/component/fail/unknow.js +8 -0
- package/lib/components/eftposPay/component/manual/index.js +10 -0
- package/lib/components/eftposPay/component/signature/index.js +3 -0
- package/lib/components/eftposPay/device.js +11 -10
- package/lib/components/eftposPay/index.js +36 -11
- package/lib/components/eftposPay/linkly/hooks/normal.js +22 -43
- package/lib/components/eftposPay/linkly/hooks/useTimeQuery.js +13 -65
- package/lib/components/eftposPay/linkly/index.js +7 -10
- package/lib/components/eftposPay/pay.js +9 -1
- package/lib/components/eftposPay/payo/config.js +15 -8
- package/lib/components/eftposPay/payo/hooks.js +12 -10
- package/lib/components/eftposPay/payo/payment.js +31 -65
- package/lib/components/eftposPay/tip.js +5 -0
- package/lib/components/eftposPay/tyro/hooks.d.ts +0 -1
- package/lib/components/eftposPay/tyro/index.js +21 -17
- package/lib/components/eftposPay/utils/payLog.d.ts +81 -0
- package/lib/components/eftposPay/utils/payLog.js +320 -0
- package/lib/components/eftposPay/windcave/receiptAction.js +5 -0
- package/lib/components/eftposPay/windcave/windcave.js +18 -20
- 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/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/WalletPass/index.d.ts +0 -5
- package/lib/components/pay/toC/PaymentMethods/WalletPass/index.js +100 -90
- package/lib/components/pay/toC/PaymentMethods/WalletPass/serve.d.ts +0 -6
- package/lib/components/pay/toC/PaymentMethods/WalletPass/utils.js +2 -2
- package/lib/components/pay/toC/WalletPassBlock/index.js +1 -3
- package/lib/components/pay/toC/index.js +19 -52
- package/lib/components/pay/toC/model.d.ts +9 -2
- package/lib/components/pay/toC/serve.d.ts +0 -18
- package/lib/components/pay/toC/serve.js +0 -6
- package/lib/components/pay/toC/utils.d.ts +2 -2
- package/lib/components/pay/toC/utils.js +2 -6
- 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/selectHolder/components/ErrorTip/index.d.ts +0 -1
- package/lib/pro/Login2.0/components/phoneValidation.js +4 -2
- package/package.json +2 -2
|
@@ -28,6 +28,7 @@ import { useFail, useStoreRef } from "../hooks";
|
|
|
28
28
|
import { useContextData, useDispatch, updateNextStep, updateComponent, updateState, updateCustom } from "../store";
|
|
29
29
|
import { useValidate } from "./hooks";
|
|
30
30
|
import { usePayment, ActionType } from "./payment";
|
|
31
|
+
import payLog from "../utils/payLog";
|
|
31
32
|
|
|
32
33
|
// 注意断网与卸载未完成的回调将终止处理
|
|
33
34
|
export var POS = function POS(_ref) {
|
|
@@ -54,7 +55,7 @@ export var POS = function POS(_ref) {
|
|
|
54
55
|
var fail = useFail(0);
|
|
55
56
|
var failRef = useRef(fail);
|
|
56
57
|
var controllerRef = useRef();
|
|
57
|
-
var clearRef = useRef();
|
|
58
|
+
var clearRef = useRef(null);
|
|
58
59
|
var initRef = useRef(false);
|
|
59
60
|
var unloadRef = useRef(false);
|
|
60
61
|
var _useValidate = useValidate(1000 * 60),
|
|
@@ -197,9 +198,15 @@ export var POS = function POS(_ref) {
|
|
|
197
198
|
// ? api.pay(apiParams, { signal: controllerRef.current.signal })
|
|
198
199
|
// : api.refund(apiParams, { signal: controllerRef.current.signal });
|
|
199
200
|
|
|
200
|
-
|
|
201
|
+
payLog.setContext({
|
|
202
|
+
transactionNumber: numRef.current
|
|
203
|
+
});
|
|
201
204
|
if (isPay) {
|
|
202
205
|
var _deviceRef$current4;
|
|
206
|
+
payLog.log('Payo:发起支付', {
|
|
207
|
+
isPay: isPay,
|
|
208
|
+
number: numRef.current
|
|
209
|
+
});
|
|
203
210
|
paymentRun({
|
|
204
211
|
paymentType: ActionType.Pay,
|
|
205
212
|
paymentNum: numRef.current,
|
|
@@ -208,39 +215,62 @@ export var POS = function POS(_ref) {
|
|
|
208
215
|
params: apiParams,
|
|
209
216
|
callbacks: {
|
|
210
217
|
onSuccess: function onSuccess(res) {
|
|
218
|
+
payLog.log('Payo:支付成功', {
|
|
219
|
+
code: res === null || res === void 0 ? void 0 : res.code
|
|
220
|
+
});
|
|
211
221
|
success(res);
|
|
212
222
|
},
|
|
213
223
|
onError: function onError(err) {
|
|
214
|
-
|
|
224
|
+
payLog.log('Payo:支付失败', {
|
|
225
|
+
code: err === null || err === void 0 ? void 0 : err.code
|
|
226
|
+
});
|
|
215
227
|
failRef.current(err, true);
|
|
216
228
|
}
|
|
217
229
|
}
|
|
218
230
|
});
|
|
219
231
|
return;
|
|
220
232
|
} else {
|
|
233
|
+
payLog.log('Payo:发起退款', {
|
|
234
|
+
isPay: isPay,
|
|
235
|
+
number: numRef.current
|
|
236
|
+
});
|
|
221
237
|
var resultPromise = api.refund(apiParams, {
|
|
222
238
|
signal: controllerRef.current.signal
|
|
223
239
|
});
|
|
224
240
|
resultPromise.then(function (res) {
|
|
225
241
|
console.log('netRef.current111 = ', netRef.current);
|
|
226
242
|
if (unloadRef.current || !netRef.current) {
|
|
243
|
+
payLog.log('Payo:退款拦截', {
|
|
244
|
+
isUnload: unloadRef.current,
|
|
245
|
+
isNet: netRef.current
|
|
246
|
+
});
|
|
227
247
|
return;
|
|
228
248
|
}
|
|
229
249
|
if (res && "".concat(res.code) === '200') {
|
|
250
|
+
payLog.log('Payo:退款成功', {
|
|
251
|
+
res: JSON.stringify(res)
|
|
252
|
+
});
|
|
230
253
|
success(res);
|
|
231
254
|
return;
|
|
232
255
|
}
|
|
233
256
|
return Promise.reject(res);
|
|
234
257
|
}).catch(function (err) {
|
|
235
|
-
console.log('netRef.current222 = ', netRef.current, unloadRef.current, err);
|
|
236
258
|
if (unloadRef.current || !netRef.current) {
|
|
259
|
+
payLog.log('Payo:退款失败拦截', {
|
|
260
|
+
isUnload: unloadRef.current,
|
|
261
|
+
isNet: netRef.current
|
|
262
|
+
});
|
|
237
263
|
return;
|
|
238
264
|
}
|
|
239
|
-
// 支付接口超时 进行支付状态查询(超时或者其它错误)
|
|
240
265
|
if (!(err !== null && err !== void 0 && err.code) || "".concat(err.code) === PayStatus.Timeout) {
|
|
266
|
+
payLog.log('Payo:退款超时,转查询');
|
|
241
267
|
checkApi();
|
|
242
268
|
return;
|
|
243
269
|
}
|
|
270
|
+
payLog.log('Payo:退款失败', {
|
|
271
|
+
code: err === null || err === void 0 ? void 0 : err.code,
|
|
272
|
+
message: err === null || err === void 0 ? void 0 : err.message
|
|
273
|
+
});
|
|
244
274
|
failRef.current(err, true);
|
|
245
275
|
});
|
|
246
276
|
}
|
|
@@ -274,6 +304,7 @@ export var Action = function Action(_ref2) {
|
|
|
274
304
|
useEffect(function () {
|
|
275
305
|
var timer = setTimeout(function () {
|
|
276
306
|
setIsShowCancel(true);
|
|
307
|
+
payLog.log('Payo:30秒后显示取消按钮');
|
|
277
308
|
}, 30 * 1000);
|
|
278
309
|
return function () {
|
|
279
310
|
clearTimeout(timer);
|
|
@@ -286,6 +317,7 @@ export var Action = function Action(_ref2) {
|
|
|
286
317
|
* @Date: 2024-08-20 12:18
|
|
287
318
|
*/
|
|
288
319
|
var onManually = function onManually() {
|
|
320
|
+
payLog.log('Payo:点击手动标记');
|
|
289
321
|
dispatch(updateState({
|
|
290
322
|
manual: {
|
|
291
323
|
title: locales.getText('page.eftpos-pay.text.request.title')(mode),
|
|
@@ -295,6 +327,7 @@ export var Action = function Action(_ref2) {
|
|
|
295
327
|
dispatch(updateComponent('Manual', true));
|
|
296
328
|
};
|
|
297
329
|
var onCancel = function onCancel() {
|
|
330
|
+
payLog.log('Payo:点击取消');
|
|
298
331
|
onChange('fail', {
|
|
299
332
|
number: number,
|
|
300
333
|
uniquePaymentNumber: number,
|
|
@@ -12,7 +12,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
|
12
12
|
import { useCallback, useEffect, useRef } from 'react';
|
|
13
13
|
import { PayStatus } from "../const";
|
|
14
14
|
import { sleep } from "../helper";
|
|
15
|
-
import
|
|
15
|
+
import payLog from "../utils/payLog";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* @title: 循环查询 接口状态
|
|
@@ -112,24 +112,15 @@ export var useValidate = function useValidate(timeout) {
|
|
|
112
112
|
(_controllerRef$curren = controllerRef.current) === null || _controllerRef$curren === void 0 || _controllerRef$curren.abort();
|
|
113
113
|
}, []);
|
|
114
114
|
var run = function run() {
|
|
115
|
-
for (var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
116
|
-
params[_key] = arguments[_key];
|
|
117
|
-
}
|
|
118
115
|
isTimeoutCloseRef.current = false;
|
|
119
116
|
TimeoutRef.current && clearTimeout(TimeoutRef.current);
|
|
120
117
|
// 开启计时
|
|
121
118
|
TimeoutRef.current = setTimeout(function () {
|
|
122
119
|
isTimeoutCloseRef.current = true;
|
|
123
|
-
|
|
124
|
-
title: '支付状态查询超时',
|
|
125
|
-
content: [{
|
|
126
|
-
key: 'params',
|
|
127
|
-
value: JSON.stringify(params)
|
|
128
|
-
}]
|
|
129
|
-
});
|
|
120
|
+
payLog.log('Payo:支付状态查询超时');
|
|
130
121
|
close();
|
|
131
122
|
}, timeout);
|
|
132
|
-
return checkApi.apply(void 0,
|
|
123
|
+
return checkApi.apply(void 0, arguments);
|
|
133
124
|
};
|
|
134
125
|
useEffect(function () {
|
|
135
126
|
return function () {
|
|
@@ -7,7 +7,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
|
|
|
7
7
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
8
8
|
import { useRef } from 'react';
|
|
9
9
|
import { PayStatus } from "../const";
|
|
10
|
-
import
|
|
10
|
+
import payLog from "../utils/payLog";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* 实现支付和查询一体化的接口
|
|
@@ -131,9 +131,8 @@ export var usePayment = function usePayment(options) {
|
|
|
131
131
|
*/
|
|
132
132
|
var finish = function finish() {
|
|
133
133
|
if (!isFinishedRef.current) {
|
|
134
|
-
clean();
|
|
135
|
-
isFinishedRef.current = true;
|
|
136
|
-
paymentLog.clearLogs();
|
|
134
|
+
clean();
|
|
135
|
+
isFinishedRef.current = true;
|
|
137
136
|
}
|
|
138
137
|
};
|
|
139
138
|
|
|
@@ -143,17 +142,14 @@ export var usePayment = function usePayment(options) {
|
|
|
143
142
|
var handleFinalSuccess = function handleFinalSuccess(res, type) {
|
|
144
143
|
var _callbacksRef$current, _callbacksRef$current2;
|
|
145
144
|
if (isFinishedRef.current || !shouldContinue()) {
|
|
146
|
-
|
|
145
|
+
payLog.log("handleFinalSuccess: \u5DF2\u5B8C\u6210\u6216\u4E0D\u5E94\u7EE7\u7EED\u5904\u7406\uFF0C\u5FFD\u7565".concat(type, "\u64CD\u4F5C\u6210\u529F\u7ED3\u679C"));
|
|
147
146
|
return;
|
|
148
147
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
content: {
|
|
153
|
-
type: type,
|
|
154
|
-
res: res
|
|
155
|
-
}
|
|
148
|
+
payLog.log('接口最终结果:支付成功', {
|
|
149
|
+
type: type,
|
|
150
|
+
res: res
|
|
156
151
|
});
|
|
152
|
+
(_callbacksRef$current = callbacksRef.current) === null || _callbacksRef$current === void 0 || (_callbacksRef$current2 = _callbacksRef$current.onSuccess) === null || _callbacksRef$current2 === void 0 || _callbacksRef$current2.call(_callbacksRef$current, res);
|
|
157
153
|
finish();
|
|
158
154
|
};
|
|
159
155
|
|
|
@@ -165,17 +161,14 @@ export var usePayment = function usePayment(options) {
|
|
|
165
161
|
var handleFinalError = function handleFinalError(error, type) {
|
|
166
162
|
var _callbacksRef$current3, _callbacksRef$current4;
|
|
167
163
|
if (isFinishedRef.current || !shouldContinue()) {
|
|
168
|
-
|
|
164
|
+
payLog.log("handleFinalError: \u5DF2\u5B8C\u6210\u6216\u4E0D\u5E94\u7EE7\u7EED\u5904\u7406\uFF0C\u5FFD\u7565".concat(type, "\u64CD\u4F5C\u9519\u8BEF"));
|
|
169
165
|
return;
|
|
170
166
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
content: {
|
|
175
|
-
type: type,
|
|
176
|
-
error: error
|
|
177
|
-
}
|
|
167
|
+
payLog.log('接口最终结果:支付失败', {
|
|
168
|
+
type: type,
|
|
169
|
+
error: error
|
|
178
170
|
});
|
|
171
|
+
(_callbacksRef$current3 = callbacksRef.current) === null || _callbacksRef$current3 === void 0 || (_callbacksRef$current4 = _callbacksRef$current3.onError) === null || _callbacksRef$current4 === void 0 || _callbacksRef$current4.call(_callbacksRef$current3, error);
|
|
179
172
|
finish();
|
|
180
173
|
};
|
|
181
174
|
|
|
@@ -185,7 +178,7 @@ export var usePayment = function usePayment(options) {
|
|
|
185
178
|
var createTimeoutPromise = function createTimeoutPromise(timeoutMs) {
|
|
186
179
|
return new Promise(function (_, reject) {
|
|
187
180
|
requestTimeoutTimerRef.current = setTimeout(function () {
|
|
188
|
-
|
|
181
|
+
payLog.log("\u23F1\uFE0F \u5355\u6B21\u67E5\u8BE2\u8D85\u65F6\uFF08".concat(timeoutMs / 1000, "\u79D2\uFF09\uFF0C\u5F3A\u5236\u7EC8\u6B62"));
|
|
189
182
|
isRequestTimeoutRef.current = true;
|
|
190
183
|
// 取消请求
|
|
191
184
|
if (queryControllerRef.current) {
|
|
@@ -209,9 +202,7 @@ export var usePayment = function usePayment(options) {
|
|
|
209
202
|
_context.next = 3;
|
|
210
203
|
break;
|
|
211
204
|
}
|
|
212
|
-
|
|
213
|
-
title: '支付轮询前置校验:支付已完成或不应继续处理,取消查询'
|
|
214
|
-
});
|
|
205
|
+
payLog.log('支付轮询前置校验:已完成或不应继续,取消查询');
|
|
215
206
|
return _context.abrupt("return");
|
|
216
207
|
case 3:
|
|
217
208
|
// 清理之前的查询控制器和超时定时器
|
|
@@ -235,9 +226,7 @@ export var usePayment = function usePayment(options) {
|
|
|
235
226
|
queryControllerRef.current = new AbortController();
|
|
236
227
|
signal = queryControllerRef.current.signal;
|
|
237
228
|
_context.prev = 10;
|
|
238
|
-
|
|
239
|
-
title: '支付轮询:开始单次查询'
|
|
240
|
-
});
|
|
229
|
+
payLog.log('支付轮询:开始单次查询');
|
|
241
230
|
// 使用 Promise.race 确保超时控制可靠
|
|
242
231
|
_context.next = 14;
|
|
243
232
|
return Promise.race([checkApi({
|
|
@@ -258,42 +247,34 @@ export var usePayment = function usePayment(options) {
|
|
|
258
247
|
_context.next = 19;
|
|
259
248
|
break;
|
|
260
249
|
}
|
|
261
|
-
|
|
262
|
-
title: '支付轮询结果:过期的查询响应,忽略'
|
|
263
|
-
});
|
|
250
|
+
payLog.log('支付轮询结果:过期的查询响应,忽略');
|
|
264
251
|
return _context.abrupt("return");
|
|
265
252
|
case 19:
|
|
266
253
|
if (!(isFinishedRef.current || !shouldContinue())) {
|
|
267
254
|
_context.next = 22;
|
|
268
255
|
break;
|
|
269
256
|
}
|
|
270
|
-
|
|
271
|
-
title: '支付轮询结果:支付已完成或不应继续处理'
|
|
272
|
-
});
|
|
257
|
+
payLog.log('支付轮询结果:已完成或不应继续处理');
|
|
273
258
|
return _context.abrupt("return");
|
|
274
259
|
case 22:
|
|
275
260
|
if (!(_res && "".concat(_res.code) === '200')) {
|
|
276
261
|
_context.next = 26;
|
|
277
262
|
break;
|
|
278
263
|
}
|
|
279
|
-
|
|
280
|
-
title: '支付轮询结果:支付成功'
|
|
281
|
-
});
|
|
264
|
+
payLog.log('支付轮询结果:支付成功');
|
|
282
265
|
handleFinalSuccess(_res, ActionType.Query);
|
|
283
266
|
return _context.abrupt("return");
|
|
284
267
|
case 26:
|
|
285
268
|
// 查询返回失败但没有明确code或超时code,继续轮询
|
|
286
269
|
if (isRequestFailed(_res === null || _res === void 0 ? void 0 : _res.code)) {
|
|
287
270
|
// 有明确错误code,停止轮询
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
content: _res
|
|
271
|
+
payLog.log('支付轮询结果:有明确错误code,停止轮询', {
|
|
272
|
+
code: _res === null || _res === void 0 ? void 0 : _res.code
|
|
291
273
|
});
|
|
292
274
|
handleFinalError(_res, ActionType.Query);
|
|
293
275
|
} else {
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
content: _res
|
|
276
|
+
payLog.log('支付轮询结果:无明确code,继续轮询', {
|
|
277
|
+
code: _res === null || _res === void 0 ? void 0 : _res.code
|
|
297
278
|
});
|
|
298
279
|
scheduleNextQuery(paymentNum);
|
|
299
280
|
}
|
|
@@ -307,15 +288,11 @@ export var usePayment = function usePayment(options) {
|
|
|
307
288
|
clearTimeout(requestTimeoutTimerRef.current);
|
|
308
289
|
requestTimeoutTimerRef.current = null;
|
|
309
290
|
}
|
|
310
|
-
|
|
311
|
-
// 检查是否是过期的响应(新查询的 ID 一定大于旧查询)
|
|
312
291
|
if (!(queryId < currentQueryIdRef.current)) {
|
|
313
292
|
_context.next = 35;
|
|
314
293
|
break;
|
|
315
294
|
}
|
|
316
|
-
|
|
317
|
-
title: '支付轮询结果:error-过期的查询异常,忽略'
|
|
318
|
-
});
|
|
295
|
+
payLog.log('支付轮询结果:error-过期的查询异常,忽略');
|
|
319
296
|
return _context.abrupt("return");
|
|
320
297
|
case 35:
|
|
321
298
|
if (!(isFinishedRef.current || !shouldContinue())) {
|
|
@@ -328,24 +305,20 @@ export var usePayment = function usePayment(options) {
|
|
|
328
305
|
_context.next = 41;
|
|
329
306
|
break;
|
|
330
307
|
}
|
|
331
|
-
|
|
332
|
-
title: '支付轮询结果:error-请求被取消或超时,继续轮询'
|
|
333
|
-
});
|
|
308
|
+
payLog.log('支付轮询结果:error-请求被取消或超时,继续轮询');
|
|
334
309
|
// 注意:这里不增加 queryId,因为 scheduleNextQuery → performQuery 会生成新的 ID
|
|
335
310
|
scheduleNextQuery(paymentNum);
|
|
336
311
|
return _context.abrupt("return");
|
|
337
312
|
case 41:
|
|
338
313
|
// 无明确code或者code是超时或支付超时,继续轮询
|
|
339
314
|
if (isRequestFailed(_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.code)) {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
content: _context.t0
|
|
315
|
+
payLog.log('支付轮询结果:error-有明确错误code,停止轮询', {
|
|
316
|
+
code: _context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.code
|
|
343
317
|
});
|
|
344
318
|
handleFinalError(_context.t0, ActionType.Query);
|
|
345
319
|
} else {
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
content: _context.t0
|
|
320
|
+
payLog.log('支付轮询结果:error-无明确code,继续轮询', {
|
|
321
|
+
code: _context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.code
|
|
349
322
|
});
|
|
350
323
|
scheduleNextQuery(paymentNum);
|
|
351
324
|
}
|
|
@@ -371,9 +344,7 @@ export var usePayment = function usePayment(options) {
|
|
|
371
344
|
clearTimeout(queryIntervalTimerRef.current);
|
|
372
345
|
}
|
|
373
346
|
queryIntervalTimerRef.current = setTimeout(function () {
|
|
374
|
-
|
|
375
|
-
title: '支付轮询:安排下一次查询'
|
|
376
|
-
});
|
|
347
|
+
payLog.log('支付轮询:安排下一次查询');
|
|
377
348
|
performQuery(paymentNum);
|
|
378
349
|
}, QUERY_INTERVAL);
|
|
379
350
|
};
|
|
@@ -393,9 +364,7 @@ export var usePayment = function usePayment(options) {
|
|
|
393
364
|
return;
|
|
394
365
|
}
|
|
395
366
|
console.log('⏱️ 轮询全局超时(2分钟),终止所有请求');
|
|
396
|
-
|
|
397
|
-
title: '轮询全局超时(2分钟),终止所有请求'
|
|
398
|
-
});
|
|
367
|
+
payLog.log('轮询全局超时(2分钟),终止所有请求');
|
|
399
368
|
handleFinalError({
|
|
400
369
|
code: PayStatus.Timeout,
|
|
401
370
|
message: '交易超时'
|
|
@@ -416,15 +385,7 @@ export var usePayment = function usePayment(options) {
|
|
|
416
385
|
_options$paymentType = options.paymentType, paymentType = _options$paymentType === void 0 ? ActionType.Pay : _options$paymentType, params = options.params, paymentNum = options.paymentNum, callbacks = options.callbacks; // 生成本次执行的唯一ID(使用时间戳)
|
|
417
386
|
runId = Date.now();
|
|
418
387
|
currentRunIdRef.current = runId;
|
|
419
|
-
_ref4 = params || {}, pay_param_base64 = _ref4.pay_param_base64, otherParams = _objectWithoutProperties(_ref4, _excluded);
|
|
420
|
-
paymentLog.init(paymentNum, {
|
|
421
|
-
orderId: options === null || options === void 0 ? void 0 : options.orderId,
|
|
422
|
-
deviceId: options === null || options === void 0 ? void 0 : options.deviceId,
|
|
423
|
-
paymentType: "PAYO_".concat(paymentType),
|
|
424
|
-
params: otherParams
|
|
425
|
-
});
|
|
426
|
-
|
|
427
|
-
// 先标记为已完成,阻止旧的请求响应被处理
|
|
388
|
+
_ref4 = params || {}, pay_param_base64 = _ref4.pay_param_base64, otherParams = _objectWithoutProperties(_ref4, _excluded); // 先标记为已完成,阻止旧的请求响应被处理
|
|
428
389
|
isFinishedRef.current = true;
|
|
429
390
|
|
|
430
391
|
// 清理资源但保留回调引用(会把 isFinishedRef 重置为 false)
|
|
@@ -437,124 +398,98 @@ export var usePayment = function usePayment(options) {
|
|
|
437
398
|
|
|
438
399
|
// 10秒后开始轮询(全局超时将在开始轮询时启动)
|
|
439
400
|
queryStartTimerRef.current = setTimeout(function () {
|
|
440
|
-
|
|
441
|
-
title: '支付后10秒开始轮询'
|
|
442
|
-
});
|
|
401
|
+
payLog.log('支付后10秒开始轮询');
|
|
443
402
|
startQuery(paymentNum);
|
|
444
403
|
}, QUERY_START_DELAY);
|
|
445
404
|
|
|
446
405
|
// 创建支付请求控制器
|
|
447
406
|
payControllerRef.current = new AbortController();
|
|
448
407
|
signal = payControllerRef.current.signal;
|
|
449
|
-
_context2.prev =
|
|
450
|
-
|
|
451
|
-
title: '发起支付请求'
|
|
452
|
-
});
|
|
408
|
+
_context2.prev = 10;
|
|
409
|
+
payLog.log('发起支付请求');
|
|
453
410
|
resultPromise = paymentType === ActionType.Pay ? payApi : refundApi;
|
|
454
411
|
if (resultPromise) {
|
|
455
|
-
_context2.next =
|
|
412
|
+
_context2.next = 15;
|
|
456
413
|
break;
|
|
457
414
|
}
|
|
458
415
|
throw new Error("".concat(paymentType === ActionType.Pay ? '支付' : '退款', "\u63A5\u53E3\u4E0D\u5B58\u5728"));
|
|
459
|
-
case
|
|
460
|
-
_context2.next =
|
|
416
|
+
case 15:
|
|
417
|
+
_context2.next = 17;
|
|
461
418
|
return resultPromise === null || resultPromise === void 0 ? void 0 : resultPromise(params, {
|
|
462
419
|
signal: signal
|
|
463
420
|
});
|
|
464
|
-
case
|
|
421
|
+
case 17:
|
|
465
422
|
_res2 = _context2.sent;
|
|
466
423
|
if (!(runId < currentRunIdRef.current)) {
|
|
467
|
-
_context2.next =
|
|
424
|
+
_context2.next = 21;
|
|
468
425
|
break;
|
|
469
426
|
}
|
|
470
|
-
|
|
471
|
-
title: '支付响应过期,忽略'
|
|
472
|
-
});
|
|
427
|
+
payLog.log('支付响应过期,忽略');
|
|
473
428
|
return _context2.abrupt("return");
|
|
474
|
-
case
|
|
429
|
+
case 21:
|
|
475
430
|
if (!(isFinishedRef.current || !shouldContinue())) {
|
|
476
|
-
_context2.next =
|
|
431
|
+
_context2.next = 24;
|
|
477
432
|
break;
|
|
478
433
|
}
|
|
479
|
-
|
|
480
|
-
title: '支付返回时已完成或不应继续处理'
|
|
481
|
-
});
|
|
434
|
+
payLog.log('支付返回时已完成或不应继续处理');
|
|
482
435
|
return _context2.abrupt("return");
|
|
483
|
-
case
|
|
436
|
+
case 24:
|
|
484
437
|
if (!(_res2 && "".concat(_res2.code) === '200')) {
|
|
485
|
-
_context2.next =
|
|
438
|
+
_context2.next = 28;
|
|
486
439
|
break;
|
|
487
440
|
}
|
|
488
|
-
|
|
489
|
-
title: '支付接口成功'
|
|
490
|
-
});
|
|
441
|
+
payLog.log('支付接口成功');
|
|
491
442
|
handleFinalSuccess(_res2, paymentType);
|
|
492
443
|
return _context2.abrupt("return");
|
|
493
|
-
case
|
|
444
|
+
case 28:
|
|
494
445
|
// 支付接口返回失败
|
|
495
446
|
// 如果有明确的错误code且不是超时,则直接失败
|
|
496
447
|
if (isRequestFailed(_res2 === null || _res2 === void 0 ? void 0 : _res2.code)) {
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
content: {
|
|
500
|
-
res: _res2
|
|
501
|
-
}
|
|
448
|
+
payLog.log('支付接口返回失败', {
|
|
449
|
+
code: _res2 === null || _res2 === void 0 ? void 0 : _res2.code
|
|
502
450
|
});
|
|
503
451
|
handleFinalError(_res2, ActionType.Pay);
|
|
504
452
|
} else {
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
content: {
|
|
508
|
-
res: _res2
|
|
509
|
-
}
|
|
453
|
+
payLog.log('支付超时或无明确错误,等待轮询结果', {
|
|
454
|
+
code: _res2 === null || _res2 === void 0 ? void 0 : _res2.code
|
|
510
455
|
});
|
|
511
456
|
}
|
|
512
|
-
_context2.next =
|
|
457
|
+
_context2.next = 40;
|
|
513
458
|
break;
|
|
514
|
-
case
|
|
515
|
-
_context2.prev =
|
|
516
|
-
_context2.t0 = _context2["catch"](
|
|
459
|
+
case 31:
|
|
460
|
+
_context2.prev = 31;
|
|
461
|
+
_context2.t0 = _context2["catch"](10);
|
|
517
462
|
if (!(runId < currentRunIdRef.current)) {
|
|
518
|
-
_context2.next =
|
|
463
|
+
_context2.next = 36;
|
|
519
464
|
break;
|
|
520
465
|
}
|
|
521
|
-
|
|
522
|
-
title: '支付响应过期,忽略'
|
|
523
|
-
});
|
|
466
|
+
payLog.log('支付异常响应过期,忽略');
|
|
524
467
|
return _context2.abrupt("return");
|
|
525
|
-
case
|
|
468
|
+
case 36:
|
|
526
469
|
if (!(isFinishedRef.current || !shouldContinue())) {
|
|
527
|
-
_context2.next =
|
|
470
|
+
_context2.next = 39;
|
|
528
471
|
break;
|
|
529
472
|
}
|
|
530
|
-
|
|
531
|
-
title: '支付异常时已完成或不应继续处理'
|
|
532
|
-
});
|
|
473
|
+
payLog.log('支付异常时已完成或不应继续处理');
|
|
533
474
|
return _context2.abrupt("return");
|
|
534
|
-
case
|
|
475
|
+
case 39:
|
|
535
476
|
// 支付接口异常
|
|
536
477
|
// 如果有明确的错误code且不是超时,则直接失败
|
|
537
478
|
if (isRequestFailed(_context2.t0 === null || _context2.t0 === void 0 ? void 0 : _context2.t0.code)) {
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
content: {
|
|
541
|
-
error: _context2.t0
|
|
542
|
-
}
|
|
479
|
+
payLog.log('支付接口异常', {
|
|
480
|
+
code: _context2.t0 === null || _context2.t0 === void 0 ? void 0 : _context2.t0.code
|
|
543
481
|
});
|
|
544
482
|
handleFinalError(_context2.t0, paymentType);
|
|
545
483
|
} else {
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
content: {
|
|
549
|
-
error: _context2.t0
|
|
550
|
-
}
|
|
484
|
+
payLog.log('支付异常超时或无明确错误,等待轮询结果', {
|
|
485
|
+
code: _context2.t0 === null || _context2.t0 === void 0 ? void 0 : _context2.t0.code
|
|
551
486
|
});
|
|
552
487
|
}
|
|
553
|
-
case
|
|
488
|
+
case 40:
|
|
554
489
|
case "end":
|
|
555
490
|
return _context2.stop();
|
|
556
491
|
}
|
|
557
|
-
}, _callee2, null, [[
|
|
492
|
+
}, _callee2, null, [[10, 31]]);
|
|
558
493
|
}));
|
|
559
494
|
return function run(_x2) {
|
|
560
495
|
return _ref3.apply(this, arguments);
|
|
@@ -565,9 +500,7 @@ export var usePayment = function usePayment(options) {
|
|
|
565
500
|
* 手动停止(完全清理,包括回调)
|
|
566
501
|
*/
|
|
567
502
|
var stop = function stop() {
|
|
568
|
-
|
|
569
|
-
title: '手动停止支付流程'
|
|
570
|
-
});
|
|
503
|
+
payLog.log('手动停止支付流程');
|
|
571
504
|
clean(); // 完全清理,包括回调
|
|
572
505
|
isFinishedRef.current = true; // 标记为已完成
|
|
573
506
|
};
|
|
@@ -19,6 +19,7 @@ import { RestoreEumn, EftposEnum } from "./const";
|
|
|
19
19
|
import dayjs from 'dayjs';
|
|
20
20
|
import { useDispatch, useContextData, updateState, updateCustom, updateNextStep } from "./store";
|
|
21
21
|
import { useStoreRef } from "./hooks";
|
|
22
|
+
import payLog from "./utils/payLog";
|
|
22
23
|
import "./tip.less";
|
|
23
24
|
function formatDateUtils(date, format) {
|
|
24
25
|
if (!date) {
|
|
@@ -90,7 +91,11 @@ export default (function (_ref) {
|
|
|
90
91
|
modeRef = _useStoreRef.modeRef,
|
|
91
92
|
amountRef = _useStoreRef.amountRef,
|
|
92
93
|
eftposRef = _useStoreRef.eftposRef;
|
|
94
|
+
useEffect(function () {
|
|
95
|
+
payLog.log('成功确认页展示');
|
|
96
|
+
}, []);
|
|
93
97
|
var onConfirm = function onConfirm() {
|
|
98
|
+
payLog.log('确认支付成功');
|
|
94
99
|
onChangeStatus('success', _objectSpread({}, ref.current || {}));
|
|
95
100
|
};
|
|
96
101
|
|