@pisell/private-materials 6.6.62 → 6.6.63
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 +8 -8
- 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 +9 -9
- package/es/components/booking/components/footer/amount.js +4 -3
- package/es/components/booking/components/footer/utils.js +10 -3
- package/es/components/booking/components/voucher/index.js +1 -1
- package/es/components/booking/info2/service/editService/index.js +76 -8
- package/es/components/booking/info2/service/editService/utils.d.ts +1 -0
- package/es/components/booking/info2/service/editService/utils.js +16 -0
- package/es/components/booking/payments/index.js +1 -1
- package/es/components/checkout/hooks/useWalletPass.d.ts +1 -1
- package/es/components/eftpos/PairModal/hooks.d.ts +27 -0
- package/es/components/eftpos/PairModal/hooks.js +67 -0
- package/es/components/eftpos/PairModal/index.d.ts +11 -0
- package/es/components/eftpos/PairModal/index.js +246 -0
- package/es/components/eftpos/PairModal/index.less +70 -0
- package/es/components/eftpos/SettlementModal/Action.d.ts +7 -0
- package/es/components/eftpos/SettlementModal/Action.js +141 -0
- package/es/components/eftpos/SettlementModal/index.d.ts +7 -0
- package/es/components/eftpos/SettlementModal/index.js +135 -0
- package/es/components/eftpos/SettlementModal/index.less +33 -0
- package/es/components/eftpos/SettlementModal/serve.d.ts +8 -0
- package/es/components/eftpos/SettlementModal/serve.js +171 -0
- package/es/components/eftpos/SettlementModal/types.d.ts +138 -0
- package/es/components/eftpos/SettlementModal/types.js +35 -0
- package/es/components/eftpos/SettlementModal/utils.d.ts +18 -0
- package/es/components/eftpos/SettlementModal/utils.js +351 -0
- package/es/components/eftpos/assets/mx51SCI.svg +15 -0
- package/es/components/eftpos/const.d.ts +3 -1
- package/es/components/eftpos/const.js +2 -0
- package/es/components/eftpos/device.d.ts +3 -1
- package/es/components/eftpos/device.js +14 -3
- package/es/components/eftpos/hooks.d.ts +13 -0
- package/es/components/eftpos/hooks.js +35 -0
- package/es/components/eftpos/index.js +198 -24
- package/es/components/eftpos/index.less +32 -1
- package/es/components/eftpos/locales.d.ts +80 -0
- package/es/components/eftpos/locales.js +205 -25
- package/es/components/eftpos/table.js +47 -3
- package/es/components/eftposPay/aggregatePayment/hooks/useMicropay.d.ts +2 -2
- package/es/components/eftposPay/aggregatePayment/hooks/usePayment.d.ts +8 -0
- package/es/components/eftposPay/aggregatePayment/hooks/usePayment.js +145 -0
- package/es/components/eftposPay/aggregatePayment/index.d.ts +2 -1
- package/es/components/eftposPay/aggregatePayment/index.js +2 -1
- package/es/components/eftposPay/aggregatePayment/mock.d.ts +495 -0
- package/es/components/eftposPay/aggregatePayment/mock.js +567 -0
- package/es/components/eftposPay/aggregatePayment/service.js +1 -0
- package/es/components/eftposPay/aggregatePayment/types.d.ts +12 -12
- package/es/components/eftposPay/aggregatePayment/types.js +4 -8
- package/es/components/eftposPay/aggregatePayment/utils/payment.d.ts +13 -13
- package/es/components/eftposPay/aggregatePayment/utils/payment.js +231 -168
- package/es/components/eftposPay/amount.js +15 -1
- package/es/components/eftposPay/app.js +2 -3
- package/es/components/eftposPay/component/fail/failCustom.js +13 -4
- package/es/components/eftposPay/component/fail/index.js +12 -5
- package/es/components/eftposPay/component/fail/network.js +3 -0
- package/es/components/eftposPay/component/fail/unknow.js +8 -0
- package/es/components/eftposPay/component/manual/index.js +17 -3
- package/es/components/eftposPay/component/signature/index.js +3 -0
- package/es/components/eftposPay/const.d.ts +8 -3
- package/es/components/eftposPay/const.js +2 -0
- package/es/components/eftposPay/device.js +225 -38
- package/es/components/eftposPay/helper.d.ts +3 -0
- package/es/components/eftposPay/helper.js +2 -1
- package/es/components/eftposPay/hooks.d.ts +1 -1
- package/es/components/eftposPay/index.js +50 -13
- package/es/components/eftposPay/linkly/const.js +1 -1
- package/es/components/eftposPay/linkly/hooks/normal.js +21 -68
- package/es/components/eftposPay/linkly/hooks/useTimeQuery.js +20 -81
- package/es/components/eftposPay/linkly/index.js +11 -23
- package/es/components/eftposPay/locales.d.ts +15 -0
- package/es/components/eftposPay/locales.js +30 -15
- package/es/components/eftposPay/manufacturer.d.ts +1 -0
- package/es/components/eftposPay/manufacturer.js +4 -0
- package/es/components/eftposPay/mx51/Action.d.ts +6 -0
- package/es/components/eftposPay/mx51/Action.js +144 -0
- package/es/components/eftposPay/mx51/const.d.ts +5 -0
- package/es/components/eftposPay/mx51/const.js +69 -0
- package/es/components/eftposPay/mx51/index.d.ts +6 -0
- package/es/components/eftposPay/mx51/index.js +498 -0
- package/es/components/eftposPay/mx51/types.d.ts +142 -0
- package/es/components/eftposPay/mx51/types.js +35 -0
- package/es/components/eftposPay/mx51/utils.d.ts +10 -0
- package/es/components/eftposPay/mx51/utils.js +121 -0
- package/es/components/eftposPay/pay.js +21 -9
- package/es/components/eftposPay/payo/config.js +39 -5
- package/es/components/eftposPay/payo/const.js +1 -1
- package/es/components/eftposPay/payo/hooks.js +3 -12
- package/es/components/eftposPay/payo/payment.js +69 -136
- package/es/components/eftposPay/store/index.d.ts +4 -8
- package/es/components/eftposPay/tip.js +5 -0
- package/es/components/eftposPay/tyro/const.js +1 -1
- package/es/components/eftposPay/tyro/index.js +44 -11
- package/es/components/eftposPay/utils/payLog.d.ts +81 -0
- package/es/components/eftposPay/utils/payLog.js +458 -0
- package/es/components/eftposPay/windcave/const.js +1 -1
- package/es/components/eftposPay/windcave/receiptAction.js +5 -0
- package/es/components/eftposPay/windcave/windcave.js +37 -38
- package/lib/components/booking/components/footer/amount.js +3 -3
- package/lib/components/booking/components/footer/utils.js +12 -5
- package/lib/components/booking/components/voucher/index.js +1 -1
- package/lib/components/booking/info2/service/editService/index.js +56 -5
- package/lib/components/booking/info2/service/editService/utils.d.ts +1 -0
- package/lib/components/booking/info2/service/editService/utils.js +16 -0
- package/lib/components/booking/payments/index.js +1 -1
- package/lib/components/checkout/hooks/useWalletPass.d.ts +1 -1
- package/lib/components/eftpos/PairModal/hooks.d.ts +27 -0
- package/lib/components/eftpos/PairModal/hooks.js +70 -0
- package/lib/components/eftpos/PairModal/index.d.ts +11 -0
- package/lib/components/eftpos/PairModal/index.js +197 -0
- package/lib/components/eftpos/PairModal/index.less +70 -0
- package/lib/components/eftpos/SettlementModal/Action.d.ts +7 -0
- package/lib/components/eftpos/SettlementModal/Action.js +153 -0
- package/lib/components/eftpos/SettlementModal/index.d.ts +7 -0
- package/lib/components/eftpos/SettlementModal/index.js +170 -0
- package/lib/components/eftpos/SettlementModal/index.less +33 -0
- package/lib/components/eftpos/SettlementModal/serve.d.ts +8 -0
- package/lib/components/eftpos/SettlementModal/serve.js +45 -0
- package/lib/components/eftpos/SettlementModal/types.d.ts +138 -0
- package/lib/components/eftpos/SettlementModal/types.js +43 -0
- package/lib/components/eftpos/SettlementModal/utils.d.ts +18 -0
- package/lib/components/eftpos/SettlementModal/utils.js +248 -0
- package/lib/components/eftpos/assets/mx51SCI.svg +15 -0
- package/lib/components/eftpos/const.d.ts +3 -1
- package/lib/components/eftpos/const.js +2 -0
- package/lib/components/eftpos/device.d.ts +3 -1
- package/lib/components/eftpos/device.js +13 -3
- package/lib/components/eftpos/hooks.d.ts +13 -0
- package/lib/components/eftpos/hooks.js +30 -0
- package/lib/components/eftpos/index.js +121 -8
- package/lib/components/eftpos/index.less +32 -1
- package/lib/components/eftpos/locales.d.ts +80 -0
- package/lib/components/eftpos/locales.js +231 -21
- package/lib/components/eftpos/table.js +30 -2
- package/lib/components/eftposPay/aggregatePayment/hooks/useMicropay.d.ts +2 -2
- package/lib/components/eftposPay/aggregatePayment/hooks/usePayment.d.ts +8 -0
- package/lib/components/eftposPay/aggregatePayment/hooks/usePayment.js +171 -0
- package/lib/components/eftposPay/aggregatePayment/index.d.ts +2 -1
- package/lib/components/eftposPay/aggregatePayment/index.js +5 -2
- package/lib/components/eftposPay/aggregatePayment/mock.d.ts +495 -0
- package/lib/components/eftposPay/aggregatePayment/mock.js +679 -0
- package/lib/components/eftposPay/aggregatePayment/types.d.ts +12 -12
- package/lib/components/eftposPay/aggregatePayment/utils/payment.d.ts +13 -13
- package/lib/components/eftposPay/aggregatePayment/utils/payment.js +173 -123
- package/lib/components/eftposPay/amount.js +13 -1
- package/lib/components/eftposPay/app.js +4 -5
- package/lib/components/eftposPay/component/fail/failCustom.js +10 -2
- package/lib/components/eftposPay/component/fail/index.js +10 -2
- package/lib/components/eftposPay/component/fail/network.js +3 -0
- package/lib/components/eftposPay/component/fail/unknow.js +8 -0
- package/lib/components/eftposPay/component/manual/index.js +16 -2
- package/lib/components/eftposPay/component/signature/index.js +3 -0
- package/lib/components/eftposPay/const.d.ts +8 -3
- package/lib/components/eftposPay/const.js +2 -0
- package/lib/components/eftposPay/device.js +114 -25
- package/lib/components/eftposPay/helper.d.ts +3 -0
- package/lib/components/eftposPay/helper.js +2 -1
- package/lib/components/eftposPay/hooks.d.ts +1 -1
- package/lib/components/eftposPay/index.js +38 -13
- package/lib/components/eftposPay/linkly/const.js +1 -1
- package/lib/components/eftposPay/linkly/hooks/normal.js +22 -43
- package/lib/components/eftposPay/linkly/hooks/useTimeQuery.js +13 -65
- package/lib/components/eftposPay/linkly/index.js +8 -10
- package/lib/components/eftposPay/locales.d.ts +15 -0
- package/lib/components/eftposPay/locales.js +30 -15
- package/lib/components/eftposPay/manufacturer.d.ts +1 -0
- package/lib/components/eftposPay/manufacturer.js +6 -0
- package/lib/components/eftposPay/mx51/Action.d.ts +6 -0
- package/lib/components/eftposPay/mx51/Action.js +154 -0
- package/lib/components/eftposPay/mx51/const.d.ts +5 -0
- package/lib/components/eftposPay/mx51/const.js +85 -0
- package/lib/components/eftposPay/mx51/index.d.ts +6 -0
- package/lib/components/eftposPay/mx51/index.js +433 -0
- package/lib/components/eftposPay/mx51/types.d.ts +142 -0
- package/lib/components/eftposPay/mx51/types.js +43 -0
- package/lib/components/eftposPay/mx51/utils.d.ts +10 -0
- package/lib/components/eftposPay/mx51/utils.js +115 -0
- package/lib/components/eftposPay/pay.js +13 -3
- package/lib/components/eftposPay/payo/config.js +16 -8
- package/lib/components/eftposPay/payo/const.js +1 -1
- package/lib/components/eftposPay/payo/hooks.js +12 -10
- package/lib/components/eftposPay/payo/payment.js +31 -65
- package/lib/components/eftposPay/store/index.d.ts +4 -8
- package/lib/components/eftposPay/tip.js +5 -0
- package/lib/components/eftposPay/tyro/const.js +1 -1
- package/lib/components/eftposPay/tyro/index.js +21 -17
- package/lib/components/eftposPay/utils/payLog.d.ts +81 -0
- package/lib/components/eftposPay/utils/payLog.js +321 -0
- package/lib/components/eftposPay/windcave/const.js +1 -1
- package/lib/components/eftposPay/windcave/receiptAction.js +5 -0
- package/lib/components/eftposPay/windcave/windcave.js +27 -29
- package/package.json +2 -2
- package/es/components/eftposPay/utils/log/index.d.ts +0 -110
- package/es/components/eftposPay/utils/log/index.js +0 -371
- package/lib/components/eftposPay/utils/log/index.d.ts +0 -110
- package/lib/components/eftposPay/utils/log/index.js +0 -294
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
import { EButtonKeyType } from "./types";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* 解析MX51参数
|
|
11
|
+
* @param params 接口返回的原始参数
|
|
12
|
+
* @param status 支付状态
|
|
13
|
+
* @param data 接口返回的数据
|
|
14
|
+
* @returns 解析后的结果对象
|
|
15
|
+
*/
|
|
16
|
+
export var parseMX51Params = function parseMX51Params(params, paymentStatus, data) {
|
|
17
|
+
if (!params) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
// 默认值
|
|
21
|
+
var result = {
|
|
22
|
+
transactionId: (params === null || params === void 0 ? void 0 : params.id) || '',
|
|
23
|
+
status: (params === null || params === void 0 ? void 0 : params.status) || '',
|
|
24
|
+
version: (params === null || params === void 0 ? void 0 : params.version) || 0,
|
|
25
|
+
message: (params === null || params === void 0 ? void 0 : params.message) || '',
|
|
26
|
+
merchantReceipt: params === null || params === void 0 ? void 0 : params.merchant_receipt,
|
|
27
|
+
customerReceipt: params === null || params === void 0 ? void 0 : params.customer_receipt,
|
|
28
|
+
resultAmounts: params === null || params === void 0 ? void 0 : params.result_amounts,
|
|
29
|
+
resultFinancialStatus: params === null || params === void 0 ? void 0 : params.result_financial_status,
|
|
30
|
+
layouts: [],
|
|
31
|
+
details: {},
|
|
32
|
+
detailsText: '',
|
|
33
|
+
autoAction: []
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// 检查是否存在 pos_instructions
|
|
37
|
+
if (!(params !== null && params !== void 0 && params.pos_instructions)) {
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
40
|
+
var posInstructions = (params === null || params === void 0 ? void 0 : params.pos_instructions) || {};
|
|
41
|
+
|
|
42
|
+
// 检查是否有自动操作
|
|
43
|
+
result.autoAction = (posInstructions === null || posInstructions === void 0 ? void 0 : posInstructions.auto_actions) || [];
|
|
44
|
+
|
|
45
|
+
// 检查是否存在 action_form
|
|
46
|
+
if (!(posInstructions !== null && posInstructions !== void 0 && posInstructions.action_form)) {
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
var actionForm = (posInstructions === null || posInstructions === void 0 ? void 0 : posInstructions.action_form) || {};
|
|
50
|
+
|
|
51
|
+
// 解析详情信息
|
|
52
|
+
if (actionForm !== null && actionForm !== void 0 && actionForm.details) {
|
|
53
|
+
result.details = _objectSpread({}, (actionForm === null || actionForm === void 0 ? void 0 : actionForm.details) || {});
|
|
54
|
+
var detailsTextArr = [];
|
|
55
|
+
Object.keys((actionForm === null || actionForm === void 0 ? void 0 : actionForm.details) || {}).forEach(function (key) {
|
|
56
|
+
var _actionForm$details;
|
|
57
|
+
detailsTextArr.push("".concat(key, ": ").concat((actionForm === null || actionForm === void 0 || (_actionForm$details = actionForm.details) === null || _actionForm$details === void 0 ? void 0 : _actionForm$details[key]) || ''));
|
|
58
|
+
});
|
|
59
|
+
result.detailsText = (detailsTextArr === null || detailsTextArr === void 0 ? void 0 : detailsTextArr.join(', ')) || '';
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// 解析布局和按钮
|
|
63
|
+
if (actionForm !== null && actionForm !== void 0 && actionForm.layout && Array.isArray(actionForm === null || actionForm === void 0 ? void 0 : actionForm.layout)) {
|
|
64
|
+
var layouts = [];
|
|
65
|
+
|
|
66
|
+
// 遍历所有布局
|
|
67
|
+
actionForm.layout.forEach(function (layout) {
|
|
68
|
+
var elements = [];
|
|
69
|
+
if (layout !== null && layout !== void 0 && layout.elements && Array.isArray(layout === null || layout === void 0 ? void 0 : layout.elements)) {
|
|
70
|
+
// 遍历布局中的所有元素
|
|
71
|
+
layout.elements.forEach(function (element) {
|
|
72
|
+
var _actionForm$propertie;
|
|
73
|
+
var elementKey = (element === null || element === void 0 ? void 0 : element.key) || '';
|
|
74
|
+
var elementLabel = (element === null || element === void 0 ? void 0 : element.label) || '';
|
|
75
|
+
|
|
76
|
+
// 从 properties 中获取对应的属性
|
|
77
|
+
var property = (actionForm === null || actionForm === void 0 || (_actionForm$propertie = actionForm.properties) === null || _actionForm$propertie === void 0 ? void 0 : _actionForm$propertie[elementKey]) || {};
|
|
78
|
+
if (property) {
|
|
79
|
+
var _element = {
|
|
80
|
+
_extra: {
|
|
81
|
+
merchantReceipt: params === null || params === void 0 ? void 0 : params.merchant_receipt,
|
|
82
|
+
customerReceipt: params === null || params === void 0 ? void 0 : params.customer_receipt,
|
|
83
|
+
paymentStatus: paymentStatus,
|
|
84
|
+
response: data
|
|
85
|
+
},
|
|
86
|
+
key: elementKey,
|
|
87
|
+
name: (property === null || property === void 0 ? void 0 : property.name) || '',
|
|
88
|
+
label: elementLabel,
|
|
89
|
+
submitUrl: (property === null || property === void 0 ? void 0 : property.submit_url) || '',
|
|
90
|
+
action: property === null || property === void 0 ? void 0 : property.action,
|
|
91
|
+
type: (property === null || property === void 0 ? void 0 : property.type) || 'button',
|
|
92
|
+
text: property === null || property === void 0 ? void 0 : property.text,
|
|
93
|
+
// 如果是打印收据按钮,需要关联对应的小票信息
|
|
94
|
+
receipt: elementKey === EButtonKeyType.PrintMerchantReceipt ? result === null || result === void 0 ? void 0 : result.merchantReceipt : elementKey === EButtonKeyType.PrintCustomerReceipt ? result === null || result === void 0 ? void 0 : result.customerReceipt : null
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// 只在 type 为 'image' 时添加 image 字段
|
|
98
|
+
if ((property === null || property === void 0 ? void 0 : property.type) === 'image') {
|
|
99
|
+
_element.image = {
|
|
100
|
+
name: (property === null || property === void 0 ? void 0 : property.name) || '',
|
|
101
|
+
data: (property === null || property === void 0 ? void 0 : property.data) || '',
|
|
102
|
+
encoding: (property === null || property === void 0 ? void 0 : property.encoding) || ''
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
elements.push(_element);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// 只添加有元素的布局
|
|
111
|
+
if (elements.length > 0) {
|
|
112
|
+
layouts.push({
|
|
113
|
+
layoutType: layout.type || 'unknown',
|
|
114
|
+
elements: elements
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
result.layouts = layouts;
|
|
119
|
+
}
|
|
120
|
+
return result;
|
|
121
|
+
};
|
|
@@ -10,9 +10,10 @@ import { getPayParams } from "./helper";
|
|
|
10
10
|
import Manual from "./component/manual";
|
|
11
11
|
import Signature from "./component/signature";
|
|
12
12
|
import { StatusEnum, PayRouteEnum, ClientEnum } from "./const";
|
|
13
|
-
import { Payo, Windcave, Tyro, Linkly, Huifu } from "./manufacturer";
|
|
13
|
+
import { Payo, Windcave, Tyro, Linkly, Huifu, Mx51 } from "./manufacturer";
|
|
14
14
|
import { useContextData, useDispatch, updateStatus, backUpProduction, updateComponent, backUpFree, updateState } from "./store";
|
|
15
15
|
import "./index.less";
|
|
16
|
+
import payLog from "./utils/payLog";
|
|
16
17
|
|
|
17
18
|
// 定制组件 用于当前页面无法扩展场景
|
|
18
19
|
var Mapping = {
|
|
@@ -45,13 +46,15 @@ var Pay = function Pay(_ref) {
|
|
|
45
46
|
client = _ref.client;
|
|
46
47
|
var data = useContextData();
|
|
47
48
|
var dataRef = useRef(data);
|
|
48
|
-
// console.log("pay = ",'pay')
|
|
49
49
|
var dispatch = useDispatch();
|
|
50
50
|
var ref = useRef(false);
|
|
51
51
|
var statusRef = useRef(data.status);
|
|
52
52
|
var comonentRef = useRef(data.component);
|
|
53
53
|
var backupRef = useRef(data.backup);
|
|
54
|
-
var clearRef = useRef(
|
|
54
|
+
var clearRef = useRef(null);
|
|
55
|
+
useEffect(function () {
|
|
56
|
+
payLog.log('支付组件初始化');
|
|
57
|
+
}, []);
|
|
55
58
|
useEffect(function () {
|
|
56
59
|
comonentRef.current = data.component;
|
|
57
60
|
}, [data.component]);
|
|
@@ -92,10 +95,11 @@ var Pay = function Pay(_ref) {
|
|
|
92
95
|
net: net
|
|
93
96
|
}));
|
|
94
97
|
if (!ref.current) {
|
|
95
|
-
// 初始化
|
|
96
98
|
ref.current = true;
|
|
97
|
-
// 断网&崩溃 恢复处理
|
|
98
99
|
if (backupRef.current && net) {
|
|
100
|
+
payLog.log('网络恢复:从备份恢复', {
|
|
101
|
+
hasBackup: true
|
|
102
|
+
});
|
|
99
103
|
var _data = Object.assign({}, (_objectDestructuringEmpty(backupRef.current), backupRef.current));
|
|
100
104
|
dispatch(backUpFree({
|
|
101
105
|
key: Date.now()
|
|
@@ -115,8 +119,10 @@ var Pay = function Pay(_ref) {
|
|
|
115
119
|
return;
|
|
116
120
|
}
|
|
117
121
|
if (net) {
|
|
122
|
+
payLog.log('网络恢复', {
|
|
123
|
+
hasBackup: !!backupRef.current
|
|
124
|
+
});
|
|
118
125
|
var _data2 = Object.assign({}, (_objectDestructuringEmpty(backupRef.current), backupRef.current));
|
|
119
|
-
// 网络恢复 释放备份
|
|
120
126
|
dispatch(backUpFree({
|
|
121
127
|
key: Date.now()
|
|
122
128
|
}));
|
|
@@ -132,10 +138,10 @@ var Pay = function Pay(_ref) {
|
|
|
132
138
|
}
|
|
133
139
|
return;
|
|
134
140
|
}
|
|
135
|
-
|
|
141
|
+
payLog.log('网络断开,备份数据');
|
|
136
142
|
dispatch(updateState({
|
|
137
143
|
form: 'Network'
|
|
138
|
-
}));
|
|
144
|
+
}));
|
|
139
145
|
dispatch(backUpProduction({}));
|
|
140
146
|
dispatch(updateState({
|
|
141
147
|
net: net,
|
|
@@ -147,16 +153,19 @@ var Pay = function Pay(_ref) {
|
|
|
147
153
|
return function () {
|
|
148
154
|
if (clearRef.current) {
|
|
149
155
|
clearTimeout(clearRef.current);
|
|
156
|
+
clearRef.current = null;
|
|
150
157
|
}
|
|
151
158
|
};
|
|
152
159
|
}, []);
|
|
153
160
|
console.log('data =>>>>>> ', data);
|
|
161
|
+
// 定制逻辑:MX51 状态为 Question 时,不展示 Header 组件
|
|
162
|
+
var isHideHeader = data.eftpos === 'mx51' && data.status === StatusEnum.Question || data.status === StatusEnum.Init;
|
|
154
163
|
return /*#__PURE__*/React.createElement(React.Fragment, null, data.render ? /*#__PURE__*/React.createElement("div", {
|
|
155
164
|
className: "pisell-lowcode__eft-pay-box ".concat(className),
|
|
156
165
|
style: data.type === 'step' ? {} : {
|
|
157
166
|
display: 'none'
|
|
158
167
|
}
|
|
159
|
-
},
|
|
168
|
+
}, isHideHeader ? null : /*#__PURE__*/React.createElement(Header, {
|
|
160
169
|
status: data.status,
|
|
161
170
|
title: data.title,
|
|
162
171
|
subTitle: data.subTitle
|
|
@@ -186,6 +195,9 @@ var Pay = function Pay(_ref) {
|
|
|
186
195
|
key: data.key,
|
|
187
196
|
onChange: onChange,
|
|
188
197
|
isNativeApp: isMobile
|
|
198
|
+
}) : null, data.eftpos === 'mx51' ? /*#__PURE__*/React.createElement(Mx51, {
|
|
199
|
+
key: data.key,
|
|
200
|
+
onChange: onChange
|
|
189
201
|
}) : null) : null, data.type === PayRouteEnum.Unset && Comm ? /*#__PURE__*/React.createElement(Comm, {
|
|
190
202
|
onChange: onChange,
|
|
191
203
|
api: api,
|
|
@@ -28,6 +28,7 @@ import { useFail, useStoreRef } from "../hooks";
|
|
|
28
28
|
import { useContextData, useDispatch, updateNextStep, updateComponent, updateState, updateCustom } from "../store";
|
|
29
29
|
import { useValidate } from "./hooks";
|
|
30
30
|
import { usePayment, ActionType } from "./payment";
|
|
31
|
+
import payLog from "../utils/payLog";
|
|
31
32
|
|
|
32
33
|
// 注意断网与卸载未完成的回调将终止处理
|
|
33
34
|
export var POS = function POS(_ref) {
|
|
@@ -54,7 +55,7 @@ export var POS = function POS(_ref) {
|
|
|
54
55
|
var fail = useFail(0);
|
|
55
56
|
var failRef = useRef(fail);
|
|
56
57
|
var controllerRef = useRef();
|
|
57
|
-
var clearRef = useRef();
|
|
58
|
+
var clearRef = useRef(null);
|
|
58
59
|
var initRef = useRef(false);
|
|
59
60
|
var unloadRef = useRef(false);
|
|
60
61
|
var _useValidate = useValidate(1000 * 60),
|
|
@@ -188,6 +189,7 @@ export var POS = function POS(_ref) {
|
|
|
188
189
|
card_reader_type: eftposRef.current,
|
|
189
190
|
card_reader_id: (_deviceRef$current3 = deviceRef.current) === null || _deviceRef$current3 === void 0 ? void 0 : _deviceRef$current3.id,
|
|
190
191
|
number: numRef.current,
|
|
192
|
+
original_payment_number: custom === null || custom === void 0 ? void 0 : custom.original_payment_number,
|
|
191
193
|
pay_param_base64: encodeURIComponent(btoa(encodeURIComponent(JSON.stringify(_objectSpread(_objectSpread({}, dataRef.current), {}, {
|
|
192
194
|
number: numRef.current
|
|
193
195
|
})))))
|
|
@@ -196,9 +198,15 @@ export var POS = function POS(_ref) {
|
|
|
196
198
|
// ? api.pay(apiParams, { signal: controllerRef.current.signal })
|
|
197
199
|
// : api.refund(apiParams, { signal: controllerRef.current.signal });
|
|
198
200
|
|
|
199
|
-
|
|
201
|
+
payLog.setContext({
|
|
202
|
+
transactionNumber: numRef.current
|
|
203
|
+
});
|
|
200
204
|
if (isPay) {
|
|
201
205
|
var _deviceRef$current4;
|
|
206
|
+
payLog.log('Payo:发起支付', {
|
|
207
|
+
isPay: isPay,
|
|
208
|
+
number: numRef.current
|
|
209
|
+
});
|
|
202
210
|
paymentRun({
|
|
203
211
|
paymentType: ActionType.Pay,
|
|
204
212
|
paymentNum: numRef.current,
|
|
@@ -207,39 +215,62 @@ export var POS = function POS(_ref) {
|
|
|
207
215
|
params: apiParams,
|
|
208
216
|
callbacks: {
|
|
209
217
|
onSuccess: function onSuccess(res) {
|
|
218
|
+
payLog.log('Payo:支付成功', {
|
|
219
|
+
code: res === null || res === void 0 ? void 0 : res.code
|
|
220
|
+
});
|
|
210
221
|
success(res);
|
|
211
222
|
},
|
|
212
223
|
onError: function onError(err) {
|
|
213
|
-
|
|
224
|
+
payLog.log('Payo:支付失败', {
|
|
225
|
+
code: err === null || err === void 0 ? void 0 : err.code
|
|
226
|
+
});
|
|
214
227
|
failRef.current(err, true);
|
|
215
228
|
}
|
|
216
229
|
}
|
|
217
230
|
});
|
|
218
231
|
return;
|
|
219
232
|
} else {
|
|
233
|
+
payLog.log('Payo:发起退款', {
|
|
234
|
+
isPay: isPay,
|
|
235
|
+
number: numRef.current
|
|
236
|
+
});
|
|
220
237
|
var resultPromise = api.refund(apiParams, {
|
|
221
238
|
signal: controllerRef.current.signal
|
|
222
239
|
});
|
|
223
240
|
resultPromise.then(function (res) {
|
|
224
241
|
console.log('netRef.current111 = ', netRef.current);
|
|
225
242
|
if (unloadRef.current || !netRef.current) {
|
|
243
|
+
payLog.log('Payo:退款拦截', {
|
|
244
|
+
isUnload: unloadRef.current,
|
|
245
|
+
isNet: netRef.current
|
|
246
|
+
});
|
|
226
247
|
return;
|
|
227
248
|
}
|
|
228
249
|
if (res && "".concat(res.code) === '200') {
|
|
250
|
+
payLog.log('Payo:退款成功', {
|
|
251
|
+
res: JSON.stringify(res)
|
|
252
|
+
});
|
|
229
253
|
success(res);
|
|
230
254
|
return;
|
|
231
255
|
}
|
|
232
256
|
return Promise.reject(res);
|
|
233
257
|
}).catch(function (err) {
|
|
234
|
-
console.log('netRef.current222 = ', netRef.current, unloadRef.current, err);
|
|
235
258
|
if (unloadRef.current || !netRef.current) {
|
|
259
|
+
payLog.log('Payo:退款失败拦截', {
|
|
260
|
+
isUnload: unloadRef.current,
|
|
261
|
+
isNet: netRef.current
|
|
262
|
+
});
|
|
236
263
|
return;
|
|
237
264
|
}
|
|
238
|
-
// 支付接口超时 进行支付状态查询(超时或者其它错误)
|
|
239
265
|
if (!(err !== null && err !== void 0 && err.code) || "".concat(err.code) === PayStatus.Timeout) {
|
|
266
|
+
payLog.log('Payo:退款超时,转查询');
|
|
240
267
|
checkApi();
|
|
241
268
|
return;
|
|
242
269
|
}
|
|
270
|
+
payLog.log('Payo:退款失败', {
|
|
271
|
+
code: err === null || err === void 0 ? void 0 : err.code,
|
|
272
|
+
message: err === null || err === void 0 ? void 0 : err.message
|
|
273
|
+
});
|
|
243
274
|
failRef.current(err, true);
|
|
244
275
|
});
|
|
245
276
|
}
|
|
@@ -273,6 +304,7 @@ export var Action = function Action(_ref2) {
|
|
|
273
304
|
useEffect(function () {
|
|
274
305
|
var timer = setTimeout(function () {
|
|
275
306
|
setIsShowCancel(true);
|
|
307
|
+
payLog.log('Payo:30秒后显示取消按钮');
|
|
276
308
|
}, 30 * 1000);
|
|
277
309
|
return function () {
|
|
278
310
|
clearTimeout(timer);
|
|
@@ -285,6 +317,7 @@ export var Action = function Action(_ref2) {
|
|
|
285
317
|
* @Date: 2024-08-20 12:18
|
|
286
318
|
*/
|
|
287
319
|
var onManually = function onManually() {
|
|
320
|
+
payLog.log('Payo:点击手动标记');
|
|
288
321
|
dispatch(updateState({
|
|
289
322
|
manual: {
|
|
290
323
|
title: locales.getText('page.eftpos-pay.text.request.title')(mode),
|
|
@@ -294,6 +327,7 @@ export var Action = function Action(_ref2) {
|
|
|
294
327
|
dispatch(updateComponent('Manual', true));
|
|
295
328
|
};
|
|
296
329
|
var onCancel = function onCancel() {
|
|
330
|
+
payLog.log('Payo:点击取消');
|
|
297
331
|
onChange('fail', {
|
|
298
332
|
number: number,
|
|
299
333
|
uniquePaymentNumber: number,
|
|
@@ -68,7 +68,7 @@ export default (function (params) {
|
|
|
68
68
|
status: StatusEnum.Loading,
|
|
69
69
|
steps: getStep(mode),
|
|
70
70
|
render: true,
|
|
71
|
-
client: client !== 'undefined' ? client : ClientEnum.Merchant,
|
|
71
|
+
client: client !== 'undefined' && client !== undefined ? client : ClientEnum.Merchant,
|
|
72
72
|
custom: other || {}
|
|
73
73
|
}, typeof net !== 'undefined' ? {
|
|
74
74
|
net: net
|
|
@@ -12,7 +12,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
|
12
12
|
import { useCallback, useEffect, useRef } from 'react';
|
|
13
13
|
import { PayStatus } from "../const";
|
|
14
14
|
import { sleep } from "../helper";
|
|
15
|
-
import
|
|
15
|
+
import payLog from "../utils/payLog";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* @title: 循环查询 接口状态
|
|
@@ -112,24 +112,15 @@ export var useValidate = function useValidate(timeout) {
|
|
|
112
112
|
(_controllerRef$curren = controllerRef.current) === null || _controllerRef$curren === void 0 || _controllerRef$curren.abort();
|
|
113
113
|
}, []);
|
|
114
114
|
var run = function run() {
|
|
115
|
-
for (var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
116
|
-
params[_key] = arguments[_key];
|
|
117
|
-
}
|
|
118
115
|
isTimeoutCloseRef.current = false;
|
|
119
116
|
TimeoutRef.current && clearTimeout(TimeoutRef.current);
|
|
120
117
|
// 开启计时
|
|
121
118
|
TimeoutRef.current = setTimeout(function () {
|
|
122
119
|
isTimeoutCloseRef.current = true;
|
|
123
|
-
|
|
124
|
-
title: '支付状态查询超时',
|
|
125
|
-
content: [{
|
|
126
|
-
key: 'params',
|
|
127
|
-
value: JSON.stringify(params)
|
|
128
|
-
}]
|
|
129
|
-
});
|
|
120
|
+
payLog.log('Payo:支付状态查询超时');
|
|
130
121
|
close();
|
|
131
122
|
}, timeout);
|
|
132
|
-
return checkApi.apply(void 0,
|
|
123
|
+
return checkApi.apply(void 0, arguments);
|
|
133
124
|
};
|
|
134
125
|
useEffect(function () {
|
|
135
126
|
return function () {
|