@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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
2
|
+
en: {
|
|
3
3
|
'page.eftpos.text.manufacturer': 'Manufacturer',
|
|
4
4
|
'page.eftpos.text.description': 'Description',
|
|
5
5
|
'page.eftpos.text.status': 'status',
|
|
@@ -9,7 +9,7 @@ export default {
|
|
|
9
9
|
if (!name) {
|
|
10
10
|
return "Add device";
|
|
11
11
|
}
|
|
12
|
-
var action = status ==
|
|
12
|
+
var action = status == 'add' ? 'Add' : status == 'edit' ? 'Edit' : 'Repair';
|
|
13
13
|
return "".concat(action, " ").concat(name, " device");
|
|
14
14
|
},
|
|
15
15
|
'page.eftpos.text.device.list': 'Device list',
|
|
@@ -21,6 +21,7 @@ export default {
|
|
|
21
21
|
'page.eftpos.text.edit': 'Edit',
|
|
22
22
|
'page.eftpos.text.delete': 'Delete',
|
|
23
23
|
'page.eftpos.text.save': 'Save',
|
|
24
|
+
'page.eftpos.text.pair': 'Pair',
|
|
24
25
|
'page.eftpos.text.confim.delete': 'Confirm delete',
|
|
25
26
|
'page.eftpos.text.confirm_delete-message': function pageEftposTextConfirm_deleteMessage(x) {
|
|
26
27
|
return "Confirm delete ".concat(x, " Device");
|
|
@@ -35,9 +36,44 @@ export default {
|
|
|
35
36
|
'page.eftpos.text.table.del.delete': 'Delete',
|
|
36
37
|
'page.eftpos.text.table.del.cancel': 'Cancel',
|
|
37
38
|
'page.eftpos.text.log': 'Log',
|
|
39
|
+
'page.eftpos.text.settlement': 'Settlement',
|
|
40
|
+
'page.eftpos.text.settlement_enquiry': 'Settlement enquiry',
|
|
41
|
+
'page.eftpos.text.simple.cloud.integration': 'Simple Cloud Integration',
|
|
42
|
+
'page.eftpos.text.simple.cloud.integration.steps': ['1. On the terminal, open “Manage POS Pairing” and create a new pairing.', '2. Select “Simple Cloud Integration”.', '3. Enter the pairing code shown on the terminal.', '4. Enter a pairing name for the terminal.', '5. Tap “Pair” to start pairing.'],
|
|
38
43
|
'page.eftpos.text.setting': 'Setting',
|
|
39
44
|
'page.eftpos.text.setting.tip': 'You have not configured the necessary parameters, which may affect the normal use of your POS! ',
|
|
40
|
-
'page.eftpos.text.setting.btn': 'Go to configure'
|
|
45
|
+
'page.eftpos.text.setting.btn': 'Go to configure',
|
|
46
|
+
'page.eftpos.text.pair.modal.content.text-info': function pageEftposTextPairModalContentTextInfo(status) {
|
|
47
|
+
if (status === 'pairing') {
|
|
48
|
+
return {
|
|
49
|
+
title: 'Pairing',
|
|
50
|
+
description: 'Confirm the code on the EFTPOS terminal to continue.',
|
|
51
|
+
codeTitle: 'Code',
|
|
52
|
+
cancenButtonText: 'Cancel',
|
|
53
|
+
okButtonText: 'Check status'
|
|
54
|
+
};
|
|
55
|
+
} else if (status === 'success') {
|
|
56
|
+
return {
|
|
57
|
+
title: 'Pairing is active',
|
|
58
|
+
description: 'You are ready to go!',
|
|
59
|
+
codeTitle: '',
|
|
60
|
+
cancenButtonText: 'Unpair',
|
|
61
|
+
okButtonText: 'Confirm'
|
|
62
|
+
};
|
|
63
|
+
} else if (status === 'failed') {
|
|
64
|
+
return {
|
|
65
|
+
title: 'Pairing not active',
|
|
66
|
+
description: 'Check the terminal, confirm the pairing code, then try again.',
|
|
67
|
+
codeTitle: 'Code',
|
|
68
|
+
cancenButtonText: 'Cancel',
|
|
69
|
+
okButtonText: 'Check status'
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
'page.eftpos.text.repair.message.warning': 'Device is already connected. No need to reconnect.',
|
|
74
|
+
'page.eftpos.text.settlement.failed': 'Please check network and terminal connections and try again',
|
|
75
|
+
'page.eftpos.text.settlement.button.done': 'Done',
|
|
76
|
+
'page.eftpos.text.pair.error': 'Please check network and terminal connections and try again'
|
|
41
77
|
},
|
|
42
78
|
'zh-CN': {
|
|
43
79
|
'page.eftpos.text.manufacturer': '厂商',
|
|
@@ -49,7 +85,7 @@ export default {
|
|
|
49
85
|
if (!name) {
|
|
50
86
|
return "\u6DFB\u52A0\u8BBE\u5907";
|
|
51
87
|
}
|
|
52
|
-
var action = status ==
|
|
88
|
+
var action = status == 'add' ? '添加' : status == 'edit' ? '编辑' : '重新配置';
|
|
53
89
|
return "".concat(action, " ").concat(name, " \u8BBE\u5907");
|
|
54
90
|
},
|
|
55
91
|
'page.eftpos.text.device.list': '设备列表',
|
|
@@ -61,6 +97,7 @@ export default {
|
|
|
61
97
|
'page.eftpos.text.edit': '编辑',
|
|
62
98
|
'page.eftpos.text.delete': '删除',
|
|
63
99
|
'page.eftpos.text.save': '保存',
|
|
100
|
+
'page.eftpos.text.pair': '配对',
|
|
64
101
|
'page.eftpos.text.confim.delete': '确认删除',
|
|
65
102
|
'page.eftpos.text.confirm_delete-message': function pageEftposTextConfirm_deleteMessage(x) {
|
|
66
103
|
return "\u786E\u8BA4\u5220\u9664 ".concat(x, " \u8BBE\u5907\u5417\uFF1F");
|
|
@@ -75,9 +112,44 @@ export default {
|
|
|
75
112
|
'page.eftpos.text.table.del.delete': '删除',
|
|
76
113
|
'page.eftpos.text.table.del.cancel': '取消',
|
|
77
114
|
'page.eftpos.text.log': '日志',
|
|
115
|
+
'page.eftpos.text.settlement': '结算',
|
|
116
|
+
'page.eftpos.text.settlement_enquiry': '结算查询',
|
|
117
|
+
'page.eftpos.text.simple.cloud.integration': '云端集成',
|
|
118
|
+
'page.eftpos.text.simple.cloud.integration.steps': ['1. 在刷卡机上打开“POS配对管理”,创建新的配对。', '2. 选择“云端集成”。', '3. 输入刷卡机显示的配对码。', '4. 为刷卡机输入配对名称。', '5. 点击“配对”开始连接。'],
|
|
78
119
|
'page.eftpos.text.setting': '设置',
|
|
79
120
|
'page.eftpos.text.setting.tip': '您尚未配置必要参数,这可能会影响您Pos的正常使用!',
|
|
80
|
-
'page.eftpos.text.setting.btn': '前往配置'
|
|
121
|
+
'page.eftpos.text.setting.btn': '前往配置',
|
|
122
|
+
'page.eftpos.text.pair.modal.content.text-info': function pageEftposTextPairModalContentTextInfo(status) {
|
|
123
|
+
if (status === 'pairing') {
|
|
124
|
+
return {
|
|
125
|
+
title: '正在配对',
|
|
126
|
+
description: '请在刷卡机上确认配对码以继续。',
|
|
127
|
+
codeTitle: '配对码',
|
|
128
|
+
cancenButtonText: '取消',
|
|
129
|
+
okButtonText: '检查状态'
|
|
130
|
+
};
|
|
131
|
+
} else if (status === 'success') {
|
|
132
|
+
return {
|
|
133
|
+
title: '配对成功',
|
|
134
|
+
description: '设备已成功连接,可开始使用。',
|
|
135
|
+
codeTitle: '',
|
|
136
|
+
cancenButtonText: '解除配对',
|
|
137
|
+
okButtonText: '确认'
|
|
138
|
+
};
|
|
139
|
+
} else if (status === 'failed') {
|
|
140
|
+
return {
|
|
141
|
+
title: '配对未生效',
|
|
142
|
+
description: '请检查刷卡机并确认配对码后重试。',
|
|
143
|
+
codeTitle: '配对码',
|
|
144
|
+
cancenButtonText: '取消',
|
|
145
|
+
okButtonText: '检查状态'
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
'page.eftpos.text.repair.message.warning': '设备已连接,无需重新连接。',
|
|
150
|
+
'page.eftpos.text.settlement.failed': '请检查网络和终端连接并重试',
|
|
151
|
+
'page.eftpos.text.settlement.button.done': '完成',
|
|
152
|
+
'page.eftpos.text.pair.error': '请检查网络与设备连接后重试'
|
|
81
153
|
},
|
|
82
154
|
'zh-HK': {
|
|
83
155
|
'page.eftpos.text.manufacturer': '廠商',
|
|
@@ -89,7 +161,7 @@ export default {
|
|
|
89
161
|
if (!name) {
|
|
90
162
|
return "\u6DFB\u52A0\u8A2D\u5099";
|
|
91
163
|
}
|
|
92
|
-
var action = status ==
|
|
164
|
+
var action = status == 'add' ? '添加' : status == 'edit' ? '編輯' : '重新配置';
|
|
93
165
|
return "".concat(action, " ").concat(name, " \u8A2D\u5099");
|
|
94
166
|
},
|
|
95
167
|
'page.eftpos.text.device.list': '設備列表',
|
|
@@ -101,6 +173,7 @@ export default {
|
|
|
101
173
|
'page.eftpos.text.edit': '編輯',
|
|
102
174
|
'page.eftpos.text.delete': '删除',
|
|
103
175
|
'page.eftpos.text.save': '保存',
|
|
176
|
+
'page.eftpos.text.pair': '配對',
|
|
104
177
|
'page.eftpos.text.confim.delete': '確認刪除',
|
|
105
178
|
'page.eftpos.text.confirm_delete-message': function pageEftposTextConfirm_deleteMessage(x) {
|
|
106
179
|
return "\u78BA\u8A8D\u522A\u9664 ".concat(x, " \u8A2D\u5099\u55CE\uFF1F");
|
|
@@ -115,9 +188,44 @@ export default {
|
|
|
115
188
|
'page.eftpos.text.table.del.delete': '刪除',
|
|
116
189
|
'page.eftpos.text.table.del.cancel': '取消',
|
|
117
190
|
'page.eftpos.text.log': '日誌',
|
|
191
|
+
'page.eftpos.text.settlement': '結算',
|
|
192
|
+
'page.eftpos.text.settlement_enquiry': '結算查詢',
|
|
193
|
+
'page.eftpos.text.simple.cloud.integration': '雲端整合',
|
|
194
|
+
'page.eftpos.text.simple.cloud.integration.steps': ['1. 在刷卡機上開啟「POS配對管理」,建立新的配對。', '2. 選擇「雲端整合」。', '3. 輸入刷卡機顯示的配對碼。', '4. 為刷卡機輸入配對名稱。', '5. 點擊「配對」開始連線。'],
|
|
118
195
|
'page.eftpos.text.setting': '设置',
|
|
119
196
|
'page.eftpos.text.setting.tip': '您尚未配置必要參數,這可能會影響您Pos的正常使用!',
|
|
120
|
-
'page.eftpos.text.setting.btn': '前往配置'
|
|
197
|
+
'page.eftpos.text.setting.btn': '前往配置',
|
|
198
|
+
'page.eftpos.text.pair.modal.content.text-info': function pageEftposTextPairModalContentTextInfo(status) {
|
|
199
|
+
if (status === 'pairing') {
|
|
200
|
+
return {
|
|
201
|
+
title: '正在配對',
|
|
202
|
+
description: '請在刷卡機上確認配對碼以繼續。',
|
|
203
|
+
codeTitle: '配對碼',
|
|
204
|
+
cancenButtonText: '取消',
|
|
205
|
+
okButtonText: '檢查狀態'
|
|
206
|
+
};
|
|
207
|
+
} else if (status === 'success') {
|
|
208
|
+
return {
|
|
209
|
+
title: '配對成功',
|
|
210
|
+
description: '設備已成功連接,可開始使用。',
|
|
211
|
+
codeTitle: '',
|
|
212
|
+
cancenButtonText: '解除配對',
|
|
213
|
+
okButtonText: '確認'
|
|
214
|
+
};
|
|
215
|
+
} else if (status === 'failed') {
|
|
216
|
+
return {
|
|
217
|
+
title: '配對未生效',
|
|
218
|
+
description: '請檢查刷卡機並確認配對碼後重試。',
|
|
219
|
+
codeTitle: '配對碼',
|
|
220
|
+
cancenButtonText: '取消',
|
|
221
|
+
okButtonText: '檢查狀態'
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
'page.eftpos.text.repair.message.warning': '設備已連接,無需重新連接。',
|
|
226
|
+
'page.eftpos.text.settlement.failed': '請檢查網絡和終端連接並重試',
|
|
227
|
+
'page.eftpos.text.settlement.button.done': '完成',
|
|
228
|
+
'page.eftpos.text.pair.error': '請檢查網絡與設備連接後重試'
|
|
121
229
|
},
|
|
122
230
|
ja: {
|
|
123
231
|
'page.eftpos.text.manufacturer': 'メーカー',
|
|
@@ -129,74 +237,146 @@ export default {
|
|
|
129
237
|
if (!name) {
|
|
130
238
|
return "\u30C7\u30D0\u30A4\u30B9\u3092\u8FFD\u52A0";
|
|
131
239
|
}
|
|
132
|
-
var action = status ==
|
|
133
|
-
return "".concat(
|
|
240
|
+
var action = status == 'add' ? '追加' : status == 'edit' ? '編集' : '再設定';
|
|
241
|
+
return "".concat(name, " \u30C7\u30D0\u30A4\u30B9\u3092").concat(action);
|
|
134
242
|
},
|
|
135
|
-
'page.eftpos.text.device.list': '
|
|
243
|
+
'page.eftpos.text.device.list': 'デバイス一覧',
|
|
136
244
|
'page.eftpos.text.device.name': 'デバイス名',
|
|
137
|
-
'page.eftpos.text.sucahrge': '
|
|
245
|
+
'page.eftpos.text.sucahrge': 'サーチャージ',
|
|
138
246
|
'page.eftpos.text.paired': 'ペアリング済み',
|
|
139
247
|
'page.eftpos.text.unpaired': '未ペアリング',
|
|
140
248
|
'page.eftpos.text.repair': '再設定',
|
|
141
249
|
'page.eftpos.text.edit': '編集',
|
|
142
250
|
'page.eftpos.text.delete': '削除',
|
|
143
251
|
'page.eftpos.text.save': '保存',
|
|
144
|
-
'page.eftpos.text.
|
|
252
|
+
'page.eftpos.text.pair': 'ペアリング',
|
|
253
|
+
'page.eftpos.text.confim.delete': '削除の確認',
|
|
145
254
|
'page.eftpos.text.confirm_delete-message': function pageEftposTextConfirm_deleteMessage(x) {
|
|
146
255
|
return "".concat(x, " \u30C7\u30D0\u30A4\u30B9\u3092\u524A\u9664\u3057\u3066\u3082\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F");
|
|
147
256
|
},
|
|
148
257
|
'page.eftpos.text.confim.cancel': 'キャンセル',
|
|
149
258
|
'page.eftpos.text.table.name': 'デバイス名',
|
|
150
259
|
'page.eftpos.text.table.status': 'ステータス',
|
|
151
|
-
'page.eftpos.text.table.surcharge': '
|
|
260
|
+
'page.eftpos.text.table.surcharge': 'サーチャージ',
|
|
152
261
|
'page.eftpos.text.table.opeartion': '操作',
|
|
153
262
|
'page.eftpos.text.table.del.title': 'デバイスを削除',
|
|
154
|
-
'page.eftpos.text.table.del.text': '
|
|
263
|
+
'page.eftpos.text.table.del.text': 'このデバイスを削除してもよろしいですか?',
|
|
155
264
|
'page.eftpos.text.table.del.delete': '削除',
|
|
156
265
|
'page.eftpos.text.table.del.cancel': 'キャンセル',
|
|
157
266
|
'page.eftpos.text.log': 'ログ',
|
|
267
|
+
'page.eftpos.text.settlement': '精算',
|
|
268
|
+
'page.eftpos.text.settlement_enquiry': '精算照会',
|
|
269
|
+
'page.eftpos.text.simple.cloud.integration': 'クラウド連携',
|
|
270
|
+
'page.eftpos.text.simple.cloud.integration.steps': ['1. 端末で「POSペアリング管理」を開き、新しいペアリングを作成します。', '2. 「クラウド連携」を選択します。', '3. 端末に表示されたペアリングコードを入力します。', '4. 端末の配対名前を入力します。', '5. 「ペアリング」をタップして接続を開始します。'],
|
|
158
271
|
'page.eftpos.text.setting': '設定',
|
|
159
|
-
'page.eftpos.text.setting.tip': '
|
|
160
|
-
'page.eftpos.text.setting.btn': '
|
|
272
|
+
'page.eftpos.text.setting.tip': '必要なパラメータが設定されていません。POS の正常な利用に影響する場合があります。',
|
|
273
|
+
'page.eftpos.text.setting.btn': '設定へ進む',
|
|
274
|
+
'page.eftpos.text.pair.modal.content.text-info': function pageEftposTextPairModalContentTextInfo(status) {
|
|
275
|
+
if (status === 'pairing') {
|
|
276
|
+
return {
|
|
277
|
+
title: 'ペアリング',
|
|
278
|
+
description: '続行するには、EFTPOS 端末でコードを確認してください。',
|
|
279
|
+
codeTitle: 'コード',
|
|
280
|
+
cancenButtonText: 'キャンセル',
|
|
281
|
+
okButtonText: '状態を確認'
|
|
282
|
+
};
|
|
283
|
+
} else if (status === 'success') {
|
|
284
|
+
return {
|
|
285
|
+
title: 'ペアリングは有効です',
|
|
286
|
+
description: '準備ができました。',
|
|
287
|
+
codeTitle: '',
|
|
288
|
+
cancenButtonText: 'ペア解除',
|
|
289
|
+
okButtonText: '確認'
|
|
290
|
+
};
|
|
291
|
+
} else if (status === 'failed') {
|
|
292
|
+
return {
|
|
293
|
+
title: 'ペアリングは無効です',
|
|
294
|
+
description: '端末を確認し、ペアリングコードを確認してから再度お試しください。',
|
|
295
|
+
codeTitle: 'コード',
|
|
296
|
+
cancenButtonText: 'キャンセル',
|
|
297
|
+
okButtonText: '状態を確認'
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
'page.eftpos.text.repair.message.warning': 'デバイスはすでに接続されています。再接続の必要はありません。',
|
|
302
|
+
'page.eftpos.text.settlement.failed': 'ネットワークと端末の接続を確認してから再度お試しください',
|
|
303
|
+
'page.eftpos.text.settlement.button.done': '完了',
|
|
304
|
+
'page.eftpos.text.pair.error': 'ネットワークと端末の接続を確認してから再度お試しください'
|
|
161
305
|
},
|
|
162
306
|
pt: {
|
|
163
307
|
'page.eftpos.text.manufacturer': 'Fabricante',
|
|
164
308
|
'page.eftpos.text.description': 'Descrição',
|
|
165
|
-
'page.eftpos.text.status': '
|
|
309
|
+
'page.eftpos.text.status': 'Status',
|
|
166
310
|
'page.eftpos.text.operation': 'Operação',
|
|
167
311
|
'page.eftpos.text.device': 'Dispositivo',
|
|
168
312
|
'page.eftpos.text.device.add': function pageEftposTextDeviceAdd(status, name) {
|
|
169
313
|
if (!name) {
|
|
170
314
|
return "Adicionar dispositivo";
|
|
171
315
|
}
|
|
172
|
-
var action = status ==
|
|
316
|
+
var action = status == 'add' ? 'Adicionar' : status == 'edit' ? 'Editar' : 'Reconfigurar';
|
|
173
317
|
return "".concat(action, " dispositivo ").concat(name);
|
|
174
318
|
},
|
|
175
319
|
'page.eftpos.text.device.list': 'Lista de dispositivos',
|
|
176
320
|
'page.eftpos.text.device.name': 'Nome do dispositivo',
|
|
177
|
-
'page.eftpos.text.sucahrge': 'Taxa',
|
|
321
|
+
'page.eftpos.text.sucahrge': 'Taxa adicional',
|
|
178
322
|
'page.eftpos.text.paired': 'Emparelhado',
|
|
179
323
|
'page.eftpos.text.unpaired': 'Não emparelhado',
|
|
180
|
-
'page.eftpos.text.repair': '
|
|
324
|
+
'page.eftpos.text.repair': 'Reconfigurar',
|
|
181
325
|
'page.eftpos.text.edit': 'Editar',
|
|
182
326
|
'page.eftpos.text.delete': 'Excluir',
|
|
183
327
|
'page.eftpos.text.save': 'Salvar',
|
|
328
|
+
'page.eftpos.text.pair': 'Emparelhar',
|
|
184
329
|
'page.eftpos.text.confim.delete': 'Confirmar exclusão',
|
|
185
330
|
'page.eftpos.text.confirm_delete-message': function pageEftposTextConfirm_deleteMessage(x) {
|
|
186
|
-
return "Confirmar exclus\xE3o do dispositivo ".concat(x);
|
|
331
|
+
return "Confirmar exclus\xE3o do dispositivo ".concat(x, "?");
|
|
187
332
|
},
|
|
188
333
|
'page.eftpos.text.confim.cancel': 'Cancelar',
|
|
189
334
|
'page.eftpos.text.table.name': 'Nome do dispositivo',
|
|
190
335
|
'page.eftpos.text.table.status': 'Status',
|
|
191
|
-
'page.eftpos.text.table.surcharge': 'Taxa',
|
|
336
|
+
'page.eftpos.text.table.surcharge': 'Taxa adicional',
|
|
192
337
|
'page.eftpos.text.table.opeartion': 'Operação',
|
|
193
338
|
'page.eftpos.text.table.del.title': 'Excluir dispositivo',
|
|
194
339
|
'page.eftpos.text.table.del.text': 'Tem certeza de que deseja excluir o dispositivo?',
|
|
195
340
|
'page.eftpos.text.table.del.delete': 'Excluir',
|
|
196
341
|
'page.eftpos.text.table.del.cancel': 'Cancelar',
|
|
197
|
-
'page.eftpos.text.log': '
|
|
342
|
+
'page.eftpos.text.log': 'Registro',
|
|
343
|
+
'page.eftpos.text.settlement': 'Liquidação',
|
|
344
|
+
'page.eftpos.text.settlement_enquiry': 'Consulta de liquidação',
|
|
345
|
+
'page.eftpos.text.simple.cloud.integration': 'Integração na Nuvem',
|
|
346
|
+
'page.eftpos.text.simple.cloud.integration.steps': ['1. No terminal, abra “Gerir emparelhamento POS” e crie um novo emparelhamento.', '2. Selecione “Integração na Nuvem”.', '3. Introduza o código de emparelhamento apresentado no terminal.', '4. Introduza um nome de emparelhamento para o terminal.', '5. Toque em “Emparelhar” para iniciar a ligação.'],
|
|
198
347
|
'page.eftpos.text.setting': 'Configurações',
|
|
199
|
-
'page.eftpos.text.setting.tip': 'Você não configurou os parâmetros necessários, o que pode afetar o uso normal do seu POS
|
|
200
|
-
'page.eftpos.text.setting.btn': 'Ir para configurar'
|
|
348
|
+
'page.eftpos.text.setting.tip': 'Você não configurou os parâmetros necessários, o que pode afetar o uso normal do seu POS.',
|
|
349
|
+
'page.eftpos.text.setting.btn': 'Ir para configurar',
|
|
350
|
+
'page.eftpos.text.pair.modal.content.text-info': function pageEftposTextPairModalContentTextInfo(status) {
|
|
351
|
+
if (status === 'pairing') {
|
|
352
|
+
return {
|
|
353
|
+
title: 'Emparelhamento',
|
|
354
|
+
description: 'Confirme o código no terminal EFTPOS para continuar.',
|
|
355
|
+
codeTitle: 'Código',
|
|
356
|
+
cancenButtonText: 'Cancelar',
|
|
357
|
+
okButtonText: 'Verificar status'
|
|
358
|
+
};
|
|
359
|
+
} else if (status === 'success') {
|
|
360
|
+
return {
|
|
361
|
+
title: 'Emparelhamento ativo',
|
|
362
|
+
description: 'Tudo pronto para usar.',
|
|
363
|
+
codeTitle: '',
|
|
364
|
+
cancenButtonText: 'Desemparelhar',
|
|
365
|
+
okButtonText: 'Confirmar'
|
|
366
|
+
};
|
|
367
|
+
} else if (status === 'failed') {
|
|
368
|
+
return {
|
|
369
|
+
title: 'Emparelhamento inativo',
|
|
370
|
+
description: 'Verifique o terminal, confirme o código de emparelhamento e tente novamente.',
|
|
371
|
+
codeTitle: 'Código',
|
|
372
|
+
cancenButtonText: 'Cancelar',
|
|
373
|
+
okButtonText: 'Verificar status'
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
},
|
|
377
|
+
'page.eftpos.text.repair.message.warning': 'O dispositivo já está conectado. Não é necessário reconectar.',
|
|
378
|
+
'page.eftpos.text.settlement.failed': 'Verifique a rede e as conexões do terminal e tente novamente',
|
|
379
|
+
'page.eftpos.text.settlement.button.done': 'Concluído',
|
|
380
|
+
'page.eftpos.text.pair.error': 'Verifique a rede e as conexões do terminal e tente novamente'
|
|
201
381
|
}
|
|
202
382
|
};
|
|
@@ -22,6 +22,8 @@ import React, { useEffect, useImperativeHandle, useMemo, useRef, useState } from
|
|
|
22
22
|
import { Space, Typography, Table, Modal, Button, Pagination, Alert } from 'antd';
|
|
23
23
|
import XClose from '@pisell/icon/es/XClose';
|
|
24
24
|
import { locales } from '@pisell/utils';
|
|
25
|
+
import { Eftpos } from "./const";
|
|
26
|
+
import SettlementModal from "./SettlementModal";
|
|
25
27
|
var Column = Table.Column;
|
|
26
28
|
var Title = Typography.Title,
|
|
27
29
|
Text = Typography.Text;
|
|
@@ -76,6 +78,16 @@ var App = function App(_ref, ref) {
|
|
|
76
78
|
data = _useState8[0],
|
|
77
79
|
setData = _useState8[1];
|
|
78
80
|
|
|
81
|
+
// 结算弹窗
|
|
82
|
+
var _useState9 = useState(false),
|
|
83
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
84
|
+
settlementModalOpen = _useState10[0],
|
|
85
|
+
setSettlementModalOpen = _useState10[1];
|
|
86
|
+
var _useState11 = useState(null),
|
|
87
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
88
|
+
settlementModalData = _useState12[0],
|
|
89
|
+
setSettlementModalData = _useState12[1];
|
|
90
|
+
|
|
79
91
|
/**
|
|
80
92
|
* @title: 加载列表数据
|
|
81
93
|
* @param {number} current 加载页数
|
|
@@ -217,6 +229,22 @@ var App = function App(_ref, ref) {
|
|
|
217
229
|
loadData: loadData
|
|
218
230
|
};
|
|
219
231
|
});
|
|
232
|
+
var onSettlement = function onSettlement(device) {
|
|
233
|
+
console.log('onSettlement', device);
|
|
234
|
+
setSettlementModalOpen(true);
|
|
235
|
+
setSettlementModalData({
|
|
236
|
+
type: 'SETTLEMENT',
|
|
237
|
+
card_reader_id: device.id
|
|
238
|
+
});
|
|
239
|
+
};
|
|
240
|
+
var onSettlementEnquiry = function onSettlementEnquiry(device) {
|
|
241
|
+
console.log('onSettlementEnquiry', device);
|
|
242
|
+
setSettlementModalOpen(true);
|
|
243
|
+
setSettlementModalData({
|
|
244
|
+
type: 'ENQUIRY',
|
|
245
|
+
card_reader_id: device.id
|
|
246
|
+
});
|
|
247
|
+
};
|
|
220
248
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
221
249
|
className: "pisell-lowcode__pos-table",
|
|
222
250
|
style: _objectSpread({}, style || {})
|
|
@@ -289,7 +317,7 @@ var App = function App(_ref, ref) {
|
|
|
289
317
|
className: "pisell-lowcode__pos-table-col"
|
|
290
318
|
}), /*#__PURE__*/React.createElement(Column, {
|
|
291
319
|
title: locales.getText('page.eftpos.text.table.opeartion'),
|
|
292
|
-
width: size[3],
|
|
320
|
+
width: type === Eftpos.MX51 ? 600 : size[3],
|
|
293
321
|
key: "opeartion",
|
|
294
322
|
className: "pisell-lowcode__pos-table-col",
|
|
295
323
|
render: function render(record) {
|
|
@@ -315,7 +343,17 @@ var App = function App(_ref, ref) {
|
|
|
315
343
|
onClick: function onClick() {
|
|
316
344
|
return onDelDevice(record);
|
|
317
345
|
}
|
|
318
|
-
}, locales.getText('page.eftpos.text.delete'))
|
|
346
|
+
}, locales.getText('page.eftpos.text.delete')), type === Eftpos.MX51 ? /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Button, {
|
|
347
|
+
type: "link",
|
|
348
|
+
onClick: function onClick() {
|
|
349
|
+
return onSettlement(record);
|
|
350
|
+
}
|
|
351
|
+
}, locales.getText('page.eftpos.text.settlement')), /*#__PURE__*/React.createElement(Button, {
|
|
352
|
+
type: "link",
|
|
353
|
+
onClick: function onClick() {
|
|
354
|
+
return onSettlementEnquiry(record);
|
|
355
|
+
}
|
|
356
|
+
}, locales.getText('page.eftpos.text.settlement_enquiry'))) : null);
|
|
319
357
|
}
|
|
320
358
|
})), /*#__PURE__*/React.createElement(Pagination, {
|
|
321
359
|
style: {
|
|
@@ -372,6 +410,12 @@ var App = function App(_ref, ref) {
|
|
|
372
410
|
className: "pisell-lowcode__pos-table-del-title"
|
|
373
411
|
}, locales.getText('page.eftpos.text.table.del.title')), /*#__PURE__*/React.createElement("div", {
|
|
374
412
|
className: "pisell-lowcode__pos-table-del-text"
|
|
375
|
-
}, locales.getText('page.eftpos.text.table.del.text')))
|
|
413
|
+
}, locales.getText('page.eftpos.text.table.del.text'))), settlementModalOpen && /*#__PURE__*/React.createElement(SettlementModal, {
|
|
414
|
+
open: settlementModalOpen,
|
|
415
|
+
onClose: function onClose() {
|
|
416
|
+
return setSettlementModalOpen(false);
|
|
417
|
+
},
|
|
418
|
+
data: settlementModalData
|
|
419
|
+
}));
|
|
376
420
|
};
|
|
377
421
|
export default /*#__PURE__*/React.forwardRef(App);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PaymentMethodOptions } from '../types';
|
|
2
2
|
declare const useMicropay: (options: PaymentMethodOptions) => {
|
|
3
|
-
run: (runParams?:
|
|
3
|
+
run: (runParams?: any) => void;
|
|
4
4
|
query: () => void;
|
|
5
5
|
action: (data: Record<string, any>) => void;
|
|
6
6
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import PaymentMethod from '../utils/payment';
|
|
2
|
+
import { PaymentMethodOptions } from '../types';
|
|
3
|
+
export declare const usePayment: (options: PaymentMethodOptions) => {
|
|
4
|
+
run: () => void;
|
|
5
|
+
query: () => void;
|
|
6
|
+
action: (data: Record<string, any>, config?: Record<string, any>) => void;
|
|
7
|
+
_instance: PaymentMethod | null;
|
|
8
|
+
};
|
|
@@ -0,0 +1,145 @@
|
|
|
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 { useEffect, useRef } from 'react';
|
|
8
|
+
import PaymentMethod from "../utils/payment";
|
|
9
|
+
import { ModeEnum } from "../../const";
|
|
10
|
+
import { useStoreRef } from "../../hooks";
|
|
11
|
+
import { getUuid } from "../../helper";
|
|
12
|
+
import { useDispatch, updateState } from "../../store";
|
|
13
|
+
import { useContextData } from "../../store";
|
|
14
|
+
export var usePayment = function usePayment(options) {
|
|
15
|
+
var _useContextData = useContextData(),
|
|
16
|
+
custom = _useContextData.custom,
|
|
17
|
+
originalParams = _useContextData.originalParams;
|
|
18
|
+
var _useStoreRef = useStoreRef(),
|
|
19
|
+
modeRef = _useStoreRef.modeRef,
|
|
20
|
+
payRef = _useStoreRef.payRef,
|
|
21
|
+
orderIdRef = _useStoreRef.orderIdRef,
|
|
22
|
+
eftposRef = _useStoreRef.eftposRef,
|
|
23
|
+
deviceRef = _useStoreRef.deviceRef,
|
|
24
|
+
dataRef = _useStoreRef.dataRef,
|
|
25
|
+
amountRef = _useStoreRef.amountRef;
|
|
26
|
+
var paymentMethodRef = useRef(null);
|
|
27
|
+
var dispatch = useDispatch();
|
|
28
|
+
var uniquePaymentNumberRef = useRef(null);
|
|
29
|
+
var isPay = modeRef.current === ModeEnum.Pay || modeRef.current === ModeEnum.FullPay;
|
|
30
|
+
useEffect(function () {
|
|
31
|
+
if (!paymentMethodRef.current) {
|
|
32
|
+
var _deviceRef$current;
|
|
33
|
+
// 如果不存在交易号需要先创建一个交易号
|
|
34
|
+
if (!options.paymentNum) {
|
|
35
|
+
var paymentNum = getUuid();
|
|
36
|
+
dispatch(updateState({
|
|
37
|
+
number: paymentNum
|
|
38
|
+
}));
|
|
39
|
+
options.paymentNum = paymentNum;
|
|
40
|
+
uniquePaymentNumberRef.current = paymentNum;
|
|
41
|
+
} else {
|
|
42
|
+
uniquePaymentNumberRef.current = options.paymentNum;
|
|
43
|
+
}
|
|
44
|
+
options.orderId = orderIdRef.current;
|
|
45
|
+
options.deviceId = (_deviceRef$current = deviceRef.current) === null || _deviceRef$current === void 0 ? void 0 : _deviceRef$current.id;
|
|
46
|
+
paymentMethodRef.current = new PaymentMethod(options);
|
|
47
|
+
}
|
|
48
|
+
return function () {
|
|
49
|
+
var _paymentMethodRef$cur, _paymentMethodRef$cur2;
|
|
50
|
+
// 卸载组件时,如果paymentMethodRef存在需要先执行销毁,再清空
|
|
51
|
+
(_paymentMethodRef$cur = paymentMethodRef.current) === null || _paymentMethodRef$cur === void 0 || (_paymentMethodRef$cur2 = _paymentMethodRef$cur.destroy) === null || _paymentMethodRef$cur2 === void 0 || _paymentMethodRef$cur2.call(_paymentMethodRef$cur);
|
|
52
|
+
paymentMethodRef.current = null;
|
|
53
|
+
};
|
|
54
|
+
}, []);
|
|
55
|
+
var run = function run() {
|
|
56
|
+
var _payRef$current, _deviceRef$current2, _options$config;
|
|
57
|
+
var params = {
|
|
58
|
+
order_id: orderIdRef.current,
|
|
59
|
+
unique_payment_number: uniquePaymentNumberRef.current,
|
|
60
|
+
payment_code: options.paymentCode,
|
|
61
|
+
amount: isPay ? (_payRef$current = payRef.current) === null || _payRef$current === void 0 ? void 0 : _payRef$current.total : amountRef.current,
|
|
62
|
+
operator_id: custom === null || custom === void 0 ? void 0 : custom.operator_id,
|
|
63
|
+
operator_type: custom === null || custom === void 0 ? void 0 : custom.operator_type,
|
|
64
|
+
platform: custom === null || custom === void 0 ? void 0 : custom.platform,
|
|
65
|
+
eftpos: {
|
|
66
|
+
card_reader_type: eftposRef.current,
|
|
67
|
+
card_reader_id: (_deviceRef$current2 = deviceRef.current) === null || _deviceRef$current2 === void 0 ? void 0 : _deviceRef$current2.id,
|
|
68
|
+
pay_param_base64: encodeURIComponent(btoa(encodeURIComponent(JSON.stringify(_objectSpread(_objectSpread({}, dataRef.current), {}, {
|
|
69
|
+
number: uniquePaymentNumberRef.current
|
|
70
|
+
})))))
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
if (options !== null && options !== void 0 && (_options$config = options.config) !== null && _options$config !== void 0 && _options$config.requestDelaySeconds) {
|
|
74
|
+
params.delay_seconds = options.config.requestDelaySeconds;
|
|
75
|
+
}
|
|
76
|
+
if (isPay) {
|
|
77
|
+
var _payRef$current2, _payRef$current3, _payRef$current4, _paymentMethodRef$cur3;
|
|
78
|
+
params.payment = {
|
|
79
|
+
original_amount: (_payRef$current2 = payRef.current) === null || _payRef$current2 === void 0 ? void 0 : _payRef$current2.amount,
|
|
80
|
+
order_payment_type: 'normal',
|
|
81
|
+
// TODO: 需要使用方提供
|
|
82
|
+
custom_payment_id: custom === null || custom === void 0 ? void 0 : custom.custom_payment_id,
|
|
83
|
+
custom_payment_code: custom === null || custom === void 0 ? void 0 : custom.custom_payment_code,
|
|
84
|
+
custom_payment_name: custom === null || custom === void 0 ? void 0 : custom.custom_payment_name,
|
|
85
|
+
custom_payment_type: custom === null || custom === void 0 ? void 0 : custom.custom_payment_type,
|
|
86
|
+
service_charge: {
|
|
87
|
+
amount: (_payRef$current3 = payRef.current) === null || _payRef$current3 === void 0 ? void 0 : _payRef$current3.surMoney,
|
|
88
|
+
percentage: (_payRef$current4 = payRef.current) === null || _payRef$current4 === void 0 ? void 0 : _payRef$current4.surPercentRate
|
|
89
|
+
},
|
|
90
|
+
metadata: {
|
|
91
|
+
unique_payment_number: uniquePaymentNumberRef.current
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
(_paymentMethodRef$cur3 = paymentMethodRef.current) === null || _paymentMethodRef$cur3 === void 0 || _paymentMethodRef$cur3.pay(params);
|
|
95
|
+
} else {
|
|
96
|
+
var _paymentMethodRef$cur4;
|
|
97
|
+
var refundPaymentContext = originalParams === null || originalParams === void 0 ? void 0 : originalParams.refund_payment_context;
|
|
98
|
+
if (refundPaymentContext) {
|
|
99
|
+
var _refundPaymentContext;
|
|
100
|
+
// 需要给退款上下文中支付方式注入交易号
|
|
101
|
+
var payments = refundPaymentContext === null || refundPaymentContext === void 0 || (_refundPaymentContext = refundPaymentContext.payments) === null || _refundPaymentContext === void 0 ? void 0 : _refundPaymentContext.map(function (payment) {
|
|
102
|
+
return _objectSpread(_objectSpread({}, payment), {}, {
|
|
103
|
+
metadata: _objectSpread(_objectSpread({}, (payment === null || payment === void 0 ? void 0 : payment.metadata) || {}), {}, {
|
|
104
|
+
unique_refund_number: uniquePaymentNumberRef.current
|
|
105
|
+
})
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
params.refund_payment_context = _objectSpread(_objectSpread({}, refundPaymentContext || {}), {}, {
|
|
109
|
+
payments: payments
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
(_paymentMethodRef$cur4 = paymentMethodRef.current) === null || _paymentMethodRef$cur4 === void 0 || _paymentMethodRef$cur4.refund(params);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
var query = function query() {
|
|
116
|
+
if (isPay) {
|
|
117
|
+
var _paymentMethodRef$cur5;
|
|
118
|
+
(_paymentMethodRef$cur5 = paymentMethodRef.current) === null || _paymentMethodRef$cur5 === void 0 || _paymentMethodRef$cur5.payQuery();
|
|
119
|
+
} else {
|
|
120
|
+
var _paymentMethodRef$cur6;
|
|
121
|
+
(_paymentMethodRef$cur6 = paymentMethodRef.current) === null || _paymentMethodRef$cur6 === void 0 || _paymentMethodRef$cur6.refundQuery();
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
var action = function action(data, config) {
|
|
125
|
+
var params = {
|
|
126
|
+
order_id: orderIdRef.current,
|
|
127
|
+
unique_payment_number: uniquePaymentNumberRef.current,
|
|
128
|
+
payment_code: options.paymentCode,
|
|
129
|
+
data: data
|
|
130
|
+
};
|
|
131
|
+
if (isPay) {
|
|
132
|
+
var _paymentMethodRef$cur7;
|
|
133
|
+
(_paymentMethodRef$cur7 = paymentMethodRef.current) === null || _paymentMethodRef$cur7 === void 0 || _paymentMethodRef$cur7.payAction(params, config);
|
|
134
|
+
} else {
|
|
135
|
+
var _paymentMethodRef$cur8;
|
|
136
|
+
(_paymentMethodRef$cur8 = paymentMethodRef.current) === null || _paymentMethodRef$cur8 === void 0 || _paymentMethodRef$cur8.refundAction(params, config);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
return {
|
|
140
|
+
run: run,
|
|
141
|
+
query: query,
|
|
142
|
+
action: action,
|
|
143
|
+
_instance: paymentMethodRef.current
|
|
144
|
+
};
|
|
145
|
+
};
|