@paykka/card-checkout-ui 0.13.8 → 0.13.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/card-checkout-ui.js +20 -20
- package/dist/card-checkout-ui.umd.cjs +21 -21
- package/dist/es/_commonjsHelpers.js +1 -82
- package/dist/es/api/index.js +2 -1
- package/dist/es/api/modules/checkout/map.js +1 -0
- package/dist/es/api/modules/get-browser-params.js +20 -8
- package/dist/es/api/modules/index.js +2 -1
- package/dist/es/api/modules/map.js +2 -1
- package/dist/es/api/modules/risk/index.js +21 -18
- package/dist/es/api/modules/threeDS/index.js +2 -1
- package/dist/es/api/modules/vietqr/index.js +2 -1
- package/dist/es/api/utils/index.js +4 -1
- package/dist/es/components/AccordionItem/AccordionItem.js +0 -1
- package/dist/es/components/AccountNameField/index.js +1 -1
- package/dist/es/components/AddressField/index.js +1 -2
- package/dist/es/components/AliPay/index.js +4 -2
- package/dist/es/components/ApplePay/index.js +201 -135
- package/dist/es/components/Boost/index.js +4 -2
- package/dist/es/components/CPFField/index.js +88 -0
- package/dist/es/components/Card/index.js +5 -11
- package/dist/es/components/CardBrands/index.js +0 -1
- package/dist/es/components/CardExpireDateField/index.js +1 -1
- package/dist/es/components/CardHolderNameField/index.js +1 -1
- package/dist/es/components/CardIBANField/index.js +1 -1
- package/dist/es/components/CardNo/index.js +0 -1
- package/dist/es/components/CardNumberField/index.js +1 -1
- package/dist/es/components/CardSecurityCodeField/index.js +1 -1
- package/dist/es/components/CardSelector/index.js +1 -1
- package/dist/es/components/CombinedCardInfo/index.js +1 -1
- package/dist/es/components/DropIn/index.js +0 -1
- package/dist/es/components/EmailField/EmailField.js +1 -1
- package/dist/es/components/EncryptedCard/index.js +12 -11
- package/dist/es/components/GooglePay/index.js +1 -0
- package/dist/es/components/GrabPay/index.js +4 -2
- package/dist/es/components/GuideCard/index.js +1 -1
- package/dist/es/components/LinePay/index.js +4 -2
- package/dist/es/components/MayBankQRPay/index.js +4 -2
- package/dist/es/components/NinePay/index.js +4 -2
- package/dist/es/components/RecurringTip/index.js +1 -2
- package/dist/es/components/SecuredFieldsProvider/index.js +20 -3
- package/dist/es/components/SecuredIframe/index.js +50 -22
- package/dist/es/components/Sepa/index.js +4 -2
- package/dist/es/components/ShopeePay/index.js +4 -2
- package/dist/es/components/SubmitButton/index.js +1 -1
- package/dist/es/components/TNGWallet/index.js +4 -2
- package/dist/es/components/ThreeDS/index.js +1 -2
- package/dist/es/components/Tip/index.js +18 -0
- package/dist/es/components/WechatPay/index.js +4 -2
- package/dist/es/components/business/QRCodeModal/QRCodeModal.js +1 -1
- package/dist/es/components/business/QRCodeModal/index.js +0 -1
- package/dist/es/components/business/index.js +0 -1
- package/dist/es/components/index.js +0 -1
- package/dist/es/components/internal/Accordion/index.js +0 -1
- package/dist/es/components/internal/Button/Button.js +0 -1
- package/dist/es/components/internal/Button/index.js +0 -1
- package/dist/es/components/internal/CheckBox/CheckBox.js +0 -1
- package/dist/es/components/internal/CheckBox/index.js +0 -1
- package/dist/es/components/internal/Form/type.js +0 -1
- package/dist/es/components/internal/Info/Info.js +0 -1
- package/dist/es/components/internal/Info/index.js +0 -1
- package/dist/es/components/internal/Input/Input.js +1 -1
- package/dist/es/components/internal/Input/type.js +0 -1
- package/dist/es/components/internal/LoadingCheck/LoadingCheck.js +0 -1
- package/dist/es/components/internal/LoadingCheck/index.js +0 -1
- package/dist/es/components/internal/Modal/Modal.js +1 -1
- package/dist/es/components/internal/QRCode/QRCode.js +0 -1
- package/dist/es/components/internal/QRCode/index.js +0 -1
- package/dist/es/components/internal/Select/Select.js +14 -17
- package/dist/es/components/internal/Select/SelectMenu.js +2 -3
- package/dist/es/components/internal/Select/SelectMenuItem.js +0 -1
- package/dist/es/components/wallets/GCash/GCash.js +4 -2
- package/dist/es/components/wallets/OpayWallet/OpayWallet.js +8 -9
- package/dist/es/components/wallets/PagaWallet/PagaWallet.js +8 -9
- package/dist/es/components/wallets/Paymaya/Paymaya.js +4 -2
- package/dist/es/components/wallets/PicPay/PicPay.js +136 -72
- package/dist/es/components/wallets/Pix/Pix.js +136 -72
- package/dist/es/components/wallets/Vietqr/Vietqr.js +4 -2
- package/dist/es/components/wallets/Zalopay/Zalopay.js +4 -2
- package/dist/es/config.js +1 -1
- package/dist/es/constant.js +2 -0
- package/dist/es/core/checkout.js +15 -3
- package/dist/es/core/environment.js +10 -2
- package/dist/es/core/index.js +0 -1
- package/dist/es/core/query.js +2 -1
- package/dist/es/core/session.js +6 -2
- package/dist/es/core/theme.js +0 -1
- package/dist/es/core.js +585 -4
- package/dist/es/hooks/index.js +0 -1
- package/dist/es/hooks/useI18n.js +0 -1
- package/dist/es/hooks/usePayState.js +13 -6
- package/dist/es/i18n/locales/de-DE.js +6 -1
- package/dist/es/i18n/locales/en-GB.js +6 -1
- package/dist/es/i18n/locales/es-ES.js +6 -1
- package/dist/es/i18n/locales/fr-FR.js +7 -2
- package/dist/es/i18n/locales/ja-JP.js +6 -1
- package/dist/es/i18n/locales/ko-KR.js +6 -1
- package/dist/es/i18n/locales/nl-NL.js +6 -1
- package/dist/es/i18n/locales/pt-PT.js +6 -1
- package/dist/es/i18n/locales/ru-RU.js +6 -1
- package/dist/es/i18n/locales/zh-CN.js +6 -1
- package/dist/es/i18n/locales/zh-HK.js +7 -2
- package/dist/es/i18n/locales/zh-TW.js +7 -2
- package/dist/es/index.js +6 -3
- package/dist/es/out/base-fraud-detection.js +134 -0
- package/dist/es/out/config.js +16 -0
- package/dist/es/out/fraud-detection.js +118 -27
- package/dist/es/out/paykka-detection.js +63 -0
- package/dist/es/out/stripe-radar.js +25 -51
- package/dist/es/out/worldpay-ddc.js +52 -99
- package/dist/es/out/worldpay-jsc-origin.js +0 -1
- package/dist/es/out/worldpay-jsc.js +21 -43
- package/dist/es/style.css +1 -1
- package/dist/es/types/event.js +33 -13
- package/dist/es/types/index.js +14 -0
- package/dist/es/utils/cpf.js +48 -0
- package/dist/es/utils/encrypt.js +18 -0
- package/dist/es/utils/iframe.js +1 -1
- package/dist/es/utils/location.js +4 -2
- package/dist/es/utils/redirect.js +8 -5
- package/dist/es/utils/system-info/index.js +1 -3
- package/dist/style.css +1 -1
- package/dist/types/api/modules/checkout/type.d.ts +2 -0
- package/dist/types/api/modules/get-browser-params.d.ts +25 -1
- package/dist/types/api/modules/risk/index.d.ts +28 -12
- package/dist/types/api/modules/type.d.ts +5 -0
- package/dist/types/api/utils/index.d.ts +3 -0
- package/dist/types/components/ApplePay/config.d.ts +9 -0
- package/dist/types/components/ApplePay/hooks/useApplePay.d.ts +15 -0
- package/dist/types/components/ApplePay/type.d.ts +53 -10
- package/dist/types/components/ApplePay/utils.d.ts +8 -2
- package/dist/types/components/CPFField/CPFField.d.ts +4 -0
- package/dist/types/components/CPFField/index.d.ts +2 -0
- package/dist/types/components/CPFField/type.d.ts +21 -0
- package/dist/types/components/SecuredFieldsProvider/type.d.ts +8 -3
- package/dist/types/components/SecuredIframe/useSecuredInput.d.ts +2 -5
- package/dist/types/components/ThreeDS/components/ThreeDSIframe/ThreeDSIframe.d.ts +6 -0
- package/dist/types/components/Tip/Tip.d.ts +3 -0
- package/dist/types/components/Tip/index.d.ts +2 -0
- package/dist/types/components/Tip/type.d.ts +12 -0
- package/dist/types/constant.d.ts +3 -1
- package/dist/types/core/checkout.d.ts +1 -1
- package/dist/types/core/environment.d.ts +12 -0
- package/dist/types/core/session.d.ts +1 -0
- package/dist/types/i18n/locales/de-DE.d.ts +4 -0
- package/dist/types/i18n/locales/en-GB.d.ts +4 -0
- package/dist/types/i18n/locales/es-ES.d.ts +4 -0
- package/dist/types/i18n/locales/fr-FR.d.ts +4 -0
- package/dist/types/i18n/locales/ja-JP.d.ts +4 -0
- package/dist/types/i18n/locales/ko-KR.d.ts +4 -0
- package/dist/types/i18n/locales/nl-NL.d.ts +4 -0
- package/dist/types/i18n/locales/pt-PT.d.ts +4 -0
- package/dist/types/i18n/locales/ru-RU.d.ts +4 -0
- package/dist/types/i18n/locales/zh-CN.d.ts +4 -0
- package/dist/types/i18n/locales/zh-HK.d.ts +4 -0
- package/dist/types/i18n/locales/zh-TW.d.ts +4 -0
- package/dist/types/out/base-fraud-detection.d.ts +53 -0
- package/dist/types/out/config.d.ts +11 -0
- package/dist/types/out/fraud-detection.d.ts +14 -3
- package/dist/types/out/paykka-detection.d.ts +20 -0
- package/dist/types/out/stripe-radar.d.ts +7 -9
- package/dist/types/out/types.d.ts +8 -2
- package/dist/types/out/worldpay-ddc.d.ts +7 -19
- package/dist/types/out/worldpay-jsc.d.ts +8 -18
- package/dist/types/types/event.d.ts +86 -39
- package/dist/types/types/fraud-detection.d.ts +1 -1
- package/dist/types/types/index.d.ts +22 -2
- package/dist/types/types/message.d.ts +12 -12
- package/dist/types/utils/app-payment.d.ts +2 -0
- package/dist/types/utils/cpf.d.ts +32 -0
- package/dist/types/utils/encrypt.d.ts +9 -0
- package/dist/types/utils/location.d.ts +1 -0
- package/dist/types/utils/system-info/index.d.ts +0 -1
- package/package.json +5 -4
- package/dist/types/components/ThreeDS/components/ThreeDSStatus/ThreeDSStatus.d.ts +0 -3
- package/dist/types/components/ThreeDS/components/ThreeDSStatus/type.d.ts +0 -6
|
@@ -89,7 +89,12 @@ const enGB = {
|
|
|
89
89
|
"qrCode.expired": "The QR code has expired.",
|
|
90
90
|
"qrCode.scanByGcash": "Scan QR code with GCash",
|
|
91
91
|
"qrCode.scanByZalopay": "Scan QR code with Zalopay",
|
|
92
|
-
"qrCode.scanByVietqr": "Scan QR code with VietQR"
|
|
92
|
+
"qrCode.scanByVietqr": "Scan QR code with VietQR",
|
|
93
|
+
// cpf
|
|
94
|
+
"cpf.label": "CPF/CNPJ",
|
|
95
|
+
"cpf.incomplete": "Your CPF/CNPJ is incomplete",
|
|
96
|
+
"cpf.placeholder": "123.456.789-00",
|
|
97
|
+
"iofTip": "This is a International purchase. IOF fees may be charged by your card issuer. Final amount depends on your bank statement."
|
|
93
98
|
};
|
|
94
99
|
export {
|
|
95
100
|
enGB as default
|
|
@@ -89,7 +89,12 @@ const esES = {
|
|
|
89
89
|
"qrCode.expired": "El código QR ha expirado.",
|
|
90
90
|
"qrCode.scanByGcash": "Escanear el código QR con GCash",
|
|
91
91
|
"qrCode.scanByZalopay": "Escanear el código QR con Zalopay",
|
|
92
|
-
"qrCode.scanByVietqr": "Escanear el código QR con VietQR"
|
|
92
|
+
"qrCode.scanByVietqr": "Escanear el código QR con VietQR",
|
|
93
|
+
// cpf
|
|
94
|
+
"cpf.label": "CPF/CNPJ",
|
|
95
|
+
"cpf.incomplete": "Su CPF/CNPJ está incompleto",
|
|
96
|
+
"cpf.placeholder": "123.456.789-00",
|
|
97
|
+
"iofTip": "Esta es una compra internacional, sin incluir posibles tarifas IOF. Estas tarifas son cobradas por el emisor de su tarjeta y no podemos estimarlas ni deducirlas. El monto final depende de su estado de cuenta bancario."
|
|
93
98
|
};
|
|
94
99
|
export {
|
|
95
100
|
esES as default
|
|
@@ -50,7 +50,7 @@ const frFR = {
|
|
|
50
50
|
"common.paySuccess": "Paiement réussi",
|
|
51
51
|
"common.payTimeout": "Connexion perdue",
|
|
52
52
|
"common.pay3DSIncomplete": "Authentification 3DS incomplète",
|
|
53
|
-
"common.queryTimeout": "
|
|
53
|
+
"common.queryTimeout": "Délai d'attente de la requête dépassé, veuillez actualiser la page ou réessayer de payer",
|
|
54
54
|
"common.generateQrCode": "Générer le code QR",
|
|
55
55
|
"common.recurringTip": "En payant cette commande, vous autorisez le marchand à débiter automatiquement votre carte bancaire à l'avenir selon les termes.",
|
|
56
56
|
"common.noData": "Pas de données",
|
|
@@ -89,7 +89,12 @@ const frFR = {
|
|
|
89
89
|
"qrCode.expired": "Le code QR a expiré.",
|
|
90
90
|
"qrCode.scanByGcash": "Scanner le code QR avec GCash",
|
|
91
91
|
"qrCode.scanByZalopay": "Scanner le code QR avec Zalopay",
|
|
92
|
-
"qrCode.scanByVietqr": "Scanner le code QR avec VietQR"
|
|
92
|
+
"qrCode.scanByVietqr": "Scanner le code QR avec VietQR",
|
|
93
|
+
// cpf
|
|
94
|
+
"cpf.label": "CPF/CNPJ",
|
|
95
|
+
"cpf.incomplete": "Votre CPF/CNPJ est incomplet",
|
|
96
|
+
"cpf.placeholder": "123.456.789-00",
|
|
97
|
+
"iofTip": "Il s'agit d'un achat international, hors frais IOF éventuels. Ces frais sont prélevés par l'émetteur de votre carte et ne peuvent être estimés ni déduits par nos soins. Le montant final dépend de votre relevé bancaire."
|
|
93
98
|
};
|
|
94
99
|
export {
|
|
95
100
|
frFR as default
|
|
@@ -89,7 +89,12 @@ const jaJP = {
|
|
|
89
89
|
"qrCode.expired": "QRコードが期限切れです。",
|
|
90
90
|
"qrCode.scanByGcash": "Gcashでスキャン",
|
|
91
91
|
"qrCode.scanByZalopay": "Zalopayでスキャン",
|
|
92
|
-
"qrCode.scanByVietqr": "VietQRでスキャン"
|
|
92
|
+
"qrCode.scanByVietqr": "VietQRでスキャン",
|
|
93
|
+
// cpf
|
|
94
|
+
"cpf.label": "CPF/CNPJ",
|
|
95
|
+
"cpf.incomplete": "CPF/CNPJが不完全です",
|
|
96
|
+
"cpf.placeholder": "123.456.789-00",
|
|
97
|
+
"iofTip": "これは国際取引であり、発生する可能性のあるIOF手数料は含まれていません。これらの手数料はカード発行会社が徴収するもので、当社では見積もりや控除はできません。最終金額は銀行明細書をご確認ください。"
|
|
93
98
|
};
|
|
94
99
|
export {
|
|
95
100
|
jaJP as default
|
|
@@ -89,7 +89,12 @@ const koKR = {
|
|
|
89
89
|
"qrCode.expired": "QR 코드가 만료되었습니다.",
|
|
90
90
|
"qrCode.scanByGcash": "GCash 스캔",
|
|
91
91
|
"qrCode.scanByZalopay": "Zalopay 스캔",
|
|
92
|
-
"qrCode.scanByVietqr": "VietQR 스캔"
|
|
92
|
+
"qrCode.scanByVietqr": "VietQR 스캔",
|
|
93
|
+
// cpf
|
|
94
|
+
"cpf.label": "CPF/CNPJ",
|
|
95
|
+
"cpf.incomplete": "CPF/CNPJ가 불완전합니다",
|
|
96
|
+
"cpf.placeholder": "123.456.789-00",
|
|
97
|
+
"iofTip": "이것은 국제 거래이며 발생할 수 있는 IOF 수수료는 포함되어 있지 않습니다. 이 수수료는 카드 발급사에서 징수하며 당사에서는 추정하거나 공제할 수 없습니다. 최종 금액은 은행 명세서를 확인해 주세요."
|
|
93
98
|
};
|
|
94
99
|
export {
|
|
95
100
|
koKR as default
|
|
@@ -89,7 +89,12 @@ const nlNL = {
|
|
|
89
89
|
"qrCode.expired": "De QR-code is verlopen.",
|
|
90
90
|
"qrCode.scanByGcash": "Scan QR-code met GCash",
|
|
91
91
|
"qrCode.scanByZalopay": "Scan QR-code met Zalopay",
|
|
92
|
-
"qrCode.scanByVietqr": "Scan QR-code met VietQR"
|
|
92
|
+
"qrCode.scanByVietqr": "Scan QR-code met VietQR",
|
|
93
|
+
// cpf
|
|
94
|
+
"cpf.label": "CPF/CNPJ",
|
|
95
|
+
"cpf.incomplete": "Uw CPF/CNPJ is onvolledig",
|
|
96
|
+
"cpf.placeholder": "123.456.789-00",
|
|
97
|
+
"iofTip": "Dit is een internationale aankoop, exclusief eventuele IOF-kosten. Deze kosten worden door uw kaartuitgever in rekening gebracht en kunnen door ons niet worden geschat of afgetrokken. Het uiteindelijke bedrag hangt af van uw bankafschrift."
|
|
93
98
|
};
|
|
94
99
|
export {
|
|
95
100
|
nlNL as default
|
|
@@ -89,7 +89,12 @@ const ptPT = {
|
|
|
89
89
|
"qrCode.expired": "O código QR expirou.",
|
|
90
90
|
"qrCode.scanByGcash": "Escaneie o código QR com GCash",
|
|
91
91
|
"qrCode.scanByZalopay": "Escaneie o código QR com Zalopay",
|
|
92
|
-
"qrCode.scanByVietqr": "Escaneie o código QR com VietQR"
|
|
92
|
+
"qrCode.scanByVietqr": "Escaneie o código QR com VietQR",
|
|
93
|
+
// cpf
|
|
94
|
+
"cpf.label": "CPF/CNPJ",
|
|
95
|
+
"cpf.incomplete": "Seu CPF/CNPJ está incompleto",
|
|
96
|
+
"cpf.placeholder": "123.456.789-00",
|
|
97
|
+
"iofTip": "Esta é uma compra internacional, não incluindo possíveis taxas de IOF. Estas taxas são cobradas pelo emissor do seu cartão e não podemos estimá-las ou deduzi-las. O valor final depende do extrato do seu banco."
|
|
93
98
|
};
|
|
94
99
|
export {
|
|
95
100
|
ptPT as default
|
|
@@ -89,7 +89,12 @@ const ruRU = {
|
|
|
89
89
|
"qrCode.expired": "Срок действия QR-кода истек.",
|
|
90
90
|
"qrCode.scanByGcash": "Сканируйте QR-кодом с GCash",
|
|
91
91
|
"qrCode.scanByZalopay": "Сканируйте QR-кодом с Zalopay",
|
|
92
|
-
"qrCode.scanByVietqr": "Сканируйте QR-кодом с VietQR"
|
|
92
|
+
"qrCode.scanByVietqr": "Сканируйте QR-кодом с VietQR",
|
|
93
|
+
// cpf
|
|
94
|
+
"cpf.label": "CPF/CNPJ",
|
|
95
|
+
"cpf.incomplete": "Ваш CPF/CNPJ неполный",
|
|
96
|
+
"cpf.placeholder": "123.456.789-00",
|
|
97
|
+
"iofTip": "Это международная покупка, не включающая возможные комиссии IOF. Эти комиссии взимаются эмитентом вашей карты, и мы не можем их оценить или вычесть. Окончательная сумма зависит от выписки вашего банка."
|
|
93
98
|
};
|
|
94
99
|
export {
|
|
95
100
|
ruRU as default
|
|
@@ -89,7 +89,12 @@ const zhCN = {
|
|
|
89
89
|
"qrCode.expired": "二维码过期",
|
|
90
90
|
"qrCode.scanByGcash": "用 Gcash 扫码",
|
|
91
91
|
"qrCode.scanByZalopay": "用 Zalopay 扫码",
|
|
92
|
-
"qrCode.scanByVietqr": "用 VietQR 扫码"
|
|
92
|
+
"qrCode.scanByVietqr": "用 VietQR 扫码",
|
|
93
|
+
// cpf
|
|
94
|
+
"cpf.label": "CPF/CNPJ",
|
|
95
|
+
"cpf.incomplete": "您的身份证件号码不完整",
|
|
96
|
+
"cpf.placeholder": "123.456.789-00",
|
|
97
|
+
"iofTip": "这是一笔国际交易,不包含可能产生的IOF费用。这些费用由您的发卡行收取,我们无法预估或减免。最终金额请以您的银行账单为准"
|
|
93
98
|
};
|
|
94
99
|
export {
|
|
95
100
|
zhCN as default
|
|
@@ -74,7 +74,7 @@ const zhHK = {
|
|
|
74
74
|
"address.city": "城市",
|
|
75
75
|
"address.postCode": "郵編",
|
|
76
76
|
"address.province": "州/省",
|
|
77
|
-
"address.area": "
|
|
77
|
+
"address.area": "區/縣",
|
|
78
78
|
// sepa
|
|
79
79
|
"sepa.iban.label": "IBAN",
|
|
80
80
|
"sepa.iban.placeholder": "DE00 0000 0000 0000 0000 00",
|
|
@@ -89,7 +89,12 @@ const zhHK = {
|
|
|
89
89
|
"qrCode.expired": "二維碼過期",
|
|
90
90
|
"qrCode.scanByGcash": "用 Gcash 掃碼",
|
|
91
91
|
"qrCode.scanByZalopay": "用 Zalopay 掃碼",
|
|
92
|
-
"qrCode.scanByVietqr": "用 VietQR 掃碼"
|
|
92
|
+
"qrCode.scanByVietqr": "用 VietQR 掃碼",
|
|
93
|
+
// cpf
|
|
94
|
+
"cpf.label": "CPF/CNPJ",
|
|
95
|
+
"cpf.incomplete": "您的身份證件號碼不完整",
|
|
96
|
+
"cpf.placeholder": "123.456.789-00",
|
|
97
|
+
"iofTip": "這是一筆國際交易,不包含可能產生的IOF費用。這些費用由您的發卡行收取,我們無法預估或減免。最終金額請以您的銀行賬單為準"
|
|
93
98
|
};
|
|
94
99
|
export {
|
|
95
100
|
zhHK as default
|
|
@@ -74,7 +74,7 @@ const zhTW = {
|
|
|
74
74
|
"address.city": "城市",
|
|
75
75
|
"address.postCode": "郵編",
|
|
76
76
|
"address.province": "州/省",
|
|
77
|
-
"address.area": "
|
|
77
|
+
"address.area": "區/縣",
|
|
78
78
|
// sepa
|
|
79
79
|
"sepa.iban.label": "IBAN",
|
|
80
80
|
"sepa.iban.placeholder": "DE00 0000 0000 0000 0000 00",
|
|
@@ -89,7 +89,12 @@ const zhTW = {
|
|
|
89
89
|
"qrCode.expired": "二維碼過期",
|
|
90
90
|
"qrCode.scanByGcash": "用 Gcash 掃碼",
|
|
91
91
|
"qrCode.scanByZalopay": "用 Zalopay 掃碼",
|
|
92
|
-
"qrCode.scanByVietqr": "用 VietQR 掃碼"
|
|
92
|
+
"qrCode.scanByVietqr": "用 VietQR 掃碼",
|
|
93
|
+
// cpf
|
|
94
|
+
"cpf.label": "CPF/CNPJ",
|
|
95
|
+
"cpf.incomplete": "您的身份證件號碼不完整",
|
|
96
|
+
"cpf.placeholder": "123.456.789-00",
|
|
97
|
+
"iofTip": "這是一筆國際交易,不包含可能產生的IOF費用。這些費用由您的發卡行收取,我們無法預估或減免。最終金額請以您的銀行帳單為準"
|
|
93
98
|
};
|
|
94
99
|
export {
|
|
95
100
|
zhTW as default
|
package/dist/es/index.js
CHANGED
|
@@ -43,20 +43,20 @@ import { PaymentMethod } from "./constant.js";
|
|
|
43
43
|
import "./utils/card-brand/brands.js";
|
|
44
44
|
import { getFingerprint } from "./utils/system-info/finger-print.js";
|
|
45
45
|
import "./utils/system-info/get-browser-info.js";
|
|
46
|
-
import { CardBrandCode, EPayKKaEnv, defaultInputStyleConfig, inputStyleAttrs } from "./types/index.js";
|
|
46
|
+
import { CardBrandCode, EPayKKaEnv, PaymentStatus, defaultInputStyleConfig, inputStyleAttrs } from "./types/index.js";
|
|
47
47
|
import { redirectToPayment } from "./utils/redirect.js";
|
|
48
48
|
import "./core.js";
|
|
49
49
|
import { I18n } from "./i18n/I18n.js";
|
|
50
50
|
import { LocaleKey } from "./i18n/locales/index.js";
|
|
51
51
|
import { setApiUrl, setCDNUrl, setCustomLocale, setCustomReqHeaders, setFraudDetectionEnv } from "./config.js";
|
|
52
|
-
import { FraudDetectionEventType } from "./types/event.js";
|
|
53
|
-
import "./api/http.js";
|
|
52
|
+
import { ApplePayEventType, FraudDetectionEventType, GooglePayEventType, PaymentEventType } from "./types/event.js";
|
|
54
53
|
import "./out/worldpay-jsc-origin.js";
|
|
55
54
|
import { ECollMode } from "./types/fraud-detection.js";
|
|
56
55
|
import { MessageAction } from "./types/message.js";
|
|
57
56
|
export {
|
|
58
57
|
AliPay,
|
|
59
58
|
ApplePay,
|
|
59
|
+
ApplePayEventType,
|
|
60
60
|
Boost,
|
|
61
61
|
Card,
|
|
62
62
|
CardBrandCode,
|
|
@@ -78,6 +78,7 @@ export {
|
|
|
78
78
|
FraudDetectionEventType,
|
|
79
79
|
GCash,
|
|
80
80
|
GooglePay,
|
|
81
|
+
GooglePayEventType,
|
|
81
82
|
GrabPay,
|
|
82
83
|
I18n,
|
|
83
84
|
IBANField,
|
|
@@ -93,7 +94,9 @@ export {
|
|
|
93
94
|
PayKKaError,
|
|
94
95
|
Paymaya,
|
|
95
96
|
PaymentComponentMap,
|
|
97
|
+
PaymentEventType,
|
|
96
98
|
PaymentMethod,
|
|
99
|
+
PaymentStatus,
|
|
97
100
|
PicPay,
|
|
98
101
|
Pix,
|
|
99
102
|
SecuredIframe,
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => {
|
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
7
|
+
import { FraudDetectionEventType } from "../types/event.js";
|
|
8
|
+
import "../core/context.js";
|
|
9
|
+
import "../core.js";
|
|
10
|
+
import "../utils/card-brand/brands.js";
|
|
11
|
+
import "../utils/system-info/get-browser-info.js";
|
|
12
|
+
import { PayKKaError, EPayKKaError } from "../core/error.js";
|
|
13
|
+
import "./worldpay-jsc-origin.js";
|
|
14
|
+
class BaseFraudDetection {
|
|
15
|
+
constructor(params) {
|
|
16
|
+
/** 当前渠道 */
|
|
17
|
+
__publicField(this, "channel");
|
|
18
|
+
__publicField(this, "options");
|
|
19
|
+
/** 欺诈检测 id */
|
|
20
|
+
__publicField(this, "fraudDetectionId", "");
|
|
21
|
+
/** 渠道配置 */
|
|
22
|
+
__publicField(this, "channelConfig");
|
|
23
|
+
/** 超时时间,单位:毫秒,如果渠道需要设置超时时间,则需要传入 */
|
|
24
|
+
__publicField(this, "timeout", null);
|
|
25
|
+
__publicField(this, "timer", null);
|
|
26
|
+
__publicField(this, "initPromise", null);
|
|
27
|
+
this.channel = params.channel;
|
|
28
|
+
this.channelConfig = params.channelConfig;
|
|
29
|
+
this.timeout = params.timeout;
|
|
30
|
+
this.options = params.options;
|
|
31
|
+
}
|
|
32
|
+
/** 如果渠道获取 id 需要一些配置,则需要实现该方法进行校验 */
|
|
33
|
+
validateChannelConfig() {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
/** 如果渠道需要加载外部资源,则需要实现该方法进行加载 */
|
|
37
|
+
load() {
|
|
38
|
+
return Promise.resolve();
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* 通用初始化方法
|
|
42
|
+
* 1. 上报开始事件
|
|
43
|
+
* 2. 校验渠道配置,如果校验失败,上报渠道配置错误事件
|
|
44
|
+
* 3. 加载渠道资源,如果加载失败,上报加载失败事件
|
|
45
|
+
* 4. 收集欺诈检测 id
|
|
46
|
+
* 5. 上报成功事件,如果收集失败,上报失败事件
|
|
47
|
+
*/
|
|
48
|
+
async init(...args) {
|
|
49
|
+
if (this.fraudDetectionId) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (this.initPromise) {
|
|
53
|
+
return this.initPromise;
|
|
54
|
+
}
|
|
55
|
+
this.initPromise = new Promise(async (resolve) => {
|
|
56
|
+
var _a;
|
|
57
|
+
this.reportEvent(FraudDetectionEventType.FRAUD_DETECTION_START);
|
|
58
|
+
if (!((_a = this.validateChannelConfig) == null ? void 0 : _a.call(this))) {
|
|
59
|
+
this.reportEvent(FraudDetectionEventType.FRAUD_DETECTION_CHANNEL_CONFIG_ERROR);
|
|
60
|
+
resolve();
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
try {
|
|
64
|
+
await this.load();
|
|
65
|
+
} catch (error) {
|
|
66
|
+
this.reportEvent(FraudDetectionEventType.FRAUD_DETECTION_LOAD_ERROR);
|
|
67
|
+
resolve();
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
try {
|
|
71
|
+
this.clearTimer();
|
|
72
|
+
if (this.timeout) {
|
|
73
|
+
const result = await Promise.race([
|
|
74
|
+
this.collect(...args),
|
|
75
|
+
this.createTimeoutPromise()
|
|
76
|
+
]);
|
|
77
|
+
if (result instanceof PayKKaError && result.type === EPayKKaError.TIMEOUT) {
|
|
78
|
+
this.reportEvent(FraudDetectionEventType.FRAUD_DETECTION_TIMEOUT);
|
|
79
|
+
resolve();
|
|
80
|
+
return;
|
|
81
|
+
} else {
|
|
82
|
+
this.fraudDetectionId = result;
|
|
83
|
+
}
|
|
84
|
+
} else {
|
|
85
|
+
this.fraudDetectionId = await this.collect(...args);
|
|
86
|
+
}
|
|
87
|
+
this.clearTimer();
|
|
88
|
+
} catch (error) {
|
|
89
|
+
this.clearTimer();
|
|
90
|
+
this.reportEvent(FraudDetectionEventType.FRAUD_DETECTION_ERROR, { message: error == null ? void 0 : error.message });
|
|
91
|
+
resolve();
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
this.reportEvent(FraudDetectionEventType.FRAUD_DETECTION_SUCCESS);
|
|
95
|
+
resolve();
|
|
96
|
+
});
|
|
97
|
+
return this.initPromise;
|
|
98
|
+
}
|
|
99
|
+
clearTimer() {
|
|
100
|
+
this.timer && clearTimeout(this.timer);
|
|
101
|
+
this.timer = null;
|
|
102
|
+
}
|
|
103
|
+
createTimeoutPromise() {
|
|
104
|
+
return new Promise((resolve) => {
|
|
105
|
+
this.timer = setTimeout(() => {
|
|
106
|
+
resolve(new PayKKaError(EPayKKaError.TIMEOUT));
|
|
107
|
+
}, this.timeout);
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
getFraudDetectionId() {
|
|
111
|
+
return this.fraudDetectionId;
|
|
112
|
+
}
|
|
113
|
+
onError(error) {
|
|
114
|
+
this.reportEvent(FraudDetectionEventType.FRAUD_DETECTION_ERROR, { message: error == null ? void 0 : error.message });
|
|
115
|
+
}
|
|
116
|
+
onWarning(message) {
|
|
117
|
+
this.reportEvent(FraudDetectionEventType.FRAUD_DETECTION_WARNING, { message });
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* 统一的事件上报方法,尽量不要在子类中调用该方法,减少耦合
|
|
121
|
+
* @param eventType 事件类型
|
|
122
|
+
* @param data 事件数据(可选,无需传 channel)
|
|
123
|
+
*/
|
|
124
|
+
reportEvent(eventType, data) {
|
|
125
|
+
var _a, _b;
|
|
126
|
+
(_b = (_a = this.options) == null ? void 0 : _a.onEvent) == null ? void 0 : _b.call(_a, eventType, {
|
|
127
|
+
...data || {},
|
|
128
|
+
channel: this.channel
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
export {
|
|
133
|
+
BaseFraudDetection
|
|
134
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const JSC_LIVE_CONFIG = {
|
|
2
|
+
organizationId: "dzppsd1h",
|
|
3
|
+
profilingDomain: "ddc.worldpay.com"
|
|
4
|
+
};
|
|
5
|
+
const JSC_TEST_CONFIG = {
|
|
6
|
+
organizationId: "afevfjm6",
|
|
7
|
+
profilingDomain: "ddc-test.worldpay.com"
|
|
8
|
+
};
|
|
9
|
+
const STRIPE_RADAR_SCRIPT_URL = "https://js.stripe.com/v3/";
|
|
10
|
+
const DDC_TIMEOUT = 1e4;
|
|
11
|
+
export {
|
|
12
|
+
DDC_TIMEOUT,
|
|
13
|
+
JSC_LIVE_CONFIG,
|
|
14
|
+
JSC_TEST_CONFIG,
|
|
15
|
+
STRIPE_RADAR_SCRIPT_URL
|
|
16
|
+
};
|
|
@@ -4,24 +4,49 @@ var __publicField = (obj, key, value) => {
|
|
|
4
4
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
var __accessCheck = (obj, member, msg) => {
|
|
8
|
+
if (!member.has(obj))
|
|
9
|
+
throw TypeError("Cannot " + msg);
|
|
10
|
+
};
|
|
11
|
+
var __privateGet = (obj, member, getter) => {
|
|
12
|
+
__accessCheck(obj, member, "read from private field");
|
|
13
|
+
return getter ? getter.call(obj) : member.get(obj);
|
|
14
|
+
};
|
|
15
|
+
var __privateAdd = (obj, member, value) => {
|
|
16
|
+
if (member.has(obj))
|
|
17
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
18
|
+
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
19
|
+
};
|
|
20
|
+
var __privateSet = (obj, member, value, setter) => {
|
|
21
|
+
__accessCheck(obj, member, "write to private field");
|
|
22
|
+
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
23
|
+
return value;
|
|
24
|
+
};
|
|
25
|
+
var _sessionMode;
|
|
26
|
+
import { getBrowserParams } from "../api/modules/get-browser-params.js";
|
|
27
|
+
import { getChannelSDKConfig } from "../api/modules/risk/index.js";
|
|
28
|
+
import { setApiUrl, setCDNUrl, setApiPrefix } from "../config.js";
|
|
29
|
+
import { ChannelCode } from "../constant.js";
|
|
30
|
+
import { apiEnv, cdnEnv } from "../core/environment.js";
|
|
9
31
|
import { ECollMode } from "../types/fraud-detection.js";
|
|
10
32
|
import { FraudDetectionEventType } from "../types/event.js";
|
|
33
|
+
import { JSC_LIVE_CONFIG, JSC_TEST_CONFIG } from "./config.js";
|
|
34
|
+
import { PayKKaDetection } from "./paykka-detection.js";
|
|
11
35
|
import { StripeRadar } from "./stripe-radar.js";
|
|
12
36
|
import { WorldpayDDC } from "./worldpay-ddc.js";
|
|
13
37
|
import { WorldpayJSC } from "./worldpay-jsc.js";
|
|
14
38
|
const DEFAULT_ENV = "eu";
|
|
15
39
|
let instance = null;
|
|
16
|
-
function getFraudDetectionInstance(
|
|
40
|
+
function getFraudDetectionInstance(config, options, mode) {
|
|
17
41
|
if (!instance) {
|
|
18
|
-
instance = new FraudDetection(
|
|
42
|
+
instance = new FraudDetection(config, mode, options);
|
|
19
43
|
}
|
|
20
44
|
return instance;
|
|
21
45
|
}
|
|
22
46
|
class FraudDetection {
|
|
23
|
-
constructor(
|
|
47
|
+
constructor(config, mode = [ECollMode.SR, ECollMode.WP, ECollMode.WJ], options) {
|
|
24
48
|
__publicField(this, "options");
|
|
49
|
+
__publicField(this, "clientKey");
|
|
25
50
|
__publicField(this, "collMap", {
|
|
26
51
|
[ECollMode.SR]: () => this.stripeRadarColl(),
|
|
27
52
|
[ECollMode.WP]: () => this.worldpayDDCColl(),
|
|
@@ -30,34 +55,52 @@ class FraudDetection {
|
|
|
30
55
|
__publicField(this, "p");
|
|
31
56
|
__publicField(this, "realMode", []);
|
|
32
57
|
__publicField(this, "env");
|
|
58
|
+
__publicField(this, "channelConfig");
|
|
59
|
+
__publicField(this, "channelConfigPromise");
|
|
60
|
+
/** 是否是 IIFE 模式,在 build 时通过 define 定义,如果 IIFE 为 true,说明商户是直接引入 SDK,用于 API 支付 */
|
|
61
|
+
__publicField(this, "isIIFE", typeof __IS_IIFE__ !== "undefined" && __IS_IIFE__);
|
|
62
|
+
__privateAdd(this, _sessionMode, void 0);
|
|
63
|
+
const { env, clientKey } = config;
|
|
33
64
|
this.realMode = mode;
|
|
34
65
|
this.options = options;
|
|
35
|
-
this.env = env;
|
|
36
|
-
|
|
37
|
-
|
|
66
|
+
this.env = env || DEFAULT_ENV;
|
|
67
|
+
this.clientKey = clientKey;
|
|
68
|
+
__privateSet(this, _sessionMode, this.isIIFE ? "API" : options == null ? void 0 : options.sessionMode);
|
|
69
|
+
if (this.isIIFE) {
|
|
70
|
+
setApiUrl(apiEnv[this.env]);
|
|
71
|
+
setCDNUrl(cdnEnv[this.env]);
|
|
72
|
+
setApiPrefix(`/session`);
|
|
38
73
|
}
|
|
39
74
|
}
|
|
40
75
|
async getFraudDetectionId(options) {
|
|
76
|
+
await this.setChannelSDKConfig();
|
|
77
|
+
await Promise.all([
|
|
78
|
+
this.worldpayDDCColl().init((options == null ? void 0 : options.bin) || ""),
|
|
79
|
+
this.paykkaDetectionColl().init()
|
|
80
|
+
]);
|
|
81
|
+
const mode = this.realMode;
|
|
41
82
|
return this.formatFraudDetectionId({
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
// worldpay jsc fraud detection id
|
|
47
|
-
wr: this.worldpayJSCColl().fraudDetectionId
|
|
83
|
+
s: mode.includes(ECollMode.SR) ? this.stripeRadarColl().getFraudDetectionId() : "",
|
|
84
|
+
w: mode.includes(ECollMode.WP) ? this.worldpayDDCColl().getFraudDetectionId() : "",
|
|
85
|
+
wr: mode.includes(ECollMode.WJ) ? this.worldpayJSCColl().getFraudDetectionId() : "",
|
|
86
|
+
p: this.paykkaDetectionColl().getFraudDetectionId()
|
|
48
87
|
});
|
|
49
88
|
}
|
|
50
89
|
/** 创建获取 fraud detection id 的 promise,缓存单例 */
|
|
51
90
|
async createFraudDetection() {
|
|
91
|
+
await this.setChannelSDKConfig();
|
|
52
92
|
if (!this.p) {
|
|
53
93
|
this.p = Promise.all(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
94
|
+
[
|
|
95
|
+
...this.realMode.map(async (item) => {
|
|
96
|
+
if (this.collMap[item]) {
|
|
97
|
+
return this.collMap[item]();
|
|
98
|
+
} else {
|
|
99
|
+
throw new Error(`Unsupported collection mode: ${item}`);
|
|
100
|
+
}
|
|
101
|
+
}),
|
|
102
|
+
this.paykkaDetectionColl()
|
|
103
|
+
]
|
|
61
104
|
);
|
|
62
105
|
}
|
|
63
106
|
await this.p;
|
|
@@ -68,23 +111,71 @@ class FraudDetection {
|
|
|
68
111
|
const s = JSON.stringify(data);
|
|
69
112
|
return btoa(s);
|
|
70
113
|
} catch (error) {
|
|
71
|
-
console.error("[PayKKa Fraud Detection SDK]:", error);
|
|
72
114
|
(_b = (_a = this.options) == null ? void 0 : _a.onEvent) == null ? void 0 : _b.call(_a, FraudDetectionEventType.FRAUD_DETECTION_TRANSFORM_ERROR);
|
|
73
115
|
return "";
|
|
74
116
|
}
|
|
75
117
|
}
|
|
118
|
+
async setChannelSDKConfig() {
|
|
119
|
+
if (this.channelConfig) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
if (this.channelConfigPromise) {
|
|
123
|
+
return this.channelConfigPromise;
|
|
124
|
+
}
|
|
125
|
+
this.channelConfigPromise = new Promise(async (resolve) => {
|
|
126
|
+
let browser = {};
|
|
127
|
+
let config = {};
|
|
128
|
+
try {
|
|
129
|
+
browser = await getBrowserParams();
|
|
130
|
+
config = await getChannelSDKConfig({
|
|
131
|
+
channel: [ChannelCode.STRIPE, ChannelCode.WORLDPAY],
|
|
132
|
+
browser
|
|
133
|
+
});
|
|
134
|
+
} catch (error) {
|
|
135
|
+
}
|
|
136
|
+
const { worldPay } = config || {};
|
|
137
|
+
let ddcOrigin = "";
|
|
138
|
+
try {
|
|
139
|
+
ddcOrigin = new URL((worldPay == null ? void 0 : worldPay.ddcCollectUrl) || "").origin;
|
|
140
|
+
} catch (error) {
|
|
141
|
+
ddcOrigin = "";
|
|
142
|
+
}
|
|
143
|
+
this.channelConfig = {
|
|
144
|
+
...config,
|
|
145
|
+
worldPay: {
|
|
146
|
+
...worldPay,
|
|
147
|
+
ddcOrigin
|
|
148
|
+
},
|
|
149
|
+
worldPayJSC: ["eu", "hk"].includes(this.env) ? JSC_LIVE_CONFIG : JSC_TEST_CONFIG,
|
|
150
|
+
paykka: {
|
|
151
|
+
clientKey: this.clientKey,
|
|
152
|
+
sessionMode: __privateGet(this, _sessionMode)
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
resolve();
|
|
156
|
+
});
|
|
157
|
+
return this.channelConfigPromise;
|
|
158
|
+
}
|
|
76
159
|
worldpayDDCColl() {
|
|
77
|
-
|
|
78
|
-
return new WorldpayDDC(config, this.options);
|
|
160
|
+
return new WorldpayDDC(this.options, this.channelConfig);
|
|
79
161
|
}
|
|
80
162
|
worldpayJSCColl() {
|
|
81
|
-
const
|
|
82
|
-
|
|
163
|
+
const instance2 = new WorldpayJSC(this.options, this.channelConfig);
|
|
164
|
+
instance2.init();
|
|
165
|
+
return instance2;
|
|
83
166
|
}
|
|
84
167
|
stripeRadarColl() {
|
|
85
|
-
|
|
168
|
+
const instance2 = new StripeRadar(this.options, this.channelConfig);
|
|
169
|
+
instance2.init();
|
|
170
|
+
return instance2;
|
|
171
|
+
}
|
|
172
|
+
paykkaDetectionColl() {
|
|
173
|
+
const instance2 = new PayKKaDetection(this.options, this.channelConfig);
|
|
174
|
+
instance2.init();
|
|
175
|
+
return instance2;
|
|
86
176
|
}
|
|
87
177
|
}
|
|
178
|
+
_sessionMode = new WeakMap();
|
|
88
179
|
export {
|
|
89
180
|
getFraudDetectionInstance
|
|
90
181
|
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => {
|
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
7
|
+
import "../utils/card-brand/brands.js";
|
|
8
|
+
import "../utils/system-info/get-browser-info.js";
|
|
9
|
+
import { ChannelCode } from "../constant.js";
|
|
10
|
+
import { parseUrl } from "../utils/location.js";
|
|
11
|
+
import "../core.js";
|
|
12
|
+
import "../core/context.js";
|
|
13
|
+
import { reportUrls } from "../api/modules/risk/index.js";
|
|
14
|
+
import { encryptAES } from "../utils/encrypt.js";
|
|
15
|
+
import { BaseFraudDetection } from "./base-fraud-detection.js";
|
|
16
|
+
import "./worldpay-jsc-origin.js";
|
|
17
|
+
const _PayKKaDetection = class _PayKKaDetection extends BaseFraudDetection {
|
|
18
|
+
constructor(options, channelConfig) {
|
|
19
|
+
if (_PayKKaDetection.instance) {
|
|
20
|
+
return _PayKKaDetection.instance;
|
|
21
|
+
}
|
|
22
|
+
super({
|
|
23
|
+
channel: ChannelCode.PAYKKA,
|
|
24
|
+
channelConfig,
|
|
25
|
+
options
|
|
26
|
+
});
|
|
27
|
+
_PayKKaDetection.instance = this;
|
|
28
|
+
}
|
|
29
|
+
validateChannelConfig() {
|
|
30
|
+
var _a;
|
|
31
|
+
const { clientKey, sessionMode } = ((_a = this.channelConfig) == null ? void 0 : _a.paykka) || {};
|
|
32
|
+
return !!clientKey && !!sessionMode;
|
|
33
|
+
}
|
|
34
|
+
async collect() {
|
|
35
|
+
var _a;
|
|
36
|
+
const { clientKey, sessionMode } = ((_a = this.channelConfig) == null ? void 0 : _a.paykka) || {};
|
|
37
|
+
const data = {
|
|
38
|
+
originUrl: this.getOrigin(),
|
|
39
|
+
refererUrl: this.getReferer()
|
|
40
|
+
};
|
|
41
|
+
const res = await reportUrls({
|
|
42
|
+
clientKey,
|
|
43
|
+
fraudDetectionMode: sessionMode,
|
|
44
|
+
data: await encryptAES(clientKey, JSON.stringify(data))
|
|
45
|
+
});
|
|
46
|
+
return res;
|
|
47
|
+
}
|
|
48
|
+
/** 获取页面来源域名 */
|
|
49
|
+
getReferer() {
|
|
50
|
+
var _a, _b;
|
|
51
|
+
const referer = document.referrer || ((_b = (_a = window.frames) == null ? void 0 : _a.top) == null ? void 0 : _b.document.referrer) || "";
|
|
52
|
+
return parseUrl(referer).origin;
|
|
53
|
+
}
|
|
54
|
+
/** 获取当前页面域名 */
|
|
55
|
+
getOrigin() {
|
|
56
|
+
return parseUrl(window.location.href).origin;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
__publicField(_PayKKaDetection, "instance", null);
|
|
60
|
+
let PayKKaDetection = _PayKKaDetection;
|
|
61
|
+
export {
|
|
62
|
+
PayKKaDetection
|
|
63
|
+
};
|