@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,5 +1,8 @@
|
|
|
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
|
-
|
|
2
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
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); }
|
|
3
6
|
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
7
|
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
8
|
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; }
|
|
@@ -11,42 +14,44 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
11
14
|
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
15
|
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
16
|
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
17
|
/* eslint-disable react/destructuring-assignment */
|
|
17
18
|
import { locales } from '@pisell/utils';
|
|
18
19
|
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 App from "./app";
|
|
22
|
+
import Tip from "./tip";
|
|
23
|
+
import { RouteEnum, ModeEnum, RestoreEumn, OrderEumn, EftposEnum } from "./const";
|
|
24
24
|
import localeTexts from "./locales";
|
|
25
25
|
import { getInitState } from "./manufacturer";
|
|
26
|
-
import
|
|
27
|
-
import { Provider, useContextData, useDispatch, updateState, updateClient } from "./store";
|
|
26
|
+
import { Provider } from "./store";
|
|
28
27
|
import "./index.less";
|
|
29
28
|
locales.init(localeTexts, localStorage.getItem('umi_locale') || 'en');
|
|
30
|
-
|
|
31
|
-
var _context$appHelper;
|
|
32
|
-
var
|
|
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),
|
|
29
|
+
export default (function (props) {
|
|
30
|
+
var _context$appHelper, _store$getState, _store$getState$call, _store$getState$call$, _props$params, _props$params2;
|
|
31
|
+
var _useState = useState(props.type === EftposEnum.Tyro ? OrderEumn.Null : props.source === RestoreEumn.Restore ? OrderEumn.Restore : OrderEumn.Normal),
|
|
43
32
|
_useState2 = _slicedToArray(_useState, 2),
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
var statusRef = useRef(data.status);
|
|
33
|
+
check = _useState2[0],
|
|
34
|
+
setCheckStatus = _useState2[1];
|
|
47
35
|
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
|
|
49
|
+
var _useState9 = useState(),
|
|
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: {},
|
|
50
55
|
formatAmount: function formatAmount(number, precision, symbol) {
|
|
51
56
|
return "".concat(symbol).concat(number);
|
|
52
57
|
},
|
|
@@ -58,38 +63,9 @@ var App = function App(_ref) {
|
|
|
58
63
|
};
|
|
59
64
|
}
|
|
60
65
|
},
|
|
61
|
-
formatAmount =
|
|
62
|
-
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]);
|
|
66
|
+
formatAmount = _ref.formatAmount,
|
|
67
|
+
storage = _ref.storage,
|
|
68
|
+
store = _ref.store;
|
|
93
69
|
|
|
94
70
|
/**
|
|
95
71
|
* terminal : terminal 内嵌
|
|
@@ -106,126 +82,12 @@ var App = function App(_ref) {
|
|
|
106
82
|
}
|
|
107
83
|
return '';
|
|
108
84
|
}, []);
|
|
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 的移动端 做特定移动端(大屏)适配
|
|
120
85
|
var isMobile = useMemo(function () {
|
|
121
86
|
return Boolean(channel);
|
|
122
87
|
}, [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;
|
|
226
88
|
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) || '$';
|
|
227
89
|
var mode = useMemo(function () {
|
|
228
|
-
if (props.source ===
|
|
90
|
+
if (props.source === RestoreEumn.Restore) {
|
|
229
91
|
if (props.params) {
|
|
230
92
|
if (props.params.mode) {
|
|
231
93
|
return props.params.mode;
|
|
@@ -248,7 +110,7 @@ export default (function (props) {
|
|
|
248
110
|
var state = useMemo(function () {
|
|
249
111
|
var current = props.params && props.params.symbol ? props.params.symbol : symbol;
|
|
250
112
|
// console.log('current 单位 = ', props.params.symbol, symbol);
|
|
251
|
-
if (props.source ===
|
|
113
|
+
if (props.source === RestoreEumn.Restore) {
|
|
252
114
|
return props.params;
|
|
253
115
|
}
|
|
254
116
|
return getInitState(props.type, props.params ? _objectSpread(_objectSpread({
|
|
@@ -260,6 +122,10 @@ export default (function (props) {
|
|
|
260
122
|
symbol: current
|
|
261
123
|
});
|
|
262
124
|
}, [mode, props.params, props.type, symbol]);
|
|
125
|
+
var stateRef = useRef(state);
|
|
126
|
+
useEffect(function () {
|
|
127
|
+
stateRef.current = state;
|
|
128
|
+
}, [state]);
|
|
263
129
|
var onChangeStatus = useCallback(function (status, params, other) {
|
|
264
130
|
props.onChangeStatus(status, params, other);
|
|
265
131
|
}, []);
|
|
@@ -295,24 +161,109 @@ export default (function (props) {
|
|
|
295
161
|
return act;
|
|
296
162
|
}, [mode, state]);
|
|
297
163
|
useEffect(function () {
|
|
298
|
-
|
|
164
|
+
document.body.id = 'body';
|
|
299
165
|
console.log('初始化 ........11221801');
|
|
300
166
|
}, []);
|
|
301
167
|
|
|
302
168
|
// console.log('action = ', action);
|
|
303
169
|
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
|
+
}
|
|
304
252
|
return /*#__PURE__*/React.createElement(Provider, {
|
|
305
|
-
state: state
|
|
253
|
+
state: check === OrderEumn.Pending ? historyData : state
|
|
306
254
|
}, /*#__PURE__*/React.createElement(App, {
|
|
307
|
-
|
|
255
|
+
api: api,
|
|
256
|
+
channel: channel,
|
|
308
257
|
params: props.params,
|
|
309
258
|
onChangeStatus: onChangeStatus,
|
|
310
259
|
terminal: props.terminal,
|
|
311
260
|
onChangeParams: props.onChangeParams,
|
|
312
|
-
action: action,
|
|
261
|
+
action: check === OrderEumn.Pending ? ModeEnum.Pay : action,
|
|
313
262
|
source: props.source,
|
|
314
263
|
tyroUrl: props.tyroUrl,
|
|
315
264
|
tyroVersion: props.tyroVersion,
|
|
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
|
|
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
|
|
317
268
|
}));
|
|
318
269
|
});
|
|
@@ -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;
|
|
@@ -82,6 +82,11 @@ 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',
|
|
85
90
|
'page.eftpos-pay.text.amount.to.pay': 'Amount to pay',
|
|
86
91
|
'page.eftpos-pay.text.surcharge.percentage': 'Percentage',
|
|
87
92
|
'page.eftpos-pay.text.surcharge.fixed': 'Fixed',
|
|
@@ -229,6 +234,11 @@ export default {
|
|
|
229
234
|
'page.eftpos-pay.text.sure': '确定',
|
|
230
235
|
'page.eftpos-pay.text.device': '请选择设备',
|
|
231
236
|
'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': '确认',
|
|
232
242
|
'page.eftpos-pay.text.amount.to.pay': '剩余待支付金额',
|
|
233
243
|
'page.eftpos-pay.text.surcharge.percentage': '百分比',
|
|
234
244
|
// Percentage
|
|
@@ -522,6 +532,11 @@ export default {
|
|
|
522
532
|
'page.eftpos-pay.text.sure': '確定',
|
|
523
533
|
'page.eftpos-pay.text.device': '請選擇設備',
|
|
524
534
|
'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': '確認',
|
|
525
540
|
'page.eftpos-pay.text.amount.to.pay': '剩餘待支付金額',
|
|
526
541
|
'page.eftpos-pay.text.surcharge.percentage': '百分比',
|
|
527
542
|
// Percentage
|
|
@@ -43,7 +43,8 @@ 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
|
|
46
|
+
eftposRef = _useStoreRef.eftposRef,
|
|
47
|
+
dataRef = _useStoreRef.dataRef;
|
|
47
48
|
var dispatch = useDispatch();
|
|
48
49
|
var _steps$ = steps[0],
|
|
49
50
|
key = _steps$.key,
|
|
@@ -69,13 +70,18 @@ export var POS = function POS(_ref) {
|
|
|
69
70
|
* @Date: 2024-01-30 16:34
|
|
70
71
|
*/
|
|
71
72
|
var success = function success(res) {
|
|
72
|
-
var _res$data;
|
|
73
|
+
var _res$data, _res$data2, _res$data3, _res$data4;
|
|
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);
|
|
73
78
|
dispatch(updateNextStep());
|
|
74
79
|
dispatch(updateCustom({
|
|
75
|
-
card_reader_surcharge: (res === null || res === void 0 ? void 0 : (_res$
|
|
80
|
+
card_reader_surcharge: (res === null || res === void 0 ? void 0 : (_res$data4 = res.data) === null || _res$data4 === void 0 ? void 0 : _res$data4.card_reader_surcharge) || 0,
|
|
81
|
+
receipt: receipt
|
|
76
82
|
}));
|
|
77
83
|
clearRef.current = setTimeout(function () {
|
|
78
|
-
var _res$
|
|
84
|
+
var _res$data5, _deviceRef$current, _deviceRef$current$se;
|
|
79
85
|
var params = getPayParams({
|
|
80
86
|
mode: modeRef.current,
|
|
81
87
|
amount: amountRef.current,
|
|
@@ -84,10 +90,10 @@ export var POS = function POS(_ref) {
|
|
|
84
90
|
device: deviceRef.current,
|
|
85
91
|
pay: payRef.current,
|
|
86
92
|
custom: {
|
|
87
|
-
card_reader_surcharge: (res === null || res === void 0 ? void 0 : (_res$
|
|
93
|
+
card_reader_surcharge: (res === null || res === void 0 ? void 0 : (_res$data5 = res.data) === null || _res$data5 === void 0 ? void 0 : _res$data5.card_reader_surcharge) || 0,
|
|
94
|
+
receipt: receipt
|
|
88
95
|
}
|
|
89
96
|
}, 'success');
|
|
90
|
-
var receipt = Array.isArray(res.receipt) ? res.receipt : [res.receipt];
|
|
91
97
|
onChange('success', _objectSpread(_objectSpread({}, params), {}, {
|
|
92
98
|
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
|
|
93
99
|
}));
|
|
@@ -149,7 +155,10 @@ export var POS = function POS(_ref) {
|
|
|
149
155
|
amount: payRef.current.total,
|
|
150
156
|
card_reader_type: eftposRef.current,
|
|
151
157
|
card_reader_id: (_deviceRef$current2 = deviceRef.current) === null || _deviceRef$current2 === void 0 ? void 0 : _deviceRef$current2.id,
|
|
152
|
-
number: numRef.current
|
|
158
|
+
number: numRef.current,
|
|
159
|
+
pay_param_base64: encodeURIComponent(btoa(encodeURIComponent(JSON.stringify(_objectSpread(_objectSpread({}, dataRef.current), {}, {
|
|
160
|
+
number: numRef.current
|
|
161
|
+
})))))
|
|
153
162
|
}, {
|
|
154
163
|
signal: controllerRef.current.signal
|
|
155
164
|
}) : api.refund({
|
|
@@ -157,7 +166,10 @@ export var POS = function POS(_ref) {
|
|
|
157
166
|
amount: amountRef.current,
|
|
158
167
|
card_reader_type: eftposRef.current,
|
|
159
168
|
card_reader_id: (_deviceRef$current3 = deviceRef.current) === null || _deviceRef$current3 === void 0 ? void 0 : _deviceRef$current3.id,
|
|
160
|
-
number: numRef.current
|
|
169
|
+
number: numRef.current,
|
|
170
|
+
pay_param_base64: encodeURIComponent(btoa(encodeURIComponent(JSON.stringify(_objectSpread(_objectSpread({}, dataRef.current), {}, {
|
|
171
|
+
number: numRef.current
|
|
172
|
+
})))))
|
|
161
173
|
}, {
|
|
162
174
|
signal: controllerRef.current.signal
|
|
163
175
|
});
|
|
@@ -297,7 +297,7 @@ export declare const backUpFree: (payload: Partial<State>) => {
|
|
|
297
297
|
amount?: string | number | undefined;
|
|
298
298
|
mode?: "refund" | "pay" | "fullPay" | "query" | undefined;
|
|
299
299
|
order_id?: string | number | undefined;
|
|
300
|
-
eftpos?: "
|
|
300
|
+
eftpos?: "tyro" | "windcave" | "payo" | "stripe" | undefined;
|
|
301
301
|
action?: "amount" | "deviceList" | "pay" | undefined;
|
|
302
302
|
key?: number | undefined;
|
|
303
303
|
step?: number | undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './tip.less';
|
|
3
|
+
/**
|
|
4
|
+
* @title: 支付状态未知页面
|
|
5
|
+
* @description:
|
|
6
|
+
* @Author: hongbing.wang
|
|
7
|
+
* @Date: 2024-08-20 11:42
|
|
8
|
+
*/
|
|
9
|
+
declare const _default: ({ onChangeStatus, className, formatAmount, cardSurcharge, receipts, successTime, onChangeParams, }: any) => React.JSX.Element;
|
|
10
|
+
export default _default;
|