react-native-tpay 0.3.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/LICENSE +22 -0
- package/README.md +555 -0
- package/android/build.gradle +95 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/tpay/TpayAmbiguousBLIKPaymentHandler.kt +21 -0
- package/android/src/main/java/com/tpay/TpayModule.kt +528 -0
- package/android/src/main/java/com/tpay/TpayPackage.kt +17 -0
- package/android/src/main/java/com/tpay/TpayResult.kt +12 -0
- package/android/src/main/java/com/tpay/TpayScreenlessPaymentHandler.kt +102 -0
- package/android/src/main/java/com/tpay/TpayScreenlessResult.kt +25 -0
- package/android/src/main/java/com/tpay/TpayScreenlessResultHandler.kt +121 -0
- package/android/src/main/java/com/tpay/delegate/AddCardDelegateImpl.kt +30 -0
- package/android/src/main/java/com/tpay/delegate/PaymentDelegateImpl.kt +33 -0
- package/android/src/main/java/com/tpay/extension/AmbiguousAlias+.kt +11 -0
- package/android/src/main/java/com/tpay/extension/BlikAlias+.kt +18 -0
- package/android/src/main/java/com/tpay/extension/CardTokenTransaction+.kt +19 -0
- package/android/src/main/java/com/tpay/extension/Exception.kt +3 -0
- package/android/src/main/java/com/tpay/extension/JSONObject+.kt +10 -0
- package/android/src/main/java/com/tpay/extension/PaymentChannel+.kt +22 -0
- package/android/src/main/java/com/tpay/extension/PaymentConstraint+.kt +24 -0
- package/android/src/main/java/com/tpay/extension/PaymentGroup+.kt +21 -0
- package/android/src/main/java/com/tpay/extension/SingleTransaction+.kt +14 -0
- package/android/src/main/java/com/tpay/extension/String+.kt +30 -0
- package/android/src/main/java/com/tpay/model/CertificateConfiguration.kt +20 -0
- package/android/src/main/java/com/tpay/model/Configuration.kt +5 -0
- package/android/src/main/java/com/tpay/model/ConfigurationMerchant.kt +33 -0
- package/android/src/main/java/com/tpay/model/Languages.kt +24 -0
- package/android/src/main/java/com/tpay/model/LocalizedString.kt +21 -0
- package/android/src/main/java/com/tpay/model/MerchantAuthorization.kt +20 -0
- package/android/src/main/java/com/tpay/model/MerchantDetails.kt +32 -0
- package/android/src/main/java/com/tpay/model/PaymentMethods.kt +90 -0
- package/android/src/main/java/com/tpay/model/TpayConfiguration.kt +50 -0
- package/android/src/main/java/com/tpay/model/WalletConfiguration.kt +14 -0
- package/android/src/main/java/com/tpay/model/googlePay/GooglePayConfiguration.kt +13 -0
- package/android/src/main/java/com/tpay/model/googlePay/GooglePayConfigureResult.kt +6 -0
- package/android/src/main/java/com/tpay/model/googlePay/GooglePayUtilsConfiguration.kt +57 -0
- package/android/src/main/java/com/tpay/model/screenless/AmbiguousBLIKAlias.kt +35 -0
- package/android/src/main/java/com/tpay/model/screenless/AmbiguousBLIKPayment.kt +26 -0
- package/android/src/main/java/com/tpay/model/screenless/BLIKScreenlessPayment.kt +28 -0
- package/android/src/main/java/com/tpay/model/screenless/CreditCardData.kt +10 -0
- package/android/src/main/java/com/tpay/model/screenless/CreditCardScreenlessPayment.kt +75 -0
- package/android/src/main/java/com/tpay/model/screenless/ExpirationDate.kt +22 -0
- package/android/src/main/java/com/tpay/model/screenless/GooglePayScreenlessPayment.kt +19 -0
- package/android/src/main/java/com/tpay/model/screenless/PaymentConstraintType.kt +5 -0
- package/android/src/main/java/com/tpay/model/screenless/RatyPekaoScreenlessPayment.kt +9 -0
- package/android/src/main/java/com/tpay/model/screenless/ScreenlessPayment.kt +87 -0
- package/android/src/main/java/com/tpay/model/screenless/TransferScreenlessPayment.kt +9 -0
- package/android/src/main/java/com/tpay/util/JsonUtil.kt +178 -0
- package/android/src/main/java/com/tpay/util/TpayBackpressUtil.kt +23 -0
- package/android/src/main/java/com/tpay/util/TpayUtil.kt +67 -0
- package/android/src/main/java/com/tpay/util/ValidationMessages.kt +19 -0
- package/ios/Source/Configuration/MerchantConfiguration.swift +120 -0
- package/ios/Source/Configuration/PaymentMethodConfiguration.swift +41 -0
- package/ios/Source/Configuration/TransactionConfiguration.swift +200 -0
- package/ios/Source/Extension/TPay+Setup.swift +32 -0
- package/ios/Source/Model/Domain/BankPayment.swift +12 -0
- package/ios/Source/Model/Domain/BlikPayment.swift +14 -0
- package/ios/Source/Model/Domain/CardPayment.swift +14 -0
- package/ios/Source/Model/Domain/ConfigurationResult.swift +98 -0
- package/ios/Source/Model/Domain/ContinuePayment.swift +10 -0
- package/ios/Source/Model/Domain/DigitalWalletPayment.swift +13 -0
- package/ios/Source/Model/Domain/PaymentChannelResult.swift +44 -0
- package/ios/Source/Model/Domain/ScreenlessResult.swift +67 -0
- package/ios/Source/Model/Domain/TokenisationData.swift +16 -0
- package/ios/Source/Model/Transportation/Transportation+AmbiguousAlias.swift +10 -0
- package/ios/Source/Model/Transportation/Transportation+Bank.swift +11 -0
- package/ios/Source/Model/Transportation/Transportation+BankPayment.swift +13 -0
- package/ios/Source/Model/Transportation/Transportation+BlikPayment+Alias.swift +9 -0
- package/ios/Source/Model/Transportation/Transportation+BlikPayment.swift +13 -0
- package/ios/Source/Model/Transportation/Transportation+Callbacks+Notifications.swift +10 -0
- package/ios/Source/Model/Transportation/Transportation+Callbacks+Redirects.swift +10 -0
- package/ios/Source/Model/Transportation/Transportation+Callbacks.swift +10 -0
- package/ios/Source/Model/Transportation/Transportation+CardDetails+Configuration.swift +9 -0
- package/ios/Source/Model/Transportation/Transportation+CardDetails+ExpiryDate.swift +10 -0
- package/ios/Source/Model/Transportation/Transportation+CardDetails.swift +12 -0
- package/ios/Source/Model/Transportation/Transportation+CardPayment.swift +13 -0
- package/ios/Source/Model/Transportation/Transportation+CardToken.swift +11 -0
- package/ios/Source/Model/Transportation/Transportation+ContinuePayment.swift +11 -0
- package/ios/Source/Model/Transportation/Transportation+DigitalWalletPayment.swift +12 -0
- package/ios/Source/Model/Transportation/Transportation+Environment.swift +23 -0
- package/ios/Source/Model/Transportation/Transportation+Languages.swift +10 -0
- package/ios/Source/Model/Transportation/Transportation+Merchant+Authorization.swift +10 -0
- package/ios/Source/Model/Transportation/Transportation+Merchant+CertificatePinning.swift +9 -0
- package/ios/Source/Model/Transportation/Transportation+Merchant+WalletConfiguration+ApplePay.swift +10 -0
- package/ios/Source/Model/Transportation/Transportation+Merchant+WalletConfiguration.swift +9 -0
- package/ios/Source/Model/Transportation/Transportation+Merchant.swift +13 -0
- package/ios/Source/Model/Transportation/Transportation+MerchantConfiguration.swift +12 -0
- package/ios/Source/Model/Transportation/Transportation+MerchantDetails+Detail.swift +10 -0
- package/ios/Source/Model/Transportation/Transportation+MerchantDetails.swift +11 -0
- package/ios/Source/Model/Transportation/Transportation+Payer+Address.swift +12 -0
- package/ios/Source/Model/Transportation/Transportation+Payer.swift +12 -0
- package/ios/Source/Model/Transportation/Transportation+PayerContext+AutomaticPaymentMethods+BlikAlias.swift +9 -0
- package/ios/Source/Model/Transportation/Transportation+PayerContext+AutomaticPaymentMethods.swift +10 -0
- package/ios/Source/Model/Transportation/Transportation+PayerContext.swift +10 -0
- package/ios/Source/Model/Transportation/Transportation+PaymentChannel.swift +21 -0
- package/ios/Source/Model/Transportation/Transportation+PaymentDetails.swift +10 -0
- package/ios/Source/Model/Transportation/Transportation+PaymentMethod.swift +47 -0
- package/ios/Source/Model/Transportation/Transportation+PaymentMethods.swift +11 -0
- package/ios/Source/Model/Transportation/Transportation+PaymentMethodsInfo.swift +12 -0
- package/ios/Source/Model/Transportation/Transportation+SingleTransaction.swift +11 -0
- package/ios/Source/Model/Transportation/Transportation+TokenPayment.swift +12 -0
- package/ios/Source/Model/Transportation/Transportation+Tokenisation.swift +12 -0
- package/ios/Source/Model/Transportation/Transportation.swift +3 -0
- package/ios/Source/Presentation/AddCardPresentation.swift +43 -0
- package/ios/Source/Presentation/CardTokenPresentation.swift +48 -0
- package/ios/Source/Presentation/PaymentPresentation.swift +48 -0
- package/ios/Source/Provider/DefaultMerchantDetailsProvider.swift +32 -0
- package/ios/Source/Provider/DefaultSSLCertificatesProvider.swift +14 -0
- package/ios/Source/TpaySDK.mm +35 -0
- package/ios/Source/TpaySDK.swift +324 -0
- package/ios/Tpay-Bridging-Header.h +2 -0
- package/lib/commonjs/assets/tpay_logo.png +0 -0
- package/lib/commonjs/assets/tpay_logo@2x.png +0 -0
- package/lib/commonjs/assets/tpay_logo@3x.png +0 -0
- package/lib/commonjs/component/tpay_button.js +38 -0
- package/lib/commonjs/component/tpay_button.js.map +1 -0
- package/lib/commonjs/index.js +856 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/model/language/language.js +12 -0
- package/lib/commonjs/model/language/language.js.map +1 -0
- package/lib/commonjs/model/language/languages.js +21 -0
- package/lib/commonjs/model/language/languages.js.map +1 -0
- package/lib/commonjs/model/language/localized_string.js +17 -0
- package/lib/commonjs/model/language/localized_string.js.map +1 -0
- package/lib/commonjs/model/merchant/apple_pay_configuration.js +22 -0
- package/lib/commonjs/model/merchant/apple_pay_configuration.js.map +1 -0
- package/lib/commonjs/model/merchant/certificate_configuration.js +20 -0
- package/lib/commonjs/model/merchant/certificate_configuration.js.map +1 -0
- package/lib/commonjs/model/merchant/google_pay_configuration.js +19 -0
- package/lib/commonjs/model/merchant/google_pay_configuration.js.map +1 -0
- package/lib/commonjs/model/merchant/merchant.js +27 -0
- package/lib/commonjs/model/merchant/merchant.js.map +1 -0
- package/lib/commonjs/model/merchant/merchant_authorization.js +21 -0
- package/lib/commonjs/model/merchant/merchant_authorization.js.map +1 -0
- package/lib/commonjs/model/merchant/merchant_details.js +23 -0
- package/lib/commonjs/model/merchant/merchant_details.js.map +1 -0
- package/lib/commonjs/model/merchant/tpay_environment.js +12 -0
- package/lib/commonjs/model/merchant/tpay_environment.js.map +1 -0
- package/lib/commonjs/model/merchant/wallet_configuration.js +21 -0
- package/lib/commonjs/model/merchant/wallet_configuration.js.map +1 -0
- package/lib/commonjs/model/payer/address.js +25 -0
- package/lib/commonjs/model/payer/address.js.map +1 -0
- package/lib/commonjs/model/payer/payer.js +25 -0
- package/lib/commonjs/model/payer/payer.js.map +1 -0
- package/lib/commonjs/model/payer/payer_context.js +21 -0
- package/lib/commonjs/model/payer/payer_context.js.map +1 -0
- package/lib/commonjs/model/payment_channel/payment_channel.js +35 -0
- package/lib/commonjs/model/payment_channel/payment_channel.js.map +1 -0
- package/lib/commonjs/model/payment_channel/payment_constraint.js +47 -0
- package/lib/commonjs/model/payment_channel/payment_constraint.js.map +1 -0
- package/lib/commonjs/model/payment_channel/payment_group.js +30 -0
- package/lib/commonjs/model/payment_channel/payment_group.js.map +1 -0
- package/lib/commonjs/model/payment_method/automatic_payment_methods.js +21 -0
- package/lib/commonjs/model/payment_method/automatic_payment_methods.js.map +1 -0
- package/lib/commonjs/model/payment_method/blik_alias.js +23 -0
- package/lib/commonjs/model/payment_method/blik_alias.js.map +1 -0
- package/lib/commonjs/model/payment_method/credit_card_brand.js +16 -0
- package/lib/commonjs/model/payment_method/credit_card_brand.js.map +1 -0
- package/lib/commonjs/model/payment_method/digital_wallet.js +15 -0
- package/lib/commonjs/model/payment_method/digital_wallet.js.map +1 -0
- package/lib/commonjs/model/payment_method/installment_payment.js +14 -0
- package/lib/commonjs/model/payment_method/installment_payment.js.map +1 -0
- package/lib/commonjs/model/payment_method/payment_method.js +16 -0
- package/lib/commonjs/model/payment_method/payment_method.js.map +1 -0
- package/lib/commonjs/model/payment_method/payment_methods.js +23 -0
- package/lib/commonjs/model/payment_method/payment_methods.js.map +1 -0
- package/lib/commonjs/model/payment_method/tokenized_card.js +23 -0
- package/lib/commonjs/model/payment_method/tokenized_card.js.map +1 -0
- package/lib/commonjs/model/result/google_pay_configure_result.js +33 -0
- package/lib/commonjs/model/result/google_pay_configure_result.js.map +1 -0
- package/lib/commonjs/model/result/google_pay_open_result.js +61 -0
- package/lib/commonjs/model/result/google_pay_open_result.js.map +1 -0
- package/lib/commonjs/model/result/payment_channels_result.js +42 -0
- package/lib/commonjs/model/result/payment_channels_result.js.map +1 -0
- package/lib/commonjs/model/result/result.js +96 -0
- package/lib/commonjs/model/result/result.js.map +1 -0
- package/lib/commonjs/model/result/screenless_result.js +141 -0
- package/lib/commonjs/model/result/screenless_result.js.map +1 -0
- package/lib/commonjs/model/screenless/ambiguous_alias.js +25 -0
- package/lib/commonjs/model/screenless/ambiguous_alias.js.map +1 -0
- package/lib/commonjs/model/screenless/ambiguous_blik_payment.js +23 -0
- package/lib/commonjs/model/screenless/ambiguous_blik_payment.js.map +1 -0
- package/lib/commonjs/model/screenless/apple_pay_payment.js +21 -0
- package/lib/commonjs/model/screenless/apple_pay_payment.js.map +1 -0
- package/lib/commonjs/model/screenless/blik_payment.js +26 -0
- package/lib/commonjs/model/screenless/blik_payment.js.map +1 -0
- package/lib/commonjs/model/screenless/callbacks.js +21 -0
- package/lib/commonjs/model/screenless/callbacks.js.map +1 -0
- package/lib/commonjs/model/screenless/credit_card.js +25 -0
- package/lib/commonjs/model/screenless/credit_card.js.map +1 -0
- package/lib/commonjs/model/screenless/credit_card_config.js +22 -0
- package/lib/commonjs/model/screenless/credit_card_config.js.map +1 -0
- package/lib/commonjs/model/screenless/credit_card_payment.js +26 -0
- package/lib/commonjs/model/screenless/credit_card_payment.js.map +1 -0
- package/lib/commonjs/model/screenless/expiration_date.js +21 -0
- package/lib/commonjs/model/screenless/expiration_date.js.map +1 -0
- package/lib/commonjs/model/screenless/frequency.js +18 -0
- package/lib/commonjs/model/screenless/frequency.js.map +1 -0
- package/lib/commonjs/model/screenless/google_pay_environment.js +15 -0
- package/lib/commonjs/model/screenless/google_pay_environment.js.map +1 -0
- package/lib/commonjs/model/screenless/google_pay_payment.js +21 -0
- package/lib/commonjs/model/screenless/google_pay_payment.js.map +1 -0
- package/lib/commonjs/model/screenless/google_pay_utils_configuration.js +27 -0
- package/lib/commonjs/model/screenless/google_pay_utils_configuration.js.map +1 -0
- package/lib/commonjs/model/screenless/notifications.js +21 -0
- package/lib/commonjs/model/screenless/notifications.js.map +1 -0
- package/lib/commonjs/model/screenless/payment_details.js +25 -0
- package/lib/commonjs/model/screenless/payment_details.js.map +1 -0
- package/lib/commonjs/model/screenless/raty_pekao_payment.js +21 -0
- package/lib/commonjs/model/screenless/raty_pekao_payment.js.map +1 -0
- package/lib/commonjs/model/screenless/recursive.js +23 -0
- package/lib/commonjs/model/screenless/recursive.js.map +1 -0
- package/lib/commonjs/model/screenless/redirects.js +21 -0
- package/lib/commonjs/model/screenless/redirects.js.map +1 -0
- package/lib/commonjs/model/screenless/screenless_payment.js +23 -0
- package/lib/commonjs/model/screenless/screenless_payment.js.map +1 -0
- package/lib/commonjs/model/screenless/transfer_payment.js +21 -0
- package/lib/commonjs/model/screenless/transfer_payment.js.map +1 -0
- package/lib/commonjs/model/tokenization/tokenization.js +21 -0
- package/lib/commonjs/model/tokenization/tokenization.js.map +1 -0
- package/lib/commonjs/model/tpay_configuration.js +25 -0
- package/lib/commonjs/model/tpay_configuration.js.map +1 -0
- package/lib/commonjs/model/transaction/single_transaction.js +24 -0
- package/lib/commonjs/model/transaction/single_transaction.js.map +1 -0
- package/lib/commonjs/model/transaction/token_payment.js +26 -0
- package/lib/commonjs/model/transaction/token_payment.js.map +1 -0
- package/lib/commonjs/model/transaction/transaction.js +23 -0
- package/lib/commonjs/model/transaction/transaction.js.map +1 -0
- package/lib/commonjs/util/google_pay_configuration_util.js +22 -0
- package/lib/commonjs/util/google_pay_configuration_util.js.map +1 -0
- package/lib/commonjs/util/google_pay_open_util.js +24 -0
- package/lib/commonjs/util/google_pay_open_util.js.map +1 -0
- package/lib/commonjs/util/payment_channels_util.js +22 -0
- package/lib/commonjs/util/payment_channels_util.js.map +1 -0
- package/lib/commonjs/util/result_util.js +40 -0
- package/lib/commonjs/util/result_util.js.map +1 -0
- package/lib/commonjs/util/screenless_result_util.js +38 -0
- package/lib/commonjs/util/screenless_result_util.js.map +1 -0
- package/lib/module/assets/tpay_logo.png +0 -0
- package/lib/module/assets/tpay_logo@2x.png +0 -0
- package/lib/module/assets/tpay_logo@3x.png +0 -0
- package/lib/module/component/tpay_button.js +31 -0
- package/lib/module/component/tpay_button.js.map +1 -0
- package/lib/module/index.js +204 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/model/language/language.js +6 -0
- package/lib/module/model/language/language.js.map +1 -0
- package/lib/module/model/language/languages.js +14 -0
- package/lib/module/model/language/languages.js.map +1 -0
- package/lib/module/model/language/localized_string.js +10 -0
- package/lib/module/model/language/localized_string.js.map +1 -0
- package/lib/module/model/merchant/apple_pay_configuration.js +15 -0
- package/lib/module/model/merchant/apple_pay_configuration.js.map +1 -0
- package/lib/module/model/merchant/certificate_configuration.js +13 -0
- package/lib/module/model/merchant/certificate_configuration.js.map +1 -0
- package/lib/module/model/merchant/google_pay_configuration.js +12 -0
- package/lib/module/model/merchant/google_pay_configuration.js.map +1 -0
- package/lib/module/model/merchant/merchant.js +20 -0
- package/lib/module/model/merchant/merchant.js.map +1 -0
- package/lib/module/model/merchant/merchant_authorization.js +14 -0
- package/lib/module/model/merchant/merchant_authorization.js.map +1 -0
- package/lib/module/model/merchant/merchant_details.js +16 -0
- package/lib/module/model/merchant/merchant_details.js.map +1 -0
- package/lib/module/model/merchant/tpay_environment.js +6 -0
- package/lib/module/model/merchant/tpay_environment.js.map +1 -0
- package/lib/module/model/merchant/wallet_configuration.js +14 -0
- package/lib/module/model/merchant/wallet_configuration.js.map +1 -0
- package/lib/module/model/payer/address.js +18 -0
- package/lib/module/model/payer/address.js.map +1 -0
- package/lib/module/model/payer/payer.js +18 -0
- package/lib/module/model/payer/payer.js.map +1 -0
- package/lib/module/model/payer/payer_context.js +14 -0
- package/lib/module/model/payer/payer_context.js.map +1 -0
- package/lib/module/model/payment_channel/payment_channel.js +28 -0
- package/lib/module/model/payment_channel/payment_channel.js.map +1 -0
- package/lib/module/model/payment_channel/payment_constraint.js +40 -0
- package/lib/module/model/payment_channel/payment_constraint.js.map +1 -0
- package/lib/module/model/payment_channel/payment_group.js +23 -0
- package/lib/module/model/payment_channel/payment_group.js.map +1 -0
- package/lib/module/model/payment_method/automatic_payment_methods.js +14 -0
- package/lib/module/model/payment_method/automatic_payment_methods.js.map +1 -0
- package/lib/module/model/payment_method/blik_alias.js +16 -0
- package/lib/module/model/payment_method/blik_alias.js.map +1 -0
- package/lib/module/model/payment_method/credit_card_brand.js +10 -0
- package/lib/module/model/payment_method/credit_card_brand.js.map +1 -0
- package/lib/module/model/payment_method/digital_wallet.js +9 -0
- package/lib/module/model/payment_method/digital_wallet.js.map +1 -0
- package/lib/module/model/payment_method/installment_payment.js +8 -0
- package/lib/module/model/payment_method/installment_payment.js.map +1 -0
- package/lib/module/model/payment_method/payment_method.js +10 -0
- package/lib/module/model/payment_method/payment_method.js.map +1 -0
- package/lib/module/model/payment_method/payment_methods.js +16 -0
- package/lib/module/model/payment_method/payment_methods.js.map +1 -0
- package/lib/module/model/payment_method/tokenized_card.js +16 -0
- package/lib/module/model/payment_method/tokenized_card.js.map +1 -0
- package/lib/module/model/result/google_pay_configure_result.js +24 -0
- package/lib/module/model/result/google_pay_configure_result.js.map +1 -0
- package/lib/module/model/result/google_pay_open_result.js +50 -0
- package/lib/module/model/result/google_pay_open_result.js.map +1 -0
- package/lib/module/model/result/payment_channels_result.js +33 -0
- package/lib/module/model/result/payment_channels_result.js.map +1 -0
- package/lib/module/model/result/result.js +81 -0
- package/lib/module/model/result/result.js.map +1 -0
- package/lib/module/model/result/screenless_result.js +127 -0
- package/lib/module/model/result/screenless_result.js.map +1 -0
- package/lib/module/model/screenless/ambiguous_alias.js +18 -0
- package/lib/module/model/screenless/ambiguous_alias.js.map +1 -0
- package/lib/module/model/screenless/ambiguous_blik_payment.js +16 -0
- package/lib/module/model/screenless/ambiguous_blik_payment.js.map +1 -0
- package/lib/module/model/screenless/apple_pay_payment.js +15 -0
- package/lib/module/model/screenless/apple_pay_payment.js.map +1 -0
- package/lib/module/model/screenless/blik_payment.js +20 -0
- package/lib/module/model/screenless/blik_payment.js.map +1 -0
- package/lib/module/model/screenless/callbacks.js +14 -0
- package/lib/module/model/screenless/callbacks.js.map +1 -0
- package/lib/module/model/screenless/credit_card.js +18 -0
- package/lib/module/model/screenless/credit_card.js.map +1 -0
- package/lib/module/model/screenless/credit_card_config.js +15 -0
- package/lib/module/model/screenless/credit_card_config.js.map +1 -0
- package/lib/module/model/screenless/credit_card_payment.js +20 -0
- package/lib/module/model/screenless/credit_card_payment.js.map +1 -0
- package/lib/module/model/screenless/expiration_date.js +14 -0
- package/lib/module/model/screenless/expiration_date.js.map +1 -0
- package/lib/module/model/screenless/frequency.js +12 -0
- package/lib/module/model/screenless/frequency.js.map +1 -0
- package/lib/module/model/screenless/google_pay_environment.js +9 -0
- package/lib/module/model/screenless/google_pay_environment.js.map +1 -0
- package/lib/module/model/screenless/google_pay_payment.js +15 -0
- package/lib/module/model/screenless/google_pay_payment.js.map +1 -0
- package/lib/module/model/screenless/google_pay_utils_configuration.js +20 -0
- package/lib/module/model/screenless/google_pay_utils_configuration.js.map +1 -0
- package/lib/module/model/screenless/notifications.js +14 -0
- package/lib/module/model/screenless/notifications.js.map +1 -0
- package/lib/module/model/screenless/payment_details.js +18 -0
- package/lib/module/model/screenless/payment_details.js.map +1 -0
- package/lib/module/model/screenless/raty_pekao_payment.js +15 -0
- package/lib/module/model/screenless/raty_pekao_payment.js.map +1 -0
- package/lib/module/model/screenless/recursive.js +16 -0
- package/lib/module/model/screenless/recursive.js.map +1 -0
- package/lib/module/model/screenless/redirects.js +14 -0
- package/lib/module/model/screenless/redirects.js.map +1 -0
- package/lib/module/model/screenless/screenless_payment.js +16 -0
- package/lib/module/model/screenless/screenless_payment.js.map +1 -0
- package/lib/module/model/screenless/transfer_payment.js +15 -0
- package/lib/module/model/screenless/transfer_payment.js.map +1 -0
- package/lib/module/model/tokenization/tokenization.js +14 -0
- package/lib/module/model/tokenization/tokenization.js.map +1 -0
- package/lib/module/model/tpay_configuration.js +18 -0
- package/lib/module/model/tpay_configuration.js.map +1 -0
- package/lib/module/model/transaction/single_transaction.js +18 -0
- package/lib/module/model/transaction/single_transaction.js.map +1 -0
- package/lib/module/model/transaction/token_payment.js +20 -0
- package/lib/module/model/transaction/token_payment.js.map +1 -0
- package/lib/module/model/transaction/transaction.js +16 -0
- package/lib/module/model/transaction/transaction.js.map +1 -0
- package/lib/module/util/google_pay_configuration_util.js +16 -0
- package/lib/module/util/google_pay_configuration_util.js.map +1 -0
- package/lib/module/util/google_pay_open_util.js +18 -0
- package/lib/module/util/google_pay_open_util.js.map +1 -0
- package/lib/module/util/payment_channels_util.js +16 -0
- package/lib/module/util/payment_channels_util.js.map +1 -0
- package/lib/module/util/result_util.js +41 -0
- package/lib/module/util/result_util.js.map +1 -0
- package/lib/module/util/screenless_result_util.js +32 -0
- package/lib/module/util/screenless_result_util.js.map +1 -0
- package/lib/typescript/src/component/tpay_button.d.ts +13 -0
- package/lib/typescript/src/component/tpay_button.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +147 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/model/language/language.d.ts +5 -0
- package/lib/typescript/src/model/language/language.d.ts.map +1 -0
- package/lib/typescript/src/model/language/languages.d.ts +14 -0
- package/lib/typescript/src/model/language/languages.d.ts.map +1 -0
- package/lib/typescript/src/model/language/localized_string.d.ts +10 -0
- package/lib/typescript/src/model/language/localized_string.d.ts.map +1 -0
- package/lib/typescript/src/model/merchant/apple_pay_configuration.d.ts +14 -0
- package/lib/typescript/src/model/merchant/apple_pay_configuration.d.ts.map +1 -0
- package/lib/typescript/src/model/merchant/certificate_configuration.d.ts +12 -0
- package/lib/typescript/src/model/merchant/certificate_configuration.d.ts.map +1 -0
- package/lib/typescript/src/model/merchant/google_pay_configuration.d.ts +11 -0
- package/lib/typescript/src/model/merchant/google_pay_configuration.d.ts.map +1 -0
- package/lib/typescript/src/model/merchant/merchant.d.ts +23 -0
- package/lib/typescript/src/model/merchant/merchant.d.ts.map +1 -0
- package/lib/typescript/src/model/merchant/merchant_authorization.d.ts +13 -0
- package/lib/typescript/src/model/merchant/merchant_authorization.d.ts.map +1 -0
- package/lib/typescript/src/model/merchant/merchant_details.d.ts +16 -0
- package/lib/typescript/src/model/merchant/merchant_details.d.ts.map +1 -0
- package/lib/typescript/src/model/merchant/tpay_environment.d.ts +5 -0
- package/lib/typescript/src/model/merchant/tpay_environment.d.ts.map +1 -0
- package/lib/typescript/src/model/merchant/wallet_configuration.d.ts +15 -0
- package/lib/typescript/src/model/merchant/wallet_configuration.d.ts.map +1 -0
- package/lib/typescript/src/model/payer/address.d.ts +17 -0
- package/lib/typescript/src/model/payer/address.d.ts.map +1 -0
- package/lib/typescript/src/model/payer/payer.d.ts +18 -0
- package/lib/typescript/src/model/payer/payer.d.ts.map +1 -0
- package/lib/typescript/src/model/payer/payer_context.d.ts +15 -0
- package/lib/typescript/src/model/payer/payer_context.d.ts.map +1 -0
- package/lib/typescript/src/model/payment_channel/payment_channel.d.ts +24 -0
- package/lib/typescript/src/model/payment_channel/payment_channel.d.ts.map +1 -0
- package/lib/typescript/src/model/payment_channel/payment_constraint.d.ts +31 -0
- package/lib/typescript/src/model/payment_channel/payment_constraint.d.ts.map +1 -0
- package/lib/typescript/src/model/payment_channel/payment_group.d.ts +19 -0
- package/lib/typescript/src/model/payment_channel/payment_group.d.ts.map +1 -0
- package/lib/typescript/src/model/payment_method/automatic_payment_methods.d.ts +15 -0
- package/lib/typescript/src/model/payment_method/automatic_payment_methods.d.ts.map +1 -0
- package/lib/typescript/src/model/payment_method/blik_alias.d.ts +15 -0
- package/lib/typescript/src/model/payment_method/blik_alias.d.ts.map +1 -0
- package/lib/typescript/src/model/payment_method/credit_card_brand.d.ts +9 -0
- package/lib/typescript/src/model/payment_method/credit_card_brand.d.ts.map +1 -0
- package/lib/typescript/src/model/payment_method/digital_wallet.d.ts +8 -0
- package/lib/typescript/src/model/payment_method/digital_wallet.d.ts.map +1 -0
- package/lib/typescript/src/model/payment_method/installment_payment.d.ts +7 -0
- package/lib/typescript/src/model/payment_method/installment_payment.d.ts.map +1 -0
- package/lib/typescript/src/model/payment_method/payment_method.d.ts +9 -0
- package/lib/typescript/src/model/payment_method/payment_method.d.ts.map +1 -0
- package/lib/typescript/src/model/payment_method/payment_methods.d.ts +18 -0
- package/lib/typescript/src/model/payment_method/payment_methods.d.ts.map +1 -0
- package/lib/typescript/src/model/payment_method/tokenized_card.d.ts +16 -0
- package/lib/typescript/src/model/payment_method/tokenized_card.d.ts.map +1 -0
- package/lib/typescript/src/model/result/google_pay_configure_result.d.ts +21 -0
- package/lib/typescript/src/model/result/google_pay_configure_result.d.ts.map +1 -0
- package/lib/typescript/src/model/result/google_pay_open_result.d.ts +44 -0
- package/lib/typescript/src/model/result/google_pay_open_result.d.ts.map +1 -0
- package/lib/typescript/src/model/result/payment_channels_result.d.ts +27 -0
- package/lib/typescript/src/model/result/payment_channels_result.d.ts.map +1 -0
- package/lib/typescript/src/model/result/result.d.ts +66 -0
- package/lib/typescript/src/model/result/result.d.ts.map +1 -0
- package/lib/typescript/src/model/result/screenless_result.d.ts +98 -0
- package/lib/typescript/src/model/result/screenless_result.d.ts.map +1 -0
- package/lib/typescript/src/model/screenless/ambiguous_alias.d.ts +15 -0
- package/lib/typescript/src/model/screenless/ambiguous_alias.d.ts.map +1 -0
- package/lib/typescript/src/model/screenless/ambiguous_blik_payment.d.ts +17 -0
- package/lib/typescript/src/model/screenless/ambiguous_blik_payment.d.ts.map +1 -0
- package/lib/typescript/src/model/screenless/apple_pay_payment.d.ts +15 -0
- package/lib/typescript/src/model/screenless/apple_pay_payment.d.ts.map +1 -0
- package/lib/typescript/src/model/screenless/blik_payment.d.ts +21 -0
- package/lib/typescript/src/model/screenless/blik_payment.d.ts.map +1 -0
- package/lib/typescript/src/model/screenless/callbacks.d.ts +15 -0
- package/lib/typescript/src/model/screenless/callbacks.d.ts.map +1 -0
- package/lib/typescript/src/model/screenless/credit_card.d.ts +19 -0
- package/lib/typescript/src/model/screenless/credit_card.d.ts.map +1 -0
- package/lib/typescript/src/model/screenless/credit_card_config.d.ts +14 -0
- package/lib/typescript/src/model/screenless/credit_card_config.d.ts.map +1 -0
- package/lib/typescript/src/model/screenless/credit_card_payment.d.ts +21 -0
- package/lib/typescript/src/model/screenless/credit_card_payment.d.ts.map +1 -0
- package/lib/typescript/src/model/screenless/expiration_date.d.ts +13 -0
- package/lib/typescript/src/model/screenless/expiration_date.d.ts.map +1 -0
- package/lib/typescript/src/model/screenless/frequency.d.ts +11 -0
- package/lib/typescript/src/model/screenless/frequency.d.ts.map +1 -0
- package/lib/typescript/src/model/screenless/google_pay_environment.d.ts +8 -0
- package/lib/typescript/src/model/screenless/google_pay_environment.d.ts.map +1 -0
- package/lib/typescript/src/model/screenless/google_pay_payment.d.ts +15 -0
- package/lib/typescript/src/model/screenless/google_pay_payment.d.ts.map +1 -0
- package/lib/typescript/src/model/screenless/google_pay_utils_configuration.d.ts +20 -0
- package/lib/typescript/src/model/screenless/google_pay_utils_configuration.d.ts.map +1 -0
- package/lib/typescript/src/model/screenless/notifications.d.ts +13 -0
- package/lib/typescript/src/model/screenless/notifications.d.ts.map +1 -0
- package/lib/typescript/src/model/screenless/payment_details.d.ts +18 -0
- package/lib/typescript/src/model/screenless/payment_details.d.ts.map +1 -0
- package/lib/typescript/src/model/screenless/raty_pekao_payment.d.ts +15 -0
- package/lib/typescript/src/model/screenless/raty_pekao_payment.d.ts.map +1 -0
- package/lib/typescript/src/model/screenless/recursive.d.ts +16 -0
- package/lib/typescript/src/model/screenless/recursive.d.ts.map +1 -0
- package/lib/typescript/src/model/screenless/redirects.d.ts +13 -0
- package/lib/typescript/src/model/screenless/redirects.d.ts.map +1 -0
- package/lib/typescript/src/model/screenless/screenless_payment.d.ts +18 -0
- package/lib/typescript/src/model/screenless/screenless_payment.d.ts.map +1 -0
- package/lib/typescript/src/model/screenless/transfer_payment.d.ts +15 -0
- package/lib/typescript/src/model/screenless/transfer_payment.d.ts.map +1 -0
- package/lib/typescript/src/model/tokenization/tokenization.d.ts +14 -0
- package/lib/typescript/src/model/tokenization/tokenization.d.ts.map +1 -0
- package/lib/typescript/src/model/tpay_configuration.d.ts +21 -0
- package/lib/typescript/src/model/tpay_configuration.d.ts.map +1 -0
- package/lib/typescript/src/model/transaction/single_transaction.d.ts +17 -0
- package/lib/typescript/src/model/transaction/single_transaction.d.ts.map +1 -0
- package/lib/typescript/src/model/transaction/token_payment.d.ts +19 -0
- package/lib/typescript/src/model/transaction/token_payment.d.ts.map +1 -0
- package/lib/typescript/src/model/transaction/transaction.d.ts +16 -0
- package/lib/typescript/src/model/transaction/transaction.d.ts.map +1 -0
- package/lib/typescript/src/util/google_pay_configuration_util.d.ts +3 -0
- package/lib/typescript/src/util/google_pay_configuration_util.d.ts.map +1 -0
- package/lib/typescript/src/util/google_pay_open_util.d.ts +3 -0
- package/lib/typescript/src/util/google_pay_open_util.d.ts.map +1 -0
- package/lib/typescript/src/util/payment_channels_util.d.ts +3 -0
- package/lib/typescript/src/util/payment_channels_util.d.ts.map +1 -0
- package/lib/typescript/src/util/result_util.d.ts +3 -0
- package/lib/typescript/src/util/result_util.d.ts.map +1 -0
- package/lib/typescript/src/util/screenless_result_util.d.ts +3 -0
- package/lib/typescript/src/util/screenless_result_util.d.ts.map +1 -0
- package/package.json +164 -0
- package/react-native-tpay.podspec +42 -0
- package/src/assets/tpay_logo.png +0 -0
- package/src/assets/tpay_logo@2x.png +0 -0
- package/src/assets/tpay_logo@3x.png +0 -0
- package/src/component/tpay_button.tsx +44 -0
- package/src/index.tsx +267 -0
- package/src/model/language/language.ts +4 -0
- package/src/model/language/languages.ts +21 -0
- package/src/model/language/localized_string.ts +14 -0
- package/src/model/merchant/apple_pay_configuration.ts +17 -0
- package/src/model/merchant/certificate_configuration.ts +15 -0
- package/src/model/merchant/google_pay_configuration.ts +13 -0
- package/src/model/merchant/merchant.ts +36 -0
- package/src/model/merchant/merchant_authorization.ts +16 -0
- package/src/model/merchant/merchant_details.ts +25 -0
- package/src/model/merchant/tpay_environment.ts +4 -0
- package/src/model/merchant/wallet_configuration.ts +22 -0
- package/src/model/payer/address.ts +27 -0
- package/src/model/payer/payer.ts +29 -0
- package/src/model/payer/payer_context.ts +22 -0
- package/src/model/payment_channel/payment_channel.ts +38 -0
- package/src/model/payment_channel/payment_constraint.ts +41 -0
- package/src/model/payment_channel/payment_group.ts +25 -0
- package/src/model/payment_method/automatic_payment_methods.ts +22 -0
- package/src/model/payment_method/blik_alias.ts +19 -0
- package/src/model/payment_method/credit_card_brand.ts +8 -0
- package/src/model/payment_method/digital_wallet.ts +7 -0
- package/src/model/payment_method/installment_payment.ts +6 -0
- package/src/model/payment_method/payment_method.ts +8 -0
- package/src/model/payment_method/payment_methods.ts +27 -0
- package/src/model/payment_method/tokenized_card.ts +21 -0
- package/src/model/result/google_pay_configure_result.ts +25 -0
- package/src/model/result/google_pay_open_result.ts +58 -0
- package/src/model/result/payment_channels_result.ts +36 -0
- package/src/model/result/result.ts +84 -0
- package/src/model/result/screenless_result.ts +138 -0
- package/src/model/screenless/ambiguous_alias.ts +19 -0
- package/src/model/screenless/ambiguous_blik_payment.ts +26 -0
- package/src/model/screenless/apple_pay_payment.ts +24 -0
- package/src/model/screenless/blik_payment.ts +32 -0
- package/src/model/screenless/callbacks.ts +22 -0
- package/src/model/screenless/credit_card.ts +30 -0
- package/src/model/screenless/credit_card_config.ts +18 -0
- package/src/model/screenless/credit_card_payment.ts +32 -0
- package/src/model/screenless/expiration_date.ts +16 -0
- package/src/model/screenless/frequency.ts +10 -0
- package/src/model/screenless/google_pay_environment.ts +7 -0
- package/src/model/screenless/google_pay_payment.ts +24 -0
- package/src/model/screenless/google_pay_utils_configuration.ts +33 -0
- package/src/model/screenless/notifications.ts +16 -0
- package/src/model/screenless/payment_details.ts +29 -0
- package/src/model/screenless/raty_pekao_payment.ts +24 -0
- package/src/model/screenless/recursive.ts +21 -0
- package/src/model/screenless/redirects.ts +16 -0
- package/src/model/screenless/screenless_payment.ts +27 -0
- package/src/model/screenless/transfer_payment.ts +24 -0
- package/src/model/tokenization/tokenization.ts +18 -0
- package/src/model/tpay_configuration.ts +32 -0
- package/src/model/transaction/single_transaction.ts +26 -0
- package/src/model/transaction/token_payment.ts +30 -0
- package/src/model/transaction/transaction.ts +25 -0
- package/src/util/google_pay_configuration_util.ts +25 -0
- package/src/util/google_pay_open_util.ts +31 -0
- package/src/util/payment_channels_util.ts +22 -0
- package/src/util/result_util.ts +44 -0
- package/src/util/screenless_result_util.ts +50 -0
|
@@ -0,0 +1,528 @@
|
|
|
1
|
+
package com.tpay
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
4
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
5
|
+
import com.facebook.react.bridge.ActivityEventListener
|
|
6
|
+
import com.facebook.react.bridge.ReactMethod
|
|
7
|
+
import com.facebook.react.ReactActivity
|
|
8
|
+
import com.facebook.react.bridge.Promise
|
|
9
|
+
import com.tpay.model.TpayConfiguration
|
|
10
|
+
import org.json.JSONArray
|
|
11
|
+
import org.json.JSONObject
|
|
12
|
+
import com.tpay.extension.*
|
|
13
|
+
import com.tpay.util.TpayUtil
|
|
14
|
+
import com.tpay.util.JsonUtil
|
|
15
|
+
import com.tpay.sdk.api.payment.*
|
|
16
|
+
import com.tpay.delegate.*
|
|
17
|
+
import com.tpay.util.TpayBackpressUtil
|
|
18
|
+
import com.tpay.sdk.api.models.*
|
|
19
|
+
import android.content.Intent
|
|
20
|
+
import com.tpay.sdk.api.addCard.*
|
|
21
|
+
import android.app.Activity
|
|
22
|
+
import com.tpay.sdk.api.cardTokenPayment.*
|
|
23
|
+
import com.tpay.model.screenless.*
|
|
24
|
+
import com.tpay.sdk.api.screenless.blik.*
|
|
25
|
+
import com.tpay.sdk.api.screenless.googlePay.*
|
|
26
|
+
import com.tpay.model.googlePay.*
|
|
27
|
+
import com.tpay.sdk.api.screenless.channelMethods.*
|
|
28
|
+
|
|
29
|
+
class TpayModule(
|
|
30
|
+
private val reactContext: ReactApplicationContext
|
|
31
|
+
) : ReactContextBaseJavaModule(reactContext), ActivityEventListener {
|
|
32
|
+
private var sheet: Presentable? = null
|
|
33
|
+
private var googlePayUtil: GooglePayUtil? = null
|
|
34
|
+
private var openGooglePayPromise: Promise? = null
|
|
35
|
+
|
|
36
|
+
init {
|
|
37
|
+
reactContext.addActivityEventListener(this)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
override fun getName(): String = NAME
|
|
41
|
+
|
|
42
|
+
@ReactMethod
|
|
43
|
+
fun configure(configuration: String, promise: Promise) = catchAndHandleException(promise) {
|
|
44
|
+
val tpayConfiguration = TpayConfiguration.fromJson(configuration)
|
|
45
|
+
tpayConfiguration.validate()
|
|
46
|
+
TpayUtil.configure(tpayConfiguration)
|
|
47
|
+
handleResult(TpayResult.ConfigurationSuccess, promise)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@ReactMethod
|
|
51
|
+
fun startPayment(json: String, promise: Promise) = handleActivity(promise) {
|
|
52
|
+
val transaction = JsonUtil.getSingleTransaction(json)
|
|
53
|
+
transaction.validate()
|
|
54
|
+
Payment.Sheet(
|
|
55
|
+
transaction = transaction,
|
|
56
|
+
activity = this,
|
|
57
|
+
supportFragmentManager = supportFragmentManager
|
|
58
|
+
).apply {
|
|
59
|
+
addObserver(PaymentDelegateImpl(this) { tpayResult ->
|
|
60
|
+
handleResult(tpayResult, promise)
|
|
61
|
+
})
|
|
62
|
+
handleSheetOpenResult(this, present(), promise)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@ReactMethod
|
|
67
|
+
fun tokenizeCard(json: String, promise: Promise) = handleActivity(promise) {
|
|
68
|
+
val tokenization = JsonUtil.getTokenization(json)
|
|
69
|
+
AddCard.Sheet(
|
|
70
|
+
tokenization = tokenization,
|
|
71
|
+
activity = this,
|
|
72
|
+
supportFragmentManager = supportFragmentManager
|
|
73
|
+
).apply {
|
|
74
|
+
addObserver(AddCardDelegateImpl(this) { tpayResult ->
|
|
75
|
+
handleResult(tpayResult, promise)
|
|
76
|
+
})
|
|
77
|
+
handleSheetOpenResult(this, present(), promise)
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@ReactMethod
|
|
82
|
+
fun startCardTokenPayment(json: String, promise: Promise) = handleActivity(promise) {
|
|
83
|
+
val transaction = JsonUtil.getCardTokenTransaction(json)
|
|
84
|
+
transaction.validate()
|
|
85
|
+
CardTokenPayment.Sheet(
|
|
86
|
+
transaction = transaction,
|
|
87
|
+
activity = this,
|
|
88
|
+
supportFragmentManager = supportFragmentManager
|
|
89
|
+
).apply {
|
|
90
|
+
addObserver(PaymentDelegateImpl(this) { tpayResult ->
|
|
91
|
+
handleResult(tpayResult, promise)
|
|
92
|
+
})
|
|
93
|
+
handleSheetOpenResult(this, present(), promise)
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@ReactMethod
|
|
98
|
+
fun screenlessBLIKPayment(json: String, promise: Promise) = handleScreenlessPayment<BLIKScreenlessPayment>(json, promise)
|
|
99
|
+
|
|
100
|
+
@ReactMethod
|
|
101
|
+
fun screenlessTransferPayment(json: String, promise: Promise) = handleScreenlessPayment<TransferScreenlessPayment>(json, promise)
|
|
102
|
+
|
|
103
|
+
@ReactMethod
|
|
104
|
+
fun screenlessRatyPekaoPayment(json: String, promise: Promise) = handleScreenlessPayment<RatyPekaoScreenlessPayment>(json, promise)
|
|
105
|
+
|
|
106
|
+
@ReactMethod
|
|
107
|
+
fun screenlessCreditCardPayment(json: String, promise: Promise) = handleScreenlessPayment<CreditCardScreenlessPayment>(json, promise)
|
|
108
|
+
|
|
109
|
+
@ReactMethod
|
|
110
|
+
fun screenlessGooglePayPayment(json: String, promise: Promise) = handleScreenlessPayment<GooglePayScreenlessPayment>(json, promise)
|
|
111
|
+
|
|
112
|
+
@ReactMethod
|
|
113
|
+
fun screenlessApplePayPayment(json: String, promise: Promise) {
|
|
114
|
+
handleScreenlessResult(TpayScreenlessResult.MethodCallError(APPLE_PAY_NOT_AVAILABLE), promise)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
@ReactMethod
|
|
118
|
+
fun screenlessAmbiguousBLIKPayment(json: String, promise: Promise) = catchAndHandleScreenlessException(promise) {
|
|
119
|
+
val payment = AmbiguousBLIKPayment.fromJson(json)
|
|
120
|
+
TpayAmbiguousBLIKPaymentHandler(payment) { screenlessResult ->
|
|
121
|
+
handleScreenlessResult(screenlessResult, promise)
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
@ReactMethod
|
|
126
|
+
fun configureGooglePayUtils(json: String, promise: Promise) = catchAndHandleGooglePayConfigurationException(promise) {
|
|
127
|
+
(reactContext.currentActivity as? ReactActivity)?.run {
|
|
128
|
+
val googlePayConfiguration = GooglePayUtilsConfiguration.fromJson(json)
|
|
129
|
+
googlePayConfiguration.validate()
|
|
130
|
+
googlePayUtil = GooglePayUtil(
|
|
131
|
+
activity = this,
|
|
132
|
+
googlePayRequest = GooglePayRequest(
|
|
133
|
+
price = googlePayConfiguration.price,
|
|
134
|
+
merchantName = googlePayConfiguration.merchantName,
|
|
135
|
+
merchantId = googlePayConfiguration.merchantId
|
|
136
|
+
),
|
|
137
|
+
googlePayEnvironment = googlePayConfiguration.environment,
|
|
138
|
+
customRequestCode = googlePayConfiguration.customRequestCode
|
|
139
|
+
)
|
|
140
|
+
handleGooglePayConfigurationResult(GooglePayConfigureResult.Success, promise)
|
|
141
|
+
} ?: handleGooglePayConfigurationResult(GooglePayConfigureResult.Error(ACTIVITY_NULL_MESSAGE), promise)
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
@ReactMethod
|
|
145
|
+
fun isGooglePayAvailable(promise: Promise) {
|
|
146
|
+
googlePayUtil?.checkIfGooglePayIsAvailable(promise::resolve) ?: promise.resolve(false)
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
@ReactMethod
|
|
150
|
+
fun openGooglePay(promise: Promise) {
|
|
151
|
+
googlePayUtil?.run {
|
|
152
|
+
openGooglePayPromise = promise
|
|
153
|
+
openGooglePay()
|
|
154
|
+
} ?: handleGooglePayOpenResult(null, promise)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
@ReactMethod
|
|
158
|
+
fun getAvailablePaymentChannels(promise: Promise) {
|
|
159
|
+
GetPaymentChannels().execute { result -> handlePaymentChannelsResult(result, promise) }
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
private fun handlePaymentChannelsResult(result: GetPaymentChannelsResult, promise: Promise) {
|
|
163
|
+
JSONObject().apply {
|
|
164
|
+
when (result) {
|
|
165
|
+
is GetPaymentChannelsResult.Success -> {
|
|
166
|
+
put(TYPE, SUCCESS)
|
|
167
|
+
put(CHANNELS, result.channels.filter { channel -> channel.isAvailable }.toJsonArray())
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
is GetPaymentChannelsResult.Error -> {
|
|
171
|
+
put(TYPE, ERROR)
|
|
172
|
+
put(MESSAGE, result.devErrorMessage)
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}.toString().let(promise::resolve)
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
private fun handleGooglePayOpenResult(
|
|
179
|
+
openGooglePayResult: OpenGooglePayResult?,
|
|
180
|
+
promise: Promise
|
|
181
|
+
) {
|
|
182
|
+
JSONObject().apply {
|
|
183
|
+
when (openGooglePayResult) {
|
|
184
|
+
is OpenGooglePayResult.Success -> {
|
|
185
|
+
put(TYPE, GOOGLE_PAY_OPEN_SUCCESS)
|
|
186
|
+
put(GOOGLE_PAY_TOKEN, openGooglePayResult.token)
|
|
187
|
+
put(GOOGLE_PAY_DESCRIPTION, openGooglePayResult.description)
|
|
188
|
+
put(GOOGLE_PAY_CARD_NETWORK, openGooglePayResult.cardNetwork)
|
|
189
|
+
put(GOOGLE_PAY_CARD_TAIL, openGooglePayResult.cardTail)
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
is OpenGooglePayResult.Cancelled -> {
|
|
193
|
+
put(TYPE, GOOGLE_PAY_OPEN_CANCELLED)
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
is OpenGooglePayResult.UnknownError -> {
|
|
197
|
+
put(TYPE, GOOGLE_PAY_OPEN_UNKNOWN_ERROR)
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
else -> {
|
|
201
|
+
put(TYPE, GOOGLE_PAY_OPEN_NOT_CONFIGURED)
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}.toString().let(promise::resolve)
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
fun handleActivity(promise: Promise, block: ReactActivity.() -> Unit) {
|
|
208
|
+
(reactContext.currentActivity as? ReactActivity)?.run {
|
|
209
|
+
runOnUiThread {
|
|
210
|
+
try {
|
|
211
|
+
block(this)
|
|
212
|
+
} catch (exception: Exception) {
|
|
213
|
+
handleException(promise, exception)
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
} ?: handleResult(TpayResult.MethodCallError(ACTIVITY_NULL_MESSAGE), promise)
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
fun handleException(promise: Promise, exception: Exception) {
|
|
220
|
+
handleResult(
|
|
221
|
+
if (exception is ValidationException) {
|
|
222
|
+
TpayResult.ValidationError(exception.message ?: UNKNOWN_VALIDATION_ERROR_MESSAGE)
|
|
223
|
+
} else {
|
|
224
|
+
TpayResult.MethodCallError(exception.message ?: UNKNOWN_ERROR)
|
|
225
|
+
}, promise
|
|
226
|
+
)
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
private fun handleScreenlessException(exception: Exception, promise: Promise) {
|
|
230
|
+
handleScreenlessResult(
|
|
231
|
+
if (exception is ValidationException) {
|
|
232
|
+
TpayScreenlessResult.ValidationError(exception.message ?: UNKNOWN_VALIDATION_ERROR_MESSAGE)
|
|
233
|
+
} else {
|
|
234
|
+
TpayScreenlessResult.MethodCallError(exception.message ?: UNKNOWN_ERROR)
|
|
235
|
+
}, promise
|
|
236
|
+
)
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
private fun handleGooglePayConfigurationException(exception: Exception, promise: Promise) {
|
|
240
|
+
handleGooglePayConfigurationResult(
|
|
241
|
+
GooglePayConfigureResult.Error(
|
|
242
|
+
if (exception is ValidationException) exception.message
|
|
243
|
+
else GOOGLE_PAY_CONFIGURATION_INVALID
|
|
244
|
+
),
|
|
245
|
+
promise
|
|
246
|
+
)
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
fun catchAndHandleException(promise: Promise, block: () -> Unit) {
|
|
250
|
+
try {
|
|
251
|
+
block()
|
|
252
|
+
} catch (exception: Exception) {
|
|
253
|
+
handleException(promise, exception)
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
fun catchAndHandleScreenlessException(promise: Promise, block: () -> Unit) {
|
|
258
|
+
try {
|
|
259
|
+
block()
|
|
260
|
+
} catch (exception: Exception) {
|
|
261
|
+
handleScreenlessException(exception, promise)
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
fun catchAndHandleGooglePayConfigurationException(promise: Promise, block: () -> Unit) {
|
|
266
|
+
try {
|
|
267
|
+
block()
|
|
268
|
+
} catch (exception: Exception) {
|
|
269
|
+
handleGooglePayConfigurationException(exception, promise)
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
private inline fun <reified T : ScreenlessPayment> handleScreenlessPayment(json: String, promise: Promise) {
|
|
274
|
+
try {
|
|
275
|
+
val payment = when (T::class) {
|
|
276
|
+
BLIKScreenlessPayment::class -> BLIKScreenlessPayment(json)
|
|
277
|
+
TransferScreenlessPayment::class -> TransferScreenlessPayment(json)
|
|
278
|
+
RatyPekaoScreenlessPayment::class -> RatyPekaoScreenlessPayment(json)
|
|
279
|
+
CreditCardScreenlessPayment::class -> CreditCardScreenlessPayment(json)
|
|
280
|
+
GooglePayScreenlessPayment::class -> GooglePayScreenlessPayment(json)
|
|
281
|
+
else -> throw IllegalArgumentException(NOT_IMPLEMENTED_SCREENLESS_PAYMENT_MESSAGE)
|
|
282
|
+
}
|
|
283
|
+
payment.validate()
|
|
284
|
+
TpayScreenlessPaymentHandler(payment) { screenlessResult ->
|
|
285
|
+
handleScreenlessResult(screenlessResult, promise)
|
|
286
|
+
}
|
|
287
|
+
} catch (exception: Exception) {
|
|
288
|
+
handleScreenlessException(exception, promise)
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
private fun handleGooglePayConfigurationResult(
|
|
293
|
+
googlePayConfigureResult: GooglePayConfigureResult,
|
|
294
|
+
promise: Promise
|
|
295
|
+
) {
|
|
296
|
+
val (type, errorMessage) = when (googlePayConfigureResult) {
|
|
297
|
+
is GooglePayConfigureResult.Success -> GOOGLE_PAY_CONFIGURATION_SUCCESS to null
|
|
298
|
+
is GooglePayConfigureResult.Error -> GOOGLE_PAY_CONFIGURATION_ERROR to googlePayConfigureResult.errorMessage
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
JSONObject().apply {
|
|
302
|
+
put(TYPE, type)
|
|
303
|
+
put(MESSAGE, errorMessage)
|
|
304
|
+
}.toString().let(promise::resolve)
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
fun handleResult(tpayResult: TpayResult, promise: Promise) {
|
|
308
|
+
val (type, value) = when (tpayResult) {
|
|
309
|
+
is TpayResult.ConfigurationSuccess -> CONFIGURATION_SUCCESS to null
|
|
310
|
+
is TpayResult.ValidationError -> VALIDATION_ERROR to tpayResult.message
|
|
311
|
+
is TpayResult.PaymentCompleted -> PAYMENT_COMPLETED to tpayResult.transactionId
|
|
312
|
+
is TpayResult.PaymentCancelled -> PAYMENT_CANCELLED to tpayResult.transactionId
|
|
313
|
+
is TpayResult.TokenizationCompleted -> TOKENIZATION_COMPLETED to null
|
|
314
|
+
is TpayResult.TokenizationFailure -> TOKENIZATION_FAILURE to null
|
|
315
|
+
is TpayResult.MethodCallError -> METHOD_CALL_ERROR to tpayResult.message
|
|
316
|
+
is TpayResult.ModuleClosed -> MODULE_CLOSED to null
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
JSONObject().apply {
|
|
320
|
+
put(TYPE, type)
|
|
321
|
+
put(VALUE, value)
|
|
322
|
+
}.toString().let(promise::resolve)
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
private fun handleScreenlessResult(
|
|
326
|
+
screenlessResult: TpayScreenlessResult,
|
|
327
|
+
promise: Promise
|
|
328
|
+
) {
|
|
329
|
+
val data = when (screenlessResult) {
|
|
330
|
+
is TpayScreenlessResult.Paid -> {
|
|
331
|
+
ScreenlessResultData(
|
|
332
|
+
type = PAID,
|
|
333
|
+
transactionId = screenlessResult.transactionId
|
|
334
|
+
)
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
is TpayScreenlessResult.PaymentCreated -> {
|
|
338
|
+
ScreenlessResultData(
|
|
339
|
+
type = PAYMENT_CREATED,
|
|
340
|
+
transactionId = screenlessResult.transactionId,
|
|
341
|
+
paymentUrl = screenlessResult.paymentUrl
|
|
342
|
+
)
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
is TpayScreenlessResult.ConfiguredPaymentFailed -> {
|
|
346
|
+
ScreenlessResultData(
|
|
347
|
+
type = CONFIGURED_PAYMENT_FAILED,
|
|
348
|
+
transactionId = screenlessResult.transactionId,
|
|
349
|
+
message = screenlessResult.errorMessage
|
|
350
|
+
)
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
is TpayScreenlessResult.BlikAmbiguousAlias -> {
|
|
354
|
+
ScreenlessResultData(
|
|
355
|
+
type = AMBIGUOUS_ALIAS,
|
|
356
|
+
transactionId = screenlessResult.transactionId,
|
|
357
|
+
ambiguousAliases = screenlessResult.ambiguousAliases
|
|
358
|
+
)
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
is TpayScreenlessResult.Error -> {
|
|
362
|
+
ScreenlessResultData(
|
|
363
|
+
type = ERROR,
|
|
364
|
+
message = screenlessResult.errorMessage
|
|
365
|
+
)
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
is TpayScreenlessResult.ValidationError -> {
|
|
369
|
+
ScreenlessResultData(
|
|
370
|
+
type = VALIDATION_ERROR,
|
|
371
|
+
message = screenlessResult.message
|
|
372
|
+
)
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
is TpayScreenlessResult.MethodCallError -> {
|
|
376
|
+
ScreenlessResultData(
|
|
377
|
+
type = METHOD_CALL_ERROR,
|
|
378
|
+
message = screenlessResult.message
|
|
379
|
+
)
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
JSONObject().apply {
|
|
384
|
+
put(TYPE, data.type)
|
|
385
|
+
put(TRANSACTION_ID, data.transactionId)
|
|
386
|
+
put(MESSAGE, data.message)
|
|
387
|
+
put(PAYMENT_URL, data.paymentUrl)
|
|
388
|
+
data.ambiguousAliases?.let { aliases ->
|
|
389
|
+
put(
|
|
390
|
+
ALIASES,
|
|
391
|
+
JSONArray().apply {
|
|
392
|
+
aliases.map { alias -> JSONObject(alias.toJson()) }.forEach(this::put)
|
|
393
|
+
}
|
|
394
|
+
)
|
|
395
|
+
}
|
|
396
|
+
}.toString().let(promise::resolve)
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
private fun handleSheetOpenResult(
|
|
400
|
+
presentable: Presentable,
|
|
401
|
+
sheetOpenResult: SheetOpenResult,
|
|
402
|
+
promise: Promise
|
|
403
|
+
) {
|
|
404
|
+
when (sheetOpenResult) {
|
|
405
|
+
is SheetOpenResult.Success -> {
|
|
406
|
+
sheet = presentable
|
|
407
|
+
TpayBackpressUtil.set(presentable)
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
is SheetOpenResult.ConfigurationInvalid -> {
|
|
411
|
+
handleResult(
|
|
412
|
+
TpayResult.ValidationError(
|
|
413
|
+
CONFIGURATION_INVALID_MESSAGE + sheetOpenResult.devMessage
|
|
414
|
+
), promise
|
|
415
|
+
)
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
is SheetOpenResult.UnexpectedError -> {
|
|
419
|
+
handleResult(
|
|
420
|
+
TpayResult.MethodCallError(sheetOpenResult.devErrorMessage ?: UNKNOWN_ERROR),
|
|
421
|
+
promise
|
|
422
|
+
)
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
override fun onActivityResult(
|
|
428
|
+
activity: Activity?,
|
|
429
|
+
requestCode: Int,
|
|
430
|
+
resultCode: Int,
|
|
431
|
+
intent: Intent?
|
|
432
|
+
) {
|
|
433
|
+
(sheet as? Payment.Sheet)?.onActivityResult(requestCode, resultCode, intent)
|
|
434
|
+
googlePayUtil?.handleActivityResult(requestCode, resultCode, intent) { result ->
|
|
435
|
+
openGooglePayPromise?.run {
|
|
436
|
+
handleGooglePayOpenResult(result, this)
|
|
437
|
+
openGooglePayPromise = null
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
override fun onNewIntent(intent: Intent) {}
|
|
443
|
+
|
|
444
|
+
private data class ScreenlessResultData(
|
|
445
|
+
val type: String,
|
|
446
|
+
val transactionId: String? = null,
|
|
447
|
+
val message: String? = null,
|
|
448
|
+
val paymentUrl: String? = null,
|
|
449
|
+
val ambiguousAliases: List<AmbiguousAlias> = emptyList()
|
|
450
|
+
)
|
|
451
|
+
|
|
452
|
+
companion object {
|
|
453
|
+
const val NAME = "TpayRNModule"
|
|
454
|
+
|
|
455
|
+
private const val METHOD_CHANNEL_NAME = "tpay"
|
|
456
|
+
private const val CONFIGURE_METHOD = "configure"
|
|
457
|
+
private const val CONFIGURE_SCREENLESS_METHOD = "configureScreenless"
|
|
458
|
+
private const val START_PAYMENT_METHOD = "startPayment"
|
|
459
|
+
private const val TOKENIZE_CARD = "tokenizeCard"
|
|
460
|
+
private const val SCREENLESS_BLIK_PAYMENT_METHOD = "screenlessBLIKPayment"
|
|
461
|
+
private const val SCREENLESS_AMBIGUOUS_BLIK_PAYMENT_METHOD = "screenlessAmbiguousBLIKPayment"
|
|
462
|
+
private const val SCREENLESS_TRANSFER_PAYMENT_METHOD = "screenlessTransferPayment"
|
|
463
|
+
private const val SCREENLESS_CREDIT_CARD_PAYMENT_METHOD = "screenlessCreditCardPayment"
|
|
464
|
+
private const val SCREENLESS_GOOGLE_PAY_PAYMENT_METHOD = "screenlessGooglePayPayment"
|
|
465
|
+
private const val AVAILABLE_PAYMENT_METHODS_METHOD = "availablePaymentMethods"
|
|
466
|
+
private const val CONFIGURE_GOOGLE_PAY_UTILS_METHOD = "configureGooglePayUtils"
|
|
467
|
+
private const val OPEN_GOOGLE_PAY_METHOD = "openGooglePay"
|
|
468
|
+
private const val IS_GOOGLE_PAY_AVAILABLE_METHOD = "isGooglePayAvailable"
|
|
469
|
+
|
|
470
|
+
private const val START_CARD_TOKEN_TRANSACTION_METHOD = "startCardTokenPayment"
|
|
471
|
+
private const val CONFIGURATION_NULL_MESSAGE = "Configuration cannot be null"
|
|
472
|
+
private const val CONFIGURATION_INVALID_MESSAGE = "Configuration invalid: "
|
|
473
|
+
private const val TRANSACTION_NULL_MESSAGE = "Transaction cannot be null"
|
|
474
|
+
private const val UNKNOWN_CONFIGURATION_ERROR_MESSAGE = "Unknown configuration error"
|
|
475
|
+
private const val PAYER_NULL_MESSAGE = "Payer cannot be null"
|
|
476
|
+
private const val TOKEN_PAYMENT_NULL_MESSAGE = "CardTokenPayment cannot be null"
|
|
477
|
+
private const val UNKNOWN_VALIDATION_ERROR_MESSAGE = "Unknown validation error"
|
|
478
|
+
private const val ACTIVITY_NULL_MESSAGE = "Activity cannot be null"
|
|
479
|
+
private const val UNKNOWN_ERROR = "Unknown error"
|
|
480
|
+
private const val SCREENLESS_BLIK_NULL_MESSAGE = "Screenless BLIK cannot be null"
|
|
481
|
+
private const val SCREENLESS_TRANSFER_NULL_MESSAGE = "Screenless transfer cannot be null"
|
|
482
|
+
const val NOT_IMPLEMENTED_SCREENLESS_PAYMENT_MESSAGE = "Not implemented screenless payment type"
|
|
483
|
+
const val NOT_IMPLEMENTED_CONFIGURATION_TYPE_MESSAGE = "Not implemented configuration type"
|
|
484
|
+
private const val GOOGLE_PAY_CONFIGURATION_NULL_MESSAGE = "Google Pay configuration cannot be null"
|
|
485
|
+
private const val GOOGLE_PAY_CONFIGURATION_INVALID = "Google Pay configuration is invalid"
|
|
486
|
+
private const val APPLE_PAY_NOT_AVAILABLE = "Apple Pay is not available on Android"
|
|
487
|
+
|
|
488
|
+
private const val CONFIGURATION_SUCCESS = "configurationSuccess"
|
|
489
|
+
private const val VALIDATION_ERROR = "validationError"
|
|
490
|
+
private const val PAYMENT_COMPLETED = "paymentCompleted"
|
|
491
|
+
private const val PAYMENT_CANCELLED = "paymentCancelled"
|
|
492
|
+
private const val TOKENIZATION_COMPLETED = "tokenizationCompleted"
|
|
493
|
+
private const val TOKENIZATION_FAILURE = "tokenizationFailure"
|
|
494
|
+
private const val METHOD_CALL_ERROR = "methodCallError"
|
|
495
|
+
private const val MODULE_CLOSED = "moduleClosed"
|
|
496
|
+
|
|
497
|
+
private const val PAYMENT_METHODS = "paymentMethods"
|
|
498
|
+
private const val SUCCESS = "success"
|
|
499
|
+
private const val PAID = "paid"
|
|
500
|
+
private const val PAYMENT_CREATED = "paymentCreated"
|
|
501
|
+
private const val CONFIGURED_PAYMENT_FAILED = "configuredPaymentFailed"
|
|
502
|
+
private const val ERROR = "error"
|
|
503
|
+
private const val DEV_ERROR_MESSAGE = "devErrorMessage"
|
|
504
|
+
private const val AMBIGUOUS_ALIAS = "ambiguousAlias"
|
|
505
|
+
private const val ALIASES = "aliases"
|
|
506
|
+
|
|
507
|
+
private const val CHANNELS = "channels"
|
|
508
|
+
|
|
509
|
+
private const val TYPE = "type"
|
|
510
|
+
private const val VALUE = "value"
|
|
511
|
+
private const val TRANSACTION_ID = "transactionId"
|
|
512
|
+
private const val MESSAGE = "message"
|
|
513
|
+
private const val PAYMENT_URL = "paymentUrl"
|
|
514
|
+
|
|
515
|
+
private const val GOOGLE_PAY_CONFIGURATION_SUCCESS = "success"
|
|
516
|
+
private const val GOOGLE_PAY_CONFIGURATION_ERROR = "error"
|
|
517
|
+
|
|
518
|
+
private const val GOOGLE_PAY_OPEN_SUCCESS = "success"
|
|
519
|
+
private const val GOOGLE_PAY_OPEN_CANCELLED = "cancelled"
|
|
520
|
+
private const val GOOGLE_PAY_OPEN_UNKNOWN_ERROR = "unknownError"
|
|
521
|
+
private const val GOOGLE_PAY_OPEN_NOT_CONFIGURED = "notConfigured"
|
|
522
|
+
|
|
523
|
+
private const val GOOGLE_PAY_TOKEN = "token"
|
|
524
|
+
private const val GOOGLE_PAY_DESCRIPTION = "description"
|
|
525
|
+
private const val GOOGLE_PAY_CARD_NETWORK = "cardNetwork"
|
|
526
|
+
private const val GOOGLE_PAY_CARD_TAIL = "cardTail"
|
|
527
|
+
}
|
|
528
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
package com.tpay
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.ReactPackage
|
|
4
|
+
import com.facebook.react.bridge.NativeModule
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
+
import com.facebook.react.uimanager.ViewManager
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class TpayPackage : ReactPackage {
|
|
10
|
+
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
|
|
11
|
+
return listOf(TpayModule(reactContext))
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
|
|
15
|
+
return emptyList()
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
package com.tpay
|
|
2
|
+
|
|
3
|
+
sealed class TpayResult {
|
|
4
|
+
data class ValidationError(val message: String) : TpayResult()
|
|
5
|
+
object ConfigurationSuccess : TpayResult()
|
|
6
|
+
data class PaymentCompleted(val transactionId: String?) : TpayResult()
|
|
7
|
+
data class PaymentCancelled(val transactionId: String?) : TpayResult()
|
|
8
|
+
object TokenizationCompleted : TpayResult()
|
|
9
|
+
object TokenizationFailure : TpayResult()
|
|
10
|
+
object ModuleClosed : TpayResult()
|
|
11
|
+
internal data class MethodCallError(val message: String) : TpayResult()
|
|
12
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
package com.tpay
|
|
2
|
+
|
|
3
|
+
import com.tpay.model.screenless.*
|
|
4
|
+
import com.tpay.sdk.api.screenless.blik.*
|
|
5
|
+
import com.tpay.sdk.api.screenless.transfer.*
|
|
6
|
+
import com.tpay.sdk.api.screenless.card.*
|
|
7
|
+
import com.tpay.sdk.api.screenless.googlePay.*
|
|
8
|
+
import com.tpay.sdk.api.screenless.PaymentDetails
|
|
9
|
+
import com.tpay.sdk.api.screenless.LongPollingConfig
|
|
10
|
+
import com.tpay.sdk.api.screenless.TransactionState
|
|
11
|
+
import com.tpay.sdk.api.screenless.pekaoInstallment.*
|
|
12
|
+
|
|
13
|
+
class TpayScreenlessPaymentHandler(
|
|
14
|
+
private val payment: ScreenlessPayment,
|
|
15
|
+
private val onResult: (TpayScreenlessResult) -> Unit
|
|
16
|
+
) {
|
|
17
|
+
init {
|
|
18
|
+
payment.run {
|
|
19
|
+
val paymentDetails = PaymentDetails(amount, description, hiddenDescription, language)
|
|
20
|
+
|
|
21
|
+
when (this) {
|
|
22
|
+
is BLIKScreenlessPayment -> {
|
|
23
|
+
BLIKPayment.Builder()
|
|
24
|
+
.apply {
|
|
25
|
+
code?.let { setBLIKCode(code) }
|
|
26
|
+
alias?.let { setBLIKAlias(alias) }
|
|
27
|
+
if (code != null && alias != null) {
|
|
28
|
+
setBLIKCodeAndRegisterAlias(code, alias)
|
|
29
|
+
}
|
|
30
|
+
setPayer(payer)
|
|
31
|
+
setPaymentDetails(paymentDetails)
|
|
32
|
+
setCallbacks(redirects, notifications)
|
|
33
|
+
}
|
|
34
|
+
.build()
|
|
35
|
+
.execute { createResult ->
|
|
36
|
+
onResult(TpayScreenlessResultHandler.handleBLIKCreateResult(createResult))
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
is TransferScreenlessPayment -> {
|
|
41
|
+
TransferPayment.Builder()
|
|
42
|
+
.apply {
|
|
43
|
+
setChannelId(channelId)
|
|
44
|
+
setPayer(payer)
|
|
45
|
+
setPaymentDetails(paymentDetails)
|
|
46
|
+
setCallbacks(redirects, notifications)
|
|
47
|
+
}
|
|
48
|
+
.build()
|
|
49
|
+
.execute { createResult ->
|
|
50
|
+
onResult(TpayScreenlessResultHandler.handleTransferCreateResult(createResult))
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
is RatyPekaoScreenlessPayment -> {
|
|
55
|
+
PekaoInstallmentPayment.Builder()
|
|
56
|
+
.apply {
|
|
57
|
+
setChannelId(channelId)
|
|
58
|
+
setPayer(payer)
|
|
59
|
+
setPaymentDetails(paymentDetails)
|
|
60
|
+
setCallbacks(redirects, notifications)
|
|
61
|
+
}
|
|
62
|
+
.build()
|
|
63
|
+
.execute { createResult ->
|
|
64
|
+
onResult(TpayScreenlessResultHandler.handleRatyPekaoCreateResult(createResult))
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
is CreditCardScreenlessPayment -> {
|
|
69
|
+
CreditCardPayment.Builder()
|
|
70
|
+
.apply {
|
|
71
|
+
creditCardData?.run {
|
|
72
|
+
setCreditCard(creditCard, domain, saveCard, rocText)
|
|
73
|
+
}
|
|
74
|
+
cardToken?.let { setCreditCardToken(cardToken) }
|
|
75
|
+
recursive?.let { setRecursive(recursive) }
|
|
76
|
+
setPayer(payer)
|
|
77
|
+
setPaymentDetails(paymentDetails)
|
|
78
|
+
setCallbacks(redirects, notifications)
|
|
79
|
+
}
|
|
80
|
+
.build()
|
|
81
|
+
.execute { createResult ->
|
|
82
|
+
onResult(TpayScreenlessResultHandler.handleCreditCardCreateResult(createResult))
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
is GooglePayScreenlessPayment -> {
|
|
87
|
+
GooglePayPayment.Builder()
|
|
88
|
+
.apply {
|
|
89
|
+
setGooglePayToken(token)
|
|
90
|
+
setPayer(payer)
|
|
91
|
+
setPaymentDetails(paymentDetails)
|
|
92
|
+
setCallbacks(redirects, notifications)
|
|
93
|
+
}
|
|
94
|
+
.build()
|
|
95
|
+
.execute { createResult ->
|
|
96
|
+
onResult(TpayScreenlessResultHandler.handleGooglePayCreateResult(createResult))
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
package com.tpay
|
|
2
|
+
|
|
3
|
+
import com.tpay.sdk.api.screenless.blik.AmbiguousAlias
|
|
4
|
+
|
|
5
|
+
sealed class TpayScreenlessResult {
|
|
6
|
+
data class Paid(val transactionId: String) : TpayScreenlessResult()
|
|
7
|
+
data class PaymentCreated(
|
|
8
|
+
val transactionId: String,
|
|
9
|
+
val paymentUrl: String?
|
|
10
|
+
) : TpayScreenlessResult()
|
|
11
|
+
|
|
12
|
+
data class ConfiguredPaymentFailed(
|
|
13
|
+
val transactionId: String,
|
|
14
|
+
val errorMessage: String?
|
|
15
|
+
) : TpayScreenlessResult()
|
|
16
|
+
|
|
17
|
+
data class BlikAmbiguousAlias(
|
|
18
|
+
val transactionId: String,
|
|
19
|
+
val ambiguousAliases: List<AmbiguousAlias>
|
|
20
|
+
) : TpayScreenlessResult()
|
|
21
|
+
|
|
22
|
+
data class Error(val errorMessage: String?) : TpayScreenlessResult()
|
|
23
|
+
data class ValidationError(val message: String) : TpayScreenlessResult()
|
|
24
|
+
data class MethodCallError(val message: String) : TpayScreenlessResult()
|
|
25
|
+
}
|