@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
|
@@ -5,9 +5,9 @@ import "../../utils/system-info/get-browser-info.js";
|
|
|
5
5
|
import { extractAreaCodeAndPhoneNumber } from "../../utils/format.js";
|
|
6
6
|
import { GooglePayEventType } from "../../types/event.js";
|
|
7
7
|
import { deepMerge } from "../../utils/object.js";
|
|
8
|
-
import { formatPaymentResult } from "../../utils/payment.js";
|
|
8
|
+
import { processPaymentStatus, formatPaymentResult } from "../../utils/payment.js";
|
|
9
9
|
import { getBrowserParams } from "../../api/modules/get-browser-params.js";
|
|
10
|
-
import {
|
|
10
|
+
import { PaymentMethod, SessionMode } from "../../constant.js";
|
|
11
11
|
import { getGooglePayInfo, googlePay } from "../../api/modules/google-pay/index.js";
|
|
12
12
|
import { useBEM } from "../../hooks/useBEM.js";
|
|
13
13
|
import "../../core/context.js";
|
|
@@ -18,12 +18,13 @@ import { useRetry } from "../../hooks/useRetry.js";
|
|
|
18
18
|
import { Info } from "../internal/Info/Info.js";
|
|
19
19
|
import { loadScript } from "../../utils/load.js";
|
|
20
20
|
import { ThreeDSAuth } from "../ThreeDS/index.js";
|
|
21
|
-
|
|
21
|
+
const createGooglePay = (core, checkout, googlePayConfig, pay, onClick, onCanUse, onCancel) => {
|
|
22
22
|
const {
|
|
23
23
|
transAmount,
|
|
24
24
|
theme: { merchantName }
|
|
25
25
|
} = checkout;
|
|
26
|
-
const { googlePay: googlePay2 } = (checkout == null ? void 0 : checkout.channelParams)
|
|
26
|
+
const { googlePay: googlePay2 } = (checkout == null ? void 0 : checkout.channelParams) || {};
|
|
27
|
+
let paymentsClient;
|
|
27
28
|
const baseRequest = {
|
|
28
29
|
apiVersion: 2,
|
|
29
30
|
apiVersionMinor: 0
|
|
@@ -36,8 +37,8 @@ function createGooglePay(core, checkout, googlePayConfig, pay, onClick, onCanUse
|
|
|
36
37
|
gatewayMerchantId: googlePay2 == null ? void 0 : googlePay2.merchantGatewayId
|
|
37
38
|
}
|
|
38
39
|
};
|
|
39
|
-
const allowedCardNetworks = (googlePay2 == null ? void 0 : googlePay2.allowedCardNetworks)
|
|
40
|
-
const allowedCardAuthMethods = (googlePay2 == null ? void 0 : googlePay2.allowedAuthMethods)
|
|
40
|
+
const allowedCardNetworks = (googlePay2 == null ? void 0 : googlePay2.allowedCardNetworks) || [];
|
|
41
|
+
const allowedCardAuthMethods = (googlePay2 == null ? void 0 : googlePay2.allowedAuthMethods) || [];
|
|
41
42
|
const baseCardPaymentMethod = {
|
|
42
43
|
type: "CARD",
|
|
43
44
|
parameters: {
|
|
@@ -50,16 +51,16 @@ function createGooglePay(core, checkout, googlePayConfig, pay, onClick, onCanUse
|
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
53
|
};
|
|
53
|
-
|
|
54
|
+
const getGoogleIsReadyToPayRequest = () => {
|
|
54
55
|
return Object.assign({}, baseRequest, {
|
|
55
56
|
allowedPaymentMethods: [baseCardPaymentMethod]
|
|
56
57
|
});
|
|
57
|
-
}
|
|
58
|
+
};
|
|
58
59
|
const cardPaymentMethod = Object.assign(
|
|
59
60
|
{ tokenizationSpecification },
|
|
60
61
|
baseCardPaymentMethod
|
|
61
62
|
);
|
|
62
|
-
|
|
63
|
+
const getGoogleTransactionInfo = () => {
|
|
63
64
|
return {
|
|
64
65
|
countryCode: googlePay2 == null ? void 0 : googlePay2.countryCode,
|
|
65
66
|
currencyCode: transAmount.currency,
|
|
@@ -67,39 +68,33 @@ function createGooglePay(core, checkout, googlePayConfig, pay, onClick, onCanUse
|
|
|
67
68
|
totalPrice: String(transAmount.amount),
|
|
68
69
|
totalPriceLabel: "Total"
|
|
69
70
|
};
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
merchantName
|
|
71
|
+
};
|
|
72
|
+
const getGooglePaymentDataRequest = () => {
|
|
73
|
+
return {
|
|
74
|
+
...baseRequest,
|
|
75
|
+
emailRequired: true,
|
|
76
|
+
allowedPaymentMethods: [cardPaymentMethod],
|
|
77
|
+
transactionInfo: getGoogleTransactionInfo(),
|
|
78
|
+
merchantInfo: {
|
|
79
|
+
merchantId: googlePay2 == null ? void 0 : googlePay2.googlePayMerchantId,
|
|
80
|
+
merchantName
|
|
81
|
+
},
|
|
82
|
+
callbackIntents: ["PAYMENT_AUTHORIZATION"]
|
|
83
83
|
};
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
function getGooglePaymentsClient() {
|
|
84
|
+
};
|
|
85
|
+
const getGooglePaymentsClient = () => {
|
|
88
86
|
if (!paymentsClient) {
|
|
89
87
|
paymentsClient = new google.payments.api.PaymentsClient({
|
|
90
88
|
environment: googlePay2 == null ? void 0 : googlePay2.environment,
|
|
91
|
-
paymentDataCallbacks: {
|
|
92
|
-
onPaymentAuthorized
|
|
93
|
-
}
|
|
89
|
+
paymentDataCallbacks: { onPaymentAuthorized }
|
|
94
90
|
});
|
|
95
91
|
}
|
|
96
92
|
return paymentsClient;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return new Promise(
|
|
93
|
+
};
|
|
94
|
+
const onPaymentAuthorized = (paymentData) => {
|
|
95
|
+
return new Promise((resolve) => {
|
|
100
96
|
var _a, _b, _c, _d;
|
|
101
97
|
(_b = (_a = core.config).onEvent) == null ? void 0 : _b.call(_a, GooglePayEventType.GOOGLE_PAY_AUTHORIZED);
|
|
102
|
-
console.log("google pay token", paymentData.paymentMethodData.tokenizationData.token);
|
|
103
98
|
console.log("google pay billingAddress", (_c = paymentData.paymentMethodData.info) == null ? void 0 : _c.billingAddress);
|
|
104
99
|
const {
|
|
105
100
|
name,
|
|
@@ -111,8 +106,7 @@ function createGooglePay(core, checkout, googlePayConfig, pay, onClick, onCanUse
|
|
|
111
106
|
locality,
|
|
112
107
|
postalCode,
|
|
113
108
|
phoneNumber
|
|
114
|
-
} = ((_d = paymentData.paymentMethodData.info) == null ? void 0 : _d.billingAddress)
|
|
115
|
-
console.warn("GooglePay Res", paymentData.paymentMethodData);
|
|
109
|
+
} = ((_d = paymentData.paymentMethodData.info) == null ? void 0 : _d.billingAddress) || {};
|
|
116
110
|
pay(paymentData.paymentMethodData.tokenizationData.token, {
|
|
117
111
|
email: paymentData.email,
|
|
118
112
|
name,
|
|
@@ -128,23 +122,29 @@ function createGooglePay(core, checkout, googlePayConfig, pay, onClick, onCanUse
|
|
|
128
122
|
resolve(payRes == null ? void 0 : payRes.res);
|
|
129
123
|
});
|
|
130
124
|
});
|
|
131
|
-
}
|
|
132
|
-
|
|
125
|
+
};
|
|
126
|
+
const onGooglePayLoaded = async (container) => {
|
|
127
|
+
var _a, _b, _c;
|
|
133
128
|
const paymentsClient2 = getGooglePaymentsClient();
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
if (
|
|
129
|
+
try {
|
|
130
|
+
const res = await paymentsClient2.isReadyToPay(getGoogleIsReadyToPayRequest());
|
|
131
|
+
if (res.result) {
|
|
137
132
|
addGooglePayButton(container);
|
|
138
133
|
onCanUse == null ? void 0 : onCanUse(true);
|
|
139
134
|
} else {
|
|
140
135
|
onCanUse == null ? void 0 : onCanUse(false);
|
|
141
136
|
(_b = (_a = core.config).onEvent) == null ? void 0 : _b.call(_a, GooglePayEventType.GOOGLE_PAY_CAN_NOT_USE);
|
|
142
137
|
}
|
|
143
|
-
}
|
|
138
|
+
} catch (err) {
|
|
144
139
|
console.error(err);
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
140
|
+
(_c = core.logger) == null ? void 0 : _c.reportErrorEvent(new PayKKaError(
|
|
141
|
+
"ERROR",
|
|
142
|
+
`google pay: ${(err == null ? void 0 : err.statusMessage) || "unknown error"}`,
|
|
143
|
+
{ code: err == null ? void 0 : err.statusCode }
|
|
144
|
+
));
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
const addGooglePayButton = (container) => {
|
|
148
148
|
const paymentsClient2 = getGooglePaymentsClient();
|
|
149
149
|
const button = paymentsClient2.createButton({
|
|
150
150
|
...googlePayConfig == null ? void 0 : googlePayConfig.button,
|
|
@@ -152,26 +152,34 @@ function createGooglePay(core, checkout, googlePayConfig, pay, onClick, onCanUse
|
|
|
152
152
|
allowedPaymentMethods: [baseCardPaymentMethod]
|
|
153
153
|
});
|
|
154
154
|
container == null ? void 0 : container.appendChild(button);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
var _a, _b;
|
|
158
|
-
(_b = (_a = core.config).onEvent) == null ? void 0 : _b.call(_a, GooglePayEventType.GOOGLE_PAY_BUTTON_CLICKED);
|
|
155
|
+
};
|
|
156
|
+
const onGooglePaymentButtonClicked = async () => {
|
|
157
|
+
var _a, _b, _c;
|
|
159
158
|
onClick == null ? void 0 : onClick();
|
|
160
159
|
const paymentDataRequest = getGooglePaymentDataRequest();
|
|
161
160
|
paymentDataRequest.transactionInfo = getGoogleTransactionInfo();
|
|
162
161
|
const paymentsClient2 = getGooglePaymentsClient();
|
|
163
|
-
console.log("
|
|
164
|
-
|
|
165
|
-
|
|
162
|
+
console.log("google pay 支付请求数据", paymentDataRequest);
|
|
163
|
+
try {
|
|
164
|
+
await paymentsClient2.loadPaymentData(paymentDataRequest);
|
|
165
|
+
} catch (err) {
|
|
166
|
+
core.payment.resetCurrPaymentMethod();
|
|
166
167
|
if ((err == null ? void 0 : err.statusCode) === "CANCELED") {
|
|
167
|
-
(
|
|
168
|
+
(_b = (_a = core.config).onEvent) == null ? void 0 : _b.call(_a, GooglePayEventType.GOOGLE_PAY_CANCELLED);
|
|
169
|
+
onCancel == null ? void 0 : onCancel();
|
|
170
|
+
} else {
|
|
171
|
+
(_c = core.logger) == null ? void 0 : _c.reportErrorEvent(new PayKKaError(
|
|
172
|
+
"ERROR",
|
|
173
|
+
`google pay: ${(err == null ? void 0 : err.statusMessage) || "unknown error"}`,
|
|
174
|
+
{ code: err == null ? void 0 : err.statusCode }
|
|
175
|
+
));
|
|
168
176
|
}
|
|
169
|
-
}
|
|
170
|
-
}
|
|
177
|
+
}
|
|
178
|
+
};
|
|
171
179
|
return {
|
|
172
180
|
onGooglePayLoaded
|
|
173
181
|
};
|
|
174
|
-
}
|
|
182
|
+
};
|
|
175
183
|
const loadGooglePayJS = (onload, onerror) => {
|
|
176
184
|
var _a;
|
|
177
185
|
if ((_a = window.google) == null ? void 0 : _a.payments) {
|
|
@@ -187,6 +195,7 @@ const loadGooglePayJS = (onload, onerror) => {
|
|
|
187
195
|
}
|
|
188
196
|
});
|
|
189
197
|
};
|
|
198
|
+
const CURR_PAYMENT_METHOD = PaymentMethod.GOOGLE_PAY;
|
|
190
199
|
const { bem } = useBEM("google-pay");
|
|
191
200
|
const DEFAULT_GOOGLE_PAY_CONFIG = {
|
|
192
201
|
button: {
|
|
@@ -204,26 +213,33 @@ const GooglePay = w((props, ref) => {
|
|
|
204
213
|
F(ref, () => ({
|
|
205
214
|
checkThreeDS
|
|
206
215
|
}));
|
|
207
|
-
const { sessionReady, i18n, fraudDetection } = usePayState(session, props.core);
|
|
216
|
+
const { sessionReady, i18n, fraudDetection, disabled } = usePayState(session, props.core);
|
|
208
217
|
const [errorMsg, setErrorMsg] = h("");
|
|
209
218
|
const [showGooglePay, setShowGooglePay] = h(false);
|
|
210
219
|
const [showThreeDSModal, setShowThreeDSModal] = h(false);
|
|
211
220
|
const [threeDSInfo, setThreeDSInfo] = h();
|
|
212
221
|
const [hosted, setHosted] = h(true);
|
|
222
|
+
const getPaymentMethodContext = () => {
|
|
223
|
+
return {
|
|
224
|
+
paymentMethod: CURR_PAYMENT_METHOD
|
|
225
|
+
};
|
|
226
|
+
};
|
|
213
227
|
const onTimeout = q(
|
|
214
228
|
(message) => {
|
|
215
|
-
var _a2;
|
|
229
|
+
var _a2, _b;
|
|
230
|
+
(_a2 = core.payment) == null ? void 0 : _a2.resetCurrPaymentMethod();
|
|
216
231
|
setErrorMsg(message || i18n.get("common.payTimeout"));
|
|
217
|
-
(
|
|
232
|
+
(_b = props.onTimeout) == null ? void 0 : _b.call(props, "retry", getPaymentMethodContext());
|
|
218
233
|
},
|
|
219
234
|
[i18n, props.onTimeout]
|
|
220
235
|
);
|
|
221
236
|
const processOnSuccess = (res) => {
|
|
222
237
|
var _a2, _b;
|
|
223
|
-
|
|
238
|
+
const paymentInfo = formatPaymentResult({
|
|
224
239
|
...res,
|
|
225
240
|
returnUrl: (_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.returnUrl
|
|
226
|
-
})
|
|
241
|
+
});
|
|
242
|
+
(_b = props.onSuccess) == null ? void 0 : _b.call(props, paymentInfo, getPaymentMethodContext());
|
|
227
243
|
};
|
|
228
244
|
y(() => {
|
|
229
245
|
var _a2, _b;
|
|
@@ -238,7 +254,7 @@ const GooglePay = w((props, ref) => {
|
|
|
238
254
|
);
|
|
239
255
|
return;
|
|
240
256
|
}
|
|
241
|
-
if (!supportMethods.includes(
|
|
257
|
+
if (!supportMethods.includes(CURR_PAYMENT_METHOD)) {
|
|
242
258
|
return;
|
|
243
259
|
}
|
|
244
260
|
loadGooglePayJS(
|
|
@@ -292,7 +308,7 @@ const GooglePay = w((props, ref) => {
|
|
|
292
308
|
sessionId: session.sessionId,
|
|
293
309
|
clientKey: session.clientKey,
|
|
294
310
|
payment: {
|
|
295
|
-
paymentMethod:
|
|
311
|
+
paymentMethod: CURR_PAYMENT_METHOD,
|
|
296
312
|
tokenData: token ?? ""
|
|
297
313
|
},
|
|
298
314
|
bill: {
|
|
@@ -313,53 +329,64 @@ const GooglePay = w((props, ref) => {
|
|
|
313
329
|
};
|
|
314
330
|
};
|
|
315
331
|
async function pay(token, billAddress, search = false, timeout) {
|
|
316
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h
|
|
332
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
317
333
|
setErrorMsg("");
|
|
318
334
|
if (!search) {
|
|
319
|
-
(_a2 = props.onSubmit) == null ? void 0 : _a2.call(props);
|
|
335
|
+
(_a2 = props.onSubmit) == null ? void 0 : _a2.call(props, void 0, getPaymentMethodContext());
|
|
320
336
|
}
|
|
321
337
|
try {
|
|
338
|
+
core.payment.currPaymentMethod.value = CURR_PAYMENT_METHOD;
|
|
322
339
|
const requestOptions = { locale: i18n.locale, timeout };
|
|
323
340
|
let res = null;
|
|
324
341
|
if (search) {
|
|
325
|
-
const extraParams = (_c = (_b = core.config)._getExtraParams) == null ? void 0 : _c.call(_b, "query",
|
|
342
|
+
const extraParams = (_c = (_b = core.config)._getExtraParams) == null ? void 0 : _c.call(_b, "query", CURR_PAYMENT_METHOD);
|
|
326
343
|
res = await getGooglePayInfo(
|
|
327
344
|
{
|
|
328
345
|
sessionId: session.sessionId,
|
|
329
346
|
clientKey: session.clientKey,
|
|
330
|
-
paymentMethod:
|
|
347
|
+
paymentMethod: CURR_PAYMENT_METHOD
|
|
331
348
|
},
|
|
332
349
|
extraParams,
|
|
333
350
|
requestOptions
|
|
334
351
|
);
|
|
335
352
|
} else {
|
|
336
|
-
const extraParams = (_e = (_d = core.config)._getExtraParams) == null ? void 0 : _e.call(_d, "payment",
|
|
353
|
+
const extraParams = (_e = (_d = core.config)._getExtraParams) == null ? void 0 : _e.call(_d, "payment", CURR_PAYMENT_METHOD);
|
|
337
354
|
res = await googlePay(
|
|
338
355
|
await getPaymentParams(token, billAddress),
|
|
339
356
|
extraParams,
|
|
340
357
|
requestOptions
|
|
341
358
|
);
|
|
342
359
|
}
|
|
343
|
-
const {
|
|
360
|
+
const { errorMessage, payInfo = {}, errorCode, sessionId } = res;
|
|
344
361
|
const { threeDSUrl } = payInfo;
|
|
345
362
|
sessionId && (session.sessionId = sessionId);
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
} else if (orderStatus === "PROCESSING") {
|
|
363
|
+
!search && ((_f = props.onSubmitResponse) == null ? void 0 : _f.call(props, res, getPaymentMethodContext()));
|
|
364
|
+
let result = {
|
|
365
|
+
end: true,
|
|
366
|
+
res: { transactionState: "SUCCESS" }
|
|
367
|
+
};
|
|
368
|
+
await processPaymentStatus(res, {
|
|
369
|
+
onProcessing: async () => {
|
|
354
370
|
const res2 = await startReFetchPayInfo();
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
371
|
+
if ((res2 == null ? void 0 : res2.end) === true) {
|
|
372
|
+
result = res2.res;
|
|
373
|
+
} else {
|
|
374
|
+
result = await startReFetchPayInfo();
|
|
375
|
+
}
|
|
376
|
+
},
|
|
377
|
+
onSuccess: () => {
|
|
378
|
+
processOnSuccess(res);
|
|
379
|
+
},
|
|
380
|
+
onFailure: () => {
|
|
381
|
+
var _a3, _b2;
|
|
360
382
|
errorMessage && setErrorMsg(errorMessage);
|
|
361
|
-
(
|
|
362
|
-
|
|
383
|
+
(_a3 = core.payment) == null ? void 0 : _a3.resetCurrPaymentMethod();
|
|
384
|
+
(_b2 = props.onError) == null ? void 0 : _b2.call(
|
|
385
|
+
props,
|
|
386
|
+
new PayKKaError("API_ERROR", errorMessage, { code: errorCode }),
|
|
387
|
+
getPaymentMethodContext()
|
|
388
|
+
);
|
|
389
|
+
result = {
|
|
363
390
|
end: true,
|
|
364
391
|
res: {
|
|
365
392
|
transactionState: "ERROR",
|
|
@@ -370,48 +397,31 @@ const GooglePay = w((props, ref) => {
|
|
|
370
397
|
}
|
|
371
398
|
}
|
|
372
399
|
};
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
} else if (orderStatus === "IN_THREED") {
|
|
400
|
+
},
|
|
401
|
+
onAuthorized: () => {
|
|
402
|
+
var _a3;
|
|
403
|
+
(_a3 = props.onAuthorized) == null ? void 0 : _a3.call(props, getPaymentMethodContext());
|
|
404
|
+
},
|
|
405
|
+
onInThreeDS: () => {
|
|
380
406
|
threeDSUrl && processThreeDS(threeDSUrl, false);
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
res: { transactionState: "SUCCESS" }
|
|
384
|
-
};
|
|
385
|
-
} else if (orderStatus === "IN_PREVIOUS_THREED") {
|
|
407
|
+
},
|
|
408
|
+
onInPreviousThreeDS: () => {
|
|
386
409
|
threeDSUrl && processThreeDS(threeDSUrl, true);
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
}
|
|
392
|
-
|
|
410
|
+
},
|
|
411
|
+
onExpired: () => {
|
|
412
|
+
var _a3;
|
|
413
|
+
(_a3 = props.onExpired) == null ? void 0 : _a3.call(props, getPaymentMethodContext());
|
|
414
|
+
},
|
|
415
|
+
onDefault: () => {
|
|
416
|
+
var _a3;
|
|
417
|
+
(_a3 = core.payment) == null ? void 0 : _a3.resetCurrPaymentMethod();
|
|
418
|
+
result = {
|
|
393
419
|
end: true,
|
|
394
|
-
res: { transactionState: "
|
|
420
|
+
res: { transactionState: "ERROR" }
|
|
395
421
|
};
|
|
396
422
|
}
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
return {
|
|
400
|
-
end: true,
|
|
401
|
-
res: { transactionState: "SUCCESS" }
|
|
402
|
-
};
|
|
403
|
-
} else if (status === "EXPIRED") {
|
|
404
|
-
(_h = props.onExpired) == null ? void 0 : _h.call(props);
|
|
405
|
-
return {
|
|
406
|
-
end: true,
|
|
407
|
-
res: { transactionState: "SUCCESS" }
|
|
408
|
-
};
|
|
409
|
-
}
|
|
410
|
-
processOnSuccess(res);
|
|
411
|
-
return {
|
|
412
|
-
end: false,
|
|
413
|
-
res: { transactionState: "SUCCESS" }
|
|
414
|
-
};
|
|
423
|
+
});
|
|
424
|
+
return result;
|
|
415
425
|
} catch (error) {
|
|
416
426
|
if (isTimeoutError(error)) {
|
|
417
427
|
if (search) {
|
|
@@ -431,9 +441,14 @@ const GooglePay = w((props, ref) => {
|
|
|
431
441
|
};
|
|
432
442
|
}
|
|
433
443
|
} else {
|
|
444
|
+
(_g = core.payment) == null ? void 0 : _g.resetCurrPaymentMethod();
|
|
434
445
|
const message = error.i18nKey ? i18n.get(error.i18nKey) : error.message;
|
|
435
446
|
setErrorMsg(message);
|
|
436
|
-
(
|
|
447
|
+
(_h = props.onError) == null ? void 0 : _h.call(
|
|
448
|
+
props,
|
|
449
|
+
new PayKKaError("API_ERROR", message, { code: error.code, cause: error }),
|
|
450
|
+
getPaymentMethodContext()
|
|
451
|
+
);
|
|
437
452
|
return {
|
|
438
453
|
end: true,
|
|
439
454
|
res: {
|
|
@@ -456,11 +471,11 @@ const GooglePay = w((props, ref) => {
|
|
|
456
471
|
}
|
|
457
472
|
);
|
|
458
473
|
async function checkThreeDS(search = false) {
|
|
459
|
-
var _a2, _b, _c, _d
|
|
474
|
+
var _a2, _b, _c, _d;
|
|
460
475
|
if (!session)
|
|
461
476
|
return { end: true };
|
|
462
477
|
try {
|
|
463
|
-
const extraParams = (_b = (_a2 = core.config)._getExtraParams) == null ? void 0 : _b.call(_a2, "query",
|
|
478
|
+
const extraParams = (_b = (_a2 = core.config)._getExtraParams) == null ? void 0 : _b.call(_a2, "query", CURR_PAYMENT_METHOD);
|
|
464
479
|
const res = await getGooglePayInfo(
|
|
465
480
|
{
|
|
466
481
|
sessionId: session.sessionId,
|
|
@@ -471,35 +486,48 @@ const GooglePay = w((props, ref) => {
|
|
|
471
486
|
locale: i18n.locale
|
|
472
487
|
}
|
|
473
488
|
);
|
|
474
|
-
const {
|
|
475
|
-
|
|
476
|
-
|
|
489
|
+
const { errorMessage } = res;
|
|
490
|
+
let end = true;
|
|
491
|
+
await processPaymentStatus(res, {
|
|
492
|
+
onProcessing: () => {
|
|
477
493
|
startReFetchPayInfo();
|
|
478
|
-
|
|
494
|
+
stopReFetchCardPay3DSInfo();
|
|
495
|
+
},
|
|
496
|
+
onSuccess: () => {
|
|
497
|
+
processOnSuccess(res);
|
|
498
|
+
stopReFetchCardPay3DSInfo();
|
|
499
|
+
},
|
|
500
|
+
onFailure: () => {
|
|
501
|
+
var _a3;
|
|
502
|
+
(_a3 = core.payment) == null ? void 0 : _a3.resetCurrPaymentMethod();
|
|
479
503
|
errorMessage && setErrorMsg(errorMessage);
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
504
|
+
stopReFetchCardPay3DSInfo();
|
|
505
|
+
},
|
|
506
|
+
onAuthorized: () => {
|
|
507
|
+
var _a3;
|
|
508
|
+
(_a3 = props.onAuthorized) == null ? void 0 : _a3.call(props, getPaymentMethodContext());
|
|
509
|
+
stopReFetchCardPay3DSInfo();
|
|
510
|
+
},
|
|
511
|
+
onInThreeDS: () => {
|
|
483
512
|
!search && startReFetchCardPay3DSInfo();
|
|
484
|
-
|
|
485
|
-
}
|
|
513
|
+
end = false;
|
|
514
|
+
},
|
|
515
|
+
onInPreviousThreeDS: () => {
|
|
486
516
|
setErrorMsg(i18n.get("common.pay3DSIncomplete"));
|
|
487
|
-
|
|
517
|
+
stopReFetchCardPay3DSInfo();
|
|
518
|
+
},
|
|
519
|
+
onExpired: () => {
|
|
520
|
+
var _a3;
|
|
521
|
+
stopReFetchCardPay3DSInfo();
|
|
522
|
+
(_a3 = props.onExpired) == null ? void 0 : _a3.call(props, getPaymentMethodContext());
|
|
523
|
+
},
|
|
524
|
+
onDefault: () => {
|
|
525
|
+
var _a3;
|
|
526
|
+
stopReFetchCardPay3DSInfo();
|
|
527
|
+
(_a3 = core.payment) == null ? void 0 : _a3.resetCurrPaymentMethod();
|
|
488
528
|
}
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
} else if (status === "SUCCESS") {
|
|
492
|
-
processOnSuccess(res);
|
|
493
|
-
stopReFetchCardPay3DSInfo();
|
|
494
|
-
return { end: true };
|
|
495
|
-
} else if (status === "EXPIRED") {
|
|
496
|
-
(_d = props.onExpired) == null ? void 0 : _d.call(props);
|
|
497
|
-
stopReFetchCardPay3DSInfo();
|
|
498
|
-
return { end: true };
|
|
499
|
-
}
|
|
500
|
-
processOnSuccess(res);
|
|
501
|
-
stopReFetchCardPay3DSInfo();
|
|
502
|
-
return { end: true };
|
|
529
|
+
});
|
|
530
|
+
return { end };
|
|
503
531
|
} catch (error) {
|
|
504
532
|
if (isTimeoutError(error)) {
|
|
505
533
|
if (search) {
|
|
@@ -511,7 +539,13 @@ const GooglePay = w((props, ref) => {
|
|
|
511
539
|
} else {
|
|
512
540
|
const message = error.i18nKey ? i18n.get(error.i18nKey) : error.message;
|
|
513
541
|
setErrorMsg(message);
|
|
514
|
-
(
|
|
542
|
+
(_c = props.onError) == null ? void 0 : _c.call(
|
|
543
|
+
props,
|
|
544
|
+
new PayKKaError("API_ERROR", message, { code: error.code, cause: error }),
|
|
545
|
+
getPaymentMethodContext()
|
|
546
|
+
);
|
|
547
|
+
(_d = core.payment) == null ? void 0 : _d.resetCurrPaymentMethod();
|
|
548
|
+
stopReFetchCardPay3DSInfo();
|
|
515
549
|
return { end: true };
|
|
516
550
|
}
|
|
517
551
|
}
|
|
@@ -524,14 +558,19 @@ const GooglePay = w((props, ref) => {
|
|
|
524
558
|
session == null ? void 0 : session.checkout,
|
|
525
559
|
googlePayConfig,
|
|
526
560
|
pay,
|
|
527
|
-
|
|
528
|
-
|
|
561
|
+
() => {
|
|
562
|
+
var _a2, _b, _c;
|
|
563
|
+
(_b = (_a2 = core.config).onEvent) == null ? void 0 : _b.call(_a2, GooglePayEventType.GOOGLE_PAY_BUTTON_CLICKED);
|
|
564
|
+
(_c = props.onBtnClick) == null ? void 0 : _c.call(props);
|
|
565
|
+
},
|
|
566
|
+
props.onCanUse,
|
|
567
|
+
props.onCancel
|
|
529
568
|
);
|
|
530
569
|
onGooglePayLoaded(containRef.current);
|
|
531
570
|
}
|
|
532
571
|
}, [sessionReady, containRef, i18n.ready.value, showGooglePay]);
|
|
533
572
|
const Button = () => {
|
|
534
|
-
return /* @__PURE__ */ u("div", { style: "width: 100%; height: 44px", children: /* @__PURE__ */ u("div", { id: "container", style: "width:100%; height: 44px", ref: containRef }) });
|
|
573
|
+
return /* @__PURE__ */ u("div", { style: "width: 100%; height: 44px", className: bem("button", { disabled }), children: /* @__PURE__ */ u("div", { id: "container", style: "width:100%; height: 44px", ref: containRef }) });
|
|
535
574
|
};
|
|
536
575
|
return /* @__PURE__ */ u("div", { children: sessionReady && showGooglePay && i18n.ready.value && /* @__PURE__ */ u(b, { children: [
|
|
537
576
|
!!errorMsg && /* @__PURE__ */ u(Info, { className: bem("error"), content: errorMsg }),
|
|
@@ -41,7 +41,14 @@ const GuideCard = (props) => {
|
|
|
41
41
|
[PaymentCategory.PIX]: redirectGuideCard,
|
|
42
42
|
[PaymentCategory.PIC_PAY]: redirectGuideCard,
|
|
43
43
|
[PaymentCategory.OPAY_WALLET]: redirectGuideCard,
|
|
44
|
-
[PaymentCategory.PAGA_WALLET]: redirectGuideCard
|
|
44
|
+
[PaymentCategory.PAGA_WALLET]: redirectGuideCard,
|
|
45
|
+
[PaymentCategory.BANCONTACT]: redirectGuideCard,
|
|
46
|
+
[PaymentCategory.IDEAL]: redirectGuideCard,
|
|
47
|
+
[PaymentCategory.BLIK]: redirectGuideCard,
|
|
48
|
+
[PaymentCategory.OVO]: redirectGuideCard,
|
|
49
|
+
[PaymentCategory.SKRILL]: redirectGuideCard,
|
|
50
|
+
[PaymentCategory.TRUSTLY]: redirectGuideCard,
|
|
51
|
+
[PaymentCategory.P24]: redirectGuideCard
|
|
45
52
|
};
|
|
46
53
|
return /* @__PURE__ */ u(b, { children: guideCardInfoMap[type] && /* @__PURE__ */ u("div", { className: bem(), children: /* @__PURE__ */ u("div", { className: bem("content"), children: [
|
|
47
54
|
/* @__PURE__ */ u("div", { className: bem("icon"), children: (_a = guideCardInfoMap[type]) == null ? void 0 : _a.icon }),
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { h, y, u } from "../../core.js";
|
|
2
|
+
import { useBEM } from "../../hooks/useBEM.js";
|
|
3
|
+
import { useI18n } from "../../hooks/useI18n.js";
|
|
4
|
+
import "../../utils/card-brand/brands.js";
|
|
5
|
+
import "../../utils/system-info/get-browser-info.js";
|
|
6
|
+
import { normalizedClass } from "../../utils/format.js";
|
|
7
|
+
import "../../core/context.js";
|
|
8
|
+
import "../../out/worldpay-jsc-origin.js";
|
|
9
|
+
import { Button } from "../internal/Button/Button.js";
|
|
10
|
+
import { IconSafe } from "../internal/icons/IconSafe.js";
|
|
11
|
+
import { LoadingCheck } from "../internal/LoadingCheck/LoadingCheck.js";
|
|
12
|
+
const { bem } = useBEM("payment-button");
|
|
13
|
+
const PaymentButton = (props) => {
|
|
14
|
+
const {
|
|
15
|
+
verified = false,
|
|
16
|
+
status = "unSubmit"
|
|
17
|
+
} = props;
|
|
18
|
+
const { i18n } = useI18n();
|
|
19
|
+
const [text, setText] = h("");
|
|
20
|
+
const Icon = () => {
|
|
21
|
+
return status === "unSubmit" ? /* @__PURE__ */ u(IconSafe, { size: 20, disabled: !verified }) : /* @__PURE__ */ u(
|
|
22
|
+
LoadingCheck,
|
|
23
|
+
{
|
|
24
|
+
size: 20,
|
|
25
|
+
checked: status === "success",
|
|
26
|
+
onCheckShow: () => setText(i18n.get("common.paySuccess"))
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
y(() => {
|
|
31
|
+
if (status === "success")
|
|
32
|
+
return;
|
|
33
|
+
if (status === "loading") {
|
|
34
|
+
setText(i18n.get("common.payProcessing"));
|
|
35
|
+
} else {
|
|
36
|
+
if (props.children) {
|
|
37
|
+
setText("");
|
|
38
|
+
} else {
|
|
39
|
+
setText(i18n.get("common.pay"));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}, [status, props.children]);
|
|
43
|
+
return /* @__PURE__ */ u(
|
|
44
|
+
Button,
|
|
45
|
+
{
|
|
46
|
+
className: normalizedClass(bem({ success: status === "success" }), props.className),
|
|
47
|
+
style: props.style,
|
|
48
|
+
icon: Icon(),
|
|
49
|
+
loading: status === "loading",
|
|
50
|
+
disabled: (props.disabled || status === "success") && status !== "loading",
|
|
51
|
+
onClick: props.onClick,
|
|
52
|
+
children: /* @__PURE__ */ u("span", { className: bem("text", { "not-verified": !verified }), children: text || props.children })
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
export {
|
|
57
|
+
PaymentButton
|
|
58
|
+
};
|
|
@@ -6,12 +6,12 @@ import "../../out/worldpay-jsc-origin.js";
|
|
|
6
6
|
import { useBEM } from "../../hooks/useBEM.js";
|
|
7
7
|
import { IconInfo } from "../internal/icons/IconInfo.js";
|
|
8
8
|
const { bem } = useBEM("recurring-tip");
|
|
9
|
-
function RecurringTip() {
|
|
9
|
+
function RecurringTip(isCard = true) {
|
|
10
10
|
return /* @__PURE__ */ u(CoreContext.Consumer, { children: (value) => {
|
|
11
|
-
var _a;
|
|
11
|
+
var _a, _b;
|
|
12
12
|
return /* @__PURE__ */ u("div", { className: bem(), children: [
|
|
13
13
|
/* @__PURE__ */ u("div", { className: bem("icon"), children: IconInfo({ size: 16 }) }),
|
|
14
|
-
/* @__PURE__ */ u("div", { className: bem("text"), children: (_a = value == null ? void 0 : value.i18n) == null ? void 0 : _a.get("common.recurringTip") })
|
|
14
|
+
/* @__PURE__ */ u("div", { className: bem("text"), children: isCard ? (_a = value == null ? void 0 : value.i18n) == null ? void 0 : _a.get("common.recurringTip") : (_b = value == null ? void 0 : value.i18n) == null ? void 0 : _b.get("common.recurringTip2") })
|
|
15
15
|
] });
|
|
16
16
|
} });
|
|
17
17
|
}
|