@paykka/card-checkout-ui 0.13.16 → 0.14.0
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 +54 -26
- package/dist/card-checkout-ui.umd.cjs +54 -26
- package/dist/es/api/modules/boost/index.js +5 -16
- package/dist/es/api/modules/gcash/index.js +5 -16
- package/dist/es/api/modules/get-browser-params.js +1 -4
- package/dist/es/api/modules/grab-pay/index.js +5 -16
- package/dist/es/api/modules/line-pay/index.js +5 -16
- package/dist/es/api/modules/may-bank-qr-pay/index.js +5 -16
- package/dist/es/api/modules/nine-pay/index.js +5 -16
- package/dist/es/api/modules/opay-wallet/index.js +5 -16
- package/dist/es/api/modules/paga-wallet/index.js +5 -16
- package/dist/es/api/modules/paymaya/index.js +5 -16
- package/dist/es/api/modules/shopee-pay/index.js +5 -16
- package/dist/es/api/modules/threeDS/index.js +16 -2
- package/dist/es/api/modules/tng-wallet/index.js +5 -16
- package/dist/es/api/modules/wallet/index.js +16 -0
- package/dist/es/api/modules/zalopay/index.js +5 -16
- package/dist/es/api/utils/index.js +2 -1
- package/dist/es/components/AccordionItem/AccordionItem.js +0 -2
- package/dist/es/components/AddressField/index.js +95 -85
- package/dist/es/components/AliPay/index.js +88 -76
- package/dist/es/components/ApplePay/index.js +61 -43
- package/dist/es/components/CPFField/index.js +2 -1
- package/dist/es/components/Card/index.js +182 -143
- package/dist/es/components/CardExpireDateField/index.js +2 -1
- package/dist/es/components/CardNo/index.js +2 -2
- package/dist/es/components/CardNumberField/index.js +2 -1
- package/dist/es/components/CardSecurityCodeField/index.js +2 -1
- package/dist/es/components/CardSelector/index.js +3 -2
- package/dist/es/components/DropIn/index.js +98 -31
- package/dist/es/components/GooglePay/index.js +190 -151
- package/dist/es/components/GuideCard/index.js +8 -1
- package/dist/es/components/PaymentButton/index.js +58 -0
- package/dist/es/components/RecurringTip/index.js +3 -3
- package/dist/es/components/SecuredFieldsProvider/index.js +81 -17
- package/dist/es/components/SecuredIframe/index.js +120 -52
- package/dist/es/components/Sepa/index.js +23 -25
- package/dist/es/components/SubmitButton/index.js +1 -1
- package/dist/es/components/ThreeDS/index.js +34 -15
- package/dist/es/components/WechatPay/index.js +94 -83
- package/dist/es/components/business/BlikCodeField/BlikCodeField.js +92 -0
- package/dist/es/components/business/BlikCodeField/blik-code-field.js +1 -0
- package/dist/es/components/business/BlikCodeField/index.js +13 -0
- package/dist/es/components/business/BlikConfirmModal/BlikConfirmModal.js +45 -0
- package/dist/es/components/business/BlikConfirmModal/blik-confirm-modal.js +1 -0
- package/dist/es/components/business/BlikConfirmModal/index.js +9 -0
- package/dist/es/components/business/BlikConfirmModal/type.js +1 -0
- package/dist/es/components/business/NameField/NameField.js +51 -0
- package/dist/es/components/business/NameField/index.js +11 -0
- package/dist/es/components/business/NameField/type.js +1 -0
- package/dist/es/components/business/PhoneField/PhoneField.js +125 -0
- package/dist/es/components/business/PhoneField/config.js +33 -0
- package/dist/es/components/business/PhoneField/index.js +14 -0
- package/dist/es/components/business/PhoneField/phone-field.js +1 -0
- package/dist/es/components/business/PhoneField/type.js +1 -0
- package/dist/es/components/business/SegmentedDigitInput/SegmentedDigitInput.js +80 -0
- package/dist/es/components/business/SegmentedDigitInput/format.js +26 -0
- package/dist/es/components/business/SegmentedDigitInput/index.js +5 -0
- package/dist/es/components/business/Tooltip/Tooltip.js +18 -0
- package/dist/es/components/business/Tooltip/index.js +6 -0
- package/dist/es/components/business/Tooltip/tooltip2.js +1 -0
- package/dist/es/components/business/index.js +14 -0
- package/dist/es/components/index.js +14 -7
- package/dist/es/components/internal/CheckBox/CheckBox.js +2 -2
- package/dist/es/components/internal/Input/Input.js +1 -1
- package/dist/es/components/internal/Select/Select.js +7 -1
- package/dist/es/components/internal/icons/IconArrowDown.js +4 -4
- package/dist/es/components/internal/icons/IconBancontact.js +95 -0
- package/dist/es/components/internal/icons/IconBlik.js +567 -0
- package/dist/es/components/internal/icons/IconIdeal.js +86 -0
- package/dist/es/components/internal/icons/IconOvo.js +47 -0
- package/dist/es/components/internal/icons/IconP24.js +40 -0
- package/dist/es/components/internal/icons/IconPhone.js +56 -0
- package/dist/es/components/internal/icons/IconSkrill.js +38 -0
- package/dist/es/components/internal/icons/IconTrustly.js +37 -0
- package/dist/es/components/wallets/Bancontact/Bancontact.js +201 -0
- package/dist/es/components/wallets/Bancontact/bancontact2.js +1 -0
- package/dist/es/components/wallets/Bancontact/index.js +1 -0
- package/dist/es/components/wallets/Bancontact/type.js +1 -0
- package/dist/es/components/wallets/Blik/Blik.js +232 -0
- package/dist/es/components/wallets/Blik/blik2.js +1 -0
- package/dist/es/components/wallets/Blik/index.js +1 -0
- package/dist/es/components/wallets/Blik/type.js +1 -0
- package/dist/es/components/wallets/Boost/Boost.js +183 -0
- package/dist/es/components/wallets/Boost/boost2.js +1 -0
- package/dist/es/components/wallets/Boost/index.js +1 -0
- package/dist/es/components/wallets/Boost/type.js +1 -0
- package/dist/es/components/wallets/GCash/GCash.js +74 -252
- package/dist/es/components/wallets/GrabPay/GrabPay.js +183 -0
- package/dist/es/components/wallets/GrabPay/grab-pay.js +1 -0
- package/dist/es/components/wallets/GrabPay/index.js +1 -0
- package/dist/es/components/wallets/GrabPay/type.js +1 -0
- package/dist/es/components/wallets/IDeal/IDeal.js +201 -0
- package/dist/es/components/wallets/IDeal/ideal2.js +1 -0
- package/dist/es/components/wallets/IDeal/index.js +1 -0
- package/dist/es/components/wallets/IDeal/type.js +1 -0
- package/dist/es/components/wallets/LinePay/LinePay.js +183 -0
- package/dist/es/components/wallets/LinePay/index.js +1 -0
- package/dist/es/components/wallets/LinePay/line-pay.js +1 -0
- package/dist/es/components/wallets/LinePay/type.js +1 -0
- package/dist/es/components/wallets/MayBankQRPay/MayBankQRPay.js +187 -0
- package/dist/es/components/wallets/MayBankQRPay/index.js +1 -0
- package/dist/es/components/wallets/MayBankQRPay/may-bank-qr-pay.js +1 -0
- package/dist/es/components/wallets/MayBankQRPay/type.js +1 -0
- package/dist/es/components/wallets/NinePay/NinePay.js +185 -0
- package/dist/es/components/wallets/NinePay/index.js +1 -0
- package/dist/es/components/wallets/NinePay/nine-pay.js +1 -0
- package/dist/es/components/wallets/NinePay/type.js +1 -0
- package/dist/es/components/wallets/OVO/OVO.js +200 -0
- package/dist/es/components/wallets/OVO/index.js +1 -0
- package/dist/es/components/wallets/OVO/ovo2.js +1 -0
- package/dist/es/components/wallets/OVO/type.js +1 -0
- package/dist/es/components/wallets/OpayWallet/OpayWallet.js +57 -218
- package/dist/es/components/wallets/P24/P24.js +198 -0
- package/dist/es/components/wallets/P24/index.js +1 -0
- package/dist/es/components/wallets/P24/p242.js +1 -0
- package/dist/es/components/wallets/P24/type.js +1 -0
- package/dist/es/components/wallets/PagaWallet/PagaWallet.js +57 -218
- package/dist/es/components/wallets/Paymaya/Paymaya.js +57 -221
- package/dist/es/components/wallets/PicPay/PicPay.js +64 -55
- package/dist/es/components/wallets/Pix/Pix.js +58 -56
- package/dist/es/components/wallets/ShopeePay/ShopeePay.js +185 -0
- package/dist/es/components/wallets/ShopeePay/index.js +1 -0
- package/dist/es/components/wallets/ShopeePay/shopee-pay.js +1 -0
- package/dist/es/components/wallets/ShopeePay/type.js +1 -0
- package/dist/es/components/wallets/Skrill/Skrill.js +200 -0
- package/dist/es/components/wallets/Skrill/index.js +1 -0
- package/dist/es/components/wallets/Skrill/skrill2.js +1 -0
- package/dist/es/components/wallets/Skrill/type.js +1 -0
- package/dist/es/components/wallets/TNGWallet/TNGWallet.js +185 -0
- package/dist/es/components/wallets/TNGWallet/index.js +1 -0
- package/dist/es/components/wallets/TNGWallet/tng-wallet.js +1 -0
- package/dist/es/components/wallets/TNGWallet/type.js +1 -0
- package/dist/es/components/wallets/Trustly/Trustly.js +226 -0
- package/dist/es/components/wallets/Trustly/index.js +1 -0
- package/dist/es/components/wallets/Trustly/trustly2.js +1 -0
- package/dist/es/components/wallets/Trustly/type.js +1 -0
- package/dist/es/components/wallets/Vietqr/Vietqr.js +73 -242
- package/dist/es/components/wallets/Zalopay/Zalopay.js +73 -242
- package/dist/es/components/wallets/index.js +14 -0
- package/dist/es/constant.js +48 -2
- package/dist/es/core/address.js +7 -6
- package/dist/es/core/checkout.js +93 -41
- package/dist/es/core/create-child.js +68 -0
- package/dist/es/core/environment.js +23 -1
- package/dist/es/core/error.js +15 -2
- package/dist/es/core/logger.js +106 -0
- package/dist/es/core/payment.js +65 -0
- package/dist/es/fe-logger.min.js +1 -0
- package/dist/es/hooks/useBaseWallet.js +280 -0
- package/dist/es/hooks/usePayState.js +37 -25
- package/dist/es/hooks/usePayment.js +1 -14
- package/dist/es/hooks/useRetry.js +50 -26
- package/dist/es/i18n/locales/de-DE.js +24 -0
- package/dist/es/i18n/locales/en-GB.js +24 -0
- package/dist/es/i18n/locales/es-ES.js +24 -0
- package/dist/es/i18n/locales/fr-FR.js +24 -0
- package/dist/es/i18n/locales/ja-JP.js +24 -0
- package/dist/es/i18n/locales/ko-KR.js +24 -0
- package/dist/es/i18n/locales/nl-NL.js +24 -0
- package/dist/es/i18n/locales/pt-PT.js +24 -0
- package/dist/es/i18n/locales/ru-RU.js +24 -0
- package/dist/es/i18n/locales/zh-CN.js +24 -0
- package/dist/es/i18n/locales/zh-HK.js +24 -0
- package/dist/es/i18n/locales/zh-TW.js +24 -0
- package/dist/es/index.js +23 -8
- package/dist/es/out/base-fraud-detection.js +4 -1
- package/dist/es/out/config.js +10 -4
- package/dist/es/out/fraud-detection.js +12 -13
- package/dist/es/out/worldpay-ddc-manager.js +7 -14
- package/dist/es/out/worldpay-ddc.js +7 -5
- package/dist/es/polyfill.js +166 -0
- package/dist/es/style.css +1 -1
- package/dist/es/types/event.js +12 -3
- package/dist/es/types/message.js +3 -0
- package/dist/es/utils/iframe.js +1 -1
- package/dist/es/utils/location.js +0 -8
- package/dist/es/utils/payment.js +12 -12
- package/dist/es/utils/redirect.js +4 -5
- package/dist/es/utils/system-info/is-ua-webview.js +1 -20
- package/dist/fe-logger.min.js +1 -0
- package/dist/polyfill.js +166 -0
- package/dist/style.css +1 -1
- package/dist/types/api/modules/index.d.ts +1 -0
- package/dist/types/api/modules/threeDS/index.d.ts +7 -0
- package/dist/types/api/modules/type.d.ts +2 -0
- package/dist/types/api/modules/wallet/index.d.ts +18 -0
- package/dist/types/api/utils/index.d.ts +1 -0
- package/dist/types/components/AddressField/index.d.ts +1 -0
- package/dist/types/components/AddressField/type.d.ts +17 -2
- package/dist/types/components/AddressField/utils.d.ts +22 -0
- package/dist/types/components/AliPay/type.d.ts +11 -15
- package/dist/types/components/ApplePay/type.d.ts +5 -28
- package/dist/types/components/CPFField/type.d.ts +1 -1
- package/dist/types/components/Card/type.d.ts +22 -23
- package/dist/types/components/CardExpireDateField/type.d.ts +1 -1
- package/dist/types/components/CardNo/type.d.ts +3 -2
- package/dist/types/components/CardNumberField/type.d.ts +1 -1
- package/dist/types/components/CardSecurityCodeField/type.d.ts +1 -1
- package/dist/types/components/CardSelector/type.d.ts +4 -4
- package/dist/types/components/DropIn/type.d.ts +10 -22
- package/dist/types/components/GooglePay/createGooglePay.d.ts +4 -4
- package/dist/types/components/GooglePay/type.d.ts +10 -14
- package/dist/types/components/PaymentButton/PaymentButton.d.ts +3 -0
- package/dist/types/components/PaymentButton/index.d.ts +2 -0
- package/dist/types/components/PaymentButton/type.d.ts +13 -0
- package/dist/types/components/RecurringTip/RecurringTip.d.ts +1 -1
- package/dist/types/components/SecuredFieldsProvider/type.d.ts +7 -1
- package/dist/types/components/SecuredIframe/HiddenIframe.d.ts +5 -0
- package/dist/types/components/ThreeDS/components/ThreeDSIframe/ThreeDSIframe.d.ts +0 -6
- package/dist/types/components/ThreeDS/components/ThreeDSIframe/type.d.ts +2 -0
- package/dist/types/components/WechatPay/type.d.ts +11 -15
- package/dist/types/components/business/BlikCodeField/BlikCodeField.d.ts +6 -0
- package/dist/types/components/business/BlikCodeField/index.d.ts +2 -0
- package/dist/types/components/business/BlikCodeField/type.d.ts +9 -0
- package/dist/types/components/business/BlikConfirmModal/BlikConfirmModal.d.ts +6 -0
- package/dist/types/components/business/BlikConfirmModal/index.d.ts +2 -0
- package/dist/types/components/business/BlikConfirmModal/type.d.ts +8 -0
- package/dist/types/components/business/NameField/NameField.d.ts +5 -0
- package/dist/types/components/business/NameField/index.d.ts +2 -0
- package/dist/types/components/business/NameField/type.d.ts +7 -0
- package/dist/types/components/business/PhoneField/PhoneField.d.ts +6 -0
- package/dist/types/components/business/PhoneField/config.d.ts +22 -0
- package/dist/types/components/business/PhoneField/index.d.ts +2 -0
- package/dist/types/components/business/PhoneField/type.d.ts +9 -0
- package/dist/types/components/business/SegmentedDigitInput/SegmentedDigitInput.d.ts +5 -0
- package/dist/types/components/business/SegmentedDigitInput/format.d.ts +5 -0
- package/dist/types/components/business/SegmentedDigitInput/index.d.ts +3 -0
- package/dist/types/components/business/SegmentedDigitInput/type.d.ts +13 -0
- package/dist/types/components/business/Tooltip/Tooltip.d.ts +11 -0
- package/dist/types/components/business/Tooltip/index.d.ts +1 -0
- package/dist/types/components/business/index.d.ts +6 -0
- package/dist/types/components/index.d.ts +0 -7
- package/dist/types/components/internal/CheckBox/type.d.ts +2 -1
- package/dist/types/components/internal/Form/type.d.ts +2 -1
- package/dist/types/components/internal/Select/type.d.ts +1 -1
- package/dist/types/components/internal/icons/IconArrowDown.d.ts +1 -1
- package/dist/types/components/internal/icons/IconBancontact.d.ts +2 -0
- package/dist/types/components/internal/icons/IconBlik.d.ts +2 -0
- package/dist/types/components/internal/icons/IconIdeal.d.ts +2 -0
- package/dist/types/components/internal/icons/IconOvo.d.ts +2 -0
- package/dist/types/components/internal/icons/IconP24.d.ts +2 -0
- package/dist/types/components/internal/icons/IconPhone.d.ts +2 -0
- package/dist/types/components/internal/icons/IconSkrill.d.ts +2 -0
- package/dist/types/components/internal/icons/IconTrustly.d.ts +2 -0
- package/dist/types/components/internal/icons/index.d.ts +8 -0
- package/dist/types/components/type.d.ts +0 -0
- package/dist/types/components/wallets/Bancontact/Bancontact.d.ts +15 -0
- package/dist/types/components/wallets/Bancontact/index.d.ts +2 -0
- package/dist/types/components/{GrabPay → wallets/Bancontact}/type.d.ts +8 -18
- package/dist/types/components/wallets/Blik/Blik.d.ts +15 -0
- package/dist/types/components/wallets/Blik/index.d.ts +2 -0
- package/dist/types/components/wallets/Blik/type.d.ts +29 -0
- package/dist/types/components/{Boost → wallets/Boost}/Boost.d.ts +9 -4
- package/dist/types/components/{Boost → wallets/Boost}/type.d.ts +3 -14
- package/dist/types/components/wallets/GCash/GCash.d.ts +5 -0
- package/dist/types/components/wallets/GCash/type.d.ts +3 -14
- package/dist/types/components/{GrabPay → wallets/GrabPay}/GrabPay.d.ts +4 -4
- package/dist/types/components/wallets/GrabPay/type.d.ts +17 -0
- package/dist/types/components/wallets/IDeal/IDeal.d.ts +15 -0
- package/dist/types/components/wallets/IDeal/index.d.ts +2 -0
- package/dist/types/components/wallets/IDeal/type.d.ts +29 -0
- package/dist/types/components/{LinePay → wallets/LinePay}/LinePay.d.ts +9 -4
- package/dist/types/components/{LinePay → wallets/LinePay}/type.d.ts +3 -14
- package/dist/types/components/wallets/MayBankQRPay/MayBankQRPay.d.ts +15 -0
- package/dist/types/components/{MayBankQRPay → wallets/MayBankQRPay}/type.d.ts +3 -14
- package/dist/types/components/wallets/NinePay/NinePay.d.ts +15 -0
- package/dist/types/components/{NinePay → wallets/NinePay}/type.d.ts +3 -14
- package/dist/types/components/wallets/OVO/OVO.d.ts +15 -0
- package/dist/types/components/wallets/OVO/index.d.ts +2 -0
- package/dist/types/components/wallets/OVO/type.d.ts +29 -0
- package/dist/types/components/wallets/OpayWallet/OpayWallet.d.ts +5 -0
- package/dist/types/components/wallets/OpayWallet/type.d.ts +4 -15
- package/dist/types/components/wallets/P24/P24.d.ts +15 -0
- package/dist/types/components/wallets/P24/index.d.ts +2 -0
- package/dist/types/components/wallets/P24/type.d.ts +29 -0
- package/dist/types/components/wallets/PagaWallet/PagaWallet.d.ts +5 -0
- package/dist/types/components/wallets/PagaWallet/type.d.ts +5 -16
- package/dist/types/components/wallets/Paymaya/Paymaya.d.ts +5 -0
- package/dist/types/components/wallets/Paymaya/type.d.ts +3 -14
- package/dist/types/components/wallets/PicPay/type.d.ts +5 -16
- package/dist/types/components/wallets/Pix/type.d.ts +5 -16
- package/dist/types/components/{ShopeePay → wallets/ShopeePay}/ShopeePay.d.ts +9 -4
- package/dist/types/components/{ShopeePay → wallets/ShopeePay}/type.d.ts +3 -14
- package/dist/types/components/wallets/Skrill/Skrill.d.ts +15 -0
- package/dist/types/components/wallets/Skrill/index.d.ts +2 -0
- package/dist/types/components/wallets/Skrill/type.d.ts +17 -0
- package/dist/types/components/{TNGWallet → wallets/TNGWallet}/TNGWallet.d.ts +9 -4
- package/dist/types/components/{TNGWallet → wallets/TNGWallet}/type.d.ts +3 -14
- package/dist/types/components/wallets/Trustly/Trustly.d.ts +15 -0
- package/dist/types/components/wallets/Trustly/index.d.ts +2 -0
- package/dist/types/components/wallets/Trustly/type.d.ts +21 -0
- package/dist/types/components/wallets/Vietqr/Vietqr.d.ts +5 -0
- package/dist/types/components/wallets/Vietqr/type.d.ts +3 -14
- package/dist/types/components/wallets/Zalopay/Zalopay.d.ts +5 -0
- package/dist/types/components/wallets/Zalopay/type.d.ts +3 -14
- package/dist/types/components/wallets/index.d.ts +14 -0
- package/dist/types/components/wallets/type.d.ts +18 -4
- package/dist/types/constant.d.ts +15 -1
- package/dist/types/core/address.d.ts +2 -5
- package/dist/types/core/checkout.d.ts +10 -10
- package/dist/types/core/create-child.d.ts +1 -0
- package/dist/types/core/environment.d.ts +5 -0
- package/dist/types/core/error.d.ts +9 -3
- package/dist/types/core/index.d.ts +2 -0
- package/dist/types/core/logger.d.ts +55 -0
- package/dist/types/core/payment.d.ts +21 -0
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/hooks/useBaseWallet.d.ts +54 -0
- package/dist/types/hooks/usePayState.d.ts +3 -1
- package/dist/types/hooks/useRetry.console-tests.d.ts +41 -0
- package/dist/types/hooks/useRetry.d.ts +22 -3
- package/dist/types/i18n/locales/de-DE.d.ts +23 -0
- package/dist/types/i18n/locales/en-GB.d.ts +23 -0
- package/dist/types/i18n/locales/es-ES.d.ts +23 -0
- package/dist/types/i18n/locales/fr-FR.d.ts +23 -0
- package/dist/types/i18n/locales/ja-JP.d.ts +23 -0
- package/dist/types/i18n/locales/ko-KR.d.ts +23 -0
- package/dist/types/i18n/locales/nl-NL.d.ts +23 -0
- package/dist/types/i18n/locales/pt-PT.d.ts +23 -0
- package/dist/types/i18n/locales/ru-RU.d.ts +23 -0
- package/dist/types/i18n/locales/zh-CN.d.ts +23 -0
- package/dist/types/i18n/locales/zh-HK.d.ts +23 -0
- package/dist/types/i18n/locales/zh-TW.d.ts +23 -0
- package/dist/types/out/base-fraud-detection.d.ts +1 -0
- package/dist/types/out/config.d.ts +6 -1
- package/dist/types/out/fraud-detection.d.ts +2 -8
- package/dist/types/out/types.d.ts +3 -1
- package/dist/types/out/worldpay-ddc-manager.d.ts +6 -7
- package/dist/types/types/event.d.ts +46 -13
- package/dist/types/types/index.d.ts +8 -37
- package/dist/types/types/message.d.ts +48 -7
- package/dist/types/types/payment.d.ts +63 -0
- package/dist/types/utils/app-payment.d.ts +7 -3
- package/dist/types/utils/behavior-tracker.d.ts +36 -0
- package/dist/types/utils/env.d.ts +37 -0
- package/dist/types/utils/iframe.d.ts +1 -1
- package/dist/types/utils/payment.d.ts +10 -10
- package/package.json +12 -5
- package/dist/es/components/Boost/index.js +0 -348
- package/dist/es/components/GrabPay/index.js +0 -348
- package/dist/es/components/LinePay/index.js +0 -348
- package/dist/es/components/MayBankQRPay/index.js +0 -354
- package/dist/es/components/NinePay/index.js +0 -348
- package/dist/es/components/ShopeePay/index.js +0 -348
- package/dist/es/components/TNGWallet/index.js +0 -348
- package/dist/types/components/MayBankQRPay/MayBankQRPay.d.ts +0 -10
- package/dist/types/components/NinePay/NinePay.d.ts +0 -10
- package/dist/types/utils/logger.d.ts +0 -14
- /package/dist/types/components/{Boost → wallets/Boost}/index.d.ts +0 -0
- /package/dist/types/components/{GrabPay → wallets/GrabPay}/index.d.ts +0 -0
- /package/dist/types/components/{LinePay → wallets/LinePay}/index.d.ts +0 -0
- /package/dist/types/components/{MayBankQRPay → wallets/MayBankQRPay}/index.d.ts +0 -0
- /package/dist/types/components/{NinePay → wallets/NinePay}/index.d.ts +0 -0
- /package/dist/types/components/{ShopeePay → wallets/ShopeePay}/index.d.ts +0 -0
- /package/dist/types/components/{TNGWallet → wallets/TNGWallet}/index.d.ts +0 -0
|
@@ -4,7 +4,7 @@ import { intersection } from "../../utils/index.js";
|
|
|
4
4
|
import { defaultInputStyleConfig } from "../../types/index.js";
|
|
5
5
|
import { getCardPayInfo, cardPay } from "../../api/modules/card/index.js";
|
|
6
6
|
import { getBrowserParams } from "../../api/modules/get-browser-params.js";
|
|
7
|
-
import { PaymentType, SessionMode, CardPaymentMethods,
|
|
7
|
+
import { PaymentMethod, PaymentType, SessionMode, CardPaymentMethods, COMMON_CLASS_NAME } from "../../constant.js";
|
|
8
8
|
import { CoreContext } from "../../core/context.js";
|
|
9
9
|
import { PayKKaError } from "../../core/error.js";
|
|
10
10
|
import "../../out/worldpay-jsc-origin.js";
|
|
@@ -12,7 +12,7 @@ import { createPromise } from "../../utils/create-promise.js";
|
|
|
12
12
|
import { useBEM } from "../../hooks/useBEM.js";
|
|
13
13
|
import { usePayState } from "../../hooks/usePayState.js";
|
|
14
14
|
import { useRetry } from "../../hooks/useRetry.js";
|
|
15
|
-
import { AddressField } from "../AddressField/index.js";
|
|
15
|
+
import { DEFAULT_ADDRESS, AddressField } from "../AddressField/index.js";
|
|
16
16
|
import { CardBrands } from "../CardBrands/index.js";
|
|
17
17
|
import { CardExpireDateField } from "../CardExpireDateField/index.js";
|
|
18
18
|
import { CardHolderNameField } from "../CardHolderNameField/index.js";
|
|
@@ -35,10 +35,11 @@ import { CombinedCardInfo } from "../CombinedCardInfo/index.js";
|
|
|
35
35
|
import { cardBrandCodes } from "../../utils/card-brand/brands.js";
|
|
36
36
|
import { findCardBrand } from "../../utils/card-brand/index.js";
|
|
37
37
|
import { separateInputStyle } from "../../utils/style.js";
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
38
|
+
import { normalizedClass, trimAll, limitedToNumber, formatAmount } from "../../utils/format.js";
|
|
39
|
+
import { formatPaymentResult, processPaymentStatus } from "../../utils/payment.js";
|
|
40
40
|
const { bem } = useBEM("card");
|
|
41
41
|
const fieldClassNames = bem("field");
|
|
42
|
+
const CURR_PAYMENT_METHOD = PaymentMethod.BANKCARD;
|
|
42
43
|
const Card = w((props, ref) => {
|
|
43
44
|
var _a, _b;
|
|
44
45
|
const {
|
|
@@ -57,7 +58,7 @@ const Card = w((props, ref) => {
|
|
|
57
58
|
} = props;
|
|
58
59
|
const addressCore = core.getAddressCore();
|
|
59
60
|
const emailState = createEmailCore();
|
|
60
|
-
const { i18n, fraudDetection, sessionReady } = usePayState(session, core);
|
|
61
|
+
const { i18n, fraudDetection, sessionReady, disabled } = usePayState(session, core);
|
|
61
62
|
const addressFieldRef = A(null);
|
|
62
63
|
const emailFieldRef = A(null);
|
|
63
64
|
const combinedCardInfoRef = A(null);
|
|
@@ -69,15 +70,7 @@ const Card = w((props, ref) => {
|
|
|
69
70
|
securityCode: "",
|
|
70
71
|
holderName: "",
|
|
71
72
|
cardInfo: "",
|
|
72
|
-
address: {
|
|
73
|
-
country: void 0,
|
|
74
|
-
province: void 0,
|
|
75
|
-
city: void 0,
|
|
76
|
-
area: void 0,
|
|
77
|
-
postCode: void 0,
|
|
78
|
-
address1: void 0,
|
|
79
|
-
address2: void 0
|
|
80
|
-
}
|
|
73
|
+
address: { ...DEFAULT_ADDRESS }
|
|
81
74
|
});
|
|
82
75
|
const [validated, setValidated] = h(false);
|
|
83
76
|
const [submitButtonStatus, setSubmitButtonStatus] = h("unSubmit");
|
|
@@ -94,25 +87,27 @@ const Card = w((props, ref) => {
|
|
|
94
87
|
const [inputStyle, setInputStyle] = h({});
|
|
95
88
|
const [splitCardInfo] = h(cardInfoLayout === "split");
|
|
96
89
|
const currentBin = A("");
|
|
90
|
+
const [hiddenIframeName, setHiddenIframeName] = h("");
|
|
97
91
|
F(ref, () => ({
|
|
98
92
|
checkThreeDS,
|
|
99
93
|
updateAddress: () => {
|
|
100
94
|
var _a2;
|
|
101
95
|
if (!(fieldStatus == null ? void 0 : fieldStatus.address.show))
|
|
102
96
|
return;
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
(
|
|
106
|
-
|
|
97
|
+
const address = addressCore.getAddressState();
|
|
98
|
+
form.address = address;
|
|
99
|
+
setForm(form);
|
|
100
|
+
(_a2 = addressFieldRef.current) == null ? void 0 : _a2.update(address);
|
|
101
|
+
validateFormSilently();
|
|
107
102
|
},
|
|
108
103
|
updateEmail: () => {
|
|
109
104
|
var _a2;
|
|
110
105
|
if (!(fieldStatus == null ? void 0 : fieldStatus.email.show))
|
|
111
106
|
return;
|
|
112
|
-
|
|
113
|
-
setForm(
|
|
107
|
+
form.email = emailState.email;
|
|
108
|
+
setForm(form);
|
|
114
109
|
(_a2 = emailFieldRef.current) == null ? void 0 : _a2.update(emailState.email);
|
|
115
|
-
|
|
110
|
+
validateFormSilently();
|
|
116
111
|
},
|
|
117
112
|
payment: () => {
|
|
118
113
|
hidePaymentButton && onSubmit();
|
|
@@ -136,17 +131,20 @@ const Card = w((props, ref) => {
|
|
|
136
131
|
setFieldStatus({ ...field });
|
|
137
132
|
};
|
|
138
133
|
const initElementStyles = () => {
|
|
139
|
-
if (!styles)
|
|
134
|
+
if (!styles)
|
|
140
135
|
return;
|
|
141
|
-
}
|
|
142
136
|
const { input } = separateInputStyle(styles);
|
|
143
137
|
input && setInputStyle(input);
|
|
144
138
|
};
|
|
139
|
+
const getPaymentMethodContext = () => {
|
|
140
|
+
return {
|
|
141
|
+
paymentMethod: CURR_PAYMENT_METHOD
|
|
142
|
+
};
|
|
143
|
+
};
|
|
145
144
|
y(() => {
|
|
146
145
|
var _a2, _b2;
|
|
147
|
-
if (!sessionReady)
|
|
146
|
+
if (!sessionReady)
|
|
148
147
|
return;
|
|
149
|
-
}
|
|
150
148
|
const { status, supportMethods = [], bill = {}, sessionMode, country } = (session == null ? void 0 : session.checkout) || {};
|
|
151
149
|
if (sessionMode === SessionMode.DROP_IN && !isDropIn) {
|
|
152
150
|
(_b2 = (_a2 = props.core.config).onInitError) == null ? void 0 : _b2.call(
|
|
@@ -155,9 +153,8 @@ const Card = w((props, ref) => {
|
|
|
155
153
|
);
|
|
156
154
|
return;
|
|
157
155
|
}
|
|
158
|
-
if (!intersection(supportMethods, CardPaymentMethods).length)
|
|
156
|
+
if (!intersection(supportMethods, CardPaymentMethods).length)
|
|
159
157
|
return;
|
|
160
|
-
}
|
|
161
158
|
initFieldStatus();
|
|
162
159
|
initElementStyles();
|
|
163
160
|
setSecurity(sessionMode !== SessionMode.HOSTED);
|
|
@@ -175,34 +172,36 @@ const Card = w((props, ref) => {
|
|
|
175
172
|
var _a2;
|
|
176
173
|
setErrorMsg(message || i18n.get("common.payTimeout"));
|
|
177
174
|
setSubmitButtonStatus("unSubmit");
|
|
178
|
-
(_a2 = props.onTimeout) == null ? void 0 : _a2.call(props);
|
|
179
|
-
core.
|
|
175
|
+
(_a2 = props.onTimeout) == null ? void 0 : _a2.call(props, "retry", getPaymentMethodContext());
|
|
176
|
+
core.payment.resetCurrPaymentMethod();
|
|
180
177
|
},
|
|
181
178
|
[i18n, props.onTimeout]
|
|
182
179
|
);
|
|
183
180
|
const processOnSuccess = (res) => {
|
|
184
181
|
var _a2, _b2;
|
|
185
182
|
setSubmitButtonStatus("success");
|
|
186
|
-
|
|
183
|
+
const paymentInfo = formatPaymentResult({
|
|
187
184
|
...res,
|
|
188
185
|
returnUrl: (_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.returnUrl
|
|
189
|
-
})
|
|
186
|
+
});
|
|
187
|
+
(_b2 = props.onSuccess) == null ? void 0 : _b2.call(props, paymentInfo, getPaymentMethodContext());
|
|
190
188
|
};
|
|
191
189
|
const processOnError = (error) => {
|
|
192
190
|
var _a2;
|
|
193
|
-
(_a2 = props.onError) == null ? void 0 : _a2.call(props, error);
|
|
194
|
-
core.
|
|
191
|
+
(_a2 = props.onError) == null ? void 0 : _a2.call(props, error, getPaymentMethodContext());
|
|
192
|
+
core.payment.resetCurrPaymentMethod();
|
|
195
193
|
};
|
|
196
|
-
const { start: startReFetchPayInfo } = useRetry(
|
|
197
|
-
|
|
198
|
-
|
|
194
|
+
const { start: startReFetchPayInfo } = useRetry(
|
|
195
|
+
(timeout) => pay(true, timeout),
|
|
196
|
+
{
|
|
197
|
+
onTimeout: () => onTimeout(i18n.get("common.queryTimeout"))
|
|
198
|
+
}
|
|
199
|
+
);
|
|
199
200
|
const validatePromise = A(createPromise());
|
|
200
201
|
const onValidated = (data) => {
|
|
201
202
|
fieldValidStatusMap.current[data.fieldType].status = data.status;
|
|
202
203
|
const results = Object.values(fieldValidStatusMap.current);
|
|
203
|
-
if (results.includes(null)) {
|
|
204
|
-
return;
|
|
205
|
-
} else {
|
|
204
|
+
if (!results.includes(null)) {
|
|
206
205
|
const validateResult = results.every((result) => result.status === "success");
|
|
207
206
|
if (validateResult) {
|
|
208
207
|
validatePromise.current.resolve(true);
|
|
@@ -211,6 +210,9 @@ const Card = w((props, ref) => {
|
|
|
211
210
|
}
|
|
212
211
|
}
|
|
213
212
|
};
|
|
213
|
+
const onHiddenIframeReady = (data) => {
|
|
214
|
+
setHiddenIframeName(data.name);
|
|
215
|
+
};
|
|
214
216
|
const validateCombineCardInfo = async () => {
|
|
215
217
|
var _a2;
|
|
216
218
|
validatePromise.current = createPromise();
|
|
@@ -234,7 +236,7 @@ const Card = w((props, ref) => {
|
|
|
234
236
|
(_a2 = formRef.current) == null ? void 0 : _a2.validate(async (errors) => {
|
|
235
237
|
var _a3;
|
|
236
238
|
(fieldStatus == null ? void 0 : fieldStatus.address.show) && addressCore.setValidateAllFields(true);
|
|
237
|
-
(_a3 = props.onSubmit) == null ? void 0 : _a3.call(props, errors);
|
|
239
|
+
(_a3 = props.onSubmit) == null ? void 0 : _a3.call(props, errors, getPaymentMethodContext());
|
|
238
240
|
if (errors) {
|
|
239
241
|
setSubmitButtonStatus("unSubmit");
|
|
240
242
|
return;
|
|
@@ -245,14 +247,14 @@ const Card = w((props, ref) => {
|
|
|
245
247
|
});
|
|
246
248
|
}
|
|
247
249
|
const getPaymentParams = async () => {
|
|
248
|
-
var _a2
|
|
250
|
+
var _a2;
|
|
249
251
|
const cardNo = trimAll(form.number);
|
|
250
252
|
const cardBrand = findCardBrand(cardNo);
|
|
251
253
|
const [expMonth, expYear] = form.expireDate.split("/");
|
|
252
254
|
const isFastPaymentForm = isFastPayment && !isEditOtherCard;
|
|
253
255
|
let paymentMethod = null;
|
|
254
256
|
if (isFastPayment) {
|
|
255
|
-
paymentMethod =
|
|
257
|
+
paymentMethod = CURR_PAYMENT_METHOD;
|
|
256
258
|
} else {
|
|
257
259
|
if (security) {
|
|
258
260
|
const fieldRef = splitCardInfo ? cardNumberFieldRef : combinedCardInfoRef;
|
|
@@ -261,10 +263,6 @@ const Card = w((props, ref) => {
|
|
|
261
263
|
paymentMethod = cardBrand.code;
|
|
262
264
|
}
|
|
263
265
|
}
|
|
264
|
-
let cardBin;
|
|
265
|
-
if (security) {
|
|
266
|
-
cardBin = splitCardInfo ? (_b2 = cardNumberFieldRef.current) == null ? void 0 : _b2.binValue() : (_c = combinedCardInfoRef.current) == null ? void 0 : _c.binValue();
|
|
267
|
-
}
|
|
268
266
|
return {
|
|
269
267
|
sessionId: session.sessionId,
|
|
270
268
|
clientKey: session.clientKey,
|
|
@@ -295,7 +293,9 @@ const Card = w((props, ref) => {
|
|
|
295
293
|
},
|
|
296
294
|
browser: await getBrowserParams({
|
|
297
295
|
fraudDetectionId: await (fraudDetection == null ? void 0 : fraudDetection.getFraudDetectionId({
|
|
298
|
-
bin:
|
|
296
|
+
bin: limitedToNumber(form.number).slice(0, 9),
|
|
297
|
+
// 快捷支付场景没有 bin,不需要传 hiddenIframeName
|
|
298
|
+
hiddenIframeName: isFastPayment ? "" : hiddenIframeName
|
|
299
299
|
}))
|
|
300
300
|
})
|
|
301
301
|
};
|
|
@@ -303,10 +303,11 @@ const Card = w((props, ref) => {
|
|
|
303
303
|
async function pay(search = false, timeout) {
|
|
304
304
|
var _a2, _b2, _c, _d, _e;
|
|
305
305
|
try {
|
|
306
|
+
core.payment.currPaymentMethod.value = CURR_PAYMENT_METHOD;
|
|
306
307
|
const requestOptions = { locale: i18n.locale, timeout };
|
|
307
308
|
let res = null;
|
|
308
309
|
if (search) {
|
|
309
|
-
const extraParams = (_b2 = (_a2 = core.config)._getExtraParams) == null ? void 0 : _b2.call(_a2, "query",
|
|
310
|
+
const extraParams = (_b2 = (_a2 = core.config)._getExtraParams) == null ? void 0 : _b2.call(_a2, "query", CURR_PAYMENT_METHOD);
|
|
310
311
|
res = await getCardPayInfo(
|
|
311
312
|
{
|
|
312
313
|
sessionId: session.sessionId,
|
|
@@ -317,7 +318,7 @@ const Card = w((props, ref) => {
|
|
|
317
318
|
);
|
|
318
319
|
} else {
|
|
319
320
|
const paymentParams = await getPaymentParams();
|
|
320
|
-
const extraParams = (_d = (_c = core.config)._getExtraParams) == null ? void 0 : _d.call(_c, "payment",
|
|
321
|
+
const extraParams = (_d = (_c = core.config)._getExtraParams) == null ? void 0 : _d.call(_c, "payment", CURR_PAYMENT_METHOD);
|
|
321
322
|
if (security) {
|
|
322
323
|
(_e = SFPRef.current) == null ? void 0 : _e.payment(paymentParams, extraParams);
|
|
323
324
|
return { end: true };
|
|
@@ -362,42 +363,62 @@ const Card = w((props, ref) => {
|
|
|
362
363
|
setThreeDSInfo(void 0);
|
|
363
364
|
checkThreeDS();
|
|
364
365
|
};
|
|
365
|
-
const processAfterPayment = (res, search = false) => {
|
|
366
|
-
var _a2
|
|
367
|
-
const {
|
|
366
|
+
const processAfterPayment = async (res, search = false) => {
|
|
367
|
+
var _a2;
|
|
368
|
+
const { errorMessage, errorCode, payInfo = {}, sessionId } = res;
|
|
368
369
|
const { threeDSUrl } = payInfo;
|
|
369
370
|
sessionId && (session.sessionId = sessionId);
|
|
370
|
-
if (
|
|
371
|
-
|
|
371
|
+
if (!search) {
|
|
372
|
+
(_a2 = props.onSubmitResponse) == null ? void 0 : _a2.call(props, res, {
|
|
373
|
+
...getPaymentMethodContext(),
|
|
374
|
+
orderId: res.orderId,
|
|
375
|
+
sessionId: session.sessionId
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
let end = true;
|
|
379
|
+
await processPaymentStatus(res, {
|
|
380
|
+
onProcessing: () => {
|
|
381
|
+
!search && startReFetchPayInfo();
|
|
382
|
+
end = false;
|
|
383
|
+
},
|
|
384
|
+
onAuthorized: () => {
|
|
385
|
+
var _a3;
|
|
372
386
|
setSubmitButtonStatus("unSubmit");
|
|
373
|
-
|
|
387
|
+
(_a3 = props.onAuthorized) == null ? void 0 : _a3.call(props, getPaymentMethodContext());
|
|
388
|
+
},
|
|
389
|
+
onInThreeDS: () => {
|
|
390
|
+
if (threeDSUrl) {
|
|
391
|
+
processThreeDS(threeDSUrl, false);
|
|
392
|
+
} else {
|
|
393
|
+
end = false;
|
|
394
|
+
}
|
|
395
|
+
},
|
|
396
|
+
onInPreviousThreeDS: () => {
|
|
397
|
+
if (threeDSUrl) {
|
|
398
|
+
processThreeDS(threeDSUrl, true);
|
|
399
|
+
} else {
|
|
400
|
+
end = false;
|
|
401
|
+
}
|
|
402
|
+
},
|
|
403
|
+
onSuccess: () => {
|
|
374
404
|
processOnSuccess(res);
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
405
|
+
},
|
|
406
|
+
onExpired: () => {
|
|
407
|
+
var _a3;
|
|
408
|
+
setSubmitButtonStatus("unSubmit");
|
|
409
|
+
(_a3 = props.onExpired) == null ? void 0 : _a3.call(props, getPaymentMethodContext());
|
|
410
|
+
},
|
|
411
|
+
onFailure: () => {
|
|
379
412
|
errorMessage && setErrorMsg(errorMessage);
|
|
380
413
|
setSubmitButtonStatus("unSubmit");
|
|
381
414
|
processOnError(new PayKKaError("API_ERROR", errorMessage, { code: errorCode }));
|
|
382
|
-
}
|
|
415
|
+
},
|
|
416
|
+
onDefault: () => {
|
|
417
|
+
core.payment.resetCurrPaymentMethod();
|
|
383
418
|
setSubmitButtonStatus("unSubmit");
|
|
384
|
-
(_a2 = props.onAuthorized) == null ? void 0 : _a2.call(props);
|
|
385
|
-
} else if (orderStatus === "IN_THREED") {
|
|
386
|
-
threeDSUrl && processThreeDS(threeDSUrl, false);
|
|
387
|
-
} else if (orderStatus === "IN_PREVIOUS_THREED") {
|
|
388
|
-
threeDSUrl && processThreeDS(threeDSUrl, true);
|
|
389
419
|
}
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
processOnSuccess(res);
|
|
393
|
-
return { end: true };
|
|
394
|
-
} else if (status === "EXPIRED") {
|
|
395
|
-
setSubmitButtonStatus("unSubmit");
|
|
396
|
-
(_b2 = props.onExpired) == null ? void 0 : _b2.call(props);
|
|
397
|
-
return { end: true };
|
|
398
|
-
}
|
|
399
|
-
setSubmitButtonStatus("unSubmit");
|
|
400
|
-
return { end: true };
|
|
420
|
+
});
|
|
421
|
+
return { end };
|
|
401
422
|
};
|
|
402
423
|
const processPaymentError = (error) => {
|
|
403
424
|
const message = error.i18nKey ? i18n.get(error.i18nKey) : error.message;
|
|
@@ -405,16 +426,12 @@ const Card = w((props, ref) => {
|
|
|
405
426
|
setSubmitButtonStatus("unSubmit");
|
|
406
427
|
processOnError(new PayKKaError("API_ERROR", message, { code: error.code, cause: error }));
|
|
407
428
|
};
|
|
408
|
-
const
|
|
429
|
+
const validateFormSilently = () => {
|
|
409
430
|
var _a2;
|
|
410
|
-
(_a2 = formRef.current) == null ? void 0 : _a2.validate(void 0, false).then(() =>
|
|
411
|
-
setValidated(true);
|
|
412
|
-
}).catch(() => {
|
|
413
|
-
setValidated(false);
|
|
414
|
-
});
|
|
431
|
+
(_a2 = formRef.current) == null ? void 0 : _a2.validate(void 0, false).then(() => setValidated(true)).catch(() => setValidated(false));
|
|
415
432
|
};
|
|
416
433
|
y(() => {
|
|
417
|
-
|
|
434
|
+
validateFormSilently();
|
|
418
435
|
}, [form]);
|
|
419
436
|
const Button = () => {
|
|
420
437
|
var _a2;
|
|
@@ -426,6 +443,7 @@ const Card = w((props, ref) => {
|
|
|
426
443
|
{
|
|
427
444
|
className: bem("button"),
|
|
428
445
|
status: submitButtonStatus,
|
|
446
|
+
disabled,
|
|
429
447
|
text,
|
|
430
448
|
loadingText: i18n.get("common.payProcessing"),
|
|
431
449
|
successText: i18n.get("common.paySuccess"),
|
|
@@ -442,11 +460,11 @@ const Card = w((props, ref) => {
|
|
|
442
460
|
}
|
|
443
461
|
);
|
|
444
462
|
async function checkThreeDS(search = false, timeout = 2e4) {
|
|
445
|
-
var _a2, _b2
|
|
463
|
+
var _a2, _b2;
|
|
446
464
|
if (!session)
|
|
447
465
|
return { end: true };
|
|
448
466
|
try {
|
|
449
|
-
const extraParams = (_b2 = (_a2 = core.config)._getExtraParams) == null ? void 0 : _b2.call(_a2, "query",
|
|
467
|
+
const extraParams = (_b2 = (_a2 = core.config)._getExtraParams) == null ? void 0 : _b2.call(_a2, "query", CURR_PAYMENT_METHOD);
|
|
450
468
|
const res = await getCardPayInfo(
|
|
451
469
|
{
|
|
452
470
|
sessionId: session.sessionId,
|
|
@@ -458,42 +476,48 @@ const Card = w((props, ref) => {
|
|
|
458
476
|
timeout
|
|
459
477
|
}
|
|
460
478
|
);
|
|
461
|
-
const {
|
|
462
|
-
|
|
463
|
-
|
|
479
|
+
const { errorMessage, errorCode } = res;
|
|
480
|
+
let end = true;
|
|
481
|
+
await processPaymentStatus(res, {
|
|
482
|
+
onProcessing: () => {
|
|
464
483
|
startReFetchPayInfo();
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
processOnError(new PayKKaError("API_ERROR", errorMessage, { code: errorCode }));
|
|
469
|
-
} else if (orderStatus === "AUTHORIZED") {
|
|
484
|
+
},
|
|
485
|
+
onAuthorized: () => {
|
|
486
|
+
var _a3;
|
|
470
487
|
setSubmitButtonStatus("unSubmit");
|
|
471
|
-
(
|
|
472
|
-
}
|
|
488
|
+
(_a3 = props.onAuthorized) == null ? void 0 : _a3.call(props, getPaymentMethodContext());
|
|
489
|
+
},
|
|
490
|
+
onInThreeDS: () => {
|
|
473
491
|
setSubmitButtonStatus("loading");
|
|
474
492
|
!search && startReFetchCardPay3DSInfo();
|
|
475
|
-
|
|
476
|
-
}
|
|
493
|
+
end = false;
|
|
494
|
+
},
|
|
495
|
+
onInPreviousThreeDS: () => {
|
|
496
|
+
setSubmitButtonStatus("unSubmit");
|
|
477
497
|
setErrorMsg(i18n.get("common.pay3DSIncomplete"));
|
|
498
|
+
},
|
|
499
|
+
onSuccess: () => {
|
|
500
|
+
processOnSuccess(res);
|
|
501
|
+
stopReFetchCardPay3DSInfo();
|
|
502
|
+
},
|
|
503
|
+
onExpired: () => {
|
|
504
|
+
var _a3;
|
|
478
505
|
setSubmitButtonStatus("unSubmit");
|
|
479
|
-
|
|
506
|
+
(_a3 = props.onExpired) == null ? void 0 : _a3.call(props, getPaymentMethodContext());
|
|
507
|
+
stopReFetchCardPay3DSInfo();
|
|
508
|
+
},
|
|
509
|
+
onFailure: () => {
|
|
510
|
+
errorMessage && setErrorMsg(errorMessage);
|
|
511
|
+
setSubmitButtonStatus("unSubmit");
|
|
512
|
+
processOnError(new PayKKaError("API_ERROR", errorMessage, { code: errorCode }));
|
|
513
|
+
},
|
|
514
|
+
onDefault: () => {
|
|
515
|
+
core.payment.resetCurrPaymentMethod();
|
|
480
516
|
setSubmitButtonStatus("unSubmit");
|
|
517
|
+
stopReFetchCardPay3DSInfo();
|
|
481
518
|
}
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
} else if (status === "SUCCESS") {
|
|
485
|
-
processOnSuccess(res);
|
|
486
|
-
stopReFetchCardPay3DSInfo();
|
|
487
|
-
return { end: true };
|
|
488
|
-
} else if (status === "EXPIRED") {
|
|
489
|
-
setSubmitButtonStatus("unSubmit");
|
|
490
|
-
(_d = props.onExpired) == null ? void 0 : _d.call(props);
|
|
491
|
-
stopReFetchCardPay3DSInfo();
|
|
492
|
-
return { end: true };
|
|
493
|
-
}
|
|
494
|
-
setSubmitButtonStatus("unSubmit");
|
|
495
|
-
stopReFetchCardPay3DSInfo();
|
|
496
|
-
return { end: true };
|
|
519
|
+
});
|
|
520
|
+
return { end };
|
|
497
521
|
} catch (error) {
|
|
498
522
|
if (isTimeoutError(error)) {
|
|
499
523
|
if (search) {
|
|
@@ -511,17 +535,15 @@ const Card = w((props, ref) => {
|
|
|
511
535
|
}
|
|
512
536
|
const isFastPayment = T(() => {
|
|
513
537
|
var _a2;
|
|
514
|
-
if (!(session == null ? void 0 : session.checkout))
|
|
538
|
+
if (!(session == null ? void 0 : session.checkout))
|
|
515
539
|
return;
|
|
516
|
-
}
|
|
517
540
|
const isPurchase = (session == null ? void 0 : session.checkout.paymentType) === PaymentType.PURCHASE;
|
|
518
541
|
const hasCardTokens = !!((_a2 = session == null ? void 0 : session.checkout.tokens) == null ? void 0 : _a2.length);
|
|
519
542
|
return isPurchase && hasCardTokens;
|
|
520
543
|
}, [session == null ? void 0 : session.checkout]);
|
|
521
544
|
const isShowStoreCheckBox = T(() => {
|
|
522
|
-
if (!(session == null ? void 0 : session.checkout))
|
|
545
|
+
if (!(session == null ? void 0 : session.checkout))
|
|
523
546
|
return;
|
|
524
|
-
}
|
|
525
547
|
return (session == null ? void 0 : session.checkout.paymentType) === PaymentType.PURCHASE && (session == null ? void 0 : session.checkout.storePaymentMethod);
|
|
526
548
|
}, [session == null ? void 0 : session.checkout]);
|
|
527
549
|
const StoreCheckBox = () => {
|
|
@@ -532,6 +554,7 @@ const Card = w((props, ref) => {
|
|
|
532
554
|
CheckBox,
|
|
533
555
|
{
|
|
534
556
|
label: i18n.get("card.storeInfo"),
|
|
557
|
+
disabled,
|
|
535
558
|
checked: storePaymentMethod,
|
|
536
559
|
onChange: onCheck
|
|
537
560
|
}
|
|
@@ -546,7 +569,7 @@ const Card = w((props, ref) => {
|
|
|
546
569
|
(_a3 = formRef.current) == null ? void 0 : _a3.resetValidation();
|
|
547
570
|
setIsEditOtherCard(false);
|
|
548
571
|
};
|
|
549
|
-
return isPurchase && hasCardTokens && /* @__PURE__ */ u("div", { className: bem("change-box"), onClick, children: [
|
|
572
|
+
return isPurchase && hasCardTokens && /* @__PURE__ */ u("div", { className: bem("change-box", { disabled }), onClick, children: [
|
|
550
573
|
/* @__PURE__ */ u(IconSwitch, {}),
|
|
551
574
|
/* @__PURE__ */ u("span", { style: { marginLeft: "2px" }, children: i18n.get("card.cardSelector.change") })
|
|
552
575
|
] });
|
|
@@ -559,9 +582,8 @@ const Card = w((props, ref) => {
|
|
|
559
582
|
const onClickChangeCard = () => {
|
|
560
583
|
var _a2;
|
|
561
584
|
const tokens = ((_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.tokens) || [];
|
|
562
|
-
if (tokens.length > 1)
|
|
585
|
+
if (tokens.length > 1)
|
|
563
586
|
return;
|
|
564
|
-
}
|
|
565
587
|
onEditOtherCard();
|
|
566
588
|
};
|
|
567
589
|
const onCardChange = (option) => {
|
|
@@ -570,7 +592,7 @@ const Card = w((props, ref) => {
|
|
|
570
592
|
};
|
|
571
593
|
const setFormRef = (dom) => {
|
|
572
594
|
formRef.current = dom;
|
|
573
|
-
dom &&
|
|
595
|
+
dom && validateFormSilently();
|
|
574
596
|
};
|
|
575
597
|
const cardNumberFieldRef = A(null);
|
|
576
598
|
const cardExpireDateFieldRef = A(null);
|
|
@@ -631,7 +653,7 @@ const Card = w((props, ref) => {
|
|
|
631
653
|
(_d = fieldRef.current) == null ? void 0 : _d.resetValidation(data.status, error);
|
|
632
654
|
}
|
|
633
655
|
setTimeout(() => {
|
|
634
|
-
|
|
656
|
+
validateFormSilently();
|
|
635
657
|
}, 100);
|
|
636
658
|
};
|
|
637
659
|
const onBrand = (data) => {
|
|
@@ -663,28 +685,41 @@ const Card = w((props, ref) => {
|
|
|
663
685
|
{
|
|
664
686
|
ref: emailFieldRef,
|
|
665
687
|
value: form.email,
|
|
666
|
-
disabled: fieldStatus == null ? void 0 : fieldStatus.email.disabled
|
|
688
|
+
disabled: (fieldStatus == null ? void 0 : fieldStatus.email.disabled) || disabled
|
|
667
689
|
}
|
|
668
690
|
) }) });
|
|
669
691
|
};
|
|
692
|
+
const CardHolderName = () => {
|
|
693
|
+
return /* @__PURE__ */ u(b, { children: (fieldStatus == null ? void 0 : fieldStatus.holderName.show) && /* @__PURE__ */ u("div", { className: bem("holder-name"), children: /* @__PURE__ */ u(CardHolderNameField, { disabled: (fieldStatus == null ? void 0 : fieldStatus.holderName.disabled) || disabled }) }) });
|
|
694
|
+
};
|
|
670
695
|
const Address = () => {
|
|
671
|
-
var _a2, _b2;
|
|
672
696
|
return /* @__PURE__ */ u(b, { children: (fieldStatus == null ? void 0 : fieldStatus.address.show) && /* @__PURE__ */ u("div", { className: bem("address"), children: /* @__PURE__ */ u(
|
|
673
697
|
AddressField,
|
|
674
698
|
{
|
|
675
699
|
ref: addressFieldRef,
|
|
676
700
|
value: form.address,
|
|
677
|
-
|
|
678
|
-
|
|
701
|
+
disabled,
|
|
702
|
+
onChange: (value) => setForm(Object.assign(form, { address: value }))
|
|
679
703
|
}
|
|
680
704
|
) }) });
|
|
681
705
|
};
|
|
682
706
|
const ErrorMessage = () => {
|
|
683
707
|
return /* @__PURE__ */ u(b, { children: !!errorMsg && /* @__PURE__ */ u(Info, { content: errorMsg }) });
|
|
684
708
|
};
|
|
685
|
-
const
|
|
709
|
+
const CardCombineInfo = () => {
|
|
710
|
+
return /* @__PURE__ */ u("div", { className: bem("card-info"), children: /* @__PURE__ */ u(
|
|
711
|
+
CombinedCardInfo,
|
|
712
|
+
{
|
|
713
|
+
ref: combinedCardInfoRef,
|
|
714
|
+
supportedCardBrands,
|
|
715
|
+
showLabel: true,
|
|
716
|
+
security
|
|
717
|
+
}
|
|
718
|
+
) });
|
|
719
|
+
};
|
|
720
|
+
const CardSplitInfo = () => {
|
|
686
721
|
var _a2, _b2, _c, _d;
|
|
687
|
-
return
|
|
722
|
+
return /* @__PURE__ */ u(b, { children: [
|
|
688
723
|
/* @__PURE__ */ u("div", { className: fieldClassNames, children: [
|
|
689
724
|
/* @__PURE__ */ u("div", { className: bem("card-number-wrapper"), children: [
|
|
690
725
|
/* @__PURE__ */ u(
|
|
@@ -693,6 +728,7 @@ const Card = w((props, ref) => {
|
|
|
693
728
|
supportedCardBrands: (_b2 = (_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.supportMethods) == null ? void 0 : _b2.filter(Boolean),
|
|
694
729
|
security,
|
|
695
730
|
ref: cardNumberFieldRef,
|
|
731
|
+
disabled,
|
|
696
732
|
onBinValue: onBinValueChanged
|
|
697
733
|
}
|
|
698
734
|
),
|
|
@@ -712,6 +748,7 @@ const Card = w((props, ref) => {
|
|
|
712
748
|
{
|
|
713
749
|
security,
|
|
714
750
|
className: fieldClassNames,
|
|
751
|
+
disabled,
|
|
715
752
|
ref: cardExpireDateFieldRef
|
|
716
753
|
}
|
|
717
754
|
),
|
|
@@ -720,26 +757,19 @@ const Card = w((props, ref) => {
|
|
|
720
757
|
{
|
|
721
758
|
security,
|
|
722
759
|
className: fieldClassNames,
|
|
760
|
+
disabled,
|
|
723
761
|
ref: cardSecurityCodeFieldRef
|
|
724
762
|
}
|
|
725
763
|
)
|
|
726
764
|
] })
|
|
727
|
-
] })
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
ref: combinedCardInfoRef,
|
|
731
|
-
supportedCardBrands,
|
|
732
|
-
showLabel: true,
|
|
733
|
-
security
|
|
734
|
-
}
|
|
735
|
-
) });
|
|
736
|
-
}, [splitCardInfo, security]);
|
|
737
|
-
const cardForm = () => {
|
|
765
|
+
] });
|
|
766
|
+
};
|
|
767
|
+
const PaymentForm = () => {
|
|
738
768
|
var _a2;
|
|
739
769
|
return /* @__PURE__ */ u(Form, { form, ref: setFormRef, onFormChange: (form2) => setForm(form2), children: /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, bem()), children: [
|
|
740
770
|
Email(),
|
|
741
|
-
|
|
742
|
-
(
|
|
771
|
+
splitCardInfo ? CardSplitInfo() : CardCombineInfo(),
|
|
772
|
+
CardHolderName(),
|
|
743
773
|
Address(),
|
|
744
774
|
((_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.paymentType) === PaymentType.RECURRING && RecurringTip(),
|
|
745
775
|
/* @__PURE__ */ u("div", { className: bem("footer-wrapper"), children: [
|
|
@@ -749,7 +779,7 @@ const Card = w((props, ref) => {
|
|
|
749
779
|
] })
|
|
750
780
|
] }) });
|
|
751
781
|
};
|
|
752
|
-
const
|
|
782
|
+
const FastPaymentForm = () => {
|
|
753
783
|
var _a2, _b2, _c, _d;
|
|
754
784
|
return /* @__PURE__ */ u(Form, { form, ref: setFormRef, onFormChange: (form2) => setForm(form2), children: /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, bem()), children: [
|
|
755
785
|
Email(),
|
|
@@ -759,6 +789,7 @@ const Card = w((props, ref) => {
|
|
|
759
789
|
{
|
|
760
790
|
value: (_c = (_b2 = (_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.tokens) == null ? void 0 : _b2[0]) == null ? void 0 : _c.token,
|
|
761
791
|
cardList: (_d = session == null ? void 0 : session.checkout) == null ? void 0 : _d.tokens,
|
|
792
|
+
disabled,
|
|
762
793
|
onClickEdit: onEditOtherCard,
|
|
763
794
|
onClickChange: onClickChangeCard,
|
|
764
795
|
onCardChange,
|
|
@@ -771,6 +802,7 @@ const Card = w((props, ref) => {
|
|
|
771
802
|
{
|
|
772
803
|
className: bem("card-security-code", fieldClassNames),
|
|
773
804
|
style: { flex: 1 },
|
|
805
|
+
disabled,
|
|
774
806
|
security,
|
|
775
807
|
ref: cardSecurityCodeFieldRef
|
|
776
808
|
}
|
|
@@ -789,10 +821,12 @@ const Card = w((props, ref) => {
|
|
|
789
821
|
{
|
|
790
822
|
ref: SFPRef,
|
|
791
823
|
i18n,
|
|
824
|
+
disabled,
|
|
792
825
|
checkoutId: core.id,
|
|
793
826
|
sessionMode: (_a = session.checkout) == null ? void 0 : _a.sessionMode,
|
|
794
827
|
supportedCardBrands,
|
|
795
828
|
style: inputStyle || defaultInputStyleConfig,
|
|
829
|
+
core,
|
|
796
830
|
onFocus: onFieldsFocus,
|
|
797
831
|
onBinValue: onBinValueChanged,
|
|
798
832
|
onBrand,
|
|
@@ -801,7 +835,12 @@ const Card = w((props, ref) => {
|
|
|
801
835
|
onPaymentTimeout: ({ message }) => onTimeout(i18n.get(message)),
|
|
802
836
|
onValidStatusChanged: onFieldValidStatusChanged,
|
|
803
837
|
onValidated,
|
|
804
|
-
|
|
838
|
+
onHiddenIframeReady: (data) => onHiddenIframeReady(data),
|
|
839
|
+
onEvent: (type, data) => {
|
|
840
|
+
var _a2, _b2;
|
|
841
|
+
return (_b2 = (_a2 = core.config).onEvent) == null ? void 0 : _b2.call(_a2, type, data);
|
|
842
|
+
},
|
|
843
|
+
children: showFastPaymentForm ? FastPaymentForm() : PaymentForm()
|
|
805
844
|
}
|
|
806
845
|
),
|
|
807
846
|
/* @__PURE__ */ u(
|