@paykka/card-checkout-ui 0.8.0 → 0.9.2
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/dist/card-checkout-ui.js +20 -13
- package/dist/card-checkout-ui.umd.cjs +20 -13
- package/dist/es/_commonjsHelpers.js +1 -0
- package/dist/es/api/http.js +19 -21
- package/dist/es/api/index.js +1 -0
- package/dist/es/api/modules/ali-pay/index.js +19 -11
- package/dist/es/api/modules/apple-pay/index.js +10 -26
- package/dist/es/api/modules/boost/index.js +56 -0
- package/dist/es/api/modules/card/index.js +17 -11
- package/dist/es/api/modules/checkout/index.js +6 -6
- package/dist/es/api/modules/checkout/map.js +23 -6
- package/dist/es/api/modules/gcash/index.js +56 -0
- package/dist/es/api/modules/get-browser-params.js +2 -2
- package/dist/es/api/modules/google-pay/index.js +10 -26
- package/dist/es/api/modules/grab-pay/index.js +56 -0
- package/dist/es/api/modules/index.js +1 -0
- package/dist/es/api/modules/line-pay/index.js +56 -0
- package/dist/es/api/modules/may-bank-qr-pay/index.js +56 -0
- package/dist/es/api/modules/nine-pay/index.js +56 -0
- package/dist/es/api/modules/paymaya/index.js +56 -0
- package/dist/es/api/modules/sepa/index.js +19 -11
- package/dist/es/api/modules/shopee-pay/index.js +56 -0
- package/dist/es/api/modules/tng-wallet/index.js +56 -0
- package/dist/es/api/modules/wechat-pay/index.js +18 -31
- package/dist/es/components/AccordionItem/AccordionItem.js +36 -0
- package/dist/es/components/AliPay/index.js +27 -39
- package/dist/es/components/ApplePay/index.js +16 -37
- package/dist/es/components/Boost/index.js +322 -0
- package/dist/es/components/Card/index.js +52 -41
- package/dist/es/components/CardBrands/index.js +2 -2
- package/dist/es/components/CardNumberField/index.js +113 -106
- package/dist/es/components/DropIn/index.js +204 -49
- package/dist/es/components/GooglePay/index.js +5 -4
- package/dist/es/components/GrabPay/index.js +322 -0
- package/dist/es/components/GuideCard/index.js +43 -0
- package/dist/es/components/LinePay/index.js +322 -0
- package/dist/es/components/MayBankQRPay/index.js +322 -0
- package/dist/es/components/NinePay/index.js +322 -0
- package/dist/es/components/SecuredIframe/index.js +3 -2
- package/dist/es/components/Sepa/index.js +6 -9
- package/dist/es/components/ShopeePay/index.js +322 -0
- package/dist/es/components/SubmitButton/index.js +6 -20
- package/dist/es/components/TNGWallet/index.js +322 -0
- package/dist/es/components/WechatPay/index.js +30 -49
- package/dist/es/components/business/QRCodeModal/QRCodeModal.js +41 -0
- package/dist/es/components/business/QRCodeModal/index.js +6 -0
- package/dist/es/components/business/QRCodeModal/qr-code-modal.js +1 -0
- package/dist/es/components/business/QRCodeModal/type.js +1 -0
- package/dist/es/components/business/index.js +6 -0
- package/dist/es/components/index.js +9 -0
- package/dist/es/components/internal/Accordion/Accordion.js +14 -0
- package/dist/es/components/internal/Accordion/accordion2.js +1 -0
- package/dist/es/components/internal/Accordion/accordionTransition.js +26 -0
- package/dist/es/components/internal/Accordion/index.js +7 -0
- package/dist/es/components/internal/Accordion/type.js +10 -0
- package/dist/es/components/internal/Modal/Modal.js +17 -3
- package/dist/es/components/internal/Modal/index.js +1 -0
- package/dist/es/components/internal/Modal/type.js +1 -0
- package/dist/es/components/internal/QRCode/QRCode.js +31 -0
- package/dist/es/components/internal/QRCode/index.js +4 -0
- package/dist/es/components/internal/QRCode/type.js +1 -0
- package/dist/es/components/internal/icons/IconBoost.js +63 -0
- package/dist/es/components/internal/icons/IconCard.js +1 -40
- package/dist/es/components/internal/icons/IconCard2.js +60 -0
- package/dist/es/components/internal/icons/IconGCash.js +196 -0
- package/dist/es/components/internal/icons/IconGcashComplete.js +184 -0
- package/dist/es/components/internal/icons/IconGrabPay.js +59 -0
- package/dist/es/components/internal/icons/IconLinePay.js +99 -0
- package/dist/es/components/internal/icons/IconMayBankQRPay.js +69 -0
- package/dist/es/components/internal/icons/IconNinePay.js +255 -0
- package/dist/es/components/internal/icons/IconPaymaya.js +114 -0
- package/dist/es/components/internal/icons/IconRedirect.js +58 -0
- package/dist/es/components/internal/icons/IconScan.js +102 -0
- package/dist/es/components/internal/icons/IconShopeePay.js +108 -0
- package/dist/es/components/internal/icons/IconTNGWallet.js +119 -0
- package/dist/es/components/internal/icons/IconUnionPay.js +65 -0
- package/dist/es/components/wallets/GCash/GCash.js +356 -0
- package/dist/es/components/wallets/GCash/g-cash.js +1 -0
- package/dist/es/components/wallets/GCash/index.js +1 -0
- package/dist/es/components/wallets/GCash/type.js +1 -0
- package/dist/es/components/wallets/Paymaya/Paymaya.js +323 -0
- package/dist/es/components/wallets/Paymaya/index.js +1 -0
- package/dist/es/components/wallets/Paymaya/paymaya2.js +1 -0
- package/dist/es/components/wallets/Paymaya/type.js +1 -0
- package/dist/es/config.js +12 -12
- package/dist/es/constant.js +84 -4
- package/dist/es/core/PayKKaCheckout.js +28 -3
- package/dist/es/core/Session.js +24 -23
- package/dist/es/core/error.js +7 -0
- package/dist/es/core/query.js +3 -2
- package/dist/es/core.js +2082 -70
- package/dist/es/hooks/usePayState.js +0 -3
- package/dist/es/i18n/I18n.js +8 -2
- package/dist/es/i18n/locales/de-DE.js +16 -1
- package/dist/es/i18n/locales/en-GB.js +16 -1
- package/dist/es/i18n/locales/es-ES.js +16 -1
- package/dist/es/i18n/locales/fr-FR.js +16 -1
- package/dist/es/i18n/locales/ja-JP.js +16 -1
- package/dist/es/i18n/locales/ko-KR.js +16 -1
- package/dist/es/i18n/locales/pt-PT.js +16 -1
- package/dist/es/i18n/locales/ru-RU.js +16 -1
- package/dist/es/i18n/locales/zh-CN.js +16 -1
- package/dist/es/i18n/locales/zh-HK.js +16 -1
- package/dist/es/i18n/locales/zh-TW.js +16 -1
- package/dist/es/i18n/util.js +12 -3
- package/dist/es/index.js +20 -0
- package/dist/es/style.css +1 -1192
- package/dist/es/types/index.js +1 -0
- package/dist/es/utils/array.js +9 -0
- package/dist/es/utils/card-brand/brands.js +11 -1
- package/dist/es/utils/card-brand/index.js +4 -3
- package/dist/es/utils/card-brand/luhn.js +25 -0
- package/dist/es/utils/date.js +25 -0
- package/dist/es/utils/detect.js +6 -0
- package/dist/es/utils/format.js +28 -12
- package/dist/es/utils/index.js +9 -1
- package/dist/es/utils/location.js +37 -0
- package/dist/es/utils/object.js +14 -0
- package/dist/es/utils/redirect.js +32 -0
- package/dist/es/utils/system-info/get-browser-info.js +4 -4
- package/dist/es/utils/system-info/get-system-info.js +11 -7
- package/dist/es/utils/system-info/index.js +4 -4
- package/dist/style.css +1 -1
- package/dist/types/api/http.d.ts +4 -10
- package/dist/types/api/modules/ali-pay/index.d.ts +2 -1
- package/dist/types/api/modules/apple-pay/index.d.ts +2 -1
- package/dist/types/api/modules/boost/index.d.ts +24 -0
- package/dist/types/api/modules/card/index.d.ts +1 -1
- package/dist/types/api/modules/checkout/index.d.ts +2 -2
- package/dist/types/api/modules/checkout/type.d.ts +9 -0
- package/dist/types/api/modules/gcash/index.d.ts +24 -0
- package/dist/types/api/modules/get-browser-params.d.ts +2 -2
- package/dist/types/api/modules/google-pay/index.d.ts +2 -1
- package/dist/types/api/modules/grab-pay/index.d.ts +24 -0
- package/dist/types/api/modules/index.d.ts +9 -0
- package/dist/types/api/modules/line-pay/index.d.ts +24 -0
- package/dist/types/api/modules/may-bank-qr-pay/index.d.ts +24 -0
- package/dist/types/api/modules/nine-pay/index.d.ts +24 -0
- package/dist/types/api/modules/paymaya/index.d.ts +24 -0
- package/dist/types/api/modules/sepa/index.d.ts +2 -1
- package/dist/types/api/modules/shopee-pay/index.d.ts +24 -0
- package/dist/types/api/modules/tng-wallet/index.d.ts +24 -0
- package/dist/types/api/modules/wechat-pay/index.d.ts +2 -1
- package/dist/types/components/Boost/Boost.d.ts +7 -0
- package/dist/types/components/Boost/index.d.ts +2 -0
- package/dist/types/components/Boost/type.d.ts +61 -0
- package/dist/types/components/DropIn/components/PaymentTabs/type.d.ts +1 -1
- package/dist/types/components/DropIn/config.d.ts +7 -0
- package/dist/types/components/DropIn/type.d.ts +11 -3
- package/dist/types/components/GrabPay/GrabPay.d.ts +7 -0
- package/dist/types/components/GrabPay/index.d.ts +2 -0
- package/dist/types/components/GrabPay/type.d.ts +61 -0
- package/dist/types/components/GuideCard/GuideCard.d.ts +3 -0
- package/dist/types/components/GuideCard/index.d.ts +2 -0
- package/dist/types/components/GuideCard/type.d.ts +4 -0
- package/dist/types/components/LinePay/LinePay.d.ts +7 -0
- package/dist/types/components/LinePay/index.d.ts +2 -0
- package/dist/types/components/LinePay/type.d.ts +61 -0
- package/dist/types/components/MayBankQRPay/MayBankQRPay.d.ts +6 -0
- package/dist/types/components/MayBankQRPay/index.d.ts +2 -0
- package/dist/types/components/MayBankQRPay/type.d.ts +61 -0
- package/dist/types/components/NinePay/NinePay.d.ts +6 -0
- package/dist/types/components/NinePay/index.d.ts +2 -0
- package/dist/types/components/NinePay/type.d.ts +61 -0
- package/dist/types/components/SecuredIframe/useSecuredInput.d.ts +1 -1
- package/dist/types/components/ShopeePay/ShopeePay.d.ts +7 -0
- package/dist/types/components/ShopeePay/index.d.ts +2 -0
- package/dist/types/components/ShopeePay/type.d.ts +61 -0
- package/dist/types/components/SubmitButton/SubmitButton.d.ts +1 -1
- package/dist/types/components/TNGWallet/TNGWallet.d.ts +7 -0
- package/dist/types/components/TNGWallet/index.d.ts +2 -0
- package/dist/types/components/TNGWallet/type.d.ts +61 -0
- package/dist/types/components/business/QRCodeModal/QRCodeModal.d.ts +3 -0
- package/dist/types/components/business/QRCodeModal/index.d.ts +2 -0
- package/dist/types/components/business/QRCodeModal/type.d.ts +18 -0
- package/dist/types/components/business/index.d.ts +1 -0
- package/dist/types/components/index.d.ts +9 -0
- package/dist/types/components/internal/Accordion/Accordion.d.ts +3 -0
- package/dist/types/components/internal/Accordion/accordionTransition.d.ts +8 -0
- package/dist/types/components/internal/Accordion/components/AccordionItem/AccordionItem.d.ts +3 -0
- package/dist/types/components/internal/Accordion/components/AccordionItem/index.d.ts +2 -0
- package/dist/types/components/internal/Accordion/components/AccordionItem/type.d.ts +18 -0
- package/dist/types/components/internal/Accordion/index.d.ts +3 -0
- package/dist/types/components/internal/Accordion/type.d.ts +18 -0
- package/dist/types/components/internal/Modal/type.d.ts +2 -0
- package/dist/types/components/internal/QRCode/QRCode.d.ts +2 -0
- package/dist/types/components/internal/QRCode/index.d.ts +2 -0
- package/dist/types/components/internal/QRCode/type.d.ts +9 -0
- package/dist/types/components/internal/icons/IconBoost.d.ts +2 -0
- package/dist/types/components/internal/icons/IconCard2.d.ts +2 -0
- package/dist/types/components/internal/icons/IconGCash.d.ts +2 -0
- package/dist/types/components/internal/icons/IconGcashComplete.d.ts +2 -0
- package/dist/types/components/internal/icons/IconGrabPay.d.ts +2 -0
- package/dist/types/components/internal/icons/IconLinePay.d.ts +2 -0
- package/dist/types/components/internal/icons/IconMayBankQRPay.d.ts +2 -0
- package/dist/types/components/internal/icons/IconNinePay.d.ts +2 -0
- package/dist/types/components/internal/icons/IconPaymaya.d.ts +2 -0
- package/dist/types/components/internal/icons/IconRedirect.d.ts +2 -0
- package/dist/types/components/internal/icons/IconScan.d.ts +2 -0
- package/dist/types/components/internal/icons/IconShopeePay.d.ts +2 -0
- package/dist/types/components/internal/icons/IconTNGWallet.d.ts +2 -0
- package/dist/types/components/internal/icons/IconUnionPay.d.ts +2 -0
- package/dist/types/components/internal/icons/index.d.ts +13 -0
- package/dist/types/components/wallets/GCash/GCash.d.ts +6 -0
- package/dist/types/components/wallets/GCash/index.d.ts +2 -0
- package/dist/types/components/wallets/GCash/type.d.ts +66 -0
- package/dist/types/components/wallets/Paymaya/Paymaya.d.ts +6 -0
- package/dist/types/components/wallets/Paymaya/index.d.ts +2 -0
- package/dist/types/components/wallets/Paymaya/type.d.ts +61 -0
- package/dist/types/config.d.ts +9 -9
- package/dist/types/constant.d.ts +28 -3
- package/dist/types/core/PayKKaCheckout.d.ts +10 -0
- package/dist/types/core/Session.d.ts +2 -0
- package/dist/types/core/error.d.ts +3 -1
- package/dist/types/core/query.d.ts +2 -2
- package/dist/types/hooks/usePayState.d.ts +0 -3
- package/dist/types/i18n/I18n.d.ts +1 -1
- package/dist/types/i18n/locales/de-DE.d.ts +13 -0
- package/dist/types/i18n/locales/en-GB.d.ts +13 -0
- package/dist/types/i18n/locales/es-ES.d.ts +13 -0
- package/dist/types/i18n/locales/fr-FR.d.ts +13 -0
- package/dist/types/i18n/locales/ja-JP.d.ts +13 -0
- package/dist/types/i18n/locales/ko-KR.d.ts +13 -0
- package/dist/types/i18n/locales/pt-PT.d.ts +13 -0
- package/dist/types/i18n/locales/ru-RU.d.ts +13 -0
- package/dist/types/i18n/locales/zh-CN.d.ts +13 -0
- package/dist/types/i18n/locales/zh-HK.d.ts +13 -0
- package/dist/types/i18n/locales/zh-TW.d.ts +13 -0
- package/dist/types/i18n/util.d.ts +5 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/types/index.d.ts +10 -3
- package/dist/types/types/message.d.ts +1 -0
- package/dist/types/utils/array.d.ts +1 -0
- package/dist/types/utils/card-brand/brands.d.ts +4 -3
- package/dist/types/utils/card-brand/index.d.ts +9 -6
- package/dist/types/utils/card-brand/luhn.d.ts +9 -0
- package/dist/types/utils/date.d.ts +9 -0
- package/dist/types/utils/detect.d.ts +1 -0
- package/dist/types/utils/format.d.ts +7 -1
- package/dist/types/utils/index.d.ts +7 -0
- package/dist/types/utils/location.d.ts +7 -0
- package/dist/types/utils/object.d.ts +1 -0
- package/dist/types/utils/redirect.d.ts +5 -0
- package/dist/types/utils/system-info/get-browser-info.d.ts +1 -1
- package/dist/types/utils/system-info/get-system-info.d.ts +3 -2
- package/dist/types/utils/system-info/index.d.ts +3 -3
- package/package.json +4 -2
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { PaymentMethod } from "../../../constant.js";
|
|
2
|
+
import "../../../utils/card-brand/brands.js";
|
|
3
|
+
import "../../../utils/system-info/get-browser-info.js";
|
|
4
|
+
import { deepMerge } from "../../../utils/object.js";
|
|
5
|
+
import { http } from "../../http.js";
|
|
6
|
+
import { payResMap } from "../map.js";
|
|
7
|
+
const mayBankQRPay = async ({
|
|
8
|
+
sessionId,
|
|
9
|
+
clientKey,
|
|
10
|
+
payment,
|
|
11
|
+
bill,
|
|
12
|
+
browser
|
|
13
|
+
}, core, options) => {
|
|
14
|
+
const { _getExtraParams } = core.config;
|
|
15
|
+
const extraParams = _getExtraParams == null ? void 0 : _getExtraParams("payment", payment.paymentMethod);
|
|
16
|
+
const params = deepMerge({
|
|
17
|
+
bill: {
|
|
18
|
+
email: bill.email,
|
|
19
|
+
country: bill.country,
|
|
20
|
+
state: bill.province,
|
|
21
|
+
city: bill.city,
|
|
22
|
+
postal_code: bill.postCode,
|
|
23
|
+
address_line1: bill.address1,
|
|
24
|
+
address_line2: bill.address2,
|
|
25
|
+
county: bill.area
|
|
26
|
+
}
|
|
27
|
+
}, extraParams || {});
|
|
28
|
+
return http.post(
|
|
29
|
+
"/session/payments",
|
|
30
|
+
{
|
|
31
|
+
...params,
|
|
32
|
+
session_id: sessionId,
|
|
33
|
+
client_key: clientKey,
|
|
34
|
+
payment: {
|
|
35
|
+
payment_method: payment.paymentMethod
|
|
36
|
+
},
|
|
37
|
+
browser
|
|
38
|
+
},
|
|
39
|
+
options
|
|
40
|
+
).then(payResMap);
|
|
41
|
+
};
|
|
42
|
+
const getMayBankQRPayInfo = async ({ sessionId, clientKey }, options) => {
|
|
43
|
+
return http.post(
|
|
44
|
+
"/session/payments/query",
|
|
45
|
+
{
|
|
46
|
+
session_id: sessionId,
|
|
47
|
+
client_key: clientKey,
|
|
48
|
+
payment_method: PaymentMethod.MAY_BANK_QR_PAY
|
|
49
|
+
},
|
|
50
|
+
options
|
|
51
|
+
).then(payResMap);
|
|
52
|
+
};
|
|
53
|
+
export {
|
|
54
|
+
getMayBankQRPayInfo,
|
|
55
|
+
mayBankQRPay
|
|
56
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { PaymentMethod } from "../../../constant.js";
|
|
2
|
+
import "../../../utils/card-brand/brands.js";
|
|
3
|
+
import "../../../utils/system-info/get-browser-info.js";
|
|
4
|
+
import { deepMerge } from "../../../utils/object.js";
|
|
5
|
+
import { http } from "../../http.js";
|
|
6
|
+
import { payResMap } from "../map.js";
|
|
7
|
+
const ninePay = async ({
|
|
8
|
+
sessionId,
|
|
9
|
+
clientKey,
|
|
10
|
+
payment,
|
|
11
|
+
bill,
|
|
12
|
+
browser
|
|
13
|
+
}, core, options) => {
|
|
14
|
+
const { _getExtraParams } = core.config;
|
|
15
|
+
const extraParams = _getExtraParams == null ? void 0 : _getExtraParams("payment", payment.paymentMethod);
|
|
16
|
+
const params = deepMerge({
|
|
17
|
+
bill: {
|
|
18
|
+
email: bill.email,
|
|
19
|
+
country: bill.country,
|
|
20
|
+
state: bill.province,
|
|
21
|
+
city: bill.city,
|
|
22
|
+
postal_code: bill.postCode,
|
|
23
|
+
address_line1: bill.address1,
|
|
24
|
+
address_line2: bill.address2,
|
|
25
|
+
county: bill.area
|
|
26
|
+
}
|
|
27
|
+
}, extraParams || {});
|
|
28
|
+
return http.post(
|
|
29
|
+
"/session/payments",
|
|
30
|
+
{
|
|
31
|
+
...params,
|
|
32
|
+
session_id: sessionId,
|
|
33
|
+
client_key: clientKey,
|
|
34
|
+
payment: {
|
|
35
|
+
payment_method: payment.paymentMethod
|
|
36
|
+
},
|
|
37
|
+
browser
|
|
38
|
+
},
|
|
39
|
+
options
|
|
40
|
+
).then(payResMap);
|
|
41
|
+
};
|
|
42
|
+
const getNinePayInfo = async ({ sessionId, clientKey }, options) => {
|
|
43
|
+
return http.post(
|
|
44
|
+
"/session/payments/query",
|
|
45
|
+
{
|
|
46
|
+
session_id: sessionId,
|
|
47
|
+
client_key: clientKey,
|
|
48
|
+
payment_method: PaymentMethod.NINE_PAY
|
|
49
|
+
},
|
|
50
|
+
options
|
|
51
|
+
).then(payResMap);
|
|
52
|
+
};
|
|
53
|
+
export {
|
|
54
|
+
getNinePayInfo,
|
|
55
|
+
ninePay
|
|
56
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { PaymentMethod } from "../../../constant.js";
|
|
2
|
+
import "../../../utils/card-brand/brands.js";
|
|
3
|
+
import "../../../utils/system-info/get-browser-info.js";
|
|
4
|
+
import { deepMerge } from "../../../utils/object.js";
|
|
5
|
+
import { http } from "../../http.js";
|
|
6
|
+
import { payResMap } from "../map.js";
|
|
7
|
+
const paymayaPay = async ({
|
|
8
|
+
sessionId,
|
|
9
|
+
clientKey,
|
|
10
|
+
payment,
|
|
11
|
+
bill,
|
|
12
|
+
browser
|
|
13
|
+
}, core, options) => {
|
|
14
|
+
const { _getExtraParams } = core.config;
|
|
15
|
+
const extraParams = _getExtraParams == null ? void 0 : _getExtraParams("payment", payment.paymentMethod);
|
|
16
|
+
const params = deepMerge({
|
|
17
|
+
bill: {
|
|
18
|
+
email: bill.email,
|
|
19
|
+
country: bill.country,
|
|
20
|
+
state: bill.province,
|
|
21
|
+
city: bill.city,
|
|
22
|
+
postal_code: bill.postCode,
|
|
23
|
+
address_line1: bill.address1,
|
|
24
|
+
address_line2: bill.address2,
|
|
25
|
+
county: bill.area
|
|
26
|
+
}
|
|
27
|
+
}, extraParams || {});
|
|
28
|
+
return http.post(
|
|
29
|
+
"/session/payments",
|
|
30
|
+
{
|
|
31
|
+
...params,
|
|
32
|
+
session_id: sessionId,
|
|
33
|
+
client_key: clientKey,
|
|
34
|
+
payment: {
|
|
35
|
+
payment_method: payment.paymentMethod
|
|
36
|
+
},
|
|
37
|
+
browser
|
|
38
|
+
},
|
|
39
|
+
options
|
|
40
|
+
).then(payResMap);
|
|
41
|
+
};
|
|
42
|
+
const getPaymayaPayInfo = async ({ sessionId, clientKey }, options) => {
|
|
43
|
+
return http.post(
|
|
44
|
+
"/session/payments/query",
|
|
45
|
+
{
|
|
46
|
+
session_id: sessionId,
|
|
47
|
+
client_key: clientKey,
|
|
48
|
+
payment_method: PaymentMethod.PAYMAYA
|
|
49
|
+
},
|
|
50
|
+
options
|
|
51
|
+
).then(payResMap);
|
|
52
|
+
};
|
|
53
|
+
export {
|
|
54
|
+
getPaymayaPayInfo,
|
|
55
|
+
paymayaPay
|
|
56
|
+
};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { PaymentMethod } from "../../../constant.js";
|
|
2
|
+
import "../../../utils/card-brand/brands.js";
|
|
3
|
+
import "../../../utils/system-info/get-browser-info.js";
|
|
4
|
+
import { deepMerge } from "../../../utils/object.js";
|
|
2
5
|
import { http } from "../../http.js";
|
|
3
6
|
import { payResMap } from "../map.js";
|
|
4
7
|
async function sepaPay({
|
|
@@ -7,10 +10,25 @@ async function sepaPay({
|
|
|
7
10
|
payment,
|
|
8
11
|
bill,
|
|
9
12
|
browser
|
|
10
|
-
}, options) {
|
|
13
|
+
}, core, options) {
|
|
14
|
+
const { _getExtraParams } = core.config;
|
|
15
|
+
const extraParams = _getExtraParams == null ? void 0 : _getExtraParams("payment", PaymentMethod.SEPA_DEBIT);
|
|
16
|
+
const params = deepMerge({
|
|
17
|
+
bill: {
|
|
18
|
+
email: bill.email,
|
|
19
|
+
country: bill.country,
|
|
20
|
+
state: bill.province,
|
|
21
|
+
city: bill.city,
|
|
22
|
+
postal_code: bill.postCode,
|
|
23
|
+
address_line1: bill.address1,
|
|
24
|
+
address_line2: bill.address2,
|
|
25
|
+
county: bill.area
|
|
26
|
+
}
|
|
27
|
+
}, extraParams || {});
|
|
11
28
|
return http.post(
|
|
12
29
|
"/session/payments",
|
|
13
30
|
{
|
|
31
|
+
...params,
|
|
14
32
|
session_id: sessionId,
|
|
15
33
|
client_key: clientKey,
|
|
16
34
|
payment: {
|
|
@@ -18,16 +36,6 @@ async function sepaPay({
|
|
|
18
36
|
payment_method: PaymentMethod.SEPA_DEBIT,
|
|
19
37
|
holder_name: payment.holderName
|
|
20
38
|
},
|
|
21
|
-
bill: {
|
|
22
|
-
email: bill.email,
|
|
23
|
-
country: bill.country,
|
|
24
|
-
state: bill.province,
|
|
25
|
-
city: bill.city,
|
|
26
|
-
postal_code: bill.postCode,
|
|
27
|
-
address_line1: bill.address1,
|
|
28
|
-
address_line2: bill.address2,
|
|
29
|
-
county: bill.area
|
|
30
|
-
},
|
|
31
39
|
browser
|
|
32
40
|
},
|
|
33
41
|
options
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { PaymentMethod } from "../../../constant.js";
|
|
2
|
+
import "../../../utils/card-brand/brands.js";
|
|
3
|
+
import "../../../utils/system-info/get-browser-info.js";
|
|
4
|
+
import { deepMerge } from "../../../utils/object.js";
|
|
5
|
+
import { http } from "../../http.js";
|
|
6
|
+
import { payResMap } from "../map.js";
|
|
7
|
+
const shopeePay = async ({
|
|
8
|
+
sessionId,
|
|
9
|
+
clientKey,
|
|
10
|
+
payment,
|
|
11
|
+
bill,
|
|
12
|
+
browser
|
|
13
|
+
}, core, options) => {
|
|
14
|
+
const { _getExtraParams } = core.config;
|
|
15
|
+
const extraParams = _getExtraParams == null ? void 0 : _getExtraParams("payment", payment.paymentMethod);
|
|
16
|
+
const params = deepMerge({
|
|
17
|
+
bill: {
|
|
18
|
+
email: bill.email,
|
|
19
|
+
country: bill.country,
|
|
20
|
+
state: bill.province,
|
|
21
|
+
city: bill.city,
|
|
22
|
+
postal_code: bill.postCode,
|
|
23
|
+
address_line1: bill.address1,
|
|
24
|
+
address_line2: bill.address2,
|
|
25
|
+
county: bill.area
|
|
26
|
+
}
|
|
27
|
+
}, extraParams || {});
|
|
28
|
+
return http.post(
|
|
29
|
+
"/session/payments",
|
|
30
|
+
{
|
|
31
|
+
...params,
|
|
32
|
+
session_id: sessionId,
|
|
33
|
+
client_key: clientKey,
|
|
34
|
+
payment: {
|
|
35
|
+
payment_method: payment.paymentMethod
|
|
36
|
+
},
|
|
37
|
+
browser
|
|
38
|
+
},
|
|
39
|
+
options
|
|
40
|
+
).then(payResMap);
|
|
41
|
+
};
|
|
42
|
+
const getShopeePayInfo = async ({ sessionId, clientKey }, options) => {
|
|
43
|
+
return http.post(
|
|
44
|
+
"/session/payments/query",
|
|
45
|
+
{
|
|
46
|
+
session_id: sessionId,
|
|
47
|
+
client_key: clientKey,
|
|
48
|
+
payment_method: PaymentMethod.SHOPEE_PAY
|
|
49
|
+
},
|
|
50
|
+
options
|
|
51
|
+
).then(payResMap);
|
|
52
|
+
};
|
|
53
|
+
export {
|
|
54
|
+
getShopeePayInfo,
|
|
55
|
+
shopeePay
|
|
56
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { PaymentMethod } from "../../../constant.js";
|
|
2
|
+
import "../../../utils/card-brand/brands.js";
|
|
3
|
+
import "../../../utils/system-info/get-browser-info.js";
|
|
4
|
+
import { deepMerge } from "../../../utils/object.js";
|
|
5
|
+
import { http } from "../../http.js";
|
|
6
|
+
import { payResMap } from "../map.js";
|
|
7
|
+
const tngWalletPay = async ({
|
|
8
|
+
sessionId,
|
|
9
|
+
clientKey,
|
|
10
|
+
payment,
|
|
11
|
+
bill,
|
|
12
|
+
browser
|
|
13
|
+
}, core, options) => {
|
|
14
|
+
const { _getExtraParams } = core.config;
|
|
15
|
+
const extraParams = _getExtraParams == null ? void 0 : _getExtraParams("payment", payment.paymentMethod);
|
|
16
|
+
const params = deepMerge({
|
|
17
|
+
bill: {
|
|
18
|
+
email: bill.email,
|
|
19
|
+
country: bill.country,
|
|
20
|
+
state: bill.province,
|
|
21
|
+
city: bill.city,
|
|
22
|
+
postal_code: bill.postCode,
|
|
23
|
+
address_line1: bill.address1,
|
|
24
|
+
address_line2: bill.address2,
|
|
25
|
+
county: bill.area
|
|
26
|
+
}
|
|
27
|
+
}, extraParams || {});
|
|
28
|
+
return http.post(
|
|
29
|
+
"/session/payments",
|
|
30
|
+
{
|
|
31
|
+
...params,
|
|
32
|
+
session_id: sessionId,
|
|
33
|
+
client_key: clientKey,
|
|
34
|
+
payment: {
|
|
35
|
+
payment_method: payment.paymentMethod
|
|
36
|
+
},
|
|
37
|
+
browser
|
|
38
|
+
},
|
|
39
|
+
options
|
|
40
|
+
).then(payResMap);
|
|
41
|
+
};
|
|
42
|
+
const getTNGWalletPayInfo = async ({ sessionId, clientKey }, options) => {
|
|
43
|
+
return http.post(
|
|
44
|
+
"/session/payments/query",
|
|
45
|
+
{
|
|
46
|
+
session_id: sessionId,
|
|
47
|
+
client_key: clientKey,
|
|
48
|
+
payment_method: PaymentMethod.TNG_WALLET
|
|
49
|
+
},
|
|
50
|
+
options
|
|
51
|
+
).then(payResMap);
|
|
52
|
+
};
|
|
53
|
+
export {
|
|
54
|
+
getTNGWalletPayInfo,
|
|
55
|
+
tngWalletPay
|
|
56
|
+
};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { PaymentMethod } from "../../../constant.js";
|
|
2
|
+
import "../../../utils/card-brand/brands.js";
|
|
3
|
+
import "../../../utils/system-info/get-browser-info.js";
|
|
4
|
+
import { deepMerge } from "../../../utils/object.js";
|
|
2
5
|
import { http } from "../../http.js";
|
|
3
6
|
import { getBrowserParams } from "../get-browser-params.js";
|
|
4
7
|
import { payResMap } from "../map.js";
|
|
@@ -7,46 +10,30 @@ async function wechatPay({
|
|
|
7
10
|
clientKey,
|
|
8
11
|
bill,
|
|
9
12
|
channelUserId
|
|
10
|
-
}, options) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
postal_code: bill.postCode,
|
|
24
|
-
address_line1: bill.address1,
|
|
25
|
-
address_line2: bill.address2,
|
|
26
|
-
county: bill.area
|
|
27
|
-
},
|
|
28
|
-
browser: await getBrowserParams(),
|
|
29
|
-
channel_user_id: channelUserId
|
|
13
|
+
}, core, options) {
|
|
14
|
+
const { _getExtraParams } = core.config;
|
|
15
|
+
const extraParams = _getExtraParams == null ? void 0 : _getExtraParams("payment", PaymentMethod.WECHAT_PAY);
|
|
16
|
+
const params = deepMerge({
|
|
17
|
+
bill: {
|
|
18
|
+
email: bill.email,
|
|
19
|
+
country: bill.country,
|
|
20
|
+
state: bill.province,
|
|
21
|
+
city: bill.city,
|
|
22
|
+
postal_code: bill.postCode,
|
|
23
|
+
address_line1: bill.address1,
|
|
24
|
+
address_line2: bill.address2,
|
|
25
|
+
county: bill.area
|
|
30
26
|
}
|
|
31
|
-
);
|
|
27
|
+
}, extraParams || {});
|
|
32
28
|
return http.post(
|
|
33
29
|
"/session/payments",
|
|
34
30
|
{
|
|
31
|
+
...params,
|
|
35
32
|
session_id: sessionId,
|
|
36
33
|
client_key: clientKey,
|
|
37
34
|
payment: {
|
|
38
35
|
payment_method: PaymentMethod.WECHAT_PAY
|
|
39
36
|
},
|
|
40
|
-
bill: {
|
|
41
|
-
email: bill.email,
|
|
42
|
-
country: bill.country,
|
|
43
|
-
state: bill.province,
|
|
44
|
-
city: bill.city,
|
|
45
|
-
postal_code: bill.postCode,
|
|
46
|
-
address_line1: bill.address1,
|
|
47
|
-
address_line2: bill.address2,
|
|
48
|
-
county: bill.area
|
|
49
|
-
},
|
|
50
37
|
browser: await getBrowserParams(),
|
|
51
38
|
channel_user_id: channelUserId
|
|
52
39
|
},
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { x, h, y, u } from "../../core.js";
|
|
2
|
+
import { COMMON_CLASS_NAME } from "../../constant.js";
|
|
3
|
+
import { useBEM } from "../../hooks/useBEM.js";
|
|
4
|
+
import "../../core/context.js";
|
|
5
|
+
import "../../utils/card-brand/brands.js";
|
|
6
|
+
import "../../utils/system-info/get-browser-info.js";
|
|
7
|
+
import { normalizedClass } from "../../utils/format.js";
|
|
8
|
+
import { AccordionContext } from "../internal/Accordion/type.js";
|
|
9
|
+
import { accordionTransition } from "../internal/Accordion/accordionTransition.js";
|
|
10
|
+
const { bem } = useBEM("accordion-item");
|
|
11
|
+
const AccordionItem = (props) => {
|
|
12
|
+
const { title, value, disabled = false, children, header } = props;
|
|
13
|
+
const { activeName, onSelect, enableTransition } = x(AccordionContext);
|
|
14
|
+
const [contentRef, setContentRef] = h(null);
|
|
15
|
+
const active = activeName === value;
|
|
16
|
+
const handleClickItem = () => {
|
|
17
|
+
if (disabled)
|
|
18
|
+
return;
|
|
19
|
+
onSelect(value);
|
|
20
|
+
};
|
|
21
|
+
y(() => {
|
|
22
|
+
if (!contentRef)
|
|
23
|
+
return;
|
|
24
|
+
accordionTransition(contentRef, active, enableTransition);
|
|
25
|
+
}, [active, contentRef]);
|
|
26
|
+
return /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, bem({ disabled })), children: [
|
|
27
|
+
/* @__PURE__ */ u("div", { className: bem("header"), onClick: handleClickItem, children: [
|
|
28
|
+
header,
|
|
29
|
+
/* @__PURE__ */ u("span", { className: bem("title", [active ? "active" : ""]), children: title })
|
|
30
|
+
] }),
|
|
31
|
+
/* @__PURE__ */ u("div", { className: bem("content", [active ? "active" : ""]), ref: setContentRef, children })
|
|
32
|
+
] });
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
AccordionItem
|
|
36
|
+
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { w, h, A, F, y, q, u } from "../../core.js";
|
|
2
2
|
import { isTimeoutError } from "../../api/http.js";
|
|
3
3
|
import { getAliPayInfo, aliPay } from "../../api/modules/ali-pay/index.js";
|
|
4
|
-
import { isUndefined } from "../../utils/is.js";
|
|
5
4
|
import "../../utils/card-brand/brands.js";
|
|
6
5
|
import "../../utils/system-info/get-browser-info.js";
|
|
7
6
|
import { cssVarPrefix, normalizedClass, formatAmount } from "../../utils/format.js";
|
|
@@ -25,8 +24,8 @@ const { bem } = useBEM("ali-pay");
|
|
|
25
24
|
const AliPay = w((props, ref) => {
|
|
26
25
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
27
26
|
const { session } = props;
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
const addressState = createAddressCore();
|
|
28
|
+
const emailState = createEmailCore();
|
|
30
29
|
const { setErrorMsg, i18n, errorMsg, sessionReady } = usePayState(session);
|
|
31
30
|
const [submitButtonStatus, setSubmitButtonStatus] = h("unSubmit");
|
|
32
31
|
const formRef = A(null);
|
|
@@ -93,12 +92,15 @@ const AliPay = w((props, ref) => {
|
|
|
93
92
|
}, 100);
|
|
94
93
|
}
|
|
95
94
|
}, [sessionReady]);
|
|
96
|
-
const onTimeout = q(
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
95
|
+
const onTimeout = q(
|
|
96
|
+
(message) => {
|
|
97
|
+
var _a2;
|
|
98
|
+
setErrorMsg(message || i18n.get("common.payTimeout"));
|
|
99
|
+
setSubmitButtonStatus("unSubmit");
|
|
100
|
+
(_a2 = props.onTimeout) == null ? void 0 : _a2.call(props, "retry");
|
|
101
|
+
},
|
|
102
|
+
[i18n, props.onTimeout]
|
|
103
|
+
);
|
|
102
104
|
const { start: startReFetchPayInfo, stop: stopReFetchPayInfo } = useRetry(
|
|
103
105
|
(timeout) => pay(true, timeout),
|
|
104
106
|
{
|
|
@@ -106,7 +108,7 @@ const AliPay = w((props, ref) => {
|
|
|
106
108
|
}
|
|
107
109
|
);
|
|
108
110
|
async function pay(search = false, timeout) {
|
|
109
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2
|
|
111
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
|
|
110
112
|
try {
|
|
111
113
|
const res = search ? await getAliPayInfo(
|
|
112
114
|
{
|
|
@@ -130,6 +132,7 @@ const AliPay = w((props, ref) => {
|
|
|
130
132
|
email: form.email
|
|
131
133
|
}
|
|
132
134
|
},
|
|
135
|
+
props.core,
|
|
133
136
|
{ locale: i18n.locale, timeout }
|
|
134
137
|
);
|
|
135
138
|
const { status, orderStatus, errorMessage, errorCode } = res;
|
|
@@ -137,49 +140,35 @@ const AliPay = w((props, ref) => {
|
|
|
137
140
|
if (status === "PROCESSING") {
|
|
138
141
|
if (!orderStatus) {
|
|
139
142
|
setSubmitButtonStatus("unSubmit");
|
|
143
|
+
return { end: true };
|
|
140
144
|
} else if (orderStatus === "SUCCESS") {
|
|
141
145
|
setSubmitButtonStatus("success");
|
|
142
146
|
(_b2 = props.onSuccess) == null ? void 0 : _b2.call(props);
|
|
143
|
-
return {
|
|
144
|
-
end: true
|
|
145
|
-
};
|
|
147
|
+
return { end: true };
|
|
146
148
|
} else if (orderStatus === "FAILURE") {
|
|
147
149
|
setErrorMsg(errorMessage);
|
|
148
150
|
setSubmitButtonStatus("unSubmit");
|
|
149
151
|
(_c2 = props.onError) == null ? void 0 : _c2.call(props, new PayKKaError("API_ERROR", errorMessage, { code: errorCode }));
|
|
150
|
-
return {
|
|
151
|
-
end: true
|
|
152
|
-
};
|
|
152
|
+
return { end: true };
|
|
153
153
|
} else if (orderStatus === "PROCESSING") {
|
|
154
154
|
!search && startReFetchPayInfo();
|
|
155
|
-
return {
|
|
156
|
-
end: false
|
|
157
|
-
};
|
|
155
|
+
return { end: false };
|
|
158
156
|
} else if (orderStatus === "CANCELED") {
|
|
159
157
|
setSubmitButtonStatus("unSubmit");
|
|
160
158
|
(_d2 = props.onTimeout) == null ? void 0 : _d2.call(props, "channel");
|
|
161
|
-
return {
|
|
162
|
-
end: true
|
|
163
|
-
};
|
|
159
|
+
return { end: true };
|
|
164
160
|
}
|
|
165
161
|
} else if (status === "SUCCESS") {
|
|
166
162
|
setSubmitButtonStatus("success");
|
|
167
163
|
(_e2 = props.onSuccess) == null ? void 0 : _e2.call(props);
|
|
168
|
-
return {
|
|
169
|
-
end: true
|
|
170
|
-
};
|
|
164
|
+
return { end: true };
|
|
171
165
|
} else if (status === "EXPIRED") {
|
|
172
166
|
setSubmitButtonStatus("unSubmit");
|
|
173
167
|
(_f2 = props.onExpired) == null ? void 0 : _f2.call(props);
|
|
174
|
-
return {
|
|
175
|
-
end: true
|
|
176
|
-
};
|
|
168
|
+
return { end: true };
|
|
177
169
|
}
|
|
178
170
|
setSubmitButtonStatus("unSubmit");
|
|
179
|
-
|
|
180
|
-
return {
|
|
181
|
-
end: true
|
|
182
|
-
};
|
|
171
|
+
return { end: true };
|
|
183
172
|
} catch (error) {
|
|
184
173
|
if (isTimeoutError(error)) {
|
|
185
174
|
if (search) {
|
|
@@ -191,7 +180,7 @@ const AliPay = w((props, ref) => {
|
|
|
191
180
|
} else {
|
|
192
181
|
const message = error.i18nKey ? i18n.get(error.i18nKey) : error.message;
|
|
193
182
|
setErrorMsg(message);
|
|
194
|
-
(
|
|
183
|
+
(_g2 = props.onError) == null ? void 0 : _g2.call(props, new PayKKaError("API_ERROR", message, { code: error.code, cause: error }));
|
|
195
184
|
setSubmitButtonStatus("unSubmit");
|
|
196
185
|
return { end: true };
|
|
197
186
|
}
|
|
@@ -214,12 +203,11 @@ const AliPay = w((props, ref) => {
|
|
|
214
203
|
});
|
|
215
204
|
}
|
|
216
205
|
const Button = () => {
|
|
217
|
-
const { transAmount } = (session == null ? void 0 : session.checkout) ?? {};
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
const text = i18n.get("common.pay") + (Number(amount) ? ` ${symbol}${amountStr}` : "");
|
|
206
|
+
const { transAmount, channelParams = {} } = (session == null ? void 0 : session.checkout) ?? {};
|
|
207
|
+
const { totalAmount } = channelParams.aliPay ?? {};
|
|
208
|
+
const amountObj = ((totalAmount == null ? void 0 : totalAmount.amount) ? totalAmount : transAmount) || {};
|
|
209
|
+
const amountText = (amountObj == null ? void 0 : amountObj.amount) ? formatAmount(amountObj).jointSymbol() : "";
|
|
210
|
+
const text = i18n.get("common.pay") + (amountText ? ` ${amountText}` : "");
|
|
223
211
|
return /* @__PURE__ */ u(
|
|
224
212
|
SubmitButton,
|
|
225
213
|
{
|