@pisell/private-materials 3.0.205 → 3.0.206
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 +7 -7
- 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 +7 -7
- package/es/components/eftposPay/component/fail/failCustom.js +0 -1
- package/es/components/eftposPay/component/fail/index.js +0 -1
- package/es/components/eftposPay/component/manual/index.js +1 -4
- package/es/components/eftposPay/const.d.ts +1 -27
- package/es/components/eftposPay/const.js +0 -22
- package/es/components/eftposPay/device.d.ts +1 -1
- package/es/components/eftposPay/device.js +2 -2
- package/es/components/eftposPay/helper.d.ts +0 -5
- package/es/components/eftposPay/helper.js +4 -10
- package/es/components/eftposPay/hooks.d.ts +0 -1
- package/es/components/eftposPay/hooks.js +16 -22
- package/es/components/eftposPay/index.d.ts +1 -1
- package/es/components/eftposPay/index.js +179 -130
- package/es/components/eftposPay/locales.d.ts +0 -15
- package/es/components/eftposPay/locales.js +0 -15
- package/es/components/eftposPay/payo/config.js +8 -20
- package/es/components/eftposPay/tyro/index.js +2 -4
- package/es/components/eftposPay/windcave/windcave.js +6 -17
- 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 +5 -19
- package/lib/components/eftposPay/const.d.ts +1 -27
- package/lib/components/eftposPay/const.js +0 -18
- package/lib/components/eftposPay/device.d.ts +1 -1
- package/lib/components/eftposPay/device.js +2 -2
- package/lib/components/eftposPay/helper.d.ts +0 -5
- package/lib/components/eftposPay/helper.js +4 -8
- package/lib/components/eftposPay/hooks.d.ts +0 -1
- package/lib/components/eftposPay/hooks.js +2 -8
- package/lib/components/eftposPay/index.d.ts +1 -1
- package/lib/components/eftposPay/index.js +144 -106
- package/lib/components/eftposPay/locales.d.ts +0 -15
- package/lib/components/eftposPay/locales.js +0 -15
- package/lib/components/eftposPay/payo/config.js +9 -33
- package/lib/components/eftposPay/tyro/index.js +2 -4
- package/lib/components/eftposPay/windcave/windcave.js +6 -29
- package/package.json +4 -4
- package/es/components/eftposPay/app.d.ts +0 -11
- package/es/components/eftposPay/app.js +0 -173
- package/es/components/eftposPay/tip.d.ts +0 -10
- package/es/components/eftposPay/tip.js +0 -177
- package/es/components/eftposPay/tip.less +0 -9
- package/lib/components/eftposPay/app.d.ts +0 -11
- package/lib/components/eftposPay/app.js +0 -166
- package/lib/components/eftposPay/tip.d.ts +0 -10
- package/lib/components/eftposPay/tip.js +0 -159
- package/lib/components/eftposPay/tip.less +0 -9
|
@@ -1,8 +1,5 @@
|
|
|
1
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
|
-
|
|
3
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
5
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
2
|
+
var _excluded = ["action", "getApi", "device_number", "terminal", "tyroUrl", "tyroVersion", "onChangeParams"];
|
|
6
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; }
|
|
7
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; }
|
|
8
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; }
|
|
@@ -14,44 +11,42 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
14
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; }
|
|
15
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; } }
|
|
16
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; }
|
|
17
16
|
/* eslint-disable react/destructuring-assignment */
|
|
18
17
|
import { locales } from '@pisell/utils';
|
|
19
18
|
import React, { useEffect, useState, useMemo, useRef, useCallback } from 'react';
|
|
19
|
+
import { useNetwork } from 'ahooks';
|
|
20
20
|
import useEngineContext from "../../hooks/useEngineContext";
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
21
|
+
import Amount from "./amount";
|
|
22
|
+
import { RouteEnum, ModeEnum, ClientEnum } from "./const";
|
|
23
|
+
import Device from "./device";
|
|
24
24
|
import localeTexts from "./locales";
|
|
25
25
|
import { getInitState } from "./manufacturer";
|
|
26
|
-
import
|
|
26
|
+
import Pay from "./pay";
|
|
27
|
+
import { Provider, useContextData, useDispatch, updateState, updateClient } from "./store";
|
|
27
28
|
import "./index.less";
|
|
28
29
|
locales.init(localeTexts, localStorage.getItem('umi_locale') || 'en');
|
|
29
|
-
|
|
30
|
-
var _context$appHelper
|
|
31
|
-
var
|
|
30
|
+
var App = function App(_ref) {
|
|
31
|
+
var _context$appHelper;
|
|
32
|
+
var action = _ref.action,
|
|
33
|
+
getApi = _ref.getApi,
|
|
34
|
+
device_number = _ref.device_number,
|
|
35
|
+
terminal = _ref.terminal,
|
|
36
|
+
tyroUrl = _ref.tyroUrl,
|
|
37
|
+
tyroVersion = _ref.tyroVersion,
|
|
38
|
+
onChangeParams = _ref.onChangeParams,
|
|
39
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
40
|
+
var data = useContextData();
|
|
41
|
+
var dispatch = useDispatch();
|
|
42
|
+
var _useState = useState(action),
|
|
32
43
|
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
-
|
|
34
|
-
|
|
44
|
+
current = _useState2[0],
|
|
45
|
+
setCurrent = _useState2[1];
|
|
46
|
+
var statusRef = useRef(data.status);
|
|
35
47
|
var context = useEngineContext();
|
|
36
|
-
var _useState3 = useState(0),
|
|
37
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
38
|
-
cardSurcharge = _useState4[0],
|
|
39
|
-
setCardSurcharge = _useState4[1];
|
|
40
|
-
var _useState5 = useState([]),
|
|
41
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
42
|
-
receipt = _useState6[0],
|
|
43
|
-
setReceipt = _useState6[1];
|
|
44
|
-
var _useState7 = useState(''),
|
|
45
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
46
|
-
updateTime = _useState8[0],
|
|
47
|
-
setTime = _useState8[1];
|
|
48
48
|
console.log('context = ', context);
|
|
49
|
-
var
|
|
50
|
-
_useState10 = _slicedToArray(_useState9, 2),
|
|
51
|
-
historyData = _useState10[0],
|
|
52
|
-
setHistory = _useState10[1];
|
|
53
|
-
var _ref = ((_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {
|
|
54
|
-
store: {},
|
|
49
|
+
var _ref2 = ((_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {
|
|
55
50
|
formatAmount: function formatAmount(number, precision, symbol) {
|
|
56
51
|
return "".concat(symbol).concat(number);
|
|
57
52
|
},
|
|
@@ -63,9 +58,38 @@ export default (function (props) {
|
|
|
63
58
|
};
|
|
64
59
|
}
|
|
65
60
|
},
|
|
66
|
-
formatAmount =
|
|
67
|
-
storage =
|
|
68
|
-
|
|
61
|
+
formatAmount = _ref2.formatAmount,
|
|
62
|
+
storage = _ref2.storage;
|
|
63
|
+
|
|
64
|
+
// 外部网络数据
|
|
65
|
+
var network = useMemo(function () {
|
|
66
|
+
return typeof terminal.network === 'boolean' ? terminal.network : true;
|
|
67
|
+
}, [terminal === null || terminal === void 0 ? void 0 : terminal.network]);
|
|
68
|
+
// 内部网络数据
|
|
69
|
+
var _useNetwork = useNetwork(),
|
|
70
|
+
online = _useNetwork.online;
|
|
71
|
+
var netRef = useRef([network, online]);
|
|
72
|
+
|
|
73
|
+
// 网络数据
|
|
74
|
+
var net = useMemo(function () {
|
|
75
|
+
var networkChange = false,
|
|
76
|
+
onlineChange = false;
|
|
77
|
+
if (netRef.current[0] !== network) {
|
|
78
|
+
netRef.current[0] = network;
|
|
79
|
+
networkChange = true;
|
|
80
|
+
}
|
|
81
|
+
if (netRef.current[1] !== online) {
|
|
82
|
+
netRef.current[1] = online;
|
|
83
|
+
onlineChange = true;
|
|
84
|
+
}
|
|
85
|
+
if (networkChange) {
|
|
86
|
+
return network;
|
|
87
|
+
}
|
|
88
|
+
return online;
|
|
89
|
+
}, [network, online]);
|
|
90
|
+
useEffect(function () {
|
|
91
|
+
statusRef.current = data.status;
|
|
92
|
+
}, [data.status]);
|
|
69
93
|
|
|
70
94
|
/**
|
|
71
95
|
* terminal : terminal 内嵌
|
|
@@ -82,12 +106,126 @@ export default (function (props) {
|
|
|
82
106
|
}
|
|
83
107
|
return '';
|
|
84
108
|
}, []);
|
|
109
|
+
var client = useMemo(function () {
|
|
110
|
+
if (channel === 'kiosk') {
|
|
111
|
+
return ClientEnum.User;
|
|
112
|
+
}
|
|
113
|
+
return ClientEnum.Merchant;
|
|
114
|
+
}, [channel]);
|
|
115
|
+
useEffect(function () {
|
|
116
|
+
dispatch(updateClient(client));
|
|
117
|
+
}, [client]);
|
|
118
|
+
|
|
119
|
+
// 内嵌在 terminal 或者 kiosk 的移动端 做特定移动端(大屏)适配
|
|
85
120
|
var isMobile = useMemo(function () {
|
|
86
121
|
return Boolean(channel);
|
|
87
122
|
}, [channel]);
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* @title: api 接口 数据
|
|
126
|
+
* @Author: hongbing.wang
|
|
127
|
+
* @Date: 2024-08-20 13:10
|
|
128
|
+
*/
|
|
129
|
+
var api = useMemo(function () {
|
|
130
|
+
if (typeof getApi === 'function') {
|
|
131
|
+
return getApi();
|
|
132
|
+
}
|
|
133
|
+
return {};
|
|
134
|
+
}, [getApi]);
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @title: 缓存状态数据 可以用于闪退,成功or失败时清除缓存
|
|
138
|
+
* @Author: hongbing.wang
|
|
139
|
+
* @Date: 2024-08-20 10:27
|
|
140
|
+
*/
|
|
141
|
+
useEffect(function () {
|
|
142
|
+
onChangeParams && onChangeParams(_objectSpread(_objectSpread(_objectSpread({}, data), data.eftpos === 'tyro' ? {
|
|
143
|
+
custom: _objectSpread(_objectSpread({}, data.custom), {}, {
|
|
144
|
+
btnList: [],
|
|
145
|
+
list: []
|
|
146
|
+
})
|
|
147
|
+
} : {}), {}, {
|
|
148
|
+
form: 'restore'
|
|
149
|
+
}));
|
|
150
|
+
}, [data, onChangeParams]);
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* @title: 支付状态切换页
|
|
154
|
+
* @Author: hongbing.wang
|
|
155
|
+
* @Date: 2024-08-20 13:10
|
|
156
|
+
*/
|
|
157
|
+
var onChange = useCallback(function (status, params, other) {
|
|
158
|
+
if (status === 'page' && typeof params === 'string') {
|
|
159
|
+
if (['amount', 'deviceList', 'pay'].includes(params)) {
|
|
160
|
+
setCurrent(params);
|
|
161
|
+
dispatch(updateState({
|
|
162
|
+
action: params
|
|
163
|
+
}));
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
console.log('状态切换 = ', status, params, other);
|
|
167
|
+
props.onChangeStatus(status, params, other);
|
|
168
|
+
}, []);
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* @title: 支付失败
|
|
172
|
+
* @Author: hongbing.wang
|
|
173
|
+
* @Date: 2024-08-20 13:09
|
|
174
|
+
*/
|
|
175
|
+
var onClose = function onClose() {
|
|
176
|
+
onChange('fail', {
|
|
177
|
+
number: data.number,
|
|
178
|
+
device: data.device,
|
|
179
|
+
order_id: data.order_id
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
if (current === RouteEnum.DeviceList) {
|
|
183
|
+
return /*#__PURE__*/React.createElement(Device, {
|
|
184
|
+
api: api,
|
|
185
|
+
onChange: onChange,
|
|
186
|
+
onClose: onClose,
|
|
187
|
+
isMobile: isMobile,
|
|
188
|
+
className: isMobile ? 'pisell-lowcode__eft-pay-terminal' : '',
|
|
189
|
+
net: net,
|
|
190
|
+
device_number: device_number,
|
|
191
|
+
formatAmount: formatAmount,
|
|
192
|
+
client: client
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
if (current === RouteEnum.Amount) {
|
|
196
|
+
return /*#__PURE__*/React.createElement(Amount, {
|
|
197
|
+
onChange: onChange,
|
|
198
|
+
onClose: onClose,
|
|
199
|
+
formatAmount: formatAmount,
|
|
200
|
+
isMobile: isMobile,
|
|
201
|
+
className: isMobile ? 'pisell-lowcode__eft-pay-terminal' : '',
|
|
202
|
+
net: net,
|
|
203
|
+
client: client
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
return /*#__PURE__*/React.createElement(Pay, {
|
|
207
|
+
api: api,
|
|
208
|
+
tyroUrl: tyroUrl,
|
|
209
|
+
tyroVersion: tyroVersion,
|
|
210
|
+
onChange: onChange,
|
|
211
|
+
className: isMobile ? 'pisell-lowcode__eft-pay-terminal' : '',
|
|
212
|
+
terminal: terminal,
|
|
213
|
+
isMobile: isMobile,
|
|
214
|
+
net: net,
|
|
215
|
+
formatAmount: formatAmount,
|
|
216
|
+
client: client
|
|
217
|
+
});
|
|
218
|
+
};
|
|
219
|
+
export default (function (props) {
|
|
220
|
+
var _context$appHelper2, _store$getState, _store$getState$call, _store$getState$call$, _props$params, _props$params2;
|
|
221
|
+
var context = useEngineContext();
|
|
222
|
+
var _ref3 = ((_context$appHelper2 = context.appHelper) === null || _context$appHelper2 === void 0 ? void 0 : _context$appHelper2.utils) || {
|
|
223
|
+
store: {}
|
|
224
|
+
},
|
|
225
|
+
store = _ref3.store;
|
|
88
226
|
var symbol = (store === null || store === void 0 ? void 0 : (_store$getState = store.getState) === null || _store$getState === void 0 ? void 0 : (_store$getState$call = _store$getState.call(store)) === null || _store$getState$call === void 0 ? void 0 : (_store$getState$call$ = _store$getState$call.global) === null || _store$getState$call$ === void 0 ? void 0 : _store$getState$call$.symbol) || '$';
|
|
89
227
|
var mode = useMemo(function () {
|
|
90
|
-
if (props.source ===
|
|
228
|
+
if (props.source === 'restore') {
|
|
91
229
|
if (props.params) {
|
|
92
230
|
if (props.params.mode) {
|
|
93
231
|
return props.params.mode;
|
|
@@ -110,7 +248,7 @@ export default (function (props) {
|
|
|
110
248
|
var state = useMemo(function () {
|
|
111
249
|
var current = props.params && props.params.symbol ? props.params.symbol : symbol;
|
|
112
250
|
// console.log('current 单位 = ', props.params.symbol, symbol);
|
|
113
|
-
if (props.source ===
|
|
251
|
+
if (props.source === 'restore') {
|
|
114
252
|
return props.params;
|
|
115
253
|
}
|
|
116
254
|
return getInitState(props.type, props.params ? _objectSpread(_objectSpread({
|
|
@@ -122,10 +260,6 @@ export default (function (props) {
|
|
|
122
260
|
symbol: current
|
|
123
261
|
});
|
|
124
262
|
}, [mode, props.params, props.type, symbol]);
|
|
125
|
-
var stateRef = useRef(state);
|
|
126
|
-
useEffect(function () {
|
|
127
|
-
stateRef.current = state;
|
|
128
|
-
}, [state]);
|
|
129
263
|
var onChangeStatus = useCallback(function (status, params, other) {
|
|
130
264
|
props.onChangeStatus(status, params, other);
|
|
131
265
|
}, []);
|
|
@@ -161,109 +295,24 @@ export default (function (props) {
|
|
|
161
295
|
return act;
|
|
162
296
|
}, [mode, state]);
|
|
163
297
|
useEffect(function () {
|
|
164
|
-
document.body.id = 'body';
|
|
298
|
+
// document.body.id = 'body';
|
|
165
299
|
console.log('初始化 ........11221801');
|
|
166
300
|
}, []);
|
|
167
301
|
|
|
168
302
|
// console.log('action = ', action);
|
|
169
303
|
console.log('props?.params?.device_number = ', props === null || props === void 0 ? void 0 : (_props$params = props.params) === null || _props$params === void 0 ? void 0 : _props$params.device_number);
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* @title: api 接口 数据
|
|
173
|
-
* @Author: hongbing.wang
|
|
174
|
-
* @Date: 2024-08-20 13:10
|
|
175
|
-
*/
|
|
176
|
-
var api = useMemo(function () {
|
|
177
|
-
if (typeof props.getApi === 'function') {
|
|
178
|
-
return props.getApi();
|
|
179
|
-
}
|
|
180
|
-
return {};
|
|
181
|
-
}, [props.getApi]);
|
|
182
|
-
useEffect(function () {
|
|
183
|
-
if (props.source === RestoreEumn.Restore || props.type === EftposEnum.Tyro) {
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
api.getTransaction({
|
|
187
|
-
order_id: stateRef.current.order_id,
|
|
188
|
-
card_reader_type: stateRef.current.eftpos,
|
|
189
|
-
receive_status: 'unprocessed'
|
|
190
|
-
}).then(function (res) {
|
|
191
|
-
if (!Array.isArray(res.data) || res.data.length === 0) {
|
|
192
|
-
setCheckStatus(OrderEumn.Null);
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
var currentMode = stateRef.current.mode === ModeEnum.FullPay ? ModeEnum.Pay : stateRef.current.mode;
|
|
196
|
-
var list = res.data.filter(function (item) {
|
|
197
|
-
return item.action === currentMode;
|
|
198
|
-
});
|
|
199
|
-
if (list.length === 0) {
|
|
200
|
-
setCheckStatus(OrderEumn.Null);
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
var latest = list.pop();
|
|
204
|
-
var numberList = list.map(function (item) {
|
|
205
|
-
return item.number;
|
|
206
|
-
});
|
|
207
|
-
if (latest.status === OrderEumn.Failed) {
|
|
208
|
-
setCheckStatus(latest.status);
|
|
209
|
-
onChangeStatus('mark_tx_processed', [].concat(_toConsumableArray(numberList), [latest.number]));
|
|
210
|
-
return;
|
|
211
|
-
}
|
|
212
|
-
if (list.length > 0) {
|
|
213
|
-
onChangeStatus('mark_tx_processed', numberList);
|
|
214
|
-
}
|
|
215
|
-
var _ref2 = (latest === null || latest === void 0 ? void 0 : latest.metadata) || {},
|
|
216
|
-
pay_param_base64 = _ref2.pay_param_base64,
|
|
217
|
-
card_reader_surcharge = _ref2.card_reader_surcharge,
|
|
218
|
-
receipt = _ref2.receipt;
|
|
219
|
-
setTime(latest.updated_at);
|
|
220
|
-
setCardSurcharge(card_reader_surcharge || 0);
|
|
221
|
-
setReceipt(receipt || []);
|
|
222
|
-
if (!pay_param_base64) {
|
|
223
|
-
setCheckStatus(OrderEumn.Failed);
|
|
224
|
-
return;
|
|
225
|
-
}
|
|
226
|
-
try {
|
|
227
|
-
var data = JSON.parse(decodeURIComponent(atob(decodeURIComponent(pay_param_base64))));
|
|
228
|
-
setHistory(data);
|
|
229
|
-
setCheckStatus(latest.status);
|
|
230
|
-
} catch (e) {
|
|
231
|
-
setCheckStatus(OrderEumn.Failed);
|
|
232
|
-
return;
|
|
233
|
-
}
|
|
234
|
-
});
|
|
235
|
-
}, []);
|
|
236
|
-
if (check === OrderEumn.Normal) {
|
|
237
|
-
return null;
|
|
238
|
-
}
|
|
239
|
-
if (check === OrderEumn.Succeed) {
|
|
240
|
-
return /*#__PURE__*/React.createElement(Provider, {
|
|
241
|
-
state: historyData
|
|
242
|
-
}, /*#__PURE__*/React.createElement(Tip, {
|
|
243
|
-
cardSurcharge: cardSurcharge,
|
|
244
|
-
receipts: receipt,
|
|
245
|
-
onChangeStatus: onChangeStatus,
|
|
246
|
-
onChangeParams: props.onChangeParams,
|
|
247
|
-
formatAmount: formatAmount,
|
|
248
|
-
successTime: updateTime,
|
|
249
|
-
className: isMobile ? 'pisell-lowcode__eft-pay-terminal' : ''
|
|
250
|
-
}));
|
|
251
|
-
}
|
|
252
304
|
return /*#__PURE__*/React.createElement(Provider, {
|
|
253
|
-
state:
|
|
305
|
+
state: state
|
|
254
306
|
}, /*#__PURE__*/React.createElement(App, {
|
|
255
|
-
|
|
256
|
-
channel: channel,
|
|
307
|
+
getApi: props.getApi,
|
|
257
308
|
params: props.params,
|
|
258
309
|
onChangeStatus: onChangeStatus,
|
|
259
310
|
terminal: props.terminal,
|
|
260
311
|
onChangeParams: props.onChangeParams,
|
|
261
|
-
action:
|
|
312
|
+
action: action,
|
|
262
313
|
source: props.source,
|
|
263
314
|
tyroUrl: props.tyroUrl,
|
|
264
315
|
tyroVersion: props.tyroVersion,
|
|
265
|
-
device_number: props === null || props === void 0 ? void 0 : (_props$params2 = props.params) === null || _props$params2 === void 0 ? void 0 : _props$params2.device_number
|
|
266
|
-
isMobile: isMobile,
|
|
267
|
-
formatAmount: formatAmount
|
|
316
|
+
device_number: props === null || props === void 0 ? void 0 : (_props$params2 = props.params) === null || _props$params2 === void 0 ? void 0 : _props$params2.device_number
|
|
268
317
|
}));
|
|
269
318
|
});
|
|
@@ -54,11 +54,6 @@ 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;
|
|
62
57
|
'page.eftpos-pay.text.amount.to.pay': string;
|
|
63
58
|
'page.eftpos-pay.text.surcharge.percentage': string;
|
|
64
59
|
'page.eftpos-pay.text.surcharge.fixed': string;
|
|
@@ -163,11 +158,6 @@ declare const _default: {
|
|
|
163
158
|
'page.eftpos-pay.text.sure': string;
|
|
164
159
|
'page.eftpos-pay.text.device': string;
|
|
165
160
|
'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;
|
|
171
161
|
'page.eftpos-pay.text.amount.to.pay': string;
|
|
172
162
|
'page.eftpos-pay.text.surcharge.percentage': string;
|
|
173
163
|
'page.eftpos-pay.text.surcharge.fixed': string;
|
|
@@ -272,11 +262,6 @@ declare const _default: {
|
|
|
272
262
|
'page.eftpos-pay.text.sure': string;
|
|
273
263
|
'page.eftpos-pay.text.device': string;
|
|
274
264
|
'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;
|
|
280
265
|
'page.eftpos-pay.text.amount.to.pay': string;
|
|
281
266
|
'page.eftpos-pay.text.surcharge.percentage': string;
|
|
282
267
|
'page.eftpos-pay.text.surcharge.fixed': string;
|
|
@@ -82,11 +82,6 @@ export default {
|
|
|
82
82
|
'page.eftpos-pay.text.sure': 'Sure',
|
|
83
83
|
'page.eftpos-pay.text.device': 'Please select device',
|
|
84
84
|
'page.eftpos-pay.text.leave': 'Please do not leave this page',
|
|
85
|
-
'page.eftpos-pay.text.latest.success': 'A Successful Payment Detected for This Order!',
|
|
86
|
-
'page.eftpos-pay.text.latest.amount': 'Amount',
|
|
87
|
-
'page.eftpos-pay.text.latest.surcharge': 'Surcharge',
|
|
88
|
-
'page.eftpos-pay.text.latest.time': 'Time',
|
|
89
|
-
'page.eftpos-pay.text.latest.confirm': 'Confirm',
|
|
90
85
|
'page.eftpos-pay.text.amount.to.pay': 'Amount to pay',
|
|
91
86
|
'page.eftpos-pay.text.surcharge.percentage': 'Percentage',
|
|
92
87
|
'page.eftpos-pay.text.surcharge.fixed': 'Fixed',
|
|
@@ -234,11 +229,6 @@ export default {
|
|
|
234
229
|
'page.eftpos-pay.text.sure': '确定',
|
|
235
230
|
'page.eftpos-pay.text.device': '请选择设备',
|
|
236
231
|
'page.eftpos-pay.text.leave': '请不要离开此页面',
|
|
237
|
-
'page.eftpos-pay.text.latest.success': '检测到此订单有一笔交易已支付成功!',
|
|
238
|
-
'page.eftpos-pay.text.latest.amount': '交易金额',
|
|
239
|
-
'page.eftpos-pay.text.latest.surcharge': '手续费',
|
|
240
|
-
'page.eftpos-pay.text.latest.time': '交易时间',
|
|
241
|
-
'page.eftpos-pay.text.latest.confirm': '确认',
|
|
242
232
|
'page.eftpos-pay.text.amount.to.pay': '剩余待支付金额',
|
|
243
233
|
'page.eftpos-pay.text.surcharge.percentage': '百分比',
|
|
244
234
|
// Percentage
|
|
@@ -532,11 +522,6 @@ export default {
|
|
|
532
522
|
'page.eftpos-pay.text.sure': '確定',
|
|
533
523
|
'page.eftpos-pay.text.device': '請選擇設備',
|
|
534
524
|
'page.eftpos-pay.text.leave': '請不要離開此頁面',
|
|
535
|
-
'page.eftpos-pay.text.latest.success': '檢測到此訂單有一筆交易已支付成功!',
|
|
536
|
-
'page.eftpos-pay.text.latest.amount': '交易金額',
|
|
537
|
-
'page.eftpos-pay.text.latest.surcharge': '手續費',
|
|
538
|
-
'page.eftpos-pay.text.latest.time': '交易時間',
|
|
539
|
-
'page.eftpos-pay.text.latest.confirm': '確認',
|
|
540
525
|
'page.eftpos-pay.text.amount.to.pay': '剩餘待支付金額',
|
|
541
526
|
'page.eftpos-pay.text.surcharge.percentage': '百分比',
|
|
542
527
|
// Percentage
|
|
@@ -43,8 +43,7 @@ export var POS = function POS(_ref) {
|
|
|
43
43
|
netRef = _useStoreRef.netRef,
|
|
44
44
|
orderIdRef = _useStoreRef.orderIdRef,
|
|
45
45
|
amountRef = _useStoreRef.amountRef,
|
|
46
|
-
eftposRef = _useStoreRef.eftposRef
|
|
47
|
-
dataRef = _useStoreRef.dataRef;
|
|
46
|
+
eftposRef = _useStoreRef.eftposRef;
|
|
48
47
|
var dispatch = useDispatch();
|
|
49
48
|
var _steps$ = steps[0],
|
|
50
49
|
key = _steps$.key,
|
|
@@ -70,18 +69,13 @@ export var POS = function POS(_ref) {
|
|
|
70
69
|
* @Date: 2024-01-30 16:34
|
|
71
70
|
*/
|
|
72
71
|
var success = function success(res) {
|
|
73
|
-
var _res$data
|
|
74
|
-
var receipt = Array.isArray(res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.receipt) ? res === null || res === void 0 ? void 0 : (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.receipt : [res === null || res === void 0 ? void 0 : (_res$data3 = res.data) === null || _res$data3 === void 0 ? void 0 : _res$data3.receipt];
|
|
75
|
-
receipt = receipt.filter(function (item) {
|
|
76
|
-
return typeof item === 'string';
|
|
77
|
-
}).filter(Boolean);
|
|
72
|
+
var _res$data;
|
|
78
73
|
dispatch(updateNextStep());
|
|
79
74
|
dispatch(updateCustom({
|
|
80
|
-
card_reader_surcharge: (res === null || res === void 0 ? void 0 : (_res$
|
|
81
|
-
receipt: receipt
|
|
75
|
+
card_reader_surcharge: (res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.card_reader_surcharge) || 0
|
|
82
76
|
}));
|
|
83
77
|
clearRef.current = setTimeout(function () {
|
|
84
|
-
var _res$
|
|
78
|
+
var _res$data2, _deviceRef$current, _deviceRef$current$se;
|
|
85
79
|
var params = getPayParams({
|
|
86
80
|
mode: modeRef.current,
|
|
87
81
|
amount: amountRef.current,
|
|
@@ -90,10 +84,10 @@ export var POS = function POS(_ref) {
|
|
|
90
84
|
device: deviceRef.current,
|
|
91
85
|
pay: payRef.current,
|
|
92
86
|
custom: {
|
|
93
|
-
card_reader_surcharge: (res === null || res === void 0 ? void 0 : (_res$
|
|
94
|
-
receipt: receipt
|
|
87
|
+
card_reader_surcharge: (res === null || res === void 0 ? void 0 : (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.card_reader_surcharge) || 0
|
|
95
88
|
}
|
|
96
89
|
}, 'success');
|
|
90
|
+
var receipt = Array.isArray(res.receipt) ? res.receipt : [res.receipt];
|
|
97
91
|
onChange('success', _objectSpread(_objectSpread({}, params), {}, {
|
|
98
92
|
receipt: (_deviceRef$current = deviceRef.current) !== null && _deviceRef$current !== void 0 && (_deviceRef$current$se = _deviceRef$current.setting) !== null && _deviceRef$current$se !== void 0 && _deviceRef$current$se.receipts ? [] : receipt
|
|
99
93
|
}));
|
|
@@ -155,10 +149,7 @@ export var POS = function POS(_ref) {
|
|
|
155
149
|
amount: payRef.current.total,
|
|
156
150
|
card_reader_type: eftposRef.current,
|
|
157
151
|
card_reader_id: (_deviceRef$current2 = deviceRef.current) === null || _deviceRef$current2 === void 0 ? void 0 : _deviceRef$current2.id,
|
|
158
|
-
number: numRef.current
|
|
159
|
-
pay_param_base64: encodeURIComponent(btoa(encodeURIComponent(JSON.stringify(_objectSpread(_objectSpread({}, dataRef.current), {}, {
|
|
160
|
-
number: numRef.current
|
|
161
|
-
})))))
|
|
152
|
+
number: numRef.current
|
|
162
153
|
}, {
|
|
163
154
|
signal: controllerRef.current.signal
|
|
164
155
|
}) : api.refund({
|
|
@@ -166,10 +157,7 @@ export var POS = function POS(_ref) {
|
|
|
166
157
|
amount: amountRef.current,
|
|
167
158
|
card_reader_type: eftposRef.current,
|
|
168
159
|
card_reader_id: (_deviceRef$current3 = deviceRef.current) === null || _deviceRef$current3 === void 0 ? void 0 : _deviceRef$current3.id,
|
|
169
|
-
number: numRef.current
|
|
170
|
-
pay_param_base64: encodeURIComponent(btoa(encodeURIComponent(JSON.stringify(_objectSpread(_objectSpread({}, dataRef.current), {}, {
|
|
171
|
-
number: numRef.current
|
|
172
|
-
})))))
|
|
160
|
+
number: numRef.current
|
|
173
161
|
}, {
|
|
174
162
|
signal: controllerRef.current.signal
|
|
175
163
|
});
|
|
@@ -440,8 +440,7 @@ export default (function (_ref) {
|
|
|
440
440
|
subTitle: ''
|
|
441
441
|
}));
|
|
442
442
|
dispatch(updateCustom({
|
|
443
|
-
card_reader_surcharge: response.surchargeAmount || 0
|
|
444
|
-
receipt: receipt
|
|
443
|
+
card_reader_surcharge: response.surchargeAmount || 0
|
|
445
444
|
}));
|
|
446
445
|
clearRef.current = setTimeout(function () {
|
|
447
446
|
var params = getPayParams({
|
|
@@ -452,8 +451,7 @@ export default (function (_ref) {
|
|
|
452
451
|
device: deviceRef.current,
|
|
453
452
|
pay: payRef.current,
|
|
454
453
|
custom: {
|
|
455
|
-
card_reader_surcharge: response.surchargeAmount || 0
|
|
456
|
-
receipt: receipt
|
|
454
|
+
card_reader_surcharge: response.surchargeAmount || 0
|
|
457
455
|
}
|
|
458
456
|
}, 'success');
|
|
459
457
|
onChange('success', _objectSpread(_objectSpread({}, params), {}, {
|
|
@@ -51,7 +51,7 @@ export default (function (_ref) {
|
|
|
51
51
|
symbolRef = _useStoreRef.symbolRef,
|
|
52
52
|
amountRef = _useStoreRef.amountRef,
|
|
53
53
|
eftposRef = _useStoreRef.eftposRef,
|
|
54
|
-
|
|
54
|
+
clientRef = _useStoreRef.clientRef;
|
|
55
55
|
var dispatch = useDispatch();
|
|
56
56
|
var fail = useFail();
|
|
57
57
|
var failRef = useRef(fail);
|
|
@@ -92,10 +92,6 @@ export default (function (_ref) {
|
|
|
92
92
|
* @Date: 2024-08-12 11:02
|
|
93
93
|
*/
|
|
94
94
|
var _useValidate = useValidate(api.check, Minute, function (res) {
|
|
95
|
-
var receipt = Array.isArray(res === null || res === void 0 ? void 0 : res.receipt) ? res.receipt : [res.receipt];
|
|
96
|
-
receipt = receipt.filter(function (item) {
|
|
97
|
-
return typeof item === 'string';
|
|
98
|
-
}).filter(Boolean);
|
|
99
95
|
// 将所有步骤状态设为完成 resolve
|
|
100
96
|
dispatch(updateCustom({
|
|
101
97
|
list: listRef.current.map(function (item) {
|
|
@@ -103,8 +99,7 @@ export default (function (_ref) {
|
|
|
103
99
|
status: 'resolve'
|
|
104
100
|
});
|
|
105
101
|
}),
|
|
106
|
-
card_reader_surcharge: (res === null || res === void 0 ? void 0 : res.card_reader_surcharge) || 0
|
|
107
|
-
receipt: receipt
|
|
102
|
+
card_reader_surcharge: (res === null || res === void 0 ? void 0 : res.card_reader_surcharge) || 0
|
|
108
103
|
}));
|
|
109
104
|
|
|
110
105
|
// 更新支付状态与文案
|
|
@@ -122,10 +117,10 @@ export default (function (_ref) {
|
|
|
122
117
|
device: deviceRef.current,
|
|
123
118
|
pay: payRef.current,
|
|
124
119
|
custom: {
|
|
125
|
-
card_reader_surcharge: (res === null || res === void 0 ? void 0 : res.card_reader_surcharge) || 0
|
|
126
|
-
receipt: receipt
|
|
120
|
+
card_reader_surcharge: (res === null || res === void 0 ? void 0 : res.card_reader_surcharge) || 0
|
|
127
121
|
}
|
|
128
122
|
}, 'success');
|
|
123
|
+
var receipt = Array.isArray(res.receipt) ? res.receipt : [res.receipt];
|
|
129
124
|
onChange('success', _objectSpread(_objectSpread({}, params), {}, {
|
|
130
125
|
receipt: (_deviceRef$current = deviceRef.current) !== null && _deviceRef$current !== void 0 && (_deviceRef$current$se = _deviceRef$current.setting) !== null && _deviceRef$current$se !== void 0 && _deviceRef$current$se.receipts ? [] : receipt
|
|
131
126
|
}));
|
|
@@ -175,10 +170,7 @@ export default (function (_ref) {
|
|
|
175
170
|
amount: payRef.current.total,
|
|
176
171
|
card_reader_type: eftposRef.current,
|
|
177
172
|
card_reader_id: (_deviceRef$current2 = deviceRef.current) === null || _deviceRef$current2 === void 0 ? void 0 : _deviceRef$current2.id,
|
|
178
|
-
number: numRef.current
|
|
179
|
-
pay_param_base64: encodeURIComponent(btoa(encodeURIComponent(JSON.stringify(_objectSpread(_objectSpread({}, dataRef.current), {}, {
|
|
180
|
-
number: numRef.current
|
|
181
|
-
})))))
|
|
173
|
+
number: numRef.current
|
|
182
174
|
}, {
|
|
183
175
|
signal: controllerRef.current.signal
|
|
184
176
|
}) : api.refund({
|
|
@@ -186,10 +178,7 @@ export default (function (_ref) {
|
|
|
186
178
|
amount: amountRef.current,
|
|
187
179
|
card_reader_type: eftposRef.current,
|
|
188
180
|
card_reader_id: (_deviceRef$current3 = deviceRef.current) === null || _deviceRef$current3 === void 0 ? void 0 : _deviceRef$current3.id,
|
|
189
|
-
number: numRef.current
|
|
190
|
-
pay_param_base64: encodeURIComponent(btoa(encodeURIComponent(JSON.stringify(_objectSpread(_objectSpread({}, dataRef.current), {}, {
|
|
191
|
-
number: numRef.current
|
|
192
|
-
})))))
|
|
181
|
+
number: numRef.current
|
|
193
182
|
}, {
|
|
194
183
|
signal: controllerRef.current.signal
|
|
195
184
|
});
|
|
@@ -101,7 +101,7 @@ var failCustom_default = ({ className = "", isMobile, onChange }) => {
|
|
|
101
101
|
onChange("print", [], "print_on_timeout");
|
|
102
102
|
};
|
|
103
103
|
const onClose = () => {
|
|
104
|
-
onChange("fail", { number,
|
|
104
|
+
onChange("fail", { number, device, order_id });
|
|
105
105
|
};
|
|
106
106
|
(0, import_ahooks.useMount)(() => {
|
|
107
107
|
if ((failCustom == null ? void 0 : failCustom.status) === "fail") {
|
|
@@ -107,7 +107,7 @@ var fail_default = ({ onChange, className = "", isMobile }) => {
|
|
|
107
107
|
onChange("print", [], "print_on_timeout");
|
|
108
108
|
};
|
|
109
109
|
const onClose = () => {
|
|
110
|
-
onChange("fail", { number,
|
|
110
|
+
onChange("fail", { number, device, order_id });
|
|
111
111
|
};
|
|
112
112
|
(0, import_ahooks.useMount)(() => {
|
|
113
113
|
if (steps[step].status === "fail") {
|