@pisell/private-materials 6.8.83 → 6.8.84
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 +10 -10
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +9 -9
- package/es/components/booking/components/footer/index.d.ts +1 -0
- package/es/components/booking/info/index.d.ts +1 -0
- package/es/components/checkout/PaymentModal.js +4 -2
- package/es/components/checkout/components/PaymentOptionsModule/index.js +1 -1
- package/es/components/eftposPay/aggregatePayment/hooks/useMicropay.d.ts +7 -0
- package/es/components/eftposPay/aggregatePayment/hooks/useMicropay.js +120 -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/service.d.ts +24 -0
- package/es/components/eftposPay/aggregatePayment/service.js +69 -0
- package/es/components/eftposPay/aggregatePayment/types.d.ts +106 -0
- package/es/components/eftposPay/aggregatePayment/types.js +65 -0
- package/es/components/eftposPay/aggregatePayment/utils/logs.d.ts +110 -0
- package/es/components/eftposPay/aggregatePayment/utils/logs.js +371 -0
- package/es/components/eftposPay/aggregatePayment/utils/payment.d.ts +139 -0
- package/es/components/eftposPay/aggregatePayment/utils/payment.js +1138 -0
- package/es/components/eftposPay/amount.d.ts +1 -1
- package/es/components/eftposPay/app.d.ts +1 -1
- package/es/components/eftposPay/app.js +5 -0
- package/es/components/eftposPay/component/fail/failCustom.js +16 -12
- package/es/components/eftposPay/component/fail/index.js +12 -5
- package/es/components/eftposPay/const.d.ts +6 -1
- package/es/components/eftposPay/const.js +3 -0
- package/es/components/eftposPay/device.d.ts +1 -1
- package/es/components/eftposPay/hooks.d.ts +3 -2
- package/es/components/eftposPay/hooks.js +12 -0
- package/es/components/eftposPay/huifu/Action.d.ts +8 -0
- package/es/components/eftposPay/huifu/Action.js +146 -0
- package/es/components/eftposPay/huifu/const.d.ts +5 -0
- package/es/components/eftposPay/huifu/const.js +70 -0
- package/es/components/eftposPay/huifu/hooks.d.ts +25 -0
- package/es/components/eftposPay/huifu/hooks.js +184 -0
- package/es/components/eftposPay/huifu/index.d.ts +5 -0
- package/es/components/eftposPay/huifu/index.js +196 -0
- package/es/components/eftposPay/huifu/index.less +180 -0
- package/es/components/eftposPay/huifu/types.d.ts +14 -0
- package/es/components/eftposPay/huifu/types.js +1 -0
- package/es/components/eftposPay/index.js +5 -1
- package/es/components/eftposPay/locales.d.ts +36 -0
- package/es/components/eftposPay/locales.js +42 -3
- package/es/components/eftposPay/manufacturer.d.ts +1 -0
- package/es/components/eftposPay/manufacturer.js +5 -0
- package/es/components/eftposPay/pay.js +6 -2
- package/es/components/eftposPay/store/index.d.ts +11 -4
- package/es/components/kioskSkuDetail/index.d.ts +3 -0
- package/es/components/kioskSkuDetail/index.js +266 -173
- package/es/components/kioskSkuDetail/index.less +49 -7
- package/es/components/kioskSkuDetail/locales.d.ts +6 -0
- package/es/components/kioskSkuDetail/locales.js +9 -3
- package/es/components/pay/toB/components/Cache/index.d.ts +1 -0
- package/es/components/pay/toB/components/EFTPOS/index.js +8 -1
- package/es/components/pay/toB/types/index.d.ts +1 -0
- package/es/components/pay/toC/PaymentList/serve.js +14 -0
- package/es/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +7 -6
- package/es/components/ticketBooking/components/ticketBooking/index.d.ts +1 -0
- package/es/components/ticketBooking/index.d.ts +16 -0
- package/es/plus/skuOptionsSelection/components/VariantCard/index.js +1 -1
- package/es/plus/skuOptionsSelection/locales.d.ts +3 -0
- package/es/plus/skuOptionsSelection/locales.js +3 -0
- package/es/pro/Login2.0/components/LoginCodeInput.js +36 -3
- package/es/pro/Login2.0/steps/CodeInput.js +37 -7
- package/lib/components/booking/components/footer/index.d.ts +1 -0
- package/lib/components/booking/info/index.d.ts +1 -0
- package/lib/components/checkout/PaymentModal.js +5 -2
- package/lib/components/checkout/components/PaymentOptionsModule/index.js +2 -1
- package/lib/components/eftposPay/aggregatePayment/hooks/useMicropay.d.ts +7 -0
- package/lib/components/eftposPay/aggregatePayment/hooks/useMicropay.js +133 -0
- package/lib/components/eftposPay/aggregatePayment/index.d.ts +3 -0
- package/lib/components/eftposPay/aggregatePayment/index.js +42 -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 +106 -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 +294 -0
- package/lib/components/eftposPay/aggregatePayment/utils/payment.d.ts +139 -0
- package/lib/components/eftposPay/aggregatePayment/utils/payment.js +752 -0
- package/lib/components/eftposPay/amount.d.ts +1 -1
- package/lib/components/eftposPay/app.d.ts +1 -1
- package/lib/components/eftposPay/app.js +5 -0
- package/lib/components/eftposPay/component/fail/failCustom.js +15 -9
- package/lib/components/eftposPay/component/fail/index.js +4 -1
- package/lib/components/eftposPay/const.d.ts +6 -1
- package/lib/components/eftposPay/const.js +3 -0
- package/lib/components/eftposPay/device.d.ts +1 -1
- package/lib/components/eftposPay/hooks.d.ts +3 -2
- package/lib/components/eftposPay/hooks.js +16 -0
- package/lib/components/eftposPay/huifu/Action.d.ts +8 -0
- package/lib/components/eftposPay/huifu/Action.js +174 -0
- package/lib/components/eftposPay/huifu/const.d.ts +5 -0
- package/lib/components/eftposPay/huifu/const.js +86 -0
- package/lib/components/eftposPay/huifu/hooks.d.ts +25 -0
- package/lib/components/eftposPay/huifu/hooks.js +186 -0
- package/lib/components/eftposPay/huifu/index.d.ts +5 -0
- package/lib/components/eftposPay/huifu/index.js +200 -0
- package/lib/components/eftposPay/huifu/index.less +180 -0
- package/lib/components/eftposPay/huifu/types.d.ts +14 -0
- package/lib/components/eftposPay/huifu/types.js +17 -0
- package/lib/components/eftposPay/index.js +5 -1
- package/lib/components/eftposPay/locales.d.ts +36 -0
- package/lib/components/eftposPay/locales.js +42 -3
- package/lib/components/eftposPay/manufacturer.d.ts +1 -0
- package/lib/components/eftposPay/manufacturer.js +7 -0
- package/lib/components/eftposPay/pay.js +3 -2
- package/lib/components/eftposPay/store/index.d.ts +11 -4
- package/lib/components/kioskSkuDetail/index.d.ts +3 -0
- package/lib/components/kioskSkuDetail/index.js +180 -113
- package/lib/components/kioskSkuDetail/index.less +49 -7
- package/lib/components/kioskSkuDetail/locales.d.ts +6 -0
- package/lib/components/kioskSkuDetail/locales.js +9 -3
- package/lib/components/pay/toB/components/Cache/index.d.ts +1 -0
- package/lib/components/pay/toB/components/EFTPOS/index.js +8 -1
- package/lib/components/pay/toB/types/index.d.ts +1 -0
- package/lib/components/pay/toC/PaymentList/serve.js +15 -0
- package/lib/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +7 -6
- package/lib/components/ticketBooking/components/ticketBooking/index.d.ts +1 -0
- package/lib/components/ticketBooking/index.d.ts +16 -0
- package/lib/plus/skuOptionsSelection/components/VariantCard/index.js +2 -0
- package/lib/plus/skuOptionsSelection/locales.d.ts +3 -0
- package/lib/plus/skuOptionsSelection/locales.js +3 -0
- package/lib/pro/Login2.0/components/LoginCodeInput.js +26 -4
- package/lib/pro/Login2.0/steps/CodeInput.js +27 -5
- package/lowcode/kiosk-sku-detail/meta.ts +229 -94
- package/package.json +1 -1
|
@@ -295,7 +295,7 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
295
295
|
case 2:
|
|
296
296
|
_ref4 = method || {}, id = _ref4.id, code = _ref4.code, name = _ref4.name, type = _ref4.type;
|
|
297
297
|
finalAmount = (_method$totalAmount = method.totalAmount) !== null && _method$totalAmount !== void 0 ? _method$totalAmount : customAmount; // 这里需要根据支付方式来判断是 eftpos 还是 mx51
|
|
298
|
-
eftposCodes = ['EFTPOS_LINKLY', 'EFTPOS_PAYO', 'EFTPOS_WINDCAVE', 'EFTPOS_TYRO'];
|
|
298
|
+
eftposCodes = ['EFTPOS_LINKLY', 'EFTPOS_PAYO', 'EFTPOS_WINDCAVE', 'EFTPOS_TYRO', 'EFTPOS_HUIFU'];
|
|
299
299
|
mx51Code = 'EFTPOS';
|
|
300
300
|
payType = '';
|
|
301
301
|
if (eftposCodes.includes((method === null || method === void 0 ? void 0 : method.code) || '')) {
|
|
@@ -415,7 +415,9 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
415
415
|
orderId: data.orderId,
|
|
416
416
|
symbol: getData('shop_symbol'),
|
|
417
417
|
amount: finalAmount,
|
|
418
|
-
surcharge: processSurcharge(method.surcharge)
|
|
418
|
+
surcharge: processSurcharge(method.surcharge),
|
|
419
|
+
operator_type: 'shop',
|
|
420
|
+
platform: 'pos'
|
|
419
421
|
},
|
|
420
422
|
mode: 'pay'
|
|
421
423
|
},
|
|
@@ -10,7 +10,7 @@ import checkoutLocales from "../../locales";
|
|
|
10
10
|
|
|
11
11
|
// 扩展 PaymentOptionsModule Props 接口
|
|
12
12
|
|
|
13
|
-
export var SHOW_METHODS_CODE = ['EFTPOS_LINKLY', 'EFTPOS', 'EFTPOS_TYRO', 'EFTPOS_WINDCAVE', 'EFTPOS_PAYO'];
|
|
13
|
+
export var SHOW_METHODS_CODE = ['EFTPOS_LINKLY', 'EFTPOS', 'EFTPOS_TYRO', 'EFTPOS_WINDCAVE', 'EFTPOS_PAYO', 'EFTPOS_HUIFU'];
|
|
14
14
|
function PaymentOptionsModule(_ref) {
|
|
15
15
|
var _context$appHelper, _context$appHelper$ge, _context$appHelper$ge2, _context$appHelper$ut;
|
|
16
16
|
var amountSymbol = _ref.amountSymbol,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { HooksRunParams, PaymentMethodOptions } from '../types';
|
|
2
|
+
declare const useMicropay: (options: PaymentMethodOptions) => {
|
|
3
|
+
run: (runParams?: HooksRunParams) => void;
|
|
4
|
+
query: () => void;
|
|
5
|
+
action: (data: Record<string, any>) => void;
|
|
6
|
+
};
|
|
7
|
+
export default useMicropay;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
import PaymentMethod from "../utils/payment";
|
|
3
|
+
import { ModeEnum } from "../../const";
|
|
4
|
+
import { useStoreRef } from "../../hooks";
|
|
5
|
+
import { getUuid } from "../../helper";
|
|
6
|
+
import { useDispatch, updateState } from "../../store";
|
|
7
|
+
import { useContextData } from "../../store";
|
|
8
|
+
var useMicropay = function useMicropay(options) {
|
|
9
|
+
var _useContextData = useContextData(),
|
|
10
|
+
custom = _useContextData.custom;
|
|
11
|
+
var _useStoreRef = useStoreRef(),
|
|
12
|
+
modeRef = _useStoreRef.modeRef,
|
|
13
|
+
payRef = _useStoreRef.payRef,
|
|
14
|
+
orderIdRef = _useStoreRef.orderIdRef,
|
|
15
|
+
eftposRef = _useStoreRef.eftposRef,
|
|
16
|
+
deviceRef = _useStoreRef.deviceRef,
|
|
17
|
+
amountRef = _useStoreRef.amountRef;
|
|
18
|
+
var paymentMethodRef = useRef(null);
|
|
19
|
+
var dispatch = useDispatch();
|
|
20
|
+
var uniquePaymentNumberRef = useRef(null);
|
|
21
|
+
var isPay = modeRef.current === ModeEnum.Pay || modeRef.current === ModeEnum.FullPay;
|
|
22
|
+
useEffect(function () {
|
|
23
|
+
if (!paymentMethodRef.current) {
|
|
24
|
+
var _deviceRef$current;
|
|
25
|
+
// 如果不存在交易号需要先创建一个交易号
|
|
26
|
+
if (!options.paymentNum) {
|
|
27
|
+
var paymentNum = getUuid();
|
|
28
|
+
dispatch(updateState({
|
|
29
|
+
number: paymentNum
|
|
30
|
+
}));
|
|
31
|
+
options.paymentNum = paymentNum;
|
|
32
|
+
uniquePaymentNumberRef.current = paymentNum;
|
|
33
|
+
} else {
|
|
34
|
+
uniquePaymentNumberRef.current = options.paymentNum;
|
|
35
|
+
}
|
|
36
|
+
options.orderId = orderIdRef.current;
|
|
37
|
+
options.deviceId = (_deviceRef$current = deviceRef.current) === null || _deviceRef$current === void 0 ? void 0 : _deviceRef$current.id;
|
|
38
|
+
paymentMethodRef.current = new PaymentMethod(options);
|
|
39
|
+
}
|
|
40
|
+
return function () {
|
|
41
|
+
var _paymentMethodRef$cur, _paymentMethodRef$cur2;
|
|
42
|
+
// 卸载组件时,如果paymentMethodRef存在需要先执行销毁,再清空
|
|
43
|
+
(_paymentMethodRef$cur = paymentMethodRef.current) === null || _paymentMethodRef$cur === void 0 || (_paymentMethodRef$cur2 = _paymentMethodRef$cur.destroy) === null || _paymentMethodRef$cur2 === void 0 || _paymentMethodRef$cur2.call(_paymentMethodRef$cur);
|
|
44
|
+
paymentMethodRef.current = null;
|
|
45
|
+
};
|
|
46
|
+
}, []);
|
|
47
|
+
var run = function run(runParams) {
|
|
48
|
+
var _payRef$current, _deviceRef$current2;
|
|
49
|
+
var params = {
|
|
50
|
+
order_id: orderIdRef.current,
|
|
51
|
+
unique_payment_number: uniquePaymentNumberRef.current,
|
|
52
|
+
payment_code: options.paymentCode,
|
|
53
|
+
amount: isPay ? (_payRef$current = payRef.current) === null || _payRef$current === void 0 ? void 0 : _payRef$current.total : amountRef.current,
|
|
54
|
+
operator_id: custom === null || custom === void 0 ? void 0 : custom.operator_id,
|
|
55
|
+
operator_type: custom === null || custom === void 0 ? void 0 : custom.operator_type,
|
|
56
|
+
platform: custom === null || custom === void 0 ? void 0 : custom.platform,
|
|
57
|
+
micropay: {
|
|
58
|
+
card_reader_type: eftposRef.current,
|
|
59
|
+
card_reader_id: (_deviceRef$current2 = deviceRef.current) === null || _deviceRef$current2 === void 0 ? void 0 : _deviceRef$current2.id
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
if (isPay) {
|
|
63
|
+
var _payRef$current2, _payRef$current3, _payRef$current4, _paymentMethodRef$cur3;
|
|
64
|
+
params.payment = {
|
|
65
|
+
original_amount: (_payRef$current2 = payRef.current) === null || _payRef$current2 === void 0 ? void 0 : _payRef$current2.amount,
|
|
66
|
+
order_payment_type: 'normal',
|
|
67
|
+
// TODO: 需要使用方提供
|
|
68
|
+
custom_payment_id: custom === null || custom === void 0 ? void 0 : custom.custom_payment_id,
|
|
69
|
+
custom_payment_code: custom === null || custom === void 0 ? void 0 : custom.custom_payment_code,
|
|
70
|
+
custom_payment_name: custom === null || custom === void 0 ? void 0 : custom.custom_payment_name,
|
|
71
|
+
custom_payment_type: custom === null || custom === void 0 ? void 0 : custom.custom_payment_type,
|
|
72
|
+
service_charge: {
|
|
73
|
+
amount: (_payRef$current3 = payRef.current) === null || _payRef$current3 === void 0 ? void 0 : _payRef$current3.surMoney,
|
|
74
|
+
percentage: (_payRef$current4 = payRef.current) === null || _payRef$current4 === void 0 ? void 0 : _payRef$current4.surPercentRate
|
|
75
|
+
},
|
|
76
|
+
metadata: {
|
|
77
|
+
unique_payment_number: uniquePaymentNumberRef.current
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
// 支付场景需要传付款码
|
|
81
|
+
params.micropay.auth_code = (runParams === null || runParams === void 0 ? void 0 : runParams.authCode) || '';
|
|
82
|
+
(_paymentMethodRef$cur3 = paymentMethodRef.current) === null || _paymentMethodRef$cur3 === void 0 || _paymentMethodRef$cur3.pay(params);
|
|
83
|
+
} else {
|
|
84
|
+
var _paymentMethodRef$cur4;
|
|
85
|
+
// 退款场景需要传 order_payment_id
|
|
86
|
+
params.micropay.order_payment_id = (runParams === null || runParams === void 0 ? void 0 : runParams.orderPaymentId) || '';
|
|
87
|
+
(_paymentMethodRef$cur4 = paymentMethodRef.current) === null || _paymentMethodRef$cur4 === void 0 || _paymentMethodRef$cur4.refund(params);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
var query = function query() {
|
|
91
|
+
if (isPay) {
|
|
92
|
+
var _paymentMethodRef$cur5;
|
|
93
|
+
(_paymentMethodRef$cur5 = paymentMethodRef.current) === null || _paymentMethodRef$cur5 === void 0 || _paymentMethodRef$cur5.payQuery();
|
|
94
|
+
} else {
|
|
95
|
+
var _paymentMethodRef$cur6;
|
|
96
|
+
(_paymentMethodRef$cur6 = paymentMethodRef.current) === null || _paymentMethodRef$cur6 === void 0 || _paymentMethodRef$cur6.refundQuery();
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
var action = function action(data) {
|
|
100
|
+
var params = {
|
|
101
|
+
order_id: orderIdRef.current,
|
|
102
|
+
unique_payment_number: uniquePaymentNumberRef.current,
|
|
103
|
+
payment_code: options.paymentCode,
|
|
104
|
+
data: data
|
|
105
|
+
};
|
|
106
|
+
if (isPay) {
|
|
107
|
+
var _paymentMethodRef$cur7;
|
|
108
|
+
(_paymentMethodRef$cur7 = paymentMethodRef.current) === null || _paymentMethodRef$cur7 === void 0 || _paymentMethodRef$cur7.payAction(params);
|
|
109
|
+
} else {
|
|
110
|
+
var _paymentMethodRef$cur8;
|
|
111
|
+
(_paymentMethodRef$cur8 = paymentMethodRef.current) === null || _paymentMethodRef$cur8 === void 0 || _paymentMethodRef$cur8.refundAction(params);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
return {
|
|
115
|
+
run: run,
|
|
116
|
+
query: query,
|
|
117
|
+
action: action
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
export default useMicropay;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 聚合支付-支付接口
|
|
3
|
+
*/
|
|
4
|
+
export declare const AGPTPayApi: (data: any, config: any) => Promise<any>;
|
|
5
|
+
/**
|
|
6
|
+
* 聚合支付-支付-查询接口
|
|
7
|
+
*/
|
|
8
|
+
export declare const AGPTQueryApi: (param: any, config: any) => Promise<any>;
|
|
9
|
+
/**
|
|
10
|
+
* 聚合支付-支付-支付行为接口
|
|
11
|
+
*/
|
|
12
|
+
export declare const AGPTActionApi: (param: any, config: any) => Promise<any>;
|
|
13
|
+
/**
|
|
14
|
+
* 聚合支付-退款接口
|
|
15
|
+
*/
|
|
16
|
+
export declare const AGPTRefundApi: (data: any, config: any) => Promise<any>;
|
|
17
|
+
/**
|
|
18
|
+
* 聚合支付-退款-查询接口
|
|
19
|
+
*/
|
|
20
|
+
export declare const AGPTRefundQueryApi: (param: any, config: any) => Promise<any>;
|
|
21
|
+
/**
|
|
22
|
+
* 聚合支付-退款-支付行为接口
|
|
23
|
+
*/
|
|
24
|
+
export declare const AGPTRefundActionApi: (param: any, config: any) => Promise<any>;
|
|
@@ -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
|
+
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 { request } from "../../../utils";
|
|
8
|
+
|
|
9
|
+
///////////////// 支付相关接口 /////////////////
|
|
10
|
+
/**
|
|
11
|
+
* 聚合支付-支付接口
|
|
12
|
+
*/
|
|
13
|
+
export var AGPTPayApi = function AGPTPayApi(data, config) {
|
|
14
|
+
return request.getRequest().post('/shop/pay/external-unified/pay', data, _objectSpread(_objectSpread({}, config || {}), {}, {
|
|
15
|
+
customMessage: true,
|
|
16
|
+
fullResult: true
|
|
17
|
+
}));
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 聚合支付-支付-查询接口
|
|
22
|
+
*/
|
|
23
|
+
export var AGPTQueryApi = function AGPTQueryApi(param, config) {
|
|
24
|
+
return request.getRequest().post('/shop/pay/external-unified/pay/verify', param, _objectSpread(_objectSpread({}, config || {}), {}, {
|
|
25
|
+
customMessage: true,
|
|
26
|
+
fullResult: true
|
|
27
|
+
}));
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 聚合支付-支付-支付行为接口
|
|
32
|
+
*/
|
|
33
|
+
export var AGPTActionApi = function AGPTActionApi(param, config) {
|
|
34
|
+
return request.getRequest().post('/shop/pay/external-unified/pay/action', param, _objectSpread(_objectSpread({}, config || {}), {}, {
|
|
35
|
+
customMessage: true,
|
|
36
|
+
fullResult: true
|
|
37
|
+
}));
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
///////////////// 退款相关接口 /////////////////
|
|
41
|
+
/**
|
|
42
|
+
* 聚合支付-退款接口
|
|
43
|
+
*/
|
|
44
|
+
export var AGPTRefundApi = function AGPTRefundApi(data, config) {
|
|
45
|
+
return request.getRequest().post('/shop/pay/external-unified/refund', data, _objectSpread(_objectSpread({}, config || {}), {}, {
|
|
46
|
+
customMessage: true,
|
|
47
|
+
fullResult: true
|
|
48
|
+
}));
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* 聚合支付-退款-查询接口
|
|
53
|
+
*/
|
|
54
|
+
export var AGPTRefundQueryApi = function AGPTRefundQueryApi(param, config) {
|
|
55
|
+
return request.getRequest().post('/shop/pay/external-unified/refund/verify', param, _objectSpread(_objectSpread({}, config || {}), {}, {
|
|
56
|
+
customMessage: true,
|
|
57
|
+
fullResult: true
|
|
58
|
+
}));
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* 聚合支付-退款-支付行为接口
|
|
63
|
+
*/
|
|
64
|
+
export var AGPTRefundActionApi = function AGPTRefundActionApi(param, config) {
|
|
65
|
+
return request.getRequest().post('/shop/pay/external-unified/refund/action', param, _objectSpread(_objectSpread({}, config || {}), {}, {
|
|
66
|
+
customMessage: true,
|
|
67
|
+
fullResult: true
|
|
68
|
+
}));
|
|
69
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import PaymentMethod from './utils/payment';
|
|
2
|
+
export declare enum EVisibleButtonType {
|
|
3
|
+
/** 取消按钮 */
|
|
4
|
+
CancelButton = "CancelButton",
|
|
5
|
+
/** 等待按钮 */
|
|
6
|
+
WaitButton = "WaitButton"
|
|
7
|
+
}
|
|
8
|
+
export declare enum EActionStatus {
|
|
9
|
+
/** 空 */
|
|
10
|
+
Empty = "Empty",
|
|
11
|
+
/** 取消 */
|
|
12
|
+
Cancel = "Cancel",
|
|
13
|
+
/** 取消中 */
|
|
14
|
+
CancelWaiting = "CancelWaiting",
|
|
15
|
+
/** 签名 */
|
|
16
|
+
Signature = "Signature",
|
|
17
|
+
/** 签名等待中 */
|
|
18
|
+
SignatureWaiting = "SignatureWaiting"
|
|
19
|
+
}
|
|
20
|
+
export declare const QUERY_START_DELAY: number;
|
|
21
|
+
export declare const GLOBAL_TIMEOUT: number;
|
|
22
|
+
export declare const REQUEST_TIMEOUT: number;
|
|
23
|
+
export declare const QUERY_INTERVAL: number;
|
|
24
|
+
/**
|
|
25
|
+
* 聚合支付初始化参数
|
|
26
|
+
*/
|
|
27
|
+
export interface PaymentMethodOptions {
|
|
28
|
+
/** 支付类型 */
|
|
29
|
+
paymentCode: string;
|
|
30
|
+
/** 交易号 */
|
|
31
|
+
paymentNum: string;
|
|
32
|
+
/** 订单ID */
|
|
33
|
+
orderId?: string | number;
|
|
34
|
+
/** 设备ID */
|
|
35
|
+
deviceId?: string | number;
|
|
36
|
+
/** 统一回调函数 */
|
|
37
|
+
callback: PaymentCallback;
|
|
38
|
+
/** 检查是否应该继续处理结果 */
|
|
39
|
+
shouldContinue?: () => boolean;
|
|
40
|
+
/** 配置 */
|
|
41
|
+
config?: PaymentMethodConfig;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* 聚合支付操作类型
|
|
45
|
+
*/
|
|
46
|
+
export declare enum ActionType {
|
|
47
|
+
/** 支付 */
|
|
48
|
+
Pay = "pay",
|
|
49
|
+
/** 支付查询 */
|
|
50
|
+
PayQuery = "payQuery",
|
|
51
|
+
/** 支付行为 */
|
|
52
|
+
PayAction = "payAction",
|
|
53
|
+
/** 退款 */
|
|
54
|
+
Refund = "refund",
|
|
55
|
+
/** 退款查询 */
|
|
56
|
+
RefundQuery = "refundQuery",
|
|
57
|
+
/** 退款行为 */
|
|
58
|
+
RefundAction = "refundAction"
|
|
59
|
+
}
|
|
60
|
+
/** 回调事件 */
|
|
61
|
+
export interface CallbackEvent {
|
|
62
|
+
/** 事件类型:成功、失败、进度 */
|
|
63
|
+
status: EPaymentStatus;
|
|
64
|
+
/** 操作类型 */
|
|
65
|
+
actionType: ActionType;
|
|
66
|
+
/** 数据:成功时是结果,失败时是错误信息,进度时是进度数据 */
|
|
67
|
+
data: any;
|
|
68
|
+
}
|
|
69
|
+
/** 统一回调函数 */
|
|
70
|
+
export declare type PaymentCallback = (instance: PaymentMethod, event: CallbackEvent) => void;
|
|
71
|
+
/**
|
|
72
|
+
* 执行操作参数
|
|
73
|
+
*/
|
|
74
|
+
export interface RunOptions {
|
|
75
|
+
/** 操作类型 */
|
|
76
|
+
actionType: ActionType;
|
|
77
|
+
/** 请求参数 */
|
|
78
|
+
params?: Record<string, any>;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* 聚合支付配置参数
|
|
82
|
+
*/
|
|
83
|
+
export interface PaymentMethodConfig {
|
|
84
|
+
/** 是否需要轮询间隔 */
|
|
85
|
+
hasQueryInterval?: boolean;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* 支付状态
|
|
89
|
+
*/
|
|
90
|
+
export declare enum EPaymentStatus {
|
|
91
|
+
/** 支付中 */
|
|
92
|
+
Processing = "processing",
|
|
93
|
+
/** 支付成功 */
|
|
94
|
+
Success = "success",
|
|
95
|
+
/** 支付失败 */
|
|
96
|
+
Failed = "failed"
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* 执行操作参数
|
|
100
|
+
*/
|
|
101
|
+
export interface HooksRunParams {
|
|
102
|
+
/** 付款码 */
|
|
103
|
+
authCode?: string | number;
|
|
104
|
+
/** 订单支付ID */
|
|
105
|
+
orderPaymentId?: string | number;
|
|
106
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export var EVisibleButtonType = /*#__PURE__*/function (EVisibleButtonType) {
|
|
2
|
+
EVisibleButtonType["CancelButton"] = "CancelButton";
|
|
3
|
+
EVisibleButtonType["WaitButton"] = "WaitButton";
|
|
4
|
+
return EVisibleButtonType;
|
|
5
|
+
}({});
|
|
6
|
+
export var EActionStatus = /*#__PURE__*/function (EActionStatus) {
|
|
7
|
+
EActionStatus["Empty"] = "Empty";
|
|
8
|
+
EActionStatus["Cancel"] = "Cancel";
|
|
9
|
+
EActionStatus["CancelWaiting"] = "CancelWaiting";
|
|
10
|
+
EActionStatus["Signature"] = "Signature";
|
|
11
|
+
EActionStatus["SignatureWaiting"] = "SignatureWaiting";
|
|
12
|
+
return EActionStatus;
|
|
13
|
+
}({});
|
|
14
|
+
|
|
15
|
+
// 开始轮询的延迟时间(支付发起后等待10秒)
|
|
16
|
+
export var QUERY_START_DELAY = 1000 * 10;
|
|
17
|
+
// 全局超时时间(2分钟)
|
|
18
|
+
export var GLOBAL_TIMEOUT = 1000 * 60 * 2;
|
|
19
|
+
// 单次请求超时时间(10秒)
|
|
20
|
+
export var REQUEST_TIMEOUT = 1000 * 10;
|
|
21
|
+
// 轮询间隔时间(2秒)
|
|
22
|
+
export var QUERY_INTERVAL = 1000 * 2;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 聚合支付初始化参数
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* 聚合支付操作类型
|
|
30
|
+
*/
|
|
31
|
+
export var ActionType = /*#__PURE__*/function (ActionType) {
|
|
32
|
+
ActionType["Pay"] = "pay";
|
|
33
|
+
ActionType["PayQuery"] = "payQuery";
|
|
34
|
+
ActionType["PayAction"] = "payAction";
|
|
35
|
+
ActionType["Refund"] = "refund";
|
|
36
|
+
ActionType["RefundQuery"] = "refundQuery";
|
|
37
|
+
ActionType["RefundAction"] = "refundAction";
|
|
38
|
+
return ActionType;
|
|
39
|
+
}({});
|
|
40
|
+
|
|
41
|
+
/** 回调事件 */
|
|
42
|
+
|
|
43
|
+
/** 统一回调函数 */
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* 执行操作参数
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* 聚合支付配置参数
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* 支付状态
|
|
55
|
+
*/
|
|
56
|
+
export var EPaymentStatus = /*#__PURE__*/function (EPaymentStatus) {
|
|
57
|
+
EPaymentStatus["Processing"] = "processing";
|
|
58
|
+
EPaymentStatus["Success"] = "success";
|
|
59
|
+
EPaymentStatus["Failed"] = "failed";
|
|
60
|
+
return EPaymentStatus;
|
|
61
|
+
}({});
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* 执行操作参数
|
|
65
|
+
*/
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
export interface LogEntry {
|
|
2
|
+
/** 日志标题 */
|
|
3
|
+
title: string;
|
|
4
|
+
/** 日志内容 */
|
|
5
|
+
content?: any;
|
|
6
|
+
/** 支付时间(精确到毫秒) */
|
|
7
|
+
time: string;
|
|
8
|
+
}
|
|
9
|
+
interface PaymentLogRecord {
|
|
10
|
+
/** 交易记录号 */
|
|
11
|
+
number: string;
|
|
12
|
+
/** 订单ID */
|
|
13
|
+
orderId?: string | number;
|
|
14
|
+
/** 设备ID */
|
|
15
|
+
deviceId?: string | number;
|
|
16
|
+
/** 支付类型 */
|
|
17
|
+
paymentCode?: string;
|
|
18
|
+
/** 创建时间 */
|
|
19
|
+
createdAt: string;
|
|
20
|
+
/** 日志条目列表 */
|
|
21
|
+
logs: LogEntry[];
|
|
22
|
+
}
|
|
23
|
+
declare class PaymentLogInstance {
|
|
24
|
+
private static instance;
|
|
25
|
+
/** 当前交易记录号 */
|
|
26
|
+
private currentNumber;
|
|
27
|
+
/** 当前日志记录 */
|
|
28
|
+
private currentRecord;
|
|
29
|
+
private constructor();
|
|
30
|
+
/**
|
|
31
|
+
* 获取单例实例
|
|
32
|
+
*/
|
|
33
|
+
static getInstance(): PaymentLogInstance;
|
|
34
|
+
/**
|
|
35
|
+
* 初始化支付日志
|
|
36
|
+
* @param number 交易记录号
|
|
37
|
+
* @param options 初始化选项
|
|
38
|
+
*/
|
|
39
|
+
init(number: string, options?: {
|
|
40
|
+
orderId?: string | number;
|
|
41
|
+
deviceId?: string | number;
|
|
42
|
+
paymentCode?: string;
|
|
43
|
+
[key: string]: any;
|
|
44
|
+
}): void;
|
|
45
|
+
/**
|
|
46
|
+
* 添加日志条目
|
|
47
|
+
* @param title 日志标题
|
|
48
|
+
* @param content 日志内容
|
|
49
|
+
*/
|
|
50
|
+
addLog(params: {
|
|
51
|
+
title: string;
|
|
52
|
+
content?: any;
|
|
53
|
+
}): void;
|
|
54
|
+
/**
|
|
55
|
+
* 构建日志内容
|
|
56
|
+
* @param record 日志记录
|
|
57
|
+
* @returns 格式化的日志内容数组
|
|
58
|
+
*/
|
|
59
|
+
private buildLogContent;
|
|
60
|
+
/**
|
|
61
|
+
* 发送单条日志记录到飞书
|
|
62
|
+
* @param record 日志记录
|
|
63
|
+
* @param isRestore 是否是恢复上传
|
|
64
|
+
*/
|
|
65
|
+
private sendLogRecord;
|
|
66
|
+
/**
|
|
67
|
+
* 发送日志到飞书
|
|
68
|
+
* @param title 日志标题(可选,仅在需要自定义标题时使用)
|
|
69
|
+
*/
|
|
70
|
+
sendLogs(title?: string): void;
|
|
71
|
+
/**
|
|
72
|
+
* 清除当前日志
|
|
73
|
+
* @param shouldSend 清除前是否发送到飞书,默认为 true
|
|
74
|
+
*/
|
|
75
|
+
clearLogs(shouldSend?: boolean): void;
|
|
76
|
+
/**
|
|
77
|
+
* 检查并上传旧日志
|
|
78
|
+
*/
|
|
79
|
+
private checkAndUploadOldLogs;
|
|
80
|
+
/**
|
|
81
|
+
* 获取所有支付日志对象
|
|
82
|
+
*/
|
|
83
|
+
private getAllLogsObject;
|
|
84
|
+
/**
|
|
85
|
+
* 保存所有支付日志对象
|
|
86
|
+
*/
|
|
87
|
+
private saveAllLogsObject;
|
|
88
|
+
/**
|
|
89
|
+
* 保存到 localStorage
|
|
90
|
+
*/
|
|
91
|
+
private saveToLocalStorage;
|
|
92
|
+
/**
|
|
93
|
+
* 从 localStorage 中删除
|
|
94
|
+
*/
|
|
95
|
+
private removeFromLocalStorage;
|
|
96
|
+
/**
|
|
97
|
+
* 获取所有旧日志
|
|
98
|
+
*/
|
|
99
|
+
private getOldLogsFromLocalStorage;
|
|
100
|
+
/**
|
|
101
|
+
* 获取当前日志记录(用于调试)
|
|
102
|
+
*/
|
|
103
|
+
getCurrentRecord(): PaymentLogRecord | null;
|
|
104
|
+
/**
|
|
105
|
+
* 获取当前交易号(用于调试)
|
|
106
|
+
*/
|
|
107
|
+
getCurrentNumber(): string | null;
|
|
108
|
+
}
|
|
109
|
+
declare const paymentLog: PaymentLogInstance;
|
|
110
|
+
export default paymentLog;
|