@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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { FormState } from "../model";
|
|
3
|
-
export declare const Provider: (ComponentUi: any) =>
|
|
3
|
+
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
4
4
|
state: FormState;
|
|
5
5
|
} & {
|
|
6
6
|
dispatch: (params: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { FormState } from "../model";
|
|
3
|
-
export declare const Provider: (ComponentUi: any) =>
|
|
3
|
+
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
4
4
|
state: FormState;
|
|
5
5
|
} & {
|
|
6
6
|
dispatch: (params: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { FormState } from "../model";
|
|
3
|
-
export declare const Provider: (ComponentUi: any) =>
|
|
3
|
+
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
4
4
|
state: FormState;
|
|
5
5
|
} & {
|
|
6
6
|
dispatch: (params: {
|
|
@@ -9,7 +9,7 @@ import { PosProps } from './const';
|
|
|
9
9
|
*/
|
|
10
10
|
declare const _default: ({ className, onChange, onClose, formatAmount, isMobile, net, client }: {
|
|
11
11
|
className?: string | undefined;
|
|
12
|
-
onChange?: ((status: "page" | "success" | "
|
|
12
|
+
onChange?: ((status: "page" | "success" | "fail", params?: string | {
|
|
13
13
|
[keys: string]: unknown;
|
|
14
14
|
} | undefined, other?: any) => void) | undefined;
|
|
15
15
|
onClose: () => void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PosProps, RouteType } from './const';
|
|
3
|
+
declare const App: ({ action, api, device_number, terminal, tyroUrl, tyroVersion, onChangeParams, isMobile, channel, formatAmount, ...props }: Omit<PosProps, "mode" | "type" | "getApi"> & {
|
|
4
|
+
action: RouteType;
|
|
5
|
+
device_number: string | number;
|
|
6
|
+
api: ReturnType<PosProps['getApi']>;
|
|
7
|
+
isMobile: boolean;
|
|
8
|
+
channel?: string | undefined;
|
|
9
|
+
formatAmount(amount: number | string, precision: number, symbol: string): string;
|
|
10
|
+
}) => React.JSX.Element;
|
|
11
|
+
export default App;
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
var _excluded = ["action", "api", "device_number", "terminal", "tyroUrl", "tyroVersion", "onChangeParams", "isMobile", "channel", "formatAmount"];
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
11
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
12
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
13
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
15
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
16
|
+
/* eslint-disable react/destructuring-assignment */
|
|
17
|
+
import React, { useEffect, useState, useMemo, useRef, useCallback } from 'react';
|
|
18
|
+
import { useNetwork } from 'ahooks';
|
|
19
|
+
import Amount from "./amount";
|
|
20
|
+
import { RouteEnum, ClientEnum, RestoreEumn } from "./const";
|
|
21
|
+
import Device from "./device";
|
|
22
|
+
import Pay from "./pay";
|
|
23
|
+
import { useContextData, useDispatch, updateState, updateClient } from "./store";
|
|
24
|
+
var App = function App(_ref) {
|
|
25
|
+
var action = _ref.action,
|
|
26
|
+
api = _ref.api,
|
|
27
|
+
device_number = _ref.device_number,
|
|
28
|
+
terminal = _ref.terminal,
|
|
29
|
+
tyroUrl = _ref.tyroUrl,
|
|
30
|
+
tyroVersion = _ref.tyroVersion,
|
|
31
|
+
onChangeParams = _ref.onChangeParams,
|
|
32
|
+
isMobile = _ref.isMobile,
|
|
33
|
+
channel = _ref.channel,
|
|
34
|
+
_ref$formatAmount = _ref.formatAmount,
|
|
35
|
+
formatAmount = _ref$formatAmount === void 0 ? function (number, precision, symbol) {
|
|
36
|
+
return "".concat(symbol).concat(number);
|
|
37
|
+
} : _ref$formatAmount,
|
|
38
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
39
|
+
var data = useContextData();
|
|
40
|
+
var dispatch = useDispatch();
|
|
41
|
+
var _useState = useState(action),
|
|
42
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
43
|
+
current = _useState2[0],
|
|
44
|
+
setCurrent = _useState2[1];
|
|
45
|
+
var statusRef = useRef(data.status);
|
|
46
|
+
|
|
47
|
+
// 外部网络数据
|
|
48
|
+
var network = useMemo(function () {
|
|
49
|
+
return typeof terminal.network === 'boolean' ? terminal.network : true;
|
|
50
|
+
}, [terminal === null || terminal === void 0 ? void 0 : terminal.network]);
|
|
51
|
+
// 内部网络数据
|
|
52
|
+
var _useNetwork = useNetwork(),
|
|
53
|
+
online = _useNetwork.online;
|
|
54
|
+
var netRef = useRef([network, online]);
|
|
55
|
+
|
|
56
|
+
// 网络数据
|
|
57
|
+
var net = useMemo(function () {
|
|
58
|
+
var networkChange = false,
|
|
59
|
+
onlineChange = false;
|
|
60
|
+
if (netRef.current[0] !== network) {
|
|
61
|
+
netRef.current[0] = network;
|
|
62
|
+
networkChange = true;
|
|
63
|
+
}
|
|
64
|
+
if (netRef.current[1] !== online) {
|
|
65
|
+
netRef.current[1] = online;
|
|
66
|
+
onlineChange = true;
|
|
67
|
+
}
|
|
68
|
+
if (networkChange) {
|
|
69
|
+
return network;
|
|
70
|
+
}
|
|
71
|
+
return online;
|
|
72
|
+
}, [network, online]);
|
|
73
|
+
useEffect(function () {
|
|
74
|
+
statusRef.current = data.status;
|
|
75
|
+
}, [data.status]);
|
|
76
|
+
var client = useMemo(function () {
|
|
77
|
+
if (channel === 'kiosk') {
|
|
78
|
+
return ClientEnum.User;
|
|
79
|
+
}
|
|
80
|
+
return ClientEnum.Merchant;
|
|
81
|
+
}, [channel]);
|
|
82
|
+
useEffect(function () {
|
|
83
|
+
dispatch(updateClient(client));
|
|
84
|
+
}, [client]);
|
|
85
|
+
|
|
86
|
+
// 内嵌在 terminal 或者 kiosk 的移动端 做特定移动端(大屏)适配
|
|
87
|
+
// const isMobile = useMemo(() => Boolean(channel), [channel]);
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @title: 缓存状态数据 可以用于闪退,成功or失败时清除缓存
|
|
91
|
+
* @Author: hongbing.wang
|
|
92
|
+
* @Date: 2024-08-20 10:27
|
|
93
|
+
*/
|
|
94
|
+
useEffect(function () {
|
|
95
|
+
onChangeParams && onChangeParams(_objectSpread(_objectSpread(_objectSpread({}, data), data.eftpos === 'tyro' ? {
|
|
96
|
+
custom: _objectSpread(_objectSpread({}, data.custom), {}, {
|
|
97
|
+
btnList: [],
|
|
98
|
+
list: []
|
|
99
|
+
})
|
|
100
|
+
} : {}), {}, {
|
|
101
|
+
form: RestoreEumn.Restore
|
|
102
|
+
}));
|
|
103
|
+
}, [data, onChangeParams]);
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* @title: 支付状态切换页
|
|
107
|
+
* @Author: hongbing.wang
|
|
108
|
+
* @Date: 2024-08-20 13:10
|
|
109
|
+
*/
|
|
110
|
+
var onChange = useCallback(function (status, params, other) {
|
|
111
|
+
if (status === 'page' && typeof params === 'string') {
|
|
112
|
+
if (['amount', 'deviceList', 'pay'].includes(params)) {
|
|
113
|
+
setCurrent(params);
|
|
114
|
+
dispatch(updateState({
|
|
115
|
+
action: params
|
|
116
|
+
}));
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
console.log('状态切换 = ', status, params, other);
|
|
120
|
+
props.onChangeStatus(status, params, other);
|
|
121
|
+
}, []);
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* @title: 支付失败
|
|
125
|
+
* @Author: hongbing.wang
|
|
126
|
+
* @Date: 2024-08-20 13:09
|
|
127
|
+
*/
|
|
128
|
+
var onClose = function onClose() {
|
|
129
|
+
onChange('fail', {
|
|
130
|
+
number: data.number,
|
|
131
|
+
uniquePaymentNumber: data.number,
|
|
132
|
+
device: data.device,
|
|
133
|
+
order_id: data.order_id
|
|
134
|
+
});
|
|
135
|
+
};
|
|
136
|
+
if (current === RouteEnum.DeviceList) {
|
|
137
|
+
return /*#__PURE__*/React.createElement(Device, {
|
|
138
|
+
api: api,
|
|
139
|
+
onChange: onChange,
|
|
140
|
+
onClose: onClose,
|
|
141
|
+
isMobile: isMobile,
|
|
142
|
+
className: isMobile ? 'pisell-lowcode__eft-pay-terminal' : '',
|
|
143
|
+
net: net,
|
|
144
|
+
device_number: device_number,
|
|
145
|
+
formatAmount: formatAmount,
|
|
146
|
+
client: client
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
if (current === RouteEnum.Amount) {
|
|
150
|
+
return /*#__PURE__*/React.createElement(Amount, {
|
|
151
|
+
onChange: onChange,
|
|
152
|
+
onClose: onClose,
|
|
153
|
+
formatAmount: formatAmount,
|
|
154
|
+
isMobile: isMobile,
|
|
155
|
+
className: isMobile ? 'pisell-lowcode__eft-pay-terminal' : '',
|
|
156
|
+
net: net,
|
|
157
|
+
client: client
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
return /*#__PURE__*/React.createElement(Pay, {
|
|
161
|
+
api: api,
|
|
162
|
+
tyroUrl: tyroUrl,
|
|
163
|
+
tyroVersion: tyroVersion,
|
|
164
|
+
onChange: onChange,
|
|
165
|
+
className: isMobile ? 'pisell-lowcode__eft-pay-terminal' : '',
|
|
166
|
+
terminal: terminal,
|
|
167
|
+
isMobile: isMobile,
|
|
168
|
+
net: net,
|
|
169
|
+
formatAmount: formatAmount,
|
|
170
|
+
client: client
|
|
171
|
+
});
|
|
172
|
+
};
|
|
173
|
+
export default App;
|
|
@@ -89,6 +89,7 @@ export default (function (_ref) {
|
|
|
89
89
|
amount: amount,
|
|
90
90
|
total: amount,
|
|
91
91
|
number: number,
|
|
92
|
+
uniquePaymentNumber: number,
|
|
92
93
|
device: device,
|
|
93
94
|
order_id: order_id
|
|
94
95
|
});
|
|
@@ -114,6 +115,7 @@ export default (function (_ref) {
|
|
|
114
115
|
setDisabled(true);
|
|
115
116
|
onChange('fail', {
|
|
116
117
|
number: number,
|
|
118
|
+
uniquePaymentNumber: number,
|
|
117
119
|
device: device,
|
|
118
120
|
order_id: order_id
|
|
119
121
|
});
|
|
@@ -151,6 +153,7 @@ export default (function (_ref) {
|
|
|
151
153
|
total: moneyDeci.toFixed(2, Decimal.ROUND_HALF_UP),
|
|
152
154
|
totalUnit: formatAmount(moneyDeci.toFixed(2, Decimal.ROUND_HALF_UP), 2, symbol),
|
|
153
155
|
number: number,
|
|
156
|
+
uniquePaymentNumber: number,
|
|
154
157
|
device: device,
|
|
155
158
|
order_id: order_id
|
|
156
159
|
}));
|
|
@@ -174,7 +177,7 @@ export default (function (_ref) {
|
|
|
174
177
|
className: "pisell-lowcode__eft-pay-manual-edit-body"
|
|
175
178
|
}, /*#__PURE__*/React.createElement("div", {
|
|
176
179
|
className: "pisell-lowcode__eft-pay-manual-edit-text"
|
|
177
|
-
}, locales.getText('page.eftpos-pay.text.manual.subtitle')(formatAmount(pay === null || pay === void 0 ? void 0 : pay.total, 2, symbol)),
|
|
180
|
+
}, locales.getText('page.eftpos-pay.text.manual.subtitle')(formatAmount(pay === null || pay === void 0 ? void 0 : pay.total, 2, symbol)), ' ', /*#__PURE__*/React.createElement("br", null), locales.getText('page.eftpos-pay.text.manual.confirm'), /*#__PURE__*/React.createElement("br", null), locales.getText('page.eftpos-pay.text.manual.diff')), /*#__PURE__*/React.createElement("div", {
|
|
178
181
|
className: "pisell-lowcode__eft-pay-manual-edit-act"
|
|
179
182
|
}, /*#__PURE__*/React.createElement("div", {
|
|
180
183
|
className: "pisell-lowcode__eft-pay-manual-edit-text"
|
|
@@ -27,6 +27,32 @@ export declare enum ModeEnum {
|
|
|
27
27
|
/** 查询 */
|
|
28
28
|
Query = "query"
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* 崩溃恢复
|
|
32
|
+
*/
|
|
33
|
+
export declare enum RestoreEumn {
|
|
34
|
+
/** 常规 */
|
|
35
|
+
Normal = "normal",
|
|
36
|
+
/** 恢复 */
|
|
37
|
+
Restore = "restore"
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* 订单状态
|
|
41
|
+
*/
|
|
42
|
+
export declare enum OrderEumn {
|
|
43
|
+
/** 恢复 */
|
|
44
|
+
Restore = "restore",
|
|
45
|
+
/** 常规 */
|
|
46
|
+
Normal = "normal",
|
|
47
|
+
/** 成功 */
|
|
48
|
+
Succeed = "succeed",
|
|
49
|
+
/** 失败 */
|
|
50
|
+
Failed = "failed",
|
|
51
|
+
/** 等待 */
|
|
52
|
+
Pending = "pending",
|
|
53
|
+
/** 没有订单状态 */
|
|
54
|
+
Null = "null"
|
|
55
|
+
}
|
|
30
56
|
export declare enum ClientEnum {
|
|
31
57
|
/** 用户端 */
|
|
32
58
|
User = "user",
|
|
@@ -60,7 +86,7 @@ export interface PosProps {
|
|
|
60
86
|
[key: string]: unknown;
|
|
61
87
|
};
|
|
62
88
|
/** 回调 */
|
|
63
|
-
onChangeStatus: (status: `${StatusEnum.Success}` | `${StatusEnum.Fail}` | 'page', params?: {
|
|
89
|
+
onChangeStatus: (status: `${StatusEnum.Success}` | `${StatusEnum.Fail}` | 'page' | 'print' | 'mark_tx_processed', params?: {
|
|
64
90
|
[keys: string]: unknown;
|
|
65
91
|
} | string, other?: any) => void;
|
|
66
92
|
onChangeParams(...agrn: unknown[]): void;
|
|
@@ -17,12 +17,34 @@ export var StatusEnum;
|
|
|
17
17
|
StatusEnum["Question"] = "question";
|
|
18
18
|
})(StatusEnum || (StatusEnum = {}));
|
|
19
19
|
export var ModeEnum;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 崩溃恢复
|
|
23
|
+
*/
|
|
20
24
|
(function (ModeEnum) {
|
|
21
25
|
ModeEnum["Pay"] = "pay";
|
|
22
26
|
ModeEnum["FullPay"] = "fullPay";
|
|
23
27
|
ModeEnum["Refund"] = "refund";
|
|
24
28
|
ModeEnum["Query"] = "query";
|
|
25
29
|
})(ModeEnum || (ModeEnum = {}));
|
|
30
|
+
export var RestoreEumn;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* 订单状态
|
|
34
|
+
*/
|
|
35
|
+
(function (RestoreEumn) {
|
|
36
|
+
RestoreEumn["Normal"] = "normal";
|
|
37
|
+
RestoreEumn["Restore"] = "restore";
|
|
38
|
+
})(RestoreEumn || (RestoreEumn = {}));
|
|
39
|
+
export var OrderEumn;
|
|
40
|
+
(function (OrderEumn) {
|
|
41
|
+
OrderEumn["Restore"] = "restore";
|
|
42
|
+
OrderEumn["Normal"] = "normal";
|
|
43
|
+
OrderEumn["Succeed"] = "succeed";
|
|
44
|
+
OrderEumn["Failed"] = "failed";
|
|
45
|
+
OrderEumn["Pending"] = "pending";
|
|
46
|
+
OrderEumn["Null"] = "null";
|
|
47
|
+
})(OrderEumn || (OrderEumn = {}));
|
|
26
48
|
export var ClientEnum;
|
|
27
49
|
(function (ClientEnum) {
|
|
28
50
|
ClientEnum["User"] = "user";
|
|
@@ -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;
|
|
@@ -203,11 +203,11 @@ export default (function (_ref) {
|
|
|
203
203
|
className: "pisell-lowcode__eft-pay-device-content"
|
|
204
204
|
}, /*#__PURE__*/React.createElement("div", {
|
|
205
205
|
className: "pisell-lowcode__eft-pay-device-name"
|
|
206
|
-
}, name), /*#__PURE__*/React.createElement("div", {
|
|
206
|
+
}, name), mode === ModeEnum.Refund ? null : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
207
207
|
className: "pisell-lowcode__eft-pay-device-money"
|
|
208
208
|
}, pay.totalUnit), /*#__PURE__*/React.createElement("div", {
|
|
209
209
|
className: "pisell-lowcode__eft-pay-device-sucharge"
|
|
210
|
-
}, locales.getText('page.eftpos-pay.text.surcharge.edit.inc.surcharge'), ": ", formatAmount("".concat(pay.surcharge), 2, symbol), " (", locales.getText('page.eftpos-pay.text.surcharge.edit.rate'), ":", pay.surRate, "% +", ' ', formatAmount("".concat(pay.surMoney), 2, symbol), ")")), /*#__PURE__*/React.createElement("div", {
|
|
210
|
+
}, locales.getText('page.eftpos-pay.text.surcharge.edit.inc.surcharge'), ": ", formatAmount("".concat(pay.surcharge), 2, symbol), " (", locales.getText('page.eftpos-pay.text.surcharge.edit.rate'), ":", pay.surRate, "% +", ' ', formatAmount("".concat(pay.surMoney), 2, symbol), ")"))), /*#__PURE__*/React.createElement("div", {
|
|
211
211
|
style: {
|
|
212
212
|
flexShrink: 0
|
|
213
213
|
}
|
|
@@ -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
|
/**
|
|
@@ -58,6 +58,7 @@ export function cloneDeep(source) {
|
|
|
58
58
|
* @Date: 2024-08-20 20:26
|
|
59
59
|
*/
|
|
60
60
|
export var getPayParams = function getPayParams(data, statue) {
|
|
61
|
+
var _data$custom;
|
|
61
62
|
if (statue === 'fail') {
|
|
62
63
|
return {
|
|
63
64
|
number: data.number,
|
|
@@ -65,10 +66,11 @@ export var getPayParams = function getPayParams(data, statue) {
|
|
|
65
66
|
order_id: data.order_id
|
|
66
67
|
};
|
|
67
68
|
}
|
|
69
|
+
var receipt = (data === null || data === void 0 ? void 0 : (_data$custom = data.custom) === null || _data$custom === void 0 ? void 0 : _data$custom.receipt) || [];
|
|
68
70
|
if (data.mode === ModeEnum.Pay || data.mode === ModeEnum.FullPay) {
|
|
69
|
-
var _data$
|
|
71
|
+
var _data$custom2, _data$device, _data$device$setting;
|
|
70
72
|
var pay = data.pay;
|
|
71
|
-
var card_reader_surcharge = ((_data$
|
|
73
|
+
var card_reader_surcharge = ((_data$custom2 = data.custom) === null || _data$custom2 === void 0 ? void 0 : _data$custom2.card_reader_surcharge) || 0;
|
|
72
74
|
var obj = pay || {};
|
|
73
75
|
var cardReaderSurcharge = card_reader_surcharge;
|
|
74
76
|
// 卡手续费
|
|
@@ -93,17 +95,21 @@ export var getPayParams = function getPayParams(data, statue) {
|
|
|
93
95
|
surcharge: surchargeDeci.toFixed(2, Decimal.ROUND_HALF_UP),
|
|
94
96
|
total: total.toFixed(2, Decimal.ROUND_HALF_UP),
|
|
95
97
|
number: data.number,
|
|
98
|
+
uniquePaymentNumber: data.number,
|
|
96
99
|
device: data.device,
|
|
97
|
-
order_id: data.order_id
|
|
100
|
+
order_id: data.order_id,
|
|
101
|
+
receipt: (_data$device = data.device) !== null && _data$device !== void 0 && (_data$device$setting = _data$device.setting) !== null && _data$device$setting !== void 0 && _data$device$setting.receipts ? [] : receipt
|
|
98
102
|
});
|
|
99
103
|
}
|
|
100
104
|
if (data.mode === ModeEnum.Refund) {
|
|
105
|
+
var _data$device2, _data$device2$setting;
|
|
101
106
|
return {
|
|
102
107
|
amount: data.amount,
|
|
103
108
|
total: data.amount,
|
|
104
109
|
number: data.number,
|
|
105
110
|
device: data.device,
|
|
106
|
-
order_id: data.order_id
|
|
111
|
+
order_id: data.order_id,
|
|
112
|
+
receipt: (_data$device2 = data.device) !== null && _data$device2 !== void 0 && (_data$device2$setting = _data$device2.setting) !== null && _data$device2$setting !== void 0 && _data$device2$setting.receipts ? [] : receipt
|
|
107
113
|
};
|
|
108
114
|
}
|
|
109
115
|
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: 通用失败处理
|
|
@@ -13,18 +13,20 @@ var Max4004 = 1;
|
|
|
13
13
|
|
|
14
14
|
// 穿越 react deep
|
|
15
15
|
export var useStoreRef = function useStoreRef() {
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
device =
|
|
19
|
-
pay =
|
|
20
|
-
number =
|
|
21
|
-
mode =
|
|
22
|
-
net =
|
|
23
|
-
status =
|
|
24
|
-
symbol =
|
|
25
|
-
amount =
|
|
26
|
-
eftpos =
|
|
27
|
-
client =
|
|
16
|
+
var data = useContextData();
|
|
17
|
+
var order_id = data.order_id,
|
|
18
|
+
device = data.device,
|
|
19
|
+
pay = data.pay,
|
|
20
|
+
number = data.number,
|
|
21
|
+
mode = data.mode,
|
|
22
|
+
net = data.net,
|
|
23
|
+
status = data.status,
|
|
24
|
+
symbol = data.symbol,
|
|
25
|
+
amount = data.amount,
|
|
26
|
+
eftpos = data.eftpos,
|
|
27
|
+
client = data.client;
|
|
28
|
+
var dataRef = useRef(data);
|
|
29
|
+
|
|
28
30
|
// 设备信息
|
|
29
31
|
var deviceRef = useRef(device);
|
|
30
32
|
|
|
@@ -55,6 +57,9 @@ export var useStoreRef = function useStoreRef() {
|
|
|
55
57
|
// 设备类型
|
|
56
58
|
var eftposRef = useRef(eftpos);
|
|
57
59
|
var clientRef = useRef(client);
|
|
60
|
+
useEffect(function () {
|
|
61
|
+
dataRef.current = data;
|
|
62
|
+
}, [data]);
|
|
58
63
|
useEffect(function () {
|
|
59
64
|
deviceRef.current = device;
|
|
60
65
|
}, [device]);
|
|
@@ -99,7 +104,8 @@ export var useStoreRef = function useStoreRef() {
|
|
|
99
104
|
symbolRef: symbolRef,
|
|
100
105
|
amountRef: amountRef,
|
|
101
106
|
eftposRef: eftposRef,
|
|
102
|
-
clientRef: clientRef
|
|
107
|
+
clientRef: clientRef,
|
|
108
|
+
dataRef: dataRef
|
|
103
109
|
};
|
|
104
110
|
};
|
|
105
111
|
|
|
@@ -111,9 +117,9 @@ export var useStoreRef = function useStoreRef() {
|
|
|
111
117
|
* @Date: 2024-08-12 11:54
|
|
112
118
|
*/
|
|
113
119
|
export var useFail = function useFail(index) {
|
|
114
|
-
var
|
|
115
|
-
steps =
|
|
116
|
-
custom =
|
|
120
|
+
var _useContextData = useContextData(),
|
|
121
|
+
steps = _useContextData.steps,
|
|
122
|
+
custom = _useContextData.custom;
|
|
117
123
|
var _useStoreRef = useStoreRef(),
|
|
118
124
|
modeRef = _useStoreRef.modeRef,
|
|
119
125
|
clientRef = _useStoreRef.clientRef;
|