@pisell/private-materials 6.3.79 → 6.3.80
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/meta.js +1 -1
- 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/appointmentBooking/components/Cart/Item/Total.d.ts +0 -1
- package/es/components/appointmentBooking/components/Cart/index.d.ts +0 -1
- package/es/components/appointmentBooking/components/Footer/index.d.ts +0 -1
- package/es/components/appointmentBooking/deposit/components/PolicyModal/index.d.ts +0 -1
- package/es/components/booking/forms/footer.d.ts +0 -1
- package/es/components/booking/forms/sendModal/useSendModal.d.ts +0 -1
- package/es/components/booking/hooks/useClearCart.d.ts +0 -1
- package/es/components/booking/info/date/index.d.ts +1 -0
- package/es/components/booking/info/dateRange/index.d.ts +0 -1
- 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 +5 -3
- package/es/components/eftpos/index.d.ts +0 -1
- package/es/components/eftpos/index.js +34 -11
- package/es/components/eftpos/index.less +26 -1
- package/es/components/eftpos/locales.d.ts +3 -0
- package/es/components/eftpos/locales.js +3 -0
- package/es/components/eftposPay/aggregatePayment/hooks/usePayment.d.ts +6 -0
- package/es/components/eftposPay/aggregatePayment/hooks/usePayment.js +125 -0
- package/es/components/eftposPay/aggregatePayment/index.d.ts +3 -0
- package/es/components/eftposPay/aggregatePayment/index.js +3 -0
- 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.d.ts +24 -0
- package/es/components/eftposPay/aggregatePayment/service.js +70 -0
- package/es/components/eftposPay/aggregatePayment/types.d.ts +96 -0
- package/es/components/eftposPay/aggregatePayment/types.js +61 -0
- package/es/components/eftposPay/aggregatePayment/utils/logs.d.ts +110 -0
- package/es/components/eftposPay/aggregatePayment/utils/logs.js +385 -0
- package/es/components/eftposPay/aggregatePayment/utils/payment.d.ts +132 -0
- package/es/components/eftposPay/aggregatePayment/utils/payment.js +1127 -0
- package/es/components/eftposPay/amount.d.ts +0 -1
- package/es/components/eftposPay/const.d.ts +6 -1
- package/es/components/eftposPay/const.js +2 -0
- package/es/components/eftposPay/hooks.d.ts +2 -1
- package/es/components/eftposPay/hooks.js +12 -0
- package/es/components/eftposPay/linkly/index.js +1 -0
- 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 +91 -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 +362 -0
- package/es/components/eftposPay/mx51/types.d.ts +136 -0
- package/es/components/eftposPay/mx51/types.js +29 -0
- package/es/components/eftposPay/mx51/utils.d.ts +10 -0
- package/es/components/eftposPay/mx51/utils.js +120 -0
- package/es/components/eftposPay/pay.js +7 -2
- package/es/components/eftposPay/store/index.d.ts +1 -1
- package/es/components/eventBooking/components/Provider/Content/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/EmptyHolderModal/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/Header/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/OrderProductModal/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/RemoveOptionConfirmModal.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/SelectHolderModal.d.ts +1 -0
- package/es/components/eventBooking/components/bookingDetailModal/components/Resource.d.ts +1 -0
- package/es/components/eventBooking/components/bookingDetailModal/components/Schedule.d.ts +1 -0
- package/es/components/eventBooking/components/scheduleCalendar/components/ScheduleTimeItem/index.d.ts +0 -1
- package/es/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +0 -1
- package/es/components/pisellSelectCustomerModal/RightPanel/List/index.d.ts +0 -1
- package/es/components/shoppingCart/hooks/useAddService.d.ts +0 -1
- package/es/components/shoppingCart/hooks/useClearCart.d.ts +0 -1
- package/es/plus/saasRegister/components/VertifyEmail.d.ts +0 -1
- package/es/plus/skuOptionsSelection/components/OptionsCard/index.d.ts +0 -1
- package/es/plus/skuOptionsSelection/components/TitleExtra/index.d.ts +0 -1
- package/es/plus/skuOptionsSelection/components/VariantCard/index.d.ts +0 -1
- package/es/plus/walletPassGallery/components/passList/index.d.ts +0 -1
- package/lib/components/appointmentBooking/components/Cart/Item/Total.d.ts +0 -1
- package/lib/components/appointmentBooking/components/Cart/index.d.ts +0 -1
- package/lib/components/appointmentBooking/components/Footer/index.d.ts +0 -1
- package/lib/components/appointmentBooking/deposit/components/PolicyModal/index.d.ts +0 -1
- package/lib/components/booking/forms/footer.d.ts +0 -1
- package/lib/components/booking/forms/sendModal/useSendModal.d.ts +0 -1
- package/lib/components/booking/hooks/useClearCart.d.ts +0 -1
- package/lib/components/booking/info/date/index.d.ts +1 -0
- package/lib/components/booking/info/dateRange/index.d.ts +0 -1
- 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 +3 -3
- package/lib/components/eftpos/index.d.ts +0 -1
- package/lib/components/eftpos/index.js +20 -5
- package/lib/components/eftpos/index.less +26 -1
- package/lib/components/eftpos/locales.d.ts +3 -0
- package/lib/components/eftpos/locales.js +3 -0
- package/lib/components/eftposPay/aggregatePayment/hooks/usePayment.d.ts +6 -0
- package/lib/components/eftposPay/aggregatePayment/hooks/usePayment.js +152 -0
- package/lib/components/eftposPay/aggregatePayment/index.d.ts +3 -0
- package/lib/components/eftposPay/aggregatePayment/index.js +32 -0
- package/lib/components/eftposPay/aggregatePayment/mock.d.ts +495 -0
- package/lib/components/eftposPay/aggregatePayment/mock.js +679 -0
- package/lib/components/eftposPay/aggregatePayment/service.d.ts +24 -0
- package/lib/components/eftposPay/aggregatePayment/service.js +81 -0
- package/lib/components/eftposPay/aggregatePayment/types.d.ts +96 -0
- package/lib/components/eftposPay/aggregatePayment/types.js +74 -0
- package/lib/components/eftposPay/aggregatePayment/utils/logs.d.ts +110 -0
- package/lib/components/eftposPay/aggregatePayment/utils/logs.js +302 -0
- package/lib/components/eftposPay/aggregatePayment/utils/payment.d.ts +132 -0
- package/lib/components/eftposPay/aggregatePayment/utils/payment.js +746 -0
- package/lib/components/eftposPay/amount.d.ts +0 -1
- package/lib/components/eftposPay/const.d.ts +6 -1
- package/lib/components/eftposPay/const.js +2 -0
- package/lib/components/eftposPay/hooks.d.ts +2 -1
- package/lib/components/eftposPay/hooks.js +16 -0
- package/lib/components/eftposPay/linkly/index.js +1 -0
- 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 +127 -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 +330 -0
- package/lib/components/eftposPay/mx51/types.d.ts +136 -0
- package/lib/components/eftposPay/mx51/types.js +39 -0
- package/lib/components/eftposPay/mx51/utils.d.ts +10 -0
- package/lib/components/eftposPay/mx51/utils.js +114 -0
- package/lib/components/eftposPay/pay.js +4 -2
- package/lib/components/eftposPay/store/index.d.ts +1 -1
- package/lib/components/eventBooking/components/Provider/Content/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/EmptyHolderModal/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/Header/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/OrderProductModal/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/RemoveOptionConfirmModal.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/SelectHolderModal.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingDetailModal/components/Resource.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingDetailModal/components/Schedule.d.ts +1 -0
- package/lib/components/eventBooking/components/scheduleCalendar/components/ScheduleTimeItem/index.d.ts +0 -1
- package/lib/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +0 -1
- package/lib/components/pisellSelectCustomerModal/RightPanel/List/index.d.ts +0 -1
- package/lib/components/shoppingCart/hooks/useAddService.d.ts +0 -1
- package/lib/components/shoppingCart/hooks/useClearCart.d.ts +0 -1
- package/lib/plus/saasRegister/components/VertifyEmail.d.ts +0 -1
- package/lib/plus/skuOptionsSelection/components/OptionsCard/index.d.ts +0 -1
- package/lib/plus/skuOptionsSelection/components/TitleExtra/index.d.ts +0 -1
- package/lib/plus/skuOptionsSelection/components/VariantCard/index.d.ts +0 -1
- package/lib/plus/walletPassGallery/components/passList/index.d.ts +0 -1
- package/lowcode/eco-cup-list/meta.ts +63 -0
- package/lowcode/eco-customer-list/meta.ts +63 -0
- package/package.json +1 -1
|
@@ -6,7 +6,10 @@ export declare enum EftposEnum {
|
|
|
6
6
|
/** 后端支付 - 支付 + 退款 */
|
|
7
7
|
Windcave = "windcave",
|
|
8
8
|
Stripe = "stripe",
|
|
9
|
-
|
|
9
|
+
/** 后端支付 - 支付 + 退款 */
|
|
10
|
+
Linkly = "linkly",
|
|
11
|
+
/** mx51支付 - 支付 + 退款 */
|
|
12
|
+
MX51 = "mx51"
|
|
10
13
|
}
|
|
11
14
|
export declare enum StatusEnum {
|
|
12
15
|
Loading = "loading",
|
|
@@ -154,6 +157,8 @@ export declare enum PayStatus {
|
|
|
154
157
|
'Unknown' = "701000",
|
|
155
158
|
/** 交易请求超时 */
|
|
156
159
|
'Timeout' = "701001",
|
|
160
|
+
/** 支付失败 */
|
|
161
|
+
'PaymentFailed' = "701002",
|
|
157
162
|
/** 繁忙 EFTPOS终端暂时不可用,因为EFTPOS正在处理另一个请求。 */
|
|
158
163
|
'PayOtherEftposFailed' = "701003",
|
|
159
164
|
/** 购物者没有出示卡片/卡片金额不足/在线拒绝/卡已过期/卡被锁定 */
|
|
@@ -4,6 +4,7 @@ export var EftposEnum = /*#__PURE__*/function (EftposEnum) {
|
|
|
4
4
|
EftposEnum["Windcave"] = "windcave";
|
|
5
5
|
EftposEnum["Stripe"] = "stripe";
|
|
6
6
|
EftposEnum["Linkly"] = "linkly";
|
|
7
|
+
EftposEnum["MX51"] = "mx51";
|
|
7
8
|
return EftposEnum;
|
|
8
9
|
}({});
|
|
9
10
|
export var StatusEnum = /*#__PURE__*/function (StatusEnum) {
|
|
@@ -68,6 +69,7 @@ export var PayStatus = /*#__PURE__*/function (PayStatus) {
|
|
|
68
69
|
PayStatus["PairingFailure"] = "606020";
|
|
69
70
|
PayStatus["Unknown"] = "701000";
|
|
70
71
|
PayStatus["Timeout"] = "701001";
|
|
72
|
+
PayStatus["PaymentFailed"] = "701002";
|
|
71
73
|
PayStatus["PayOtherEftposFailed"] = "701003";
|
|
72
74
|
PayStatus["PayCardErrorFailed"] = "701004";
|
|
73
75
|
PayStatus["NoNetWork"] = "701005";
|
|
@@ -19,7 +19,7 @@ export declare const useStoreRef: <T extends {
|
|
|
19
19
|
readonly netRef: React.MutableRefObject<boolean | undefined>;
|
|
20
20
|
readonly symbolRef: React.MutableRefObject<string>;
|
|
21
21
|
readonly amountRef: React.MutableRefObject<string | number>;
|
|
22
|
-
readonly eftposRef: React.MutableRefObject<"stripe" | "payo" | "tyro" | "windcave" | "linkly">;
|
|
22
|
+
readonly eftposRef: React.MutableRefObject<"stripe" | "payo" | "tyro" | "windcave" | "linkly" | "mx51">;
|
|
23
23
|
readonly clientRef: React.MutableRefObject<ClientEnum>;
|
|
24
24
|
readonly dataRef: React.MutableRefObject<import("./store").State>;
|
|
25
25
|
};
|
|
@@ -32,4 +32,5 @@ export declare const useStoreRef: <T extends {
|
|
|
32
32
|
*/
|
|
33
33
|
export declare const useFail: (index: number) => (res: {
|
|
34
34
|
code?: `${PayStatus}`;
|
|
35
|
+
message?: string;
|
|
35
36
|
}, isMark?: boolean) => void;
|
|
@@ -314,6 +314,18 @@ export var useFail = function useFail(index) {
|
|
|
314
314
|
}));
|
|
315
315
|
return;
|
|
316
316
|
}
|
|
317
|
+
if (code === PayStatus.PaymentFailed) {
|
|
318
|
+
// 前往错误页 不可标记状态
|
|
319
|
+
steps[index].title = locales.getText('page.eftpos-pay.text.transaction.fail');
|
|
320
|
+
steps[index].fail = (res === null || res === void 0 ? void 0 : res.message) || locales.getText('page.eftpos-pay.text.failed')(modeRef.current);
|
|
321
|
+
steps[index].status = 'fail';
|
|
322
|
+
dispatch(updateSteps(steps));
|
|
323
|
+
dispatch(updateComponent('Fail'));
|
|
324
|
+
dispatch(updateCustom({
|
|
325
|
+
errorStatus: 'know' // unknow know
|
|
326
|
+
}));
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
317
329
|
|
|
318
330
|
// 其他场景前往未知错误页
|
|
319
331
|
steps[index].title = locales.getText('page.eftpos-pay.text.failed')(modeRef.current);
|
|
@@ -105,6 +105,7 @@ var Linkly = function Linkly(_ref) {
|
|
|
105
105
|
}, [fail]);
|
|
106
106
|
useEffect(function () {
|
|
107
107
|
var _utils$isTerminal, _utils$interaction;
|
|
108
|
+
console.log('statusRef.current11111', statusRef.current);
|
|
108
109
|
if (statusRef.current === StatusEnum.Success || statusRef.current === StatusEnum.Fail) {
|
|
109
110
|
return;
|
|
110
111
|
}
|
|
@@ -4,4 +4,5 @@ export { default as Payo } from './payo';
|
|
|
4
4
|
export { default as Windcave } from './windcave/windcave';
|
|
5
5
|
export { default as Tyro } from './tyro';
|
|
6
6
|
export { default as Linkly } from './linkly';
|
|
7
|
+
export { default as Mx51 } from './mx51';
|
|
7
8
|
export declare const getInitState: (type: string, params?: any) => State;
|
|
@@ -3,11 +3,13 @@ import getPayoInitState from "./payo/const";
|
|
|
3
3
|
import getTyroInitState from "./tyro/const";
|
|
4
4
|
import getWindcaveInitState from "./windcave/const";
|
|
5
5
|
import getLinklyInitState from "./linkly/const";
|
|
6
|
+
import getMx51InitState from "./mx51/const";
|
|
6
7
|
export { getAmonunt } from "./helper";
|
|
7
8
|
export { default as Payo } from "./payo";
|
|
8
9
|
export { default as Windcave } from "./windcave/windcave";
|
|
9
10
|
export { default as Tyro } from "./tyro";
|
|
10
11
|
export { default as Linkly } from "./linkly";
|
|
12
|
+
export { default as Mx51 } from "./mx51";
|
|
11
13
|
export var getInitState = function getInitState(type, params) {
|
|
12
14
|
switch (type) {
|
|
13
15
|
case EftposEnum.Payo:
|
|
@@ -18,6 +20,8 @@ export var getInitState = function getInitState(type, params) {
|
|
|
18
20
|
return getTyroInitState(params);
|
|
19
21
|
case EftposEnum.Linkly:
|
|
20
22
|
return getLinklyInitState(params);
|
|
23
|
+
case EftposEnum.MX51:
|
|
24
|
+
return getMx51InitState(params);
|
|
21
25
|
default:
|
|
22
26
|
throw new Error('未知的厂商类型');
|
|
23
27
|
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Button, Input } from 'antd';
|
|
3
|
+
/**
|
|
4
|
+
* @title 渲染动态内容
|
|
5
|
+
* @description 用于渲染从接口解析出来的元素
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
var Action = function Action(props) {
|
|
9
|
+
var _data$layouts, _data$layouts2;
|
|
10
|
+
var data = props.data,
|
|
11
|
+
_props$showMessage = props.showMessage,
|
|
12
|
+
showMessage = _props$showMessage === void 0 ? true : _props$showMessage;
|
|
13
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, showMessage && (data === null || data === void 0 ? void 0 : data.message) && /*#__PURE__*/React.createElement("div", {
|
|
14
|
+
className: "pisell-lowcode__eft-pay-step-item pisell-lowcode__eft-pay-step-item-tip"
|
|
15
|
+
}, data === null || data === void 0 ? void 0 : data.message), (data === null || data === void 0 || (_data$layouts = data.layouts) === null || _data$layouts === void 0 ? void 0 : _data$layouts.length) > 0 && (data === null || data === void 0 || (_data$layouts2 = data.layouts) === null || _data$layouts2 === void 0 ? void 0 : _data$layouts2.map(function (item, index) {
|
|
16
|
+
var _item$elements;
|
|
17
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
18
|
+
key: index,
|
|
19
|
+
className: "pisell-lowcode__eft-pay-step-item-btns",
|
|
20
|
+
style: {
|
|
21
|
+
marginTop: '20px',
|
|
22
|
+
width: '100%',
|
|
23
|
+
display: 'flex',
|
|
24
|
+
justifyContent: 'center'
|
|
25
|
+
}
|
|
26
|
+
}, item === null || item === void 0 || (_item$elements = item.elements) === null || _item$elements === void 0 ? void 0 : _item$elements.map(function (element) {
|
|
27
|
+
var key = element.key,
|
|
28
|
+
label = element.label,
|
|
29
|
+
type = element.type,
|
|
30
|
+
text = element.text;
|
|
31
|
+
if (type === 'button') {
|
|
32
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
33
|
+
key: key + label,
|
|
34
|
+
block: true,
|
|
35
|
+
className: "pisell-lowcode__eft-pay-step-item-btn",
|
|
36
|
+
onClick: function onClick() {
|
|
37
|
+
var _props$onClick;
|
|
38
|
+
return props === null || props === void 0 || (_props$onClick = props.onClick) === null || _props$onClick === void 0 ? void 0 : _props$onClick.call(props, element);
|
|
39
|
+
}
|
|
40
|
+
}, element.label);
|
|
41
|
+
} else if (type === 'text') {
|
|
42
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
43
|
+
key: key + label,
|
|
44
|
+
className: "pisell-lowcode__eft-pay-step-item-tip"
|
|
45
|
+
}, label ? "".concat(label, ": ") : '', text || '');
|
|
46
|
+
} else if (type === 'image') {
|
|
47
|
+
var _ref = (element === null || element === void 0 ? void 0 : element.image) || {},
|
|
48
|
+
name = _ref.name,
|
|
49
|
+
_data = _ref.data,
|
|
50
|
+
encoding = _ref.encoding;
|
|
51
|
+
var imageUrl = _data ? "data:".concat(name || 'image/png', ";").concat(encoding || 'base64', ",").concat(_data) : '';
|
|
52
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
53
|
+
style: {
|
|
54
|
+
width: '100%',
|
|
55
|
+
display: 'flex',
|
|
56
|
+
justifyContent: 'center'
|
|
57
|
+
}
|
|
58
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
59
|
+
key: key + label,
|
|
60
|
+
src: imageUrl,
|
|
61
|
+
alt: label
|
|
62
|
+
}));
|
|
63
|
+
} else if (type === 'input') {
|
|
64
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
65
|
+
style: {
|
|
66
|
+
width: '100%',
|
|
67
|
+
display: 'flex',
|
|
68
|
+
alignItems: 'center'
|
|
69
|
+
}
|
|
70
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
71
|
+
style: {
|
|
72
|
+
marginRight: '10px'
|
|
73
|
+
}
|
|
74
|
+
}, "".concat(label ? "".concat(label, " ") : '')), /*#__PURE__*/React.createElement(Input, {
|
|
75
|
+
key: key + label,
|
|
76
|
+
alt: label,
|
|
77
|
+
style: {
|
|
78
|
+
flex: 1
|
|
79
|
+
}
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
82
|
+
return null;
|
|
83
|
+
}));
|
|
84
|
+
})), (data === null || data === void 0 ? void 0 : data.detailsText) && /*#__PURE__*/React.createElement("div", {
|
|
85
|
+
className: "pisell-lowcode__eft-pay-step-item pisell-lowcode__eft-pay-step-item-tip",
|
|
86
|
+
style: {
|
|
87
|
+
marginTop: '24px'
|
|
88
|
+
}
|
|
89
|
+
}, data === null || data === void 0 ? void 0 : data.detailsText));
|
|
90
|
+
};
|
|
91
|
+
export default Action;
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
var _excluded = ["order_id", "name", "symbol", "amount", "mode", "number", "pay", "device", "net", "client"];
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
+
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); }
|
|
8
|
+
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; }
|
|
9
|
+
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; }
|
|
10
|
+
import { locales } from '@pisell/utils';
|
|
11
|
+
import { ClientEnum, EftposEnum, ModeEnum, PayRouteEnum, StatusEnum } from "../const";
|
|
12
|
+
export var getStep = function getStep() {
|
|
13
|
+
var mode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ModeEnum.Pay;
|
|
14
|
+
return [{
|
|
15
|
+
key: Date.now(),
|
|
16
|
+
title: locales.getText('page.eftpos-pay.text.loading')(mode),
|
|
17
|
+
// 'Payment in process...',
|
|
18
|
+
text: locales.getText('page.eftpos-pay.text.waiting.processing'),
|
|
19
|
+
// 'Waiting for the processing...',
|
|
20
|
+
warn: '',
|
|
21
|
+
tip: locales.getText('page.eftpos-pay.text.processing'),
|
|
22
|
+
// 'processing...',
|
|
23
|
+
status: StatusEnum.Loading
|
|
24
|
+
}];
|
|
25
|
+
};
|
|
26
|
+
export default (function (params) {
|
|
27
|
+
var _ref = params || {
|
|
28
|
+
mode: ModeEnum.Pay
|
|
29
|
+
},
|
|
30
|
+
order_id = _ref.order_id,
|
|
31
|
+
name = _ref.name,
|
|
32
|
+
symbol = _ref.symbol,
|
|
33
|
+
amount = _ref.amount,
|
|
34
|
+
mode = _ref.mode,
|
|
35
|
+
number = _ref.number,
|
|
36
|
+
pay = _ref.pay,
|
|
37
|
+
device = _ref.device,
|
|
38
|
+
net = _ref.net,
|
|
39
|
+
client = _ref.client,
|
|
40
|
+
other = _objectWithoutProperties(_ref, _excluded);
|
|
41
|
+
console.log('params =>>>>>> ', params);
|
|
42
|
+
return _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
43
|
+
order_id: order_id,
|
|
44
|
+
name: name,
|
|
45
|
+
symbol: symbol,
|
|
46
|
+
amount: amount,
|
|
47
|
+
mode: mode,
|
|
48
|
+
eftpos: EftposEnum.MX51,
|
|
49
|
+
key: Date.now(),
|
|
50
|
+
step: 0,
|
|
51
|
+
type: PayRouteEnum.Step,
|
|
52
|
+
title: locales.getText('page.eftpos-pay.text.loading')(mode),
|
|
53
|
+
component: '',
|
|
54
|
+
status: StatusEnum.Loading,
|
|
55
|
+
steps: getStep(mode),
|
|
56
|
+
render: true,
|
|
57
|
+
client: client !== 'undefined' ? client : ClientEnum.Merchant,
|
|
58
|
+
warn: '',
|
|
59
|
+
custom: other || {}
|
|
60
|
+
}, typeof net !== 'undefined' ? {
|
|
61
|
+
net: net
|
|
62
|
+
} : {}), typeof number !== 'undefined' ? {
|
|
63
|
+
number: number
|
|
64
|
+
} : {}), typeof pay !== 'undefined' ? {
|
|
65
|
+
pay: pay
|
|
66
|
+
} : {}), typeof device !== 'undefined' ? {
|
|
67
|
+
device: device
|
|
68
|
+
} : {});
|
|
69
|
+
});
|
|
@@ -0,0 +1,362 @@
|
|
|
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
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
|
+
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; }
|
|
11
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
14
|
+
import { locales } from '@pisell/utils';
|
|
15
|
+
import { PisellModal } from '@pisell/materials';
|
|
16
|
+
import useEngineContext from "../../../hooks/useEngineContext";
|
|
17
|
+
import { request } from "../../../utils";
|
|
18
|
+
import { useContextData } from "../store";
|
|
19
|
+
import { StatusEnum } from "../const";
|
|
20
|
+
import { useStoreRef } from "../hooks";
|
|
21
|
+
import { usePayment } from "../aggregatePayment";
|
|
22
|
+
import { EPaymentStatus } from "../aggregatePayment/types";
|
|
23
|
+
import { parseMX51Params } from "./utils";
|
|
24
|
+
import { EButtonKeyType } from "./types";
|
|
25
|
+
import Action from "./Action";
|
|
26
|
+
import { useDispatch, updateStatus, updateCustom, updateState } from "../store";
|
|
27
|
+
import { useFail } from "../hooks";
|
|
28
|
+
import { getInitState } from "../manufacturer";
|
|
29
|
+
import { getPayParams } from "../helper";
|
|
30
|
+
var AggregatePayment = function AggregatePayment(_ref) {
|
|
31
|
+
var onChange = _ref.onChange;
|
|
32
|
+
// 设置request
|
|
33
|
+
var context = useEngineContext();
|
|
34
|
+
var utils = context.appHelper.utils || {};
|
|
35
|
+
request.setRequest(utils === null || utils === void 0 ? void 0 : utils.request);
|
|
36
|
+
|
|
37
|
+
// 数据源
|
|
38
|
+
var _useContextData = useContextData(),
|
|
39
|
+
title = _useContextData.title,
|
|
40
|
+
custom = _useContextData.custom,
|
|
41
|
+
status = _useContextData.status,
|
|
42
|
+
eftpos = _useContextData.eftpos,
|
|
43
|
+
mode = _useContextData.mode,
|
|
44
|
+
name = _useContextData.name,
|
|
45
|
+
symbol = _useContextData.symbol,
|
|
46
|
+
amount = _useContextData.amount,
|
|
47
|
+
order_id = _useContextData.order_id;
|
|
48
|
+
var _useStoreRef = useStoreRef(),
|
|
49
|
+
statusRef = _useStoreRef.statusRef,
|
|
50
|
+
numRef = _useStoreRef.numRef,
|
|
51
|
+
netRef = _useStoreRef.netRef,
|
|
52
|
+
modeRef = _useStoreRef.modeRef,
|
|
53
|
+
deviceRef = _useStoreRef.deviceRef,
|
|
54
|
+
orderIdRef = _useStoreRef.orderIdRef,
|
|
55
|
+
amountRef = _useStoreRef.amountRef,
|
|
56
|
+
payRef = _useStoreRef.payRef;
|
|
57
|
+
var dispatch = useDispatch();
|
|
58
|
+
var fail = useFail(0);
|
|
59
|
+
var failRef = useRef(fail);
|
|
60
|
+
var _useState = useState(false),
|
|
61
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
62
|
+
receiptModalShow = _useState2[0],
|
|
63
|
+
setReceiptModalShow = _useState2[1];
|
|
64
|
+
var _useState3 = useState(null),
|
|
65
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
66
|
+
receiptModalData = _useState4[0],
|
|
67
|
+
setReceiptModalData = _useState4[1];
|
|
68
|
+
useEffect(function () {
|
|
69
|
+
failRef.current = fail;
|
|
70
|
+
}, [fail]);
|
|
71
|
+
|
|
72
|
+
// 当前组件数据
|
|
73
|
+
var initRef = useRef(false);
|
|
74
|
+
var unloadRef = useRef(false);
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* 更新到加载状态
|
|
78
|
+
*/
|
|
79
|
+
var updateToLoading = function updateToLoading() {
|
|
80
|
+
dispatch(updateStatus(StatusEnum.Loading));
|
|
81
|
+
dispatch(updateState({
|
|
82
|
+
title: locales.getText('page.eftpos-pay.text.loading')(modeRef.current)
|
|
83
|
+
}));
|
|
84
|
+
};
|
|
85
|
+
var payment = usePayment({
|
|
86
|
+
paymentCode: 'EFTPOS_MX51',
|
|
87
|
+
paymentNum: numRef.current || '',
|
|
88
|
+
shouldContinue: function shouldContinue() {
|
|
89
|
+
return !(unloadRef.current || !netRef.current);
|
|
90
|
+
},
|
|
91
|
+
config: {
|
|
92
|
+
hasQueryInterval: false // 不开启轮询间隔
|
|
93
|
+
},
|
|
94
|
+
callback: function callback(_instance, response) {
|
|
95
|
+
var _data$data;
|
|
96
|
+
console.log('callback =>>>>>> ', response);
|
|
97
|
+
var _ref2 = response || {},
|
|
98
|
+
status = _ref2.status,
|
|
99
|
+
data = _ref2.data;
|
|
100
|
+
var _ref3 = (data === null || data === void 0 || (_data$data = data.data) === null || _data$data === void 0 ? void 0 : _data$data.external_unified_response) || {},
|
|
101
|
+
transaction = _ref3.transaction,
|
|
102
|
+
action = _ref3.action;
|
|
103
|
+
var transformedData = parseMX51Params(transaction, status, data);
|
|
104
|
+
console.log('event_transformedData =>>>>>> ', transformedData);
|
|
105
|
+
dispatch(updateCustom({
|
|
106
|
+
customAction: transformedData
|
|
107
|
+
}));
|
|
108
|
+
if (status === EPaymentStatus.Processing) {
|
|
109
|
+
if (action === 'signature') {
|
|
110
|
+
var _transformedData$auto;
|
|
111
|
+
// 签名,需要停止轮询
|
|
112
|
+
dispatch(updateStatus(StatusEnum.Question));
|
|
113
|
+
// 更新标题
|
|
114
|
+
dispatch(updateState({
|
|
115
|
+
title: (transformedData === null || transformedData === void 0 ? void 0 : transformedData.message) || ''
|
|
116
|
+
}));
|
|
117
|
+
_instance.stop();
|
|
118
|
+
// 如果存在签名票自动打印,需要触发打印
|
|
119
|
+
if (transformedData !== null && transformedData !== void 0 && (_transformedData$auto = transformedData.autoAction) !== null && _transformedData$auto !== void 0 && _transformedData$auto.includes('PRINT_MERCHANT_RECEIPT')) {
|
|
120
|
+
var merchantReceipt = (transformedData === null || transformedData === void 0 ? void 0 : transformedData.merchantReceipt) || '';
|
|
121
|
+
onChange('print', merchantReceipt ? [merchantReceipt] : []);
|
|
122
|
+
}
|
|
123
|
+
} else {
|
|
124
|
+
updateToLoading();
|
|
125
|
+
}
|
|
126
|
+
} else if (status === EPaymentStatus.Success) {
|
|
127
|
+
dispatch(updateStatus('success'));
|
|
128
|
+
dispatch(updateState({
|
|
129
|
+
title: (transformedData === null || transformedData === void 0 ? void 0 : transformedData.message) || ''
|
|
130
|
+
}));
|
|
131
|
+
} else if (status === EPaymentStatus.Failed) {
|
|
132
|
+
// 失败分为两种情况:MX51返回失败信息 和 后端返回失败信息
|
|
133
|
+
if (transformedData) {
|
|
134
|
+
// 渲染需要走自定义
|
|
135
|
+
dispatch(updateStatus('fail'));
|
|
136
|
+
dispatch(updateState({
|
|
137
|
+
title: (transformedData === null || transformedData === void 0 ? void 0 : transformedData.message) || ''
|
|
138
|
+
}));
|
|
139
|
+
} else {
|
|
140
|
+
var _failRef$current;
|
|
141
|
+
(_failRef$current = failRef.current) === null || _failRef$current === void 0 || _failRef$current.call(failRef, data, false);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
// 页面初始化处理
|
|
148
|
+
useEffect(function () {
|
|
149
|
+
// 支付检测
|
|
150
|
+
console.log('mx51页面初始化', statusRef.current);
|
|
151
|
+
if (statusRef.current === StatusEnum.Success || statusRef.current === StatusEnum.Fail || statusRef.current === StatusEnum.Question) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (initRef.current) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
initRef.current = true;
|
|
158
|
+
|
|
159
|
+
// 存在支付流水号
|
|
160
|
+
if (numRef.current) {
|
|
161
|
+
console.log('payment.query');
|
|
162
|
+
payment.query();
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
payment.run();
|
|
166
|
+
}, []);
|
|
167
|
+
|
|
168
|
+
// 页面卸载处理
|
|
169
|
+
useEffect(function () {
|
|
170
|
+
return function () {
|
|
171
|
+
console.log('页面卸载');
|
|
172
|
+
unloadRef.current = true;
|
|
173
|
+
};
|
|
174
|
+
}, []);
|
|
175
|
+
|
|
176
|
+
// 取消支付
|
|
177
|
+
var onCancel = function onCancel(element) {
|
|
178
|
+
console.log('onCancel', element);
|
|
179
|
+
payment.action({
|
|
180
|
+
submit_url: element === null || element === void 0 ? void 0 : element.submitUrl
|
|
181
|
+
});
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
// 拒绝签名
|
|
185
|
+
var onDecline = function onDecline(element) {
|
|
186
|
+
console.log('onDecline', element);
|
|
187
|
+
updateToLoading();
|
|
188
|
+
payment.action({
|
|
189
|
+
submit_url: element === null || element === void 0 ? void 0 : element.submitUrl
|
|
190
|
+
});
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
// 接受签名
|
|
194
|
+
var onAccept = function onAccept(element) {
|
|
195
|
+
console.log('onAccept', element);
|
|
196
|
+
updateToLoading();
|
|
197
|
+
payment.action({
|
|
198
|
+
submit_url: element === null || element === void 0 ? void 0 : element.submitUrl
|
|
199
|
+
});
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
// 打印商户收据
|
|
203
|
+
var onPrintMerchantReceipt = function onPrintMerchantReceipt(element) {
|
|
204
|
+
console.log('onPrintMerchantReceipt', element);
|
|
205
|
+
onChange('print', element !== null && element !== void 0 && element.receipt ? [element === null || element === void 0 ? void 0 : element.receipt] : []);
|
|
206
|
+
setReceiptModalShow(true);
|
|
207
|
+
setReceiptModalData(element === null || element === void 0 ? void 0 : element.receipt);
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
// 打印客户收据
|
|
211
|
+
var onPrintCustomerReceipt = function onPrintCustomerReceipt(element) {
|
|
212
|
+
console.log('onPrintCustomerReceipt', element);
|
|
213
|
+
onChange('print', element !== null && element !== void 0 && element.receipt ? [element === null || element === void 0 ? void 0 : element.receipt] : []);
|
|
214
|
+
setReceiptModalShow(true);
|
|
215
|
+
setReceiptModalData(element === null || element === void 0 ? void 0 : element.receipt);
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
// 重试交易
|
|
219
|
+
var onRetry = function onRetry(element) {
|
|
220
|
+
console.log('onRetry', element);
|
|
221
|
+
onChange('page', 'pay');
|
|
222
|
+
var _params = _objectSpread(_objectSpread({}, custom || {}), {}, {
|
|
223
|
+
// 自定义参数需要重新传递
|
|
224
|
+
mode: mode,
|
|
225
|
+
name: name,
|
|
226
|
+
symbol: symbol,
|
|
227
|
+
amount: amount,
|
|
228
|
+
order_id: order_id,
|
|
229
|
+
number: ''
|
|
230
|
+
});
|
|
231
|
+
dispatch(updateState(getInitState(eftpos, _params)));
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
// 交易完成
|
|
235
|
+
var onTransactionComplete = function onTransactionComplete(element) {
|
|
236
|
+
console.log('onTransactionComplete', element);
|
|
237
|
+
var _ref4 = element._extra || {},
|
|
238
|
+
paymentStatus = _ref4.paymentStatus,
|
|
239
|
+
response = _ref4.response,
|
|
240
|
+
merchantReceipt = _ref4.merchantReceipt,
|
|
241
|
+
customerReceipt = _ref4.customerReceipt;
|
|
242
|
+
if (paymentStatus === EPaymentStatus.Success) {
|
|
243
|
+
var _response$data, _deviceRef$current;
|
|
244
|
+
var receipt = [];
|
|
245
|
+
// 刷卡机的手续费
|
|
246
|
+
var card_reader_surcharge = (response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 || (_response$data = _response$data.external_unified_response) === null || _response$data === void 0 ? void 0 : _response$data.external_service_fee) || 0;
|
|
247
|
+
var deviceSetting = (_deviceRef$current = deviceRef.current) === null || _deviceRef$current === void 0 ? void 0 : _deviceRef$current.setting;
|
|
248
|
+
// 设备是否打印商家小票
|
|
249
|
+
var isEftposPrintMerchantReceipt = deviceSetting === null || deviceSetting === void 0 ? void 0 : deviceSetting.print_merchant_receipt;
|
|
250
|
+
// 设备是否打印客户小票
|
|
251
|
+
var isEftposPrintCustomerReceipt = deviceSetting === null || deviceSetting === void 0 ? void 0 : deviceSetting.prompt_customer_receipt;
|
|
252
|
+
if (!isEftposPrintMerchantReceipt && merchantReceipt) {
|
|
253
|
+
receipt.push(merchantReceipt);
|
|
254
|
+
}
|
|
255
|
+
if (!isEftposPrintCustomerReceipt && customerReceipt) {
|
|
256
|
+
receipt.push(customerReceipt);
|
|
257
|
+
}
|
|
258
|
+
var _params2 = getPayParams({
|
|
259
|
+
mode: modeRef.current,
|
|
260
|
+
amount: amountRef.current,
|
|
261
|
+
order_id: orderIdRef.current,
|
|
262
|
+
number: numRef.current,
|
|
263
|
+
device: deviceRef.current,
|
|
264
|
+
pay: payRef.current,
|
|
265
|
+
custom: {
|
|
266
|
+
card_reader_surcharge: card_reader_surcharge,
|
|
267
|
+
receipt: receipt
|
|
268
|
+
}
|
|
269
|
+
}, 'success');
|
|
270
|
+
onChange('success', _objectSpread(_objectSpread({}, _params2), {}, {
|
|
271
|
+
receipt: receipt
|
|
272
|
+
}));
|
|
273
|
+
} else {
|
|
274
|
+
onChange('fail', {
|
|
275
|
+
order_id: orderIdRef.current,
|
|
276
|
+
number: numRef.current,
|
|
277
|
+
uniquePaymentNumber: numRef.current,
|
|
278
|
+
device: deviceRef.current
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
var onNormalClick = function onNormalClick(element) {
|
|
283
|
+
// 如果存在submit_url,则提交到API
|
|
284
|
+
if (element !== null && element !== void 0 && element.submitUrl) {
|
|
285
|
+
console.log('onNormalClick_submit_url', element === null || element === void 0 ? void 0 : element.submitUrl);
|
|
286
|
+
updateToLoading();
|
|
287
|
+
payment.action({
|
|
288
|
+
submit_url: element === null || element === void 0 ? void 0 : element.submitUrl
|
|
289
|
+
});
|
|
290
|
+
} else {
|
|
291
|
+
console.log('onNormalClick_no_submit_url', element);
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
// 点击元素
|
|
296
|
+
var onElementClick = function onElementClick(element) {
|
|
297
|
+
console.log('onElementClick', element);
|
|
298
|
+
switch (element.key) {
|
|
299
|
+
case EButtonKeyType.CancelTransaction:
|
|
300
|
+
onCancel(element);
|
|
301
|
+
break;
|
|
302
|
+
case EButtonKeyType.DeclineSignature:
|
|
303
|
+
onDecline(element);
|
|
304
|
+
break;
|
|
305
|
+
case EButtonKeyType.ApproveSignature:
|
|
306
|
+
onAccept(element);
|
|
307
|
+
break;
|
|
308
|
+
case EButtonKeyType.PrintMerchantReceipt:
|
|
309
|
+
onPrintMerchantReceipt(element);
|
|
310
|
+
break;
|
|
311
|
+
case EButtonKeyType.PrintCustomerReceipt:
|
|
312
|
+
onPrintCustomerReceipt(element);
|
|
313
|
+
break;
|
|
314
|
+
case EButtonKeyType.RetryTransaction:
|
|
315
|
+
onRetry(element);
|
|
316
|
+
break;
|
|
317
|
+
case EButtonKeyType.TransactionComplete:
|
|
318
|
+
onTransactionComplete(element);
|
|
319
|
+
break;
|
|
320
|
+
default:
|
|
321
|
+
onNormalClick(element);
|
|
322
|
+
break;
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
console.log('custom>>>>', custom);
|
|
326
|
+
var onCloseReceiptModal = function onCloseReceiptModal() {
|
|
327
|
+
setReceiptModalShow(false);
|
|
328
|
+
setReceiptModalData(null);
|
|
329
|
+
};
|
|
330
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
331
|
+
className: "pisell-lowcode__eft-pay-body"
|
|
332
|
+
}, status === StatusEnum.Question ? /*#__PURE__*/React.createElement("div", {
|
|
333
|
+
className: "pisell-lowcode__eft-pay-title",
|
|
334
|
+
style: {
|
|
335
|
+
textAlign: 'center'
|
|
336
|
+
}
|
|
337
|
+
}, title) : null, /*#__PURE__*/React.createElement(Action, {
|
|
338
|
+
data: custom === null || custom === void 0 ? void 0 : custom.customAction,
|
|
339
|
+
showMessage: status === StatusEnum.Loading,
|
|
340
|
+
onClick: onElementClick
|
|
341
|
+
})), receiptModalShow ? /*#__PURE__*/React.createElement(PisellModal, {
|
|
342
|
+
open: receiptModalShow,
|
|
343
|
+
onCancel: onCloseReceiptModal,
|
|
344
|
+
maskClosable: true,
|
|
345
|
+
footer: null
|
|
346
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
347
|
+
style: {
|
|
348
|
+
padding: '16px',
|
|
349
|
+
display: 'flex',
|
|
350
|
+
alignItems: 'center',
|
|
351
|
+
justifyContent: 'center'
|
|
352
|
+
}
|
|
353
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
354
|
+
style: {
|
|
355
|
+
display: 'inline-block',
|
|
356
|
+
whiteSpace: 'pre-wrap',
|
|
357
|
+
fontFamily: 'monospace',
|
|
358
|
+
backgroundColor: '#fff'
|
|
359
|
+
}
|
|
360
|
+
}, receiptModalData))) : null);
|
|
361
|
+
};
|
|
362
|
+
export default AggregatePayment;
|