@pisell/private-materials 3.0.206 → 3.0.207
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 +142 -142
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +9 -9
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +8 -8
- package/es/components/booking/forms/model.d.ts +1 -1
- package/es/components/booking/notes/index.d.ts +1 -1
- package/es/components/booking/notes/model.d.ts +1 -1
- package/es/components/booking/payments/model.d.ts +1 -1
- package/es/components/eftposPay/amount.d.ts +1 -1
- package/es/components/eftposPay/app.d.ts +11 -0
- package/es/components/eftposPay/app.js +173 -0
- package/es/components/eftposPay/component/fail/failCustom.js +1 -0
- package/es/components/eftposPay/component/fail/index.js +1 -0
- package/es/components/eftposPay/component/manual/index.js +4 -1
- package/es/components/eftposPay/const.d.ts +27 -1
- package/es/components/eftposPay/const.js +22 -0
- package/es/components/eftposPay/device.d.ts +1 -1
- package/es/components/eftposPay/device.js +2 -2
- package/es/components/eftposPay/helper.d.ts +5 -0
- package/es/components/eftposPay/helper.js +10 -4
- package/es/components/eftposPay/hooks.d.ts +2 -1
- package/es/components/eftposPay/hooks.js +22 -16
- package/es/components/eftposPay/index.d.ts +1 -1
- package/es/components/eftposPay/index.js +130 -179
- package/es/components/eftposPay/locales.d.ts +15 -0
- package/es/components/eftposPay/locales.js +15 -0
- package/es/components/eftposPay/payo/config.js +20 -8
- package/es/components/eftposPay/store/index.d.ts +1 -1
- package/es/components/eftposPay/tip.d.ts +10 -0
- package/es/components/eftposPay/tip.js +177 -0
- package/es/components/eftposPay/tip.less +9 -0
- package/es/components/eftposPay/tyro/index.js +4 -2
- package/es/components/eftposPay/windcave/windcave.js +17 -6
- package/es/components/schedules/index.d.ts +1 -1
- package/es/components/schedules/model.d.ts +1 -1
- package/lib/components/booking/forms/model.d.ts +1 -1
- package/lib/components/booking/notes/index.d.ts +1 -1
- package/lib/components/booking/notes/model.d.ts +1 -1
- package/lib/components/booking/payments/model.d.ts +1 -1
- package/lib/components/eftposPay/amount.d.ts +1 -1
- package/lib/components/eftposPay/app.d.ts +11 -0
- package/lib/components/eftposPay/app.js +166 -0
- package/lib/components/eftposPay/component/fail/failCustom.js +1 -1
- package/lib/components/eftposPay/component/fail/index.js +1 -1
- package/lib/components/eftposPay/component/manual/index.js +19 -5
- package/lib/components/eftposPay/const.d.ts +27 -1
- package/lib/components/eftposPay/const.js +18 -0
- package/lib/components/eftposPay/device.d.ts +1 -1
- package/lib/components/eftposPay/device.js +2 -2
- package/lib/components/eftposPay/helper.d.ts +5 -0
- package/lib/components/eftposPay/helper.js +8 -4
- package/lib/components/eftposPay/hooks.d.ts +2 -1
- package/lib/components/eftposPay/hooks.js +8 -2
- package/lib/components/eftposPay/index.d.ts +1 -1
- package/lib/components/eftposPay/index.js +106 -144
- package/lib/components/eftposPay/locales.d.ts +15 -0
- package/lib/components/eftposPay/locales.js +15 -0
- package/lib/components/eftposPay/payo/config.js +33 -9
- package/lib/components/eftposPay/store/index.d.ts +1 -1
- package/lib/components/eftposPay/tip.d.ts +10 -0
- package/lib/components/eftposPay/tip.js +159 -0
- package/lib/components/eftposPay/tip.less +9 -0
- package/lib/components/eftposPay/tyro/index.js +4 -2
- package/lib/components/eftposPay/windcave/windcave.js +29 -6
- package/lib/components/schedules/index.d.ts +1 -1
- package/lib/components/schedules/model.d.ts +1 -1
- package/package.json +1 -1
|
@@ -22,8 +22,10 @@ __export(const_exports, {
|
|
|
22
22
|
ClientEnum: () => ClientEnum,
|
|
23
23
|
EftposEnum: () => EftposEnum,
|
|
24
24
|
ModeEnum: () => ModeEnum,
|
|
25
|
+
OrderEumn: () => OrderEumn,
|
|
25
26
|
PayRouteEnum: () => PayRouteEnum,
|
|
26
27
|
PayStatus: () => PayStatus,
|
|
28
|
+
RestoreEumn: () => RestoreEumn,
|
|
27
29
|
RouteEnum: () => RouteEnum,
|
|
28
30
|
StatusEnum: () => StatusEnum
|
|
29
31
|
});
|
|
@@ -53,6 +55,20 @@ var ModeEnum = /* @__PURE__ */ ((ModeEnum2) => {
|
|
|
53
55
|
ModeEnum2["Query"] = "query";
|
|
54
56
|
return ModeEnum2;
|
|
55
57
|
})(ModeEnum || {});
|
|
58
|
+
var RestoreEumn = /* @__PURE__ */ ((RestoreEumn2) => {
|
|
59
|
+
RestoreEumn2["Normal"] = "normal";
|
|
60
|
+
RestoreEumn2["Restore"] = "restore";
|
|
61
|
+
return RestoreEumn2;
|
|
62
|
+
})(RestoreEumn || {});
|
|
63
|
+
var OrderEumn = /* @__PURE__ */ ((OrderEumn2) => {
|
|
64
|
+
OrderEumn2["Restore"] = "restore";
|
|
65
|
+
OrderEumn2["Normal"] = "normal";
|
|
66
|
+
OrderEumn2["Succeed"] = "succeed";
|
|
67
|
+
OrderEumn2["Failed"] = "failed";
|
|
68
|
+
OrderEumn2["Pending"] = "pending";
|
|
69
|
+
OrderEumn2["Null"] = "null";
|
|
70
|
+
return OrderEumn2;
|
|
71
|
+
})(OrderEumn || {});
|
|
56
72
|
var ClientEnum = /* @__PURE__ */ ((ClientEnum2) => {
|
|
57
73
|
ClientEnum2["User"] = "user";
|
|
58
74
|
ClientEnum2["Merchant"] = "merchant";
|
|
@@ -89,8 +105,10 @@ var PayStatus = /* @__PURE__ */ ((PayStatus2) => {
|
|
|
89
105
|
ClientEnum,
|
|
90
106
|
EftposEnum,
|
|
91
107
|
ModeEnum,
|
|
108
|
+
OrderEumn,
|
|
92
109
|
PayRouteEnum,
|
|
93
110
|
PayStatus,
|
|
111
|
+
RestoreEumn,
|
|
94
112
|
RouteEnum,
|
|
95
113
|
StatusEnum
|
|
96
114
|
});
|
|
@@ -11,7 +11,7 @@ import './device.less';
|
|
|
11
11
|
declare const _default: ({ api, onChange, onClose, className, device_number, isMobile, net, client, formatAmount, }: {
|
|
12
12
|
api: PayProps['api'];
|
|
13
13
|
className?: string | undefined;
|
|
14
|
-
onChange?: ((status: "page" | "success" | "fail", params?: string | {
|
|
14
|
+
onChange?: ((status: "page" | "success" | "print" | "fail" | "mark_tx_processed", params?: string | {
|
|
15
15
|
[keys: string]: unknown;
|
|
16
16
|
} | undefined, other?: any) => void) | undefined;
|
|
17
17
|
onClose: () => void;
|
|
@@ -167,11 +167,11 @@ var device_default = ({
|
|
|
167
167
|
role: "button",
|
|
168
168
|
tabIndex: index
|
|
169
169
|
},
|
|
170
|
-
/* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-device-content" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-device-name" }, name), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-device-money" }, pay.totalUnit), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-device-sucharge" }, import_utils.locales.getText(
|
|
170
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-device-content" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-device-name" }, name), mode === import_const.ModeEnum.Refund ? null : /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-device-money" }, pay.totalUnit), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-device-sucharge" }, import_utils.locales.getText(
|
|
171
171
|
"page.eftpos-pay.text.surcharge.edit.inc.surcharge"
|
|
172
172
|
), ": ", formatAmount(`${pay.surcharge}`, 2, symbol), " (", import_utils.locales.getText(
|
|
173
173
|
"page.eftpos-pay.text.surcharge.edit.rate"
|
|
174
|
-
), ":", pay.surRate, "% +", " ", formatAmount(`${pay.surMoney}`, 2, symbol), ")")),
|
|
174
|
+
), ":", pay.surRate, "% +", " ", formatAmount(`${pay.surMoney}`, 2, symbol), ")"))),
|
|
175
175
|
/* @__PURE__ */ import_react.default.createElement("div", { style: { flexShrink: 0 } }, /* @__PURE__ */ import_react.default.createElement(
|
|
176
176
|
import_ChevronRight.default,
|
|
177
177
|
{
|
|
@@ -28,16 +28,19 @@ export declare const getPayParams: (data: Partial<Omit<State, key>> & Pick<State
|
|
|
28
28
|
order_id: string | number;
|
|
29
29
|
amount?: undefined;
|
|
30
30
|
total?: undefined;
|
|
31
|
+
receipt?: undefined;
|
|
31
32
|
} | {
|
|
32
33
|
cardReaderSurcharge: {};
|
|
33
34
|
surMoney: string;
|
|
34
35
|
surcharge: string;
|
|
35
36
|
total: string;
|
|
36
37
|
number: string | number | undefined;
|
|
38
|
+
uniquePaymentNumber: string | number | undefined;
|
|
37
39
|
device: {
|
|
38
40
|
[key: string]: unknown;
|
|
39
41
|
} | undefined;
|
|
40
42
|
order_id: string | number;
|
|
43
|
+
receipt: {};
|
|
41
44
|
amount?: undefined;
|
|
42
45
|
} | {
|
|
43
46
|
amount: string | number;
|
|
@@ -47,12 +50,14 @@ export declare const getPayParams: (data: Partial<Omit<State, key>> & Pick<State
|
|
|
47
50
|
[key: string]: unknown;
|
|
48
51
|
} | undefined;
|
|
49
52
|
order_id: string | number;
|
|
53
|
+
receipt: {};
|
|
50
54
|
} | {
|
|
51
55
|
amount: string | number;
|
|
52
56
|
total: string | number;
|
|
53
57
|
number: string | number | undefined;
|
|
54
58
|
order_id: string | number;
|
|
55
59
|
device?: undefined;
|
|
60
|
+
receipt?: undefined;
|
|
56
61
|
};
|
|
57
62
|
export declare const limitDecimals: (value: any) => any;
|
|
58
63
|
/**
|
|
@@ -62,7 +62,7 @@ function cloneDeep(source, hash = /* @__PURE__ */ new WeakMap()) {
|
|
|
62
62
|
return target;
|
|
63
63
|
}
|
|
64
64
|
var getPayParams = (data, statue) => {
|
|
65
|
-
var _a;
|
|
65
|
+
var _a, _b, _c, _d, _e, _f;
|
|
66
66
|
if (statue === "fail") {
|
|
67
67
|
return {
|
|
68
68
|
number: data.number,
|
|
@@ -70,9 +70,10 @@ var getPayParams = (data, statue) => {
|
|
|
70
70
|
order_id: data.order_id
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
|
+
const receipt = ((_a = data == null ? void 0 : data.custom) == null ? void 0 : _a.receipt) || [];
|
|
73
74
|
if (data.mode === import_const.ModeEnum.Pay || data.mode === import_const.ModeEnum.FullPay) {
|
|
74
75
|
const pay = data.pay;
|
|
75
|
-
const card_reader_surcharge = ((
|
|
76
|
+
const card_reader_surcharge = ((_b = data.custom) == null ? void 0 : _b.card_reader_surcharge) || 0;
|
|
76
77
|
const obj = pay || {};
|
|
77
78
|
const cardReaderSurcharge = card_reader_surcharge;
|
|
78
79
|
const surCardDeci = new import_decimal.Decimal(Number(cardReaderSurcharge));
|
|
@@ -89,8 +90,10 @@ var getPayParams = (data, statue) => {
|
|
|
89
90
|
surcharge: surchargeDeci.toFixed(2, import_decimal.Decimal.ROUND_HALF_UP),
|
|
90
91
|
total: total.toFixed(2, import_decimal.Decimal.ROUND_HALF_UP),
|
|
91
92
|
number: data.number,
|
|
93
|
+
uniquePaymentNumber: data.number,
|
|
92
94
|
device: data.device,
|
|
93
|
-
order_id: data.order_id
|
|
95
|
+
order_id: data.order_id,
|
|
96
|
+
receipt: ((_d = (_c = data.device) == null ? void 0 : _c.setting) == null ? void 0 : _d.receipts) ? [] : receipt
|
|
94
97
|
};
|
|
95
98
|
}
|
|
96
99
|
if (data.mode === import_const.ModeEnum.Refund) {
|
|
@@ -99,7 +102,8 @@ var getPayParams = (data, statue) => {
|
|
|
99
102
|
total: data.amount,
|
|
100
103
|
number: data.number,
|
|
101
104
|
device: data.device,
|
|
102
|
-
order_id: data.order_id
|
|
105
|
+
order_id: data.order_id,
|
|
106
|
+
receipt: ((_f = (_e = data.device) == null ? void 0 : _e.setting) == null ? void 0 : _f.receipts) ? [] : receipt
|
|
103
107
|
};
|
|
104
108
|
}
|
|
105
109
|
return {
|
|
@@ -19,8 +19,9 @@ export declare const useStoreRef: <T extends {
|
|
|
19
19
|
readonly netRef: React.MutableRefObject<boolean | undefined>;
|
|
20
20
|
readonly symbolRef: React.MutableRefObject<string>;
|
|
21
21
|
readonly amountRef: React.MutableRefObject<string | number>;
|
|
22
|
-
readonly eftposRef: React.MutableRefObject<"
|
|
22
|
+
readonly eftposRef: React.MutableRefObject<"payo" | "tyro" | "windcave" | "stripe">;
|
|
23
23
|
readonly clientRef: React.MutableRefObject<ClientEnum>;
|
|
24
|
+
readonly dataRef: React.MutableRefObject<import("./store").State>;
|
|
24
25
|
};
|
|
25
26
|
/**
|
|
26
27
|
* @title: 通用失败处理
|
|
@@ -30,6 +30,7 @@ var import_store = require("./store");
|
|
|
30
30
|
var import_const2 = require("./const");
|
|
31
31
|
var Max4004 = 1;
|
|
32
32
|
var useStoreRef = () => {
|
|
33
|
+
const data = (0, import_store.useContextData)();
|
|
33
34
|
const {
|
|
34
35
|
order_id,
|
|
35
36
|
device,
|
|
@@ -42,7 +43,8 @@ var useStoreRef = () => {
|
|
|
42
43
|
amount,
|
|
43
44
|
eftpos,
|
|
44
45
|
client
|
|
45
|
-
} =
|
|
46
|
+
} = data;
|
|
47
|
+
const dataRef = (0, import_react.useRef)(data);
|
|
46
48
|
const deviceRef = (0, import_react.useRef)(device);
|
|
47
49
|
const payRef = (0, import_react.useRef)(pay);
|
|
48
50
|
const numRef = (0, import_react.useRef)(number);
|
|
@@ -54,6 +56,9 @@ var useStoreRef = () => {
|
|
|
54
56
|
const amountRef = (0, import_react.useRef)(amount);
|
|
55
57
|
const eftposRef = (0, import_react.useRef)(eftpos);
|
|
56
58
|
const clientRef = (0, import_react.useRef)(client);
|
|
59
|
+
(0, import_react.useEffect)(() => {
|
|
60
|
+
dataRef.current = data;
|
|
61
|
+
}, [data]);
|
|
57
62
|
(0, import_react.useEffect)(() => {
|
|
58
63
|
deviceRef.current = device;
|
|
59
64
|
}, [device]);
|
|
@@ -98,7 +103,8 @@ var useStoreRef = () => {
|
|
|
98
103
|
symbolRef,
|
|
99
104
|
amountRef,
|
|
100
105
|
eftposRef,
|
|
101
|
-
clientRef
|
|
106
|
+
clientRef,
|
|
107
|
+
dataRef
|
|
102
108
|
};
|
|
103
109
|
};
|
|
104
110
|
var useFail = (index) => {
|
|
@@ -34,67 +34,33 @@ __export(eftposPay_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(eftposPay_exports);
|
|
35
35
|
var import_utils = require("@pisell/utils");
|
|
36
36
|
var import_react = __toESM(require("react"));
|
|
37
|
-
var import_ahooks = require("ahooks");
|
|
38
37
|
var import_useEngineContext = __toESM(require("../../hooks/useEngineContext"));
|
|
39
|
-
var
|
|
38
|
+
var import_app = __toESM(require("./app"));
|
|
39
|
+
var import_tip = __toESM(require("./tip"));
|
|
40
40
|
var import_const = require("./const");
|
|
41
|
-
var import_device = __toESM(require("./device"));
|
|
42
41
|
var import_locales = __toESM(require("./locales"));
|
|
43
42
|
var import_manufacturer = require("./manufacturer");
|
|
44
|
-
var import_pay = __toESM(require("./pay"));
|
|
45
43
|
var import_store = require("./store");
|
|
46
44
|
var import_index = require("./index.less");
|
|
47
45
|
import_utils.locales.init(import_locales.default, localStorage.getItem("umi_locale") || "en");
|
|
48
|
-
var
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
tyroUrl,
|
|
54
|
-
tyroVersion,
|
|
55
|
-
onChangeParams,
|
|
56
|
-
...props
|
|
57
|
-
}) => {
|
|
58
|
-
var _a;
|
|
59
|
-
const data = (0, import_store.useContextData)();
|
|
60
|
-
const dispatch = (0, import_store.useDispatch)();
|
|
61
|
-
const [current, setCurrent] = (0, import_react.useState)(action);
|
|
62
|
-
const statusRef = (0, import_react.useRef)(data.status);
|
|
46
|
+
var eftposPay_default = (props) => {
|
|
47
|
+
var _a, _b, _c, _d, _e, _f;
|
|
48
|
+
const [check, setCheckStatus] = (0, import_react.useState)(
|
|
49
|
+
props.type === import_const.EftposEnum.Tyro ? import_const.OrderEumn.Null : props.source === import_const.RestoreEumn.Restore ? import_const.OrderEumn.Restore : import_const.OrderEumn.Normal
|
|
50
|
+
);
|
|
63
51
|
const context = (0, import_useEngineContext.default)();
|
|
52
|
+
const [cardSurcharge, setCardSurcharge] = (0, import_react.useState)(0);
|
|
53
|
+
const [receipt, setReceipt] = (0, import_react.useState)([]);
|
|
54
|
+
const [updateTime, setTime] = (0, import_react.useState)("");
|
|
64
55
|
console.log("context = ", context);
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
formatAmount: (number, precision, symbol) => `${symbol}${number}`,
|
|
56
|
+
const [historyData, setHistory] = (0, import_react.useState)();
|
|
57
|
+
const { formatAmount, storage, store } = ((_a = context.appHelper) == null ? void 0 : _a.utils) || {
|
|
58
|
+
store: {},
|
|
59
|
+
formatAmount: (number, precision, symbol2) => `${symbol2}${number}`,
|
|
70
60
|
storage: () => ({
|
|
71
61
|
get: () => ""
|
|
72
62
|
})
|
|
73
63
|
};
|
|
74
|
-
const network = (0, import_react.useMemo)(
|
|
75
|
-
() => typeof terminal.network === "boolean" ? terminal.network : true,
|
|
76
|
-
[terminal == null ? void 0 : terminal.network]
|
|
77
|
-
);
|
|
78
|
-
const { online } = (0, import_ahooks.useNetwork)();
|
|
79
|
-
const netRef = (0, import_react.useRef)([network, online]);
|
|
80
|
-
const net = (0, import_react.useMemo)(() => {
|
|
81
|
-
let networkChange = false, onlineChange = false;
|
|
82
|
-
if (netRef.current[0] !== network) {
|
|
83
|
-
netRef.current[0] = network;
|
|
84
|
-
networkChange = true;
|
|
85
|
-
}
|
|
86
|
-
if (netRef.current[1] !== online) {
|
|
87
|
-
netRef.current[1] = online;
|
|
88
|
-
onlineChange = true;
|
|
89
|
-
}
|
|
90
|
-
if (networkChange) {
|
|
91
|
-
return network;
|
|
92
|
-
}
|
|
93
|
-
return online;
|
|
94
|
-
}, [network, online]);
|
|
95
|
-
(0, import_react.useEffect)(() => {
|
|
96
|
-
statusRef.current = data.status;
|
|
97
|
-
}, [data.status]);
|
|
98
64
|
const channel = (0, import_react.useMemo)(() => {
|
|
99
65
|
var _a2;
|
|
100
66
|
const channel2 = ((_a2 = storage == null ? void 0 : storage.get) == null ? void 0 : _a2.call(storage, "channel")) || "";
|
|
@@ -106,99 +72,10 @@ var App = ({
|
|
|
106
72
|
}
|
|
107
73
|
return "";
|
|
108
74
|
}, []);
|
|
109
|
-
const client = (0, import_react.useMemo)(() => {
|
|
110
|
-
if (channel === "kiosk") {
|
|
111
|
-
return import_const.ClientEnum.User;
|
|
112
|
-
}
|
|
113
|
-
return import_const.ClientEnum.Merchant;
|
|
114
|
-
}, [channel]);
|
|
115
|
-
(0, import_react.useEffect)(() => {
|
|
116
|
-
dispatch((0, import_store.updateClient)(client));
|
|
117
|
-
}, [client]);
|
|
118
75
|
const isMobile = (0, import_react.useMemo)(() => Boolean(channel), [channel]);
|
|
119
|
-
const api = (0, import_react.useMemo)(() => {
|
|
120
|
-
if (typeof getApi === "function") {
|
|
121
|
-
return getApi();
|
|
122
|
-
}
|
|
123
|
-
return {};
|
|
124
|
-
}, [getApi]);
|
|
125
|
-
(0, import_react.useEffect)(() => {
|
|
126
|
-
onChangeParams && onChangeParams({
|
|
127
|
-
...data,
|
|
128
|
-
...data.eftpos === "tyro" ? { custom: { ...data.custom, btnList: [], list: [] } } : {},
|
|
129
|
-
form: "restore"
|
|
130
|
-
});
|
|
131
|
-
}, [data, onChangeParams]);
|
|
132
|
-
const onChange = (0, import_react.useCallback)((status, params, other) => {
|
|
133
|
-
if (status === "page" && typeof params === "string") {
|
|
134
|
-
if (["amount", "deviceList", "pay"].includes(params)) {
|
|
135
|
-
setCurrent(params);
|
|
136
|
-
dispatch((0, import_store.updateState)({ action: params }));
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
console.log("状态切换 = ", status, params, other);
|
|
140
|
-
props.onChangeStatus(status, params, other);
|
|
141
|
-
}, []);
|
|
142
|
-
const onClose = () => {
|
|
143
|
-
onChange("fail", {
|
|
144
|
-
number: data.number,
|
|
145
|
-
device: data.device,
|
|
146
|
-
order_id: data.order_id
|
|
147
|
-
});
|
|
148
|
-
};
|
|
149
|
-
if (current === import_const.RouteEnum.DeviceList) {
|
|
150
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
151
|
-
import_device.default,
|
|
152
|
-
{
|
|
153
|
-
api,
|
|
154
|
-
onChange,
|
|
155
|
-
onClose,
|
|
156
|
-
isMobile,
|
|
157
|
-
className: isMobile ? "pisell-lowcode__eft-pay-terminal" : "",
|
|
158
|
-
net,
|
|
159
|
-
device_number,
|
|
160
|
-
formatAmount,
|
|
161
|
-
client
|
|
162
|
-
}
|
|
163
|
-
);
|
|
164
|
-
}
|
|
165
|
-
if (current === import_const.RouteEnum.Amount) {
|
|
166
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
167
|
-
import_amount.default,
|
|
168
|
-
{
|
|
169
|
-
onChange,
|
|
170
|
-
onClose,
|
|
171
|
-
formatAmount,
|
|
172
|
-
isMobile,
|
|
173
|
-
className: isMobile ? "pisell-lowcode__eft-pay-terminal" : "",
|
|
174
|
-
net,
|
|
175
|
-
client
|
|
176
|
-
}
|
|
177
|
-
);
|
|
178
|
-
}
|
|
179
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
180
|
-
import_pay.default,
|
|
181
|
-
{
|
|
182
|
-
api,
|
|
183
|
-
tyroUrl,
|
|
184
|
-
tyroVersion,
|
|
185
|
-
onChange,
|
|
186
|
-
className: isMobile ? "pisell-lowcode__eft-pay-terminal" : "",
|
|
187
|
-
terminal,
|
|
188
|
-
isMobile,
|
|
189
|
-
net,
|
|
190
|
-
formatAmount,
|
|
191
|
-
client
|
|
192
|
-
}
|
|
193
|
-
);
|
|
194
|
-
};
|
|
195
|
-
var eftposPay_default = (props) => {
|
|
196
|
-
var _a, _b, _c, _d, _e, _f;
|
|
197
|
-
const context = (0, import_useEngineContext.default)();
|
|
198
|
-
const { store } = ((_a = context.appHelper) == null ? void 0 : _a.utils) || { store: {} };
|
|
199
76
|
const symbol = ((_d = (_c = (_b = store == null ? void 0 : store.getState) == null ? void 0 : _b.call(store)) == null ? void 0 : _c.global) == null ? void 0 : _d.symbol) || "$";
|
|
200
77
|
const mode = (0, import_react.useMemo)(() => {
|
|
201
|
-
if (props.source ===
|
|
78
|
+
if (props.source === import_const.RestoreEumn.Restore) {
|
|
202
79
|
if (props.params) {
|
|
203
80
|
if (props.params.mode) {
|
|
204
81
|
return props.params.mode;
|
|
@@ -213,7 +90,7 @@ var eftposPay_default = (props) => {
|
|
|
213
90
|
}, [props.mode, props.source, props.params]);
|
|
214
91
|
const state = (0, import_react.useMemo)(() => {
|
|
215
92
|
const current = props.params && props.params.symbol ? props.params.symbol : symbol;
|
|
216
|
-
if (props.source ===
|
|
93
|
+
if (props.source === import_const.RestoreEumn.Restore) {
|
|
217
94
|
return props.params;
|
|
218
95
|
}
|
|
219
96
|
return (0, import_manufacturer.getInitState)(
|
|
@@ -221,6 +98,10 @@ var eftposPay_default = (props) => {
|
|
|
221
98
|
props.params ? { mode, ...props.params, symbol: current } : { mode, symbol: current }
|
|
222
99
|
);
|
|
223
100
|
}, [mode, props.params, props.type, symbol]);
|
|
101
|
+
const stateRef = (0, import_react.useRef)(state);
|
|
102
|
+
(0, import_react.useEffect)(() => {
|
|
103
|
+
stateRef.current = state;
|
|
104
|
+
}, [state]);
|
|
224
105
|
const onChangeStatus = (0, import_react.useCallback)(
|
|
225
106
|
(status, params, other) => {
|
|
226
107
|
props.onChangeStatus(status, params, other);
|
|
@@ -256,22 +137,103 @@ var eftposPay_default = (props) => {
|
|
|
256
137
|
return act;
|
|
257
138
|
}, [mode, state]);
|
|
258
139
|
(0, import_react.useEffect)(() => {
|
|
140
|
+
document.body.id = "body";
|
|
259
141
|
console.log("初始化 ........11221801");
|
|
260
142
|
}, []);
|
|
261
143
|
console.log("props?.params?.device_number = ", (_e = props == null ? void 0 : props.params) == null ? void 0 : _e.device_number);
|
|
262
|
-
|
|
263
|
-
|
|
144
|
+
const api = (0, import_react.useMemo)(() => {
|
|
145
|
+
if (typeof props.getApi === "function") {
|
|
146
|
+
return props.getApi();
|
|
147
|
+
}
|
|
148
|
+
return {};
|
|
149
|
+
}, [props.getApi]);
|
|
150
|
+
(0, import_react.useEffect)(() => {
|
|
151
|
+
if (props.source === import_const.RestoreEumn.Restore || props.type === import_const.EftposEnum.Tyro) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
api.getTransaction({
|
|
155
|
+
order_id: stateRef.current.order_id,
|
|
156
|
+
card_reader_type: stateRef.current.eftpos,
|
|
157
|
+
receive_status: "unprocessed"
|
|
158
|
+
}).then((res) => {
|
|
159
|
+
if (!Array.isArray(res.data) || res.data.length === 0) {
|
|
160
|
+
setCheckStatus(import_const.OrderEumn.Null);
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
const currentMode = stateRef.current.mode === import_const.ModeEnum.FullPay ? import_const.ModeEnum.Pay : stateRef.current.mode;
|
|
164
|
+
const list = res.data.filter(
|
|
165
|
+
(item) => item.action === currentMode
|
|
166
|
+
);
|
|
167
|
+
if (list.length === 0) {
|
|
168
|
+
setCheckStatus(import_const.OrderEumn.Null);
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
const latest = list.pop();
|
|
172
|
+
const numberList = list.map((item) => item.number);
|
|
173
|
+
if (latest.status === import_const.OrderEumn.Failed) {
|
|
174
|
+
setCheckStatus(latest.status);
|
|
175
|
+
onChangeStatus("mark_tx_processed", [
|
|
176
|
+
...numberList,
|
|
177
|
+
latest.number
|
|
178
|
+
]);
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
if (list.length > 0) {
|
|
182
|
+
onChangeStatus("mark_tx_processed", numberList);
|
|
183
|
+
}
|
|
184
|
+
const { pay_param_base64, card_reader_surcharge, receipt: receipt2 } = (latest == null ? void 0 : latest.metadata) || {};
|
|
185
|
+
setTime(latest.updated_at);
|
|
186
|
+
setCardSurcharge(card_reader_surcharge || 0);
|
|
187
|
+
setReceipt(receipt2 || []);
|
|
188
|
+
if (!pay_param_base64) {
|
|
189
|
+
setCheckStatus(import_const.OrderEumn.Failed);
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
try {
|
|
193
|
+
const data = JSON.parse(
|
|
194
|
+
decodeURIComponent(atob(decodeURIComponent(pay_param_base64)))
|
|
195
|
+
);
|
|
196
|
+
setHistory(data);
|
|
197
|
+
setCheckStatus(latest.status);
|
|
198
|
+
} catch (e) {
|
|
199
|
+
setCheckStatus(import_const.OrderEumn.Failed);
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
}, []);
|
|
204
|
+
if (check === import_const.OrderEumn.Normal) {
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
if (check === import_const.OrderEumn.Succeed) {
|
|
208
|
+
return /* @__PURE__ */ import_react.default.createElement(import_store.Provider, { state: historyData }, /* @__PURE__ */ import_react.default.createElement(
|
|
209
|
+
import_tip.default,
|
|
210
|
+
{
|
|
211
|
+
cardSurcharge,
|
|
212
|
+
receipts: receipt,
|
|
213
|
+
onChangeStatus,
|
|
214
|
+
onChangeParams: props.onChangeParams,
|
|
215
|
+
formatAmount,
|
|
216
|
+
successTime: updateTime,
|
|
217
|
+
className: isMobile ? "pisell-lowcode__eft-pay-terminal" : ""
|
|
218
|
+
}
|
|
219
|
+
));
|
|
220
|
+
}
|
|
221
|
+
return /* @__PURE__ */ import_react.default.createElement(import_store.Provider, { state: check === import_const.OrderEumn.Pending ? historyData : state }, /* @__PURE__ */ import_react.default.createElement(
|
|
222
|
+
import_app.default,
|
|
264
223
|
{
|
|
265
|
-
|
|
224
|
+
api,
|
|
225
|
+
channel,
|
|
266
226
|
params: props.params,
|
|
267
227
|
onChangeStatus,
|
|
268
228
|
terminal: props.terminal,
|
|
269
229
|
onChangeParams: props.onChangeParams,
|
|
270
|
-
action,
|
|
230
|
+
action: check === import_const.OrderEumn.Pending ? import_const.ModeEnum.Pay : action,
|
|
271
231
|
source: props.source,
|
|
272
232
|
tyroUrl: props.tyroUrl,
|
|
273
233
|
tyroVersion: props.tyroVersion,
|
|
274
|
-
device_number: (_f = props == null ? void 0 : props.params) == null ? void 0 : _f.device_number
|
|
234
|
+
device_number: (_f = props == null ? void 0 : props.params) == null ? void 0 : _f.device_number,
|
|
235
|
+
isMobile,
|
|
236
|
+
formatAmount
|
|
275
237
|
}
|
|
276
238
|
));
|
|
277
239
|
};
|
|
@@ -54,6 +54,11 @@ declare const _default: {
|
|
|
54
54
|
'page.eftpos-pay.text.sure': string;
|
|
55
55
|
'page.eftpos-pay.text.device': string;
|
|
56
56
|
'page.eftpos-pay.text.leave': string;
|
|
57
|
+
'page.eftpos-pay.text.latest.success': string;
|
|
58
|
+
'page.eftpos-pay.text.latest.amount': string;
|
|
59
|
+
'page.eftpos-pay.text.latest.surcharge': string;
|
|
60
|
+
'page.eftpos-pay.text.latest.time': string;
|
|
61
|
+
'page.eftpos-pay.text.latest.confirm': string;
|
|
57
62
|
'page.eftpos-pay.text.amount.to.pay': string;
|
|
58
63
|
'page.eftpos-pay.text.surcharge.percentage': string;
|
|
59
64
|
'page.eftpos-pay.text.surcharge.fixed': string;
|
|
@@ -158,6 +163,11 @@ declare const _default: {
|
|
|
158
163
|
'page.eftpos-pay.text.sure': string;
|
|
159
164
|
'page.eftpos-pay.text.device': string;
|
|
160
165
|
'page.eftpos-pay.text.leave': string;
|
|
166
|
+
'page.eftpos-pay.text.latest.success': string;
|
|
167
|
+
'page.eftpos-pay.text.latest.amount': string;
|
|
168
|
+
'page.eftpos-pay.text.latest.surcharge': string;
|
|
169
|
+
'page.eftpos-pay.text.latest.time': string;
|
|
170
|
+
'page.eftpos-pay.text.latest.confirm': string;
|
|
161
171
|
'page.eftpos-pay.text.amount.to.pay': string;
|
|
162
172
|
'page.eftpos-pay.text.surcharge.percentage': string;
|
|
163
173
|
'page.eftpos-pay.text.surcharge.fixed': string;
|
|
@@ -262,6 +272,11 @@ declare const _default: {
|
|
|
262
272
|
'page.eftpos-pay.text.sure': string;
|
|
263
273
|
'page.eftpos-pay.text.device': string;
|
|
264
274
|
'page.eftpos-pay.text.leave': string;
|
|
275
|
+
'page.eftpos-pay.text.latest.success': string;
|
|
276
|
+
'page.eftpos-pay.text.latest.amount': string;
|
|
277
|
+
'page.eftpos-pay.text.latest.surcharge': string;
|
|
278
|
+
'page.eftpos-pay.text.latest.time': string;
|
|
279
|
+
'page.eftpos-pay.text.latest.confirm': string;
|
|
265
280
|
'page.eftpos-pay.text.amount.to.pay': string;
|
|
266
281
|
'page.eftpos-pay.text.surcharge.percentage': string;
|
|
267
282
|
'page.eftpos-pay.text.surcharge.fixed': string;
|
|
@@ -78,6 +78,11 @@ var locales_default = {
|
|
|
78
78
|
"page.eftpos-pay.text.sure": "Sure",
|
|
79
79
|
"page.eftpos-pay.text.device": "Please select device",
|
|
80
80
|
"page.eftpos-pay.text.leave": "Please do not leave this page",
|
|
81
|
+
"page.eftpos-pay.text.latest.success": "A Successful Payment Detected for This Order!",
|
|
82
|
+
"page.eftpos-pay.text.latest.amount": "Amount",
|
|
83
|
+
"page.eftpos-pay.text.latest.surcharge": "Surcharge",
|
|
84
|
+
"page.eftpos-pay.text.latest.time": "Time",
|
|
85
|
+
"page.eftpos-pay.text.latest.confirm": "Confirm",
|
|
81
86
|
"page.eftpos-pay.text.amount.to.pay": "Amount to pay",
|
|
82
87
|
"page.eftpos-pay.text.surcharge.percentage": "Percentage",
|
|
83
88
|
"page.eftpos-pay.text.surcharge.fixed": "Fixed",
|
|
@@ -187,6 +192,11 @@ var locales_default = {
|
|
|
187
192
|
"page.eftpos-pay.text.sure": "确定",
|
|
188
193
|
"page.eftpos-pay.text.device": "请选择设备",
|
|
189
194
|
"page.eftpos-pay.text.leave": "请不要离开此页面",
|
|
195
|
+
"page.eftpos-pay.text.latest.success": "检测到此订单有一笔交易已支付成功!",
|
|
196
|
+
"page.eftpos-pay.text.latest.amount": "交易金额",
|
|
197
|
+
"page.eftpos-pay.text.latest.surcharge": "手续费",
|
|
198
|
+
"page.eftpos-pay.text.latest.time": "交易时间",
|
|
199
|
+
"page.eftpos-pay.text.latest.confirm": "确认",
|
|
190
200
|
"page.eftpos-pay.text.amount.to.pay": "剩余待支付金额",
|
|
191
201
|
"page.eftpos-pay.text.surcharge.percentage": "百分比",
|
|
192
202
|
// Percentage
|
|
@@ -449,6 +459,11 @@ var locales_default = {
|
|
|
449
459
|
"page.eftpos-pay.text.sure": "確定",
|
|
450
460
|
"page.eftpos-pay.text.device": "請選擇設備",
|
|
451
461
|
"page.eftpos-pay.text.leave": "請不要離開此頁面",
|
|
462
|
+
"page.eftpos-pay.text.latest.success": "檢測到此訂單有一筆交易已支付成功!",
|
|
463
|
+
"page.eftpos-pay.text.latest.amount": "交易金額",
|
|
464
|
+
"page.eftpos-pay.text.latest.surcharge": "手續費",
|
|
465
|
+
"page.eftpos-pay.text.latest.time": "交易時間",
|
|
466
|
+
"page.eftpos-pay.text.latest.confirm": "確認",
|
|
452
467
|
"page.eftpos-pay.text.amount.to.pay": "剩餘待支付金額",
|
|
453
468
|
"page.eftpos-pay.text.surcharge.percentage": "百分比",
|
|
454
469
|
// Percentage
|
|
@@ -56,7 +56,8 @@ var POS = ({
|
|
|
56
56
|
netRef,
|
|
57
57
|
orderIdRef,
|
|
58
58
|
amountRef,
|
|
59
|
-
eftposRef
|
|
59
|
+
eftposRef,
|
|
60
|
+
dataRef
|
|
60
61
|
} = (0, import_hooks.useStoreRef)();
|
|
61
62
|
const dispatch = (0, import_store.useDispatch)();
|
|
62
63
|
const { key, ...props } = steps[0];
|
|
@@ -71,15 +72,18 @@ var POS = ({
|
|
|
71
72
|
failRef.current = fail;
|
|
72
73
|
}, [fail]);
|
|
73
74
|
const success = (res) => {
|
|
74
|
-
var _a;
|
|
75
|
+
var _a, _b, _c, _d;
|
|
76
|
+
let receipt = Array.isArray((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.receipt) ? (_b = res == null ? void 0 : res.data) == null ? void 0 : _b.receipt : [(_c = res == null ? void 0 : res.data) == null ? void 0 : _c.receipt];
|
|
77
|
+
receipt = receipt.filter((item) => typeof item === "string").filter(Boolean);
|
|
75
78
|
dispatch((0, import_store.updateNextStep)());
|
|
76
79
|
dispatch(
|
|
77
80
|
(0, import_store.updateCustom)({
|
|
78
|
-
card_reader_surcharge: ((
|
|
81
|
+
card_reader_surcharge: ((_d = res == null ? void 0 : res.data) == null ? void 0 : _d.card_reader_surcharge) || 0,
|
|
82
|
+
receipt
|
|
79
83
|
})
|
|
80
84
|
);
|
|
81
85
|
clearRef.current = setTimeout(() => {
|
|
82
|
-
var _a2,
|
|
86
|
+
var _a2, _b2, _c2;
|
|
83
87
|
const params = (0, import_helper.getPayParams)(
|
|
84
88
|
{
|
|
85
89
|
mode: modeRef.current,
|
|
@@ -89,15 +93,15 @@ var POS = ({
|
|
|
89
93
|
device: deviceRef.current,
|
|
90
94
|
pay: payRef.current,
|
|
91
95
|
custom: {
|
|
92
|
-
card_reader_surcharge: ((_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.card_reader_surcharge) || 0
|
|
96
|
+
card_reader_surcharge: ((_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.card_reader_surcharge) || 0,
|
|
97
|
+
receipt
|
|
93
98
|
}
|
|
94
99
|
},
|
|
95
100
|
"success"
|
|
96
101
|
);
|
|
97
|
-
const receipt = Array.isArray(res.receipt) ? res.receipt : [res.receipt];
|
|
98
102
|
onChange("success", {
|
|
99
103
|
...params,
|
|
100
|
-
receipt: ((
|
|
104
|
+
receipt: ((_c2 = (_b2 = deviceRef.current) == null ? void 0 : _b2.setting) == null ? void 0 : _c2.receipts) ? [] : receipt
|
|
101
105
|
});
|
|
102
106
|
}, 1e3);
|
|
103
107
|
};
|
|
@@ -147,7 +151,17 @@ var POS = ({
|
|
|
147
151
|
amount: payRef.current.total,
|
|
148
152
|
card_reader_type: eftposRef.current,
|
|
149
153
|
card_reader_id: (_a = deviceRef.current) == null ? void 0 : _a.id,
|
|
150
|
-
number: numRef.current
|
|
154
|
+
number: numRef.current,
|
|
155
|
+
pay_param_base64: encodeURIComponent(
|
|
156
|
+
btoa(
|
|
157
|
+
encodeURIComponent(
|
|
158
|
+
JSON.stringify({
|
|
159
|
+
...dataRef.current,
|
|
160
|
+
number: numRef.current
|
|
161
|
+
})
|
|
162
|
+
)
|
|
163
|
+
)
|
|
164
|
+
)
|
|
151
165
|
},
|
|
152
166
|
{ signal: controllerRef.current.signal }
|
|
153
167
|
) : api.refund(
|
|
@@ -156,7 +170,17 @@ var POS = ({
|
|
|
156
170
|
amount: amountRef.current,
|
|
157
171
|
card_reader_type: eftposRef.current,
|
|
158
172
|
card_reader_id: (_b = deviceRef.current) == null ? void 0 : _b.id,
|
|
159
|
-
number: numRef.current
|
|
173
|
+
number: numRef.current,
|
|
174
|
+
pay_param_base64: encodeURIComponent(
|
|
175
|
+
btoa(
|
|
176
|
+
encodeURIComponent(
|
|
177
|
+
JSON.stringify({
|
|
178
|
+
...dataRef.current,
|
|
179
|
+
number: numRef.current
|
|
180
|
+
})
|
|
181
|
+
)
|
|
182
|
+
)
|
|
183
|
+
)
|
|
160
184
|
},
|
|
161
185
|
{ signal: controllerRef.current.signal }
|
|
162
186
|
);
|