@pisell/private-materials 6.3.215 → 6.3.216
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/meta.js +1 -1
- package/build/lowcode/render/default/view.js +2 -2
- package/build/lowcode/view.js +2 -2
- package/es/components/eftposPay/aggregatePayment/utils/payment.js +46 -16
- package/es/components/eftposPay/mx51/index.js +4 -25
- package/es/components/eftposPay/mx51/types.js +1 -5
- package/es/index.js +0 -1
- package/es/plus/pisellReservation/data/bookingToReservationTables.js +1 -1
- package/es/plus/pisellReservation/floorMap/floorPlanApi.js +1 -1
- package/es/plus/pisellReservation/floorMap/reservationMock.js +1 -1
- package/es/plus/saasDevice/devicePasscodes/model.js +4 -4
- package/es/plus/walletPassGallery/components/timelineSection/index.js +4 -4
- package/es/private-materials/lowcode/authmodal/meta.d.ts +1 -0
- package/es/pro/Login2.0/AuthModal.d.ts +1 -1
- package/es/pro/Login2.0/index.d.ts +1 -2
- package/es/pro/Login2.0/shared/types.d.ts +1 -1
- package/lib/components/eftposPay/aggregatePayment/utils/payment.js +45 -15
- package/lib/components/eftposPay/mx51/index.js +3 -24
- package/lib/components/eftposPay/mx51/types.js +0 -5
- package/package.json +1 -1
- package/es/plus/pisellReservation/index.js +0 -17
|
@@ -4,7 +4,7 @@ import { _asyncToGenerator } from "../../../../_virtual/_@oxc-project_runtime@0.
|
|
|
4
4
|
import { PayStatus } from "../../const.js";
|
|
5
5
|
import { cloneDeep, getUuid } from "../../helper.js";
|
|
6
6
|
import payLog from "../../utils/payLog.js";
|
|
7
|
-
import { ActionType, EPaymentStatus, QUERY_INTERVAL, QUERY_START_DELAY
|
|
7
|
+
import { ActionType, EPaymentStatus, QUERY_INTERVAL, QUERY_START_DELAY } from "../types.js";
|
|
8
8
|
import { AGPTActionApi, AGPTPayApi, AGPTQueryApi, AGPTRefundActionApi, AGPTRefundApi, AGPTRefundQueryApi } from "../service.js";
|
|
9
9
|
import { locales } from "@pisell/utils";
|
|
10
10
|
//#region src/components/eftposPay/aggregatePayment/utils/payment.ts
|
|
@@ -35,6 +35,7 @@ var PaymentMethod = class {
|
|
|
35
35
|
_defineProperty(this, "callback", void 0);
|
|
36
36
|
_defineProperty(this, "shouldContinue", void 0);
|
|
37
37
|
_defineProperty(this, "config", {});
|
|
38
|
+
_defineProperty(this, "mx51TransactionVersion", void 0);
|
|
38
39
|
_defineProperty(this, "controller", null);
|
|
39
40
|
_defineProperty(this, "queryController", null);
|
|
40
41
|
_defineProperty(this, "queryStartTimer", null);
|
|
@@ -65,22 +66,37 @@ var PaymentMethod = class {
|
|
|
65
66
|
}
|
|
66
67
|
});
|
|
67
68
|
}
|
|
69
|
+
get isMx51() {
|
|
70
|
+
return this.initOptions.paymentCode === "EFTPOS_MX51";
|
|
71
|
+
}
|
|
72
|
+
updateMx51TransactionVersion(res) {
|
|
73
|
+
var _res$data;
|
|
74
|
+
if (!this.isMx51 || `${res === null || res === void 0 ? void 0 : res.code}` !== "200") return;
|
|
75
|
+
const version = res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 || (_res$data = _res$data.external_unified_response) === null || _res$data === void 0 || (_res$data = _res$data.transaction) === null || _res$data === void 0 ? void 0 : _res$data.version;
|
|
76
|
+
if (typeof version !== "number" || !Number.isSafeInteger(version) || version <= 0) return;
|
|
77
|
+
this.mx51TransactionVersion = Math.max(this.mx51TransactionVersion || 0, version);
|
|
78
|
+
}
|
|
79
|
+
isMx51QueryRetry(res) {
|
|
80
|
+
var _res$data2;
|
|
81
|
+
const response = res === null || res === void 0 || (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.external_unified_response;
|
|
82
|
+
return this.isMx51 && (response === null || response === void 0 ? void 0 : response.external_unified_status) === EPaymentStatus.Processing && !(response === null || response === void 0 ? void 0 : response.transaction) && (response === null || response === void 0 ? void 0 : response.external_unified_retry) === true;
|
|
83
|
+
}
|
|
68
84
|
/**
|
|
69
85
|
* 判断请求是否需要等待轮询结果
|
|
70
86
|
* 1. 有明确错误code且不是超时和支付超时,则直接失败
|
|
71
87
|
* @param code 错误码
|
|
72
88
|
*/
|
|
73
89
|
isBusinessFailed(res) {
|
|
74
|
-
var _res$
|
|
75
|
-
const { external_unified_status, response_code } = (res === null || res === void 0 || (_res$
|
|
90
|
+
var _res$data3;
|
|
91
|
+
const { external_unified_status, response_code } = (res === null || res === void 0 || (_res$data3 = res.data) === null || _res$data3 === void 0 ? void 0 : _res$data3.external_unified_response) || {};
|
|
76
92
|
return `${res === null || res === void 0 ? void 0 : res.code}` === "200" && external_unified_status === EPaymentStatus.Failed && response_code !== PayStatus.Timeout && response_code !== PayStatus.PayTimeout;
|
|
77
93
|
}
|
|
78
94
|
/**
|
|
79
95
|
* 判断业务是否成功
|
|
80
96
|
*/
|
|
81
97
|
isBusinessSuccess(res) {
|
|
82
|
-
var _res$
|
|
83
|
-
const { external_unified_status } = (res === null || res === void 0 || (_res$
|
|
98
|
+
var _res$data4;
|
|
99
|
+
const { external_unified_status } = (res === null || res === void 0 || (_res$data4 = res.data) === null || _res$data4 === void 0 ? void 0 : _res$data4.external_unified_response) || {};
|
|
84
100
|
return `${res === null || res === void 0 ? void 0 : res.code}` === "200" && external_unified_status === EPaymentStatus.Success;
|
|
85
101
|
}
|
|
86
102
|
/**
|
|
@@ -243,10 +259,10 @@ var PaymentMethod = class {
|
|
|
243
259
|
* 处理接口响应
|
|
244
260
|
*/
|
|
245
261
|
handleResponse(res) {
|
|
246
|
-
var _res$
|
|
262
|
+
var _res$data5;
|
|
247
263
|
if (!this.currentActionType) return;
|
|
248
264
|
let needContinue = true;
|
|
249
|
-
const { external_unified_status } = (res === null || res === void 0 || (_res$
|
|
265
|
+
const { external_unified_status } = (res === null || res === void 0 || (_res$data5 = res.data) === null || _res$data5 === void 0 ? void 0 : _res$data5.external_unified_response) || {};
|
|
250
266
|
switch (external_unified_status) {
|
|
251
267
|
case EPaymentStatus.Success:
|
|
252
268
|
this.handleOperationSuccess(res);
|
|
@@ -302,16 +318,21 @@ var PaymentMethod = class {
|
|
|
302
318
|
_this.currentQueryId = queryId;
|
|
303
319
|
_this.queryController = new AbortController();
|
|
304
320
|
const { signal } = _this.queryController;
|
|
321
|
+
let _extraParams = {};
|
|
322
|
+
if (_this.isMx51) {
|
|
323
|
+
var _this$mx51Transaction;
|
|
324
|
+
_extraParams.min_version = ((_this$mx51Transaction = _this.mx51TransactionVersion) !== null && _this$mx51Transaction !== void 0 ? _this$mx51Transaction : 0) + 1;
|
|
325
|
+
}
|
|
305
326
|
paymentLog.addLog({ title: "查询轮询:开始单次查询" });
|
|
306
327
|
try {
|
|
307
|
-
var _this$initOptions, _res$
|
|
308
|
-
const res = yield Promise.race([_this.currentQueryApi({
|
|
328
|
+
var _this$initOptions, _res$data6;
|
|
329
|
+
const res = yield Promise.race([_this.currentQueryApi(_objectSpread2({
|
|
309
330
|
order_id: _this.orderId,
|
|
310
331
|
unique_payment_number: _this.paymentNum,
|
|
311
332
|
payment_code: (_this$initOptions = _this.initOptions) === null || _this$initOptions === void 0 ? void 0 : _this$initOptions.paymentCode,
|
|
312
333
|
request_version: queryId,
|
|
313
334
|
is_force_request_api: 1
|
|
314
|
-
}, { signal }), _this.createTimeoutPromise(
|
|
335
|
+
}, _extraParams), { signal }), _this.createTimeoutPromise(_this.config.singleQueryTimeout || 1e4)]);
|
|
315
336
|
paymentLog.addLog({
|
|
316
337
|
title: "查询轮询:单次查询返回",
|
|
317
338
|
content: {
|
|
@@ -323,7 +344,7 @@ var PaymentMethod = class {
|
|
|
323
344
|
clearTimeout(_this.requestTimeoutTimer);
|
|
324
345
|
_this.requestTimeoutTimer = null;
|
|
325
346
|
}
|
|
326
|
-
if ((res === null || res === void 0 || (_res$
|
|
347
|
+
if ((res === null || res === void 0 || (_res$data6 = res.data) === null || _res$data6 === void 0 ? void 0 : _res$data6.request_version) !== _this.currentQueryId) {
|
|
327
348
|
paymentLog.addLog({ title: "查询轮询结果:过期的查询响应,忽略" });
|
|
328
349
|
return;
|
|
329
350
|
}
|
|
@@ -336,6 +357,12 @@ var PaymentMethod = class {
|
|
|
336
357
|
_this.handleOperationError(res);
|
|
337
358
|
return;
|
|
338
359
|
}
|
|
360
|
+
if (_this.isMx51QueryRetry(res)) {
|
|
361
|
+
paymentLog.addLog({ title: "查询轮询:MX51等待新版本,保持当前渲染并重试" });
|
|
362
|
+
_this.scheduleNextQuery(actionType);
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
_this.updateMx51TransactionVersion(res);
|
|
339
366
|
if (_this.isBusinessSuccess(res)) {
|
|
340
367
|
paymentLog.addLog({ title: "查询轮询结果:查询成功" });
|
|
341
368
|
if (_this.handleResponse(res)) _this.scheduleNextQuery(actionType);
|
|
@@ -531,7 +558,7 @@ var PaymentMethod = class {
|
|
|
531
558
|
_this3.startQuery(actionType);
|
|
532
559
|
};
|
|
533
560
|
try {
|
|
534
|
-
var _res$
|
|
561
|
+
var _res$data7;
|
|
535
562
|
paymentLog.addLog({
|
|
536
563
|
title: `发起${actionType}请求`,
|
|
537
564
|
content: {
|
|
@@ -548,7 +575,7 @@ var PaymentMethod = class {
|
|
|
548
575
|
res
|
|
549
576
|
}
|
|
550
577
|
});
|
|
551
|
-
if (
|
|
578
|
+
if ((res === null || res === void 0 || (_res$data7 = res.data) === null || _res$data7 === void 0 ? void 0 : _res$data7.request_version) !== _this3.currentRunId) {
|
|
552
579
|
paymentLog.addLog({
|
|
553
580
|
title: "响应过期,忽略",
|
|
554
581
|
content: { actionType }
|
|
@@ -567,6 +594,7 @@ var PaymentMethod = class {
|
|
|
567
594
|
_this3.handleOperationError(res);
|
|
568
595
|
return;
|
|
569
596
|
}
|
|
597
|
+
_this3.updateMx51TransactionVersion(res);
|
|
570
598
|
if (_this3.isBusinessSuccess(res)) {
|
|
571
599
|
paymentLog.addLog({
|
|
572
600
|
title: `${actionType}接口成功`,
|
|
@@ -589,7 +617,7 @@ var PaymentMethod = class {
|
|
|
589
617
|
_this3.handleOperationError(res);
|
|
590
618
|
} else {
|
|
591
619
|
_this3.handleOperationProcess(res);
|
|
592
|
-
_query("
|
|
620
|
+
_query("processing", `${actionType}接口未返回最终结果,开始轮询`, {
|
|
593
621
|
actionType,
|
|
594
622
|
res
|
|
595
623
|
});
|
|
@@ -642,7 +670,7 @@ var PaymentMethod = class {
|
|
|
642
670
|
_this4.controller = new AbortController();
|
|
643
671
|
const { signal } = _this4.controller;
|
|
644
672
|
try {
|
|
645
|
-
var _res$
|
|
673
|
+
var _res$data8;
|
|
646
674
|
const res = yield actionApi(_objectSpread2(_objectSpread2({}, params || {}), {}, { request_version: runActionId }), { signal });
|
|
647
675
|
if (_this4.isFinished || !_this4.shouldContinue()) {
|
|
648
676
|
paymentLog.addLog({
|
|
@@ -651,13 +679,14 @@ var PaymentMethod = class {
|
|
|
651
679
|
});
|
|
652
680
|
return;
|
|
653
681
|
}
|
|
654
|
-
if (
|
|
682
|
+
if ((res === null || res === void 0 || (_res$data8 = res.data) === null || _res$data8 === void 0 ? void 0 : _res$data8.request_version) !== _this4.currentRunId) {
|
|
655
683
|
paymentLog.addLog({
|
|
656
684
|
title: "Action响应过期,忽略",
|
|
657
685
|
content: { actionType }
|
|
658
686
|
});
|
|
659
687
|
return;
|
|
660
688
|
}
|
|
689
|
+
_this4.updateMx51TransactionVersion(res);
|
|
661
690
|
if (config === null || config === void 0 ? void 0 : config.needResponse) {
|
|
662
691
|
_this4.handleResponse(res);
|
|
663
692
|
return;
|
|
@@ -766,6 +795,7 @@ var PaymentMethod = class {
|
|
|
766
795
|
destroy() {
|
|
767
796
|
paymentLog.addLog({ title: "支付步骤结束,销毁实例" });
|
|
768
797
|
this.clean(true);
|
|
798
|
+
this.mx51TransactionVersion = void 0;
|
|
769
799
|
}
|
|
770
800
|
};
|
|
771
801
|
//#endregion
|
|
@@ -9,7 +9,7 @@ import { useFail, useStoreRef } from "../hooks.js";
|
|
|
9
9
|
import payLog from "../utils/payLog.js";
|
|
10
10
|
import { EPaymentStatus } from "../aggregatePayment/types.js";
|
|
11
11
|
import { usePayment } from "../aggregatePayment/hooks/usePayment.js";
|
|
12
|
-
import {
|
|
12
|
+
import { EButtonKeyType } from "./types.js";
|
|
13
13
|
import { parseMX51Params } from "./utils.js";
|
|
14
14
|
import Action from "./Action.js";
|
|
15
15
|
import { getInitState } from "../manufacturer.js";
|
|
@@ -41,7 +41,6 @@ const AggregatePayment = ({ onChange }) => {
|
|
|
41
41
|
const [cancelDisabled, setCancelDisabled] = useState(false);
|
|
42
42
|
const clickLockedRef = useRef(false);
|
|
43
43
|
const clickUnlockTimerRef = useRef(null);
|
|
44
|
-
const actionTimeoutRef = useRef(null);
|
|
45
44
|
const clearRef = useRef(null);
|
|
46
45
|
useEffect(() => {
|
|
47
46
|
failRef.current = fail;
|
|
@@ -62,7 +61,8 @@ const AggregatePayment = ({ onChange }) => {
|
|
|
62
61
|
config: {
|
|
63
62
|
hasQueryInterval: false,
|
|
64
63
|
globalQueryTimeout: 1e3 * 60 * 2,
|
|
65
|
-
requestDelaySeconds: 130
|
|
64
|
+
requestDelaySeconds: 130,
|
|
65
|
+
singleQueryTimeout: 1e3 * 30
|
|
66
66
|
},
|
|
67
67
|
callback: (_instance, response) => {
|
|
68
68
|
var _data$data;
|
|
@@ -72,7 +72,6 @@ const AggregatePayment = ({ onChange }) => {
|
|
|
72
72
|
const transformedData = parseMX51Params(transaction, status, data);
|
|
73
73
|
console.log("event_transformedData =>>>>>> ", transformedData);
|
|
74
74
|
dispatch(updateCustom({ customAction: transformedData }));
|
|
75
|
-
let needClearActionTimeout = true;
|
|
76
75
|
if (status === EPaymentStatus.Processing) if (action === "signature") {
|
|
77
76
|
var _transformedData$auto;
|
|
78
77
|
dispatch(updateStatus(StatusEnum.Question));
|
|
@@ -82,22 +81,12 @@ const AggregatePayment = ({ onChange }) => {
|
|
|
82
81
|
const merchantReceipt = (transformedData === null || transformedData === void 0 ? void 0 : transformedData.merchantReceipt) || "";
|
|
83
82
|
onChange("print", merchantReceipt ? [merchantReceipt] : []);
|
|
84
83
|
}
|
|
85
|
-
} else
|
|
86
|
-
needClearActionTimeout = false;
|
|
87
|
-
updateToLoading();
|
|
88
|
-
}
|
|
84
|
+
} else updateToLoading();
|
|
89
85
|
else if (status === EPaymentStatus.Success) handleSuccess(data);
|
|
90
86
|
else if (status === EPaymentStatus.Failed) if (transformedData) {
|
|
91
87
|
dispatch(updateStatus("fail"));
|
|
92
88
|
dispatch(updateState({ title: (transformedData === null || transformedData === void 0 ? void 0 : transformedData.message) || "" }));
|
|
93
89
|
} else handleFail(data);
|
|
94
|
-
if (needClearActionTimeout) {
|
|
95
|
-
if (actionTimeoutRef.current) {
|
|
96
|
-
payLog.log("清除操作行为超时定时器");
|
|
97
|
-
clearTimeout(actionTimeoutRef.current);
|
|
98
|
-
actionTimeoutRef.current = null;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
90
|
}
|
|
102
91
|
});
|
|
103
92
|
useEffect(() => {
|
|
@@ -116,10 +105,6 @@ const AggregatePayment = ({ onChange }) => {
|
|
|
116
105
|
return () => {
|
|
117
106
|
console.log("页面卸载");
|
|
118
107
|
unloadRef.current = true;
|
|
119
|
-
if (actionTimeoutRef.current) {
|
|
120
|
-
clearTimeout(actionTimeoutRef.current);
|
|
121
|
-
actionTimeoutRef.current = null;
|
|
122
|
-
}
|
|
123
108
|
if (clearRef.current) {
|
|
124
109
|
clearTimeout(clearRef.current);
|
|
125
110
|
clearRef.current = null;
|
|
@@ -188,12 +173,6 @@ const AggregatePayment = ({ onChange }) => {
|
|
|
188
173
|
console.log("onCancel", element);
|
|
189
174
|
setCancelDisabled(true);
|
|
190
175
|
payment.action({ submit_url: element === null || element === void 0 ? void 0 : element.submitUrl });
|
|
191
|
-
actionTimeoutRef.current = setTimeout(() => {
|
|
192
|
-
var _payment$_instance, _payment$_instance$st, _failRef$current2;
|
|
193
|
-
payLog.log("取消操作超时,前往标记支付");
|
|
194
|
-
payment === null || payment === void 0 || (_payment$_instance = payment._instance) === null || _payment$_instance === void 0 || (_payment$_instance$st = _payment$_instance.stop) === null || _payment$_instance$st === void 0 || _payment$_instance$st.call(_payment$_instance);
|
|
195
|
-
(_failRef$current2 = failRef.current) === null || _failRef$current2 === void 0 || _failRef$current2.call(failRef, { code: PayStatus.Timeout }, true);
|
|
196
|
-
}, CANCEL_ACTION_TIMEOUT);
|
|
197
176
|
};
|
|
198
177
|
const onDecline = (element) => {
|
|
199
178
|
payment.action({ submit_url: element === null || element === void 0 ? void 0 : element.submitUrl });
|
|
@@ -20,9 +20,5 @@ let EButtonKeyType = /* @__PURE__ */ function(EButtonKeyType) {
|
|
|
20
20
|
EButtonKeyType["CallTestFunction"] = "call_test_function";
|
|
21
21
|
return EButtonKeyType;
|
|
22
22
|
}({});
|
|
23
|
-
/**
|
|
24
|
-
* 操作行为超时时间
|
|
25
|
-
*/
|
|
26
|
-
const CANCEL_ACTION_TIMEOUT = 1e3 * 20;
|
|
27
23
|
//#endregion
|
|
28
|
-
export {
|
|
24
|
+
export { EButtonKeyType };
|
package/es/index.js
CHANGED
|
@@ -106,7 +106,6 @@ import PisellVenueControlPage from "./plus/pisellReservation/PisellVenueControlP
|
|
|
106
106
|
import PisellVenueWallPage from "./plus/pisellReservation/PisellVenueWallPage.js";
|
|
107
107
|
import PisellReservationTablePage from "./plus/pisellReservation/PisellReservationTablePage.js";
|
|
108
108
|
import SelectFloorMapResourceDialog from "./plus/pisellReservation/components/SelectFloorMapResourceDialog.js";
|
|
109
|
-
import "./plus/pisellReservation/index.js";
|
|
110
109
|
import { PisellTopology, PisellTopologyCore } from "./plus/pisellTopology/PisellTopology.js";
|
|
111
110
|
import pisellAdyenDashboard_default from "./plus/pisellAdyenDashboard/index.js";
|
|
112
111
|
import weekday from "dayjs/plugin/weekday";
|
|
@@ -259,4 +259,4 @@ function bookingListToReservationTableRows(bookings) {
|
|
|
259
259
|
return rows;
|
|
260
260
|
}
|
|
261
261
|
//#endregion
|
|
262
|
-
export { applyHostResourceShellToBaseRow, bookingListToReservationTableRows, customerBrief, extractResourceRecordIds, filterBookingsByResourceIds,
|
|
262
|
+
export { applyHostResourceShellToBaseRow, bookingListToReservationTableRows, customerBrief, extractResourceRecordIds, filterBookingsByResourceIds, hostBookingUiPatchFromRecord, isMonitorScheduleBookingSkipped, mergeBookingsForResourceRecord };
|
|
@@ -79,4 +79,4 @@ function toastFloorPlanLoadError(err) {
|
|
|
79
79
|
PisellToast({ content: err instanceof Error ? err.message : String(err) });
|
|
80
80
|
}
|
|
81
81
|
//#endregion
|
|
82
|
-
export { PISELL_RESERVATION_FLOOR_PLAN_CODE,
|
|
82
|
+
export { PISELL_RESERVATION_FLOOR_PLAN_CODE, ensureShopFloorPlanByCode, saveViewConfigToShopFloorPlan, shopLayoutToSceneElements$1 as shopLayoutToSceneElements, toastFloorPlanLoadError, toastFloorPlanSaveError, unsubscribeShopFloorPlanCodeQuery };
|
|
@@ -927,4 +927,4 @@ function getReservationDataSourceFormColumns() {
|
|
|
927
927
|
];
|
|
928
928
|
}
|
|
929
929
|
//#endregion
|
|
930
|
-
export { RESERVATION_BOUND_ROUND_TABLE_ELEMENT_KIND, RESERVATION_BOUND_TABLE_ELEMENT_KIND, applyReservationFloorMapLiveLabels,
|
|
930
|
+
export { RESERVATION_BOUND_ROUND_TABLE_ELEMENT_KIND, RESERVATION_BOUND_TABLE_ELEMENT_KIND, applyReservationFloorMapLiveLabels, defaultReservationTableRows, getDefaultReservationFloorMapConfig, getReservationDataSourceFormColumns, getReservationFloorMapShellConfig, mergeFloorMapElementKindCategoriesWithDefaults, mergeFloorMapElementKindsWithDefaults };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { _objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
|
|
2
2
|
import dayjs from "dayjs";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import timezonePlugin from "dayjs/plugin/timezone";
|
|
4
|
+
import utcPlugin from "dayjs/plugin/utc";
|
|
5
5
|
//#region src/plus/saasDevice/devicePasscodes/model.ts
|
|
6
|
-
dayjs.extend(
|
|
7
|
-
dayjs.extend(
|
|
6
|
+
dayjs.extend(utcPlugin);
|
|
7
|
+
dayjs.extend(timezonePlugin);
|
|
8
8
|
const INITIAL_DEVICE_PASSCODE_STATE = {
|
|
9
9
|
deviceIds: [],
|
|
10
10
|
devicesById: {}
|
|
@@ -6,12 +6,12 @@ import React, { useCallback, useMemo } from "react";
|
|
|
6
6
|
import { locales } from "@pisell/utils";
|
|
7
7
|
import { Button, PisellEmpty, PisellModal, PisellStatisticList, Skeleton, Timeline, usePisellConfig } from "@pisell/materials";
|
|
8
8
|
import { useRequest } from "ahooks";
|
|
9
|
-
import
|
|
10
|
-
import
|
|
9
|
+
import timezonePlugin from "dayjs/plugin/timezone";
|
|
10
|
+
import utcPlugin from "dayjs/plugin/utc";
|
|
11
11
|
import "./index.less";
|
|
12
12
|
//#region src/plus/walletPassGallery/components/timelineSection/index.tsx
|
|
13
|
-
dayjs.extend(
|
|
14
|
-
dayjs.extend(
|
|
13
|
+
dayjs.extend(timezonePlugin);
|
|
14
|
+
dayjs.extend(utcPlugin);
|
|
15
15
|
const stateTimeUnix = 1723255863;
|
|
16
16
|
const TimelineSection = (props) => {
|
|
17
17
|
const { code, tag, timezone, apiPrefix, isTerminalEnv, interaction, locale, translation, virtualCurrencyDisplay } = props;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { AuthMethodType, EmailAuthConfig, EmailRegistrationVerification, LoginFormData, OAuthConfig, PhoneAuthConfig, RegisterFormData, UIConfig, VerificationMethod } from "./shared/types.js";
|
|
2
1
|
import { Login2, Login2Config, Login2Events, Login2Props } from "./Login2.js";
|
|
3
2
|
import { Register2, Register2Config, Register2Events, Register2Props } from "./Register2.js";
|
|
4
|
-
import { AuthModal } from "./AuthModal.js";
|
|
3
|
+
import { AuthModal, AuthModalProps } from "./AuthModal.js";
|
|
@@ -226,4 +226,4 @@ interface RegisterFormData {
|
|
|
226
226
|
verification_token?: string;
|
|
227
227
|
}
|
|
228
228
|
//#endregion
|
|
229
|
-
export { AuthMethodType, EmailAuthConfig,
|
|
229
|
+
export { AuthMethodType, EmailAuthConfig, LegalTermsConfig, LoginFormData, LoginMethodItem, OAuthConfig, PhoneAuthConfig, RegisterFormData, RegistrationMethodItem, UIConfig };
|
|
@@ -36,6 +36,7 @@ var PaymentMethod = class {
|
|
|
36
36
|
require_defineProperty._defineProperty(this, "callback", void 0);
|
|
37
37
|
require_defineProperty._defineProperty(this, "shouldContinue", void 0);
|
|
38
38
|
require_defineProperty._defineProperty(this, "config", {});
|
|
39
|
+
require_defineProperty._defineProperty(this, "mx51TransactionVersion", void 0);
|
|
39
40
|
require_defineProperty._defineProperty(this, "controller", null);
|
|
40
41
|
require_defineProperty._defineProperty(this, "queryController", null);
|
|
41
42
|
require_defineProperty._defineProperty(this, "queryStartTimer", null);
|
|
@@ -66,22 +67,37 @@ var PaymentMethod = class {
|
|
|
66
67
|
}
|
|
67
68
|
});
|
|
68
69
|
}
|
|
70
|
+
get isMx51() {
|
|
71
|
+
return this.initOptions.paymentCode === "EFTPOS_MX51";
|
|
72
|
+
}
|
|
73
|
+
updateMx51TransactionVersion(res) {
|
|
74
|
+
var _res$data;
|
|
75
|
+
if (!this.isMx51 || `${res === null || res === void 0 ? void 0 : res.code}` !== "200") return;
|
|
76
|
+
const version = res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 || (_res$data = _res$data.external_unified_response) === null || _res$data === void 0 || (_res$data = _res$data.transaction) === null || _res$data === void 0 ? void 0 : _res$data.version;
|
|
77
|
+
if (typeof version !== "number" || !Number.isSafeInteger(version) || version <= 0) return;
|
|
78
|
+
this.mx51TransactionVersion = Math.max(this.mx51TransactionVersion || 0, version);
|
|
79
|
+
}
|
|
80
|
+
isMx51QueryRetry(res) {
|
|
81
|
+
var _res$data2;
|
|
82
|
+
const response = res === null || res === void 0 || (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.external_unified_response;
|
|
83
|
+
return this.isMx51 && (response === null || response === void 0 ? void 0 : response.external_unified_status) === require_types.EPaymentStatus.Processing && !(response === null || response === void 0 ? void 0 : response.transaction) && (response === null || response === void 0 ? void 0 : response.external_unified_retry) === true;
|
|
84
|
+
}
|
|
69
85
|
/**
|
|
70
86
|
* 判断请求是否需要等待轮询结果
|
|
71
87
|
* 1. 有明确错误code且不是超时和支付超时,则直接失败
|
|
72
88
|
* @param code 错误码
|
|
73
89
|
*/
|
|
74
90
|
isBusinessFailed(res) {
|
|
75
|
-
var _res$
|
|
76
|
-
const { external_unified_status, response_code } = (res === null || res === void 0 || (_res$
|
|
91
|
+
var _res$data3;
|
|
92
|
+
const { external_unified_status, response_code } = (res === null || res === void 0 || (_res$data3 = res.data) === null || _res$data3 === void 0 ? void 0 : _res$data3.external_unified_response) || {};
|
|
77
93
|
return `${res === null || res === void 0 ? void 0 : res.code}` === "200" && external_unified_status === require_types.EPaymentStatus.Failed && response_code !== require_const.PayStatus.Timeout && response_code !== require_const.PayStatus.PayTimeout;
|
|
78
94
|
}
|
|
79
95
|
/**
|
|
80
96
|
* 判断业务是否成功
|
|
81
97
|
*/
|
|
82
98
|
isBusinessSuccess(res) {
|
|
83
|
-
var _res$
|
|
84
|
-
const { external_unified_status } = (res === null || res === void 0 || (_res$
|
|
99
|
+
var _res$data4;
|
|
100
|
+
const { external_unified_status } = (res === null || res === void 0 || (_res$data4 = res.data) === null || _res$data4 === void 0 ? void 0 : _res$data4.external_unified_response) || {};
|
|
85
101
|
return `${res === null || res === void 0 ? void 0 : res.code}` === "200" && external_unified_status === require_types.EPaymentStatus.Success;
|
|
86
102
|
}
|
|
87
103
|
/**
|
|
@@ -244,10 +260,10 @@ var PaymentMethod = class {
|
|
|
244
260
|
* 处理接口响应
|
|
245
261
|
*/
|
|
246
262
|
handleResponse(res) {
|
|
247
|
-
var _res$
|
|
263
|
+
var _res$data5;
|
|
248
264
|
if (!this.currentActionType) return;
|
|
249
265
|
let needContinue = true;
|
|
250
|
-
const { external_unified_status } = (res === null || res === void 0 || (_res$
|
|
266
|
+
const { external_unified_status } = (res === null || res === void 0 || (_res$data5 = res.data) === null || _res$data5 === void 0 ? void 0 : _res$data5.external_unified_response) || {};
|
|
251
267
|
switch (external_unified_status) {
|
|
252
268
|
case require_types.EPaymentStatus.Success:
|
|
253
269
|
this.handleOperationSuccess(res);
|
|
@@ -303,16 +319,21 @@ var PaymentMethod = class {
|
|
|
303
319
|
_this.currentQueryId = queryId;
|
|
304
320
|
_this.queryController = new AbortController();
|
|
305
321
|
const { signal } = _this.queryController;
|
|
322
|
+
let _extraParams = {};
|
|
323
|
+
if (_this.isMx51) {
|
|
324
|
+
var _this$mx51Transaction;
|
|
325
|
+
_extraParams.min_version = ((_this$mx51Transaction = _this.mx51TransactionVersion) !== null && _this$mx51Transaction !== void 0 ? _this$mx51Transaction : 0) + 1;
|
|
326
|
+
}
|
|
306
327
|
paymentLog.addLog({ title: "查询轮询:开始单次查询" });
|
|
307
328
|
try {
|
|
308
|
-
var _this$initOptions, _res$
|
|
309
|
-
const res = yield Promise.race([_this.currentQueryApi({
|
|
329
|
+
var _this$initOptions, _res$data6;
|
|
330
|
+
const res = yield Promise.race([_this.currentQueryApi(require_objectSpread2._objectSpread2({
|
|
310
331
|
order_id: _this.orderId,
|
|
311
332
|
unique_payment_number: _this.paymentNum,
|
|
312
333
|
payment_code: (_this$initOptions = _this.initOptions) === null || _this$initOptions === void 0 ? void 0 : _this$initOptions.paymentCode,
|
|
313
334
|
request_version: queryId,
|
|
314
335
|
is_force_request_api: 1
|
|
315
|
-
}, { signal }), _this.createTimeoutPromise(
|
|
336
|
+
}, _extraParams), { signal }), _this.createTimeoutPromise(_this.config.singleQueryTimeout || 1e4)]);
|
|
316
337
|
paymentLog.addLog({
|
|
317
338
|
title: "查询轮询:单次查询返回",
|
|
318
339
|
content: {
|
|
@@ -324,7 +345,7 @@ var PaymentMethod = class {
|
|
|
324
345
|
clearTimeout(_this.requestTimeoutTimer);
|
|
325
346
|
_this.requestTimeoutTimer = null;
|
|
326
347
|
}
|
|
327
|
-
if ((res === null || res === void 0 || (_res$
|
|
348
|
+
if ((res === null || res === void 0 || (_res$data6 = res.data) === null || _res$data6 === void 0 ? void 0 : _res$data6.request_version) !== _this.currentQueryId) {
|
|
328
349
|
paymentLog.addLog({ title: "查询轮询结果:过期的查询响应,忽略" });
|
|
329
350
|
return;
|
|
330
351
|
}
|
|
@@ -337,6 +358,12 @@ var PaymentMethod = class {
|
|
|
337
358
|
_this.handleOperationError(res);
|
|
338
359
|
return;
|
|
339
360
|
}
|
|
361
|
+
if (_this.isMx51QueryRetry(res)) {
|
|
362
|
+
paymentLog.addLog({ title: "查询轮询:MX51等待新版本,保持当前渲染并重试" });
|
|
363
|
+
_this.scheduleNextQuery(actionType);
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
_this.updateMx51TransactionVersion(res);
|
|
340
367
|
if (_this.isBusinessSuccess(res)) {
|
|
341
368
|
paymentLog.addLog({ title: "查询轮询结果:查询成功" });
|
|
342
369
|
if (_this.handleResponse(res)) _this.scheduleNextQuery(actionType);
|
|
@@ -532,7 +559,7 @@ var PaymentMethod = class {
|
|
|
532
559
|
_this3.startQuery(actionType);
|
|
533
560
|
};
|
|
534
561
|
try {
|
|
535
|
-
var _res$
|
|
562
|
+
var _res$data7;
|
|
536
563
|
paymentLog.addLog({
|
|
537
564
|
title: `发起${actionType}请求`,
|
|
538
565
|
content: {
|
|
@@ -549,7 +576,7 @@ var PaymentMethod = class {
|
|
|
549
576
|
res
|
|
550
577
|
}
|
|
551
578
|
});
|
|
552
|
-
if (
|
|
579
|
+
if ((res === null || res === void 0 || (_res$data7 = res.data) === null || _res$data7 === void 0 ? void 0 : _res$data7.request_version) !== _this3.currentRunId) {
|
|
553
580
|
paymentLog.addLog({
|
|
554
581
|
title: "响应过期,忽略",
|
|
555
582
|
content: { actionType }
|
|
@@ -568,6 +595,7 @@ var PaymentMethod = class {
|
|
|
568
595
|
_this3.handleOperationError(res);
|
|
569
596
|
return;
|
|
570
597
|
}
|
|
598
|
+
_this3.updateMx51TransactionVersion(res);
|
|
571
599
|
if (_this3.isBusinessSuccess(res)) {
|
|
572
600
|
paymentLog.addLog({
|
|
573
601
|
title: `${actionType}接口成功`,
|
|
@@ -590,7 +618,7 @@ var PaymentMethod = class {
|
|
|
590
618
|
_this3.handleOperationError(res);
|
|
591
619
|
} else {
|
|
592
620
|
_this3.handleOperationProcess(res);
|
|
593
|
-
_query("
|
|
621
|
+
_query("processing", `${actionType}接口未返回最终结果,开始轮询`, {
|
|
594
622
|
actionType,
|
|
595
623
|
res
|
|
596
624
|
});
|
|
@@ -643,7 +671,7 @@ var PaymentMethod = class {
|
|
|
643
671
|
_this4.controller = new AbortController();
|
|
644
672
|
const { signal } = _this4.controller;
|
|
645
673
|
try {
|
|
646
|
-
var _res$
|
|
674
|
+
var _res$data8;
|
|
647
675
|
const res = yield actionApi(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, params || {}), {}, { request_version: runActionId }), { signal });
|
|
648
676
|
if (_this4.isFinished || !_this4.shouldContinue()) {
|
|
649
677
|
paymentLog.addLog({
|
|
@@ -652,13 +680,14 @@ var PaymentMethod = class {
|
|
|
652
680
|
});
|
|
653
681
|
return;
|
|
654
682
|
}
|
|
655
|
-
if (
|
|
683
|
+
if ((res === null || res === void 0 || (_res$data8 = res.data) === null || _res$data8 === void 0 ? void 0 : _res$data8.request_version) !== _this4.currentRunId) {
|
|
656
684
|
paymentLog.addLog({
|
|
657
685
|
title: "Action响应过期,忽略",
|
|
658
686
|
content: { actionType }
|
|
659
687
|
});
|
|
660
688
|
return;
|
|
661
689
|
}
|
|
690
|
+
_this4.updateMx51TransactionVersion(res);
|
|
662
691
|
if (config === null || config === void 0 ? void 0 : config.needResponse) {
|
|
663
692
|
_this4.handleResponse(res);
|
|
664
693
|
return;
|
|
@@ -767,6 +796,7 @@ var PaymentMethod = class {
|
|
|
767
796
|
destroy() {
|
|
768
797
|
paymentLog.addLog({ title: "支付步骤结束,销毁实例" });
|
|
769
798
|
this.clean(true);
|
|
799
|
+
this.mx51TransactionVersion = void 0;
|
|
770
800
|
}
|
|
771
801
|
};
|
|
772
802
|
//#endregion
|
|
@@ -43,7 +43,6 @@ const AggregatePayment = ({ onChange }) => {
|
|
|
43
43
|
const [cancelDisabled, setCancelDisabled] = (0, react.useState)(false);
|
|
44
44
|
const clickLockedRef = (0, react.useRef)(false);
|
|
45
45
|
const clickUnlockTimerRef = (0, react.useRef)(null);
|
|
46
|
-
const actionTimeoutRef = (0, react.useRef)(null);
|
|
47
46
|
const clearRef = (0, react.useRef)(null);
|
|
48
47
|
(0, react.useEffect)(() => {
|
|
49
48
|
failRef.current = fail;
|
|
@@ -64,7 +63,8 @@ const AggregatePayment = ({ onChange }) => {
|
|
|
64
63
|
config: {
|
|
65
64
|
hasQueryInterval: false,
|
|
66
65
|
globalQueryTimeout: 1e3 * 60 * 2,
|
|
67
|
-
requestDelaySeconds: 130
|
|
66
|
+
requestDelaySeconds: 130,
|
|
67
|
+
singleQueryTimeout: 1e3 * 30
|
|
68
68
|
},
|
|
69
69
|
callback: (_instance, response) => {
|
|
70
70
|
var _data$data;
|
|
@@ -74,7 +74,6 @@ const AggregatePayment = ({ onChange }) => {
|
|
|
74
74
|
const transformedData = require_utils.parseMX51Params(transaction, status, data);
|
|
75
75
|
console.log("event_transformedData =>>>>>> ", transformedData);
|
|
76
76
|
dispatch(require_index$1.updateCustom({ customAction: transformedData }));
|
|
77
|
-
let needClearActionTimeout = true;
|
|
78
77
|
if (status === require_types.EPaymentStatus.Processing) if (action === "signature") {
|
|
79
78
|
var _transformedData$auto;
|
|
80
79
|
dispatch(require_index$1.updateStatus(require_const.StatusEnum.Question));
|
|
@@ -84,22 +83,12 @@ const AggregatePayment = ({ onChange }) => {
|
|
|
84
83
|
const merchantReceipt = (transformedData === null || transformedData === void 0 ? void 0 : transformedData.merchantReceipt) || "";
|
|
85
84
|
onChange("print", merchantReceipt ? [merchantReceipt] : []);
|
|
86
85
|
}
|
|
87
|
-
} else
|
|
88
|
-
needClearActionTimeout = false;
|
|
89
|
-
updateToLoading();
|
|
90
|
-
}
|
|
86
|
+
} else updateToLoading();
|
|
91
87
|
else if (status === require_types.EPaymentStatus.Success) handleSuccess(data);
|
|
92
88
|
else if (status === require_types.EPaymentStatus.Failed) if (transformedData) {
|
|
93
89
|
dispatch(require_index$1.updateStatus("fail"));
|
|
94
90
|
dispatch(require_index$1.updateState({ title: (transformedData === null || transformedData === void 0 ? void 0 : transformedData.message) || "" }));
|
|
95
91
|
} else handleFail(data);
|
|
96
|
-
if (needClearActionTimeout) {
|
|
97
|
-
if (actionTimeoutRef.current) {
|
|
98
|
-
require_payLog.default.log("清除操作行为超时定时器");
|
|
99
|
-
clearTimeout(actionTimeoutRef.current);
|
|
100
|
-
actionTimeoutRef.current = null;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
92
|
}
|
|
104
93
|
});
|
|
105
94
|
(0, react.useEffect)(() => {
|
|
@@ -118,10 +107,6 @@ const AggregatePayment = ({ onChange }) => {
|
|
|
118
107
|
return () => {
|
|
119
108
|
console.log("页面卸载");
|
|
120
109
|
unloadRef.current = true;
|
|
121
|
-
if (actionTimeoutRef.current) {
|
|
122
|
-
clearTimeout(actionTimeoutRef.current);
|
|
123
|
-
actionTimeoutRef.current = null;
|
|
124
|
-
}
|
|
125
110
|
if (clearRef.current) {
|
|
126
111
|
clearTimeout(clearRef.current);
|
|
127
112
|
clearRef.current = null;
|
|
@@ -190,12 +175,6 @@ const AggregatePayment = ({ onChange }) => {
|
|
|
190
175
|
console.log("onCancel", element);
|
|
191
176
|
setCancelDisabled(true);
|
|
192
177
|
payment.action({ submit_url: element === null || element === void 0 ? void 0 : element.submitUrl });
|
|
193
|
-
actionTimeoutRef.current = setTimeout(() => {
|
|
194
|
-
var _payment$_instance, _payment$_instance$st, _failRef$current2;
|
|
195
|
-
require_payLog.default.log("取消操作超时,前往标记支付");
|
|
196
|
-
payment === null || payment === void 0 || (_payment$_instance = payment._instance) === null || _payment$_instance === void 0 || (_payment$_instance$st = _payment$_instance.stop) === null || _payment$_instance$st === void 0 || _payment$_instance$st.call(_payment$_instance);
|
|
197
|
-
(_failRef$current2 = failRef.current) === null || _failRef$current2 === void 0 || _failRef$current2.call(failRef, { code: require_const.PayStatus.Timeout }, true);
|
|
198
|
-
}, require_types$1.CANCEL_ACTION_TIMEOUT);
|
|
199
178
|
};
|
|
200
179
|
const onDecline = (element) => {
|
|
201
180
|
payment.action({ submit_url: element === null || element === void 0 ? void 0 : element.submitUrl });
|
|
@@ -20,10 +20,5 @@ let EButtonKeyType = /* @__PURE__ */ function(EButtonKeyType) {
|
|
|
20
20
|
EButtonKeyType["CallTestFunction"] = "call_test_function";
|
|
21
21
|
return EButtonKeyType;
|
|
22
22
|
}({});
|
|
23
|
-
/**
|
|
24
|
-
* 操作行为超时时间
|
|
25
|
-
*/
|
|
26
|
-
const CANCEL_ACTION_TIMEOUT = 1e3 * 20;
|
|
27
23
|
//#endregion
|
|
28
|
-
exports.CANCEL_ACTION_TIMEOUT = CANCEL_ACTION_TIMEOUT;
|
|
29
24
|
exports.EButtonKeyType = EButtonKeyType;
|