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,121 @@
|
|
|
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
|
+
object TpayScreenlessResultHandler {
|
|
14
|
+
fun handleCreditCardCreateResult(
|
|
15
|
+
createResult: CreateCreditCardTransactionResult
|
|
16
|
+
): TpayScreenlessResult {
|
|
17
|
+
return when (createResult) {
|
|
18
|
+
is CreateCreditCardTransactionResult.Created -> {
|
|
19
|
+
TpayScreenlessResult.PaymentCreated(
|
|
20
|
+
createResult.transactionId,
|
|
21
|
+
createResult.paymentUrl
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
is CreateCreditCardTransactionResult.CreatedAndPaid -> {
|
|
26
|
+
TpayScreenlessResult.Paid(createResult.transactionId)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
is CreateCreditCardTransactionResult.Error -> {
|
|
30
|
+
TpayScreenlessResult.Error(createResult.errorMessage)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
fun handleTransferCreateResult(
|
|
36
|
+
createResult: CreateTransferTransactionResult
|
|
37
|
+
): TpayScreenlessResult {
|
|
38
|
+
return when (createResult) {
|
|
39
|
+
is CreateTransferTransactionResult.Created -> {
|
|
40
|
+
TpayScreenlessResult.PaymentCreated(
|
|
41
|
+
createResult.transactionId,
|
|
42
|
+
createResult.paymentUrl
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
is CreateTransferTransactionResult.Error -> {
|
|
47
|
+
TpayScreenlessResult.Error(createResult.errorMessage)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
fun handleRatyPekaoCreateResult(
|
|
53
|
+
createResult: CreatePekaoInstallmentTransactionResult
|
|
54
|
+
): TpayScreenlessResult {
|
|
55
|
+
return when (createResult) {
|
|
56
|
+
is CreatePekaoInstallmentTransactionResult.Created -> {
|
|
57
|
+
TpayScreenlessResult.PaymentCreated(
|
|
58
|
+
createResult.transactionId,
|
|
59
|
+
createResult.paymentUrl
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
is CreatePekaoInstallmentTransactionResult.Error -> {
|
|
64
|
+
TpayScreenlessResult.Error(createResult.devErrorMessage)
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
fun handleBLIKCreateResult(
|
|
70
|
+
createResult: CreateBLIKTransactionResult
|
|
71
|
+
): TpayScreenlessResult {
|
|
72
|
+
return when (createResult) {
|
|
73
|
+
is CreateBLIKTransactionResult.Created -> {
|
|
74
|
+
TpayScreenlessResult.PaymentCreated(createResult.transactionId, null)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
is CreateBLIKTransactionResult.CreatedAndPaid -> {
|
|
78
|
+
TpayScreenlessResult.Paid(createResult.transactionId)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
is CreateBLIKTransactionResult.ConfiguredPaymentFailed -> {
|
|
82
|
+
TpayScreenlessResult.ConfiguredPaymentFailed(
|
|
83
|
+
createResult.transactionId,
|
|
84
|
+
createResult.errorMessage
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
is CreateBLIKTransactionResult.AmbiguousBlikAlias -> {
|
|
89
|
+
TpayScreenlessResult.BlikAmbiguousAlias(
|
|
90
|
+
createResult.transactionId,
|
|
91
|
+
createResult.aliases
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
is CreateBLIKTransactionResult.Error -> {
|
|
96
|
+
TpayScreenlessResult.Error(createResult.errorMessage)
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
fun handleGooglePayCreateResult(
|
|
102
|
+
createResult: CreateGooglePayTransactionResult
|
|
103
|
+
): TpayScreenlessResult {
|
|
104
|
+
return when (createResult) {
|
|
105
|
+
is CreateGooglePayTransactionResult.Created -> {
|
|
106
|
+
TpayScreenlessResult.PaymentCreated(
|
|
107
|
+
createResult.transactionId,
|
|
108
|
+
createResult.paymentUrl
|
|
109
|
+
)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
is CreateGooglePayTransactionResult.CreatedAndPaid -> {
|
|
113
|
+
TpayScreenlessResult.Paid(createResult.transactionId)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
is CreateGooglePayTransactionResult.Error -> {
|
|
117
|
+
TpayScreenlessResult.Error(createResult.errorMessage)
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
package com.tpay.delegate
|
|
2
|
+
|
|
3
|
+
import com.tpay.sdk.api.addCard.*
|
|
4
|
+
import com.tpay.TpayResult
|
|
5
|
+
import com.tpay.util.TpayBackpressUtil
|
|
6
|
+
|
|
7
|
+
class AddCardDelegateImpl(
|
|
8
|
+
private val sheet: AddCard.Sheet,
|
|
9
|
+
private val onResult: (TpayResult) -> Unit
|
|
10
|
+
) : AddCardDelegate {
|
|
11
|
+
override fun onAddCardSuccess(tokenizationId: String?) {
|
|
12
|
+
onResult(TpayResult.TokenizationCompleted)
|
|
13
|
+
remove()
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
override fun onAddCardFailure() {
|
|
17
|
+
onResult(TpayResult.TokenizationFailure)
|
|
18
|
+
remove()
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
override fun onModuleClosed() {
|
|
22
|
+
onResult(TpayResult.ModuleClosed)
|
|
23
|
+
remove()
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
private fun remove() {
|
|
27
|
+
sheet.removeObserver()
|
|
28
|
+
TpayBackpressUtil.remove()
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
package com.tpay.delegate
|
|
2
|
+
|
|
3
|
+
import com.tpay.sdk.api.payment.PaymentDelegate
|
|
4
|
+
import com.tpay.sdk.api.models.ObservablePayment
|
|
5
|
+
import com.tpay.TpayResult
|
|
6
|
+
import com.tpay.util.TpayBackpressUtil
|
|
7
|
+
|
|
8
|
+
class PaymentDelegateImpl(
|
|
9
|
+
private val sheet: ObservablePayment,
|
|
10
|
+
private val onResult: (TpayResult) -> Unit
|
|
11
|
+
) : PaymentDelegate {
|
|
12
|
+
override fun onPaymentCreated(transactionId: String?) {}
|
|
13
|
+
|
|
14
|
+
override fun onPaymentCompleted(transactionId: String?) {
|
|
15
|
+
onResult(TpayResult.PaymentCompleted(transactionId))
|
|
16
|
+
remove()
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
override fun onPaymentCancelled(transactionId: String?) {
|
|
20
|
+
onResult(TpayResult.PaymentCancelled(transactionId))
|
|
21
|
+
remove()
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
override fun onModuleClosed() {
|
|
25
|
+
onResult(TpayResult.ModuleClosed)
|
|
26
|
+
remove()
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
private fun remove() {
|
|
30
|
+
sheet.removeObserver()
|
|
31
|
+
TpayBackpressUtil.remove()
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
package com.tpay.extension
|
|
2
|
+
|
|
3
|
+
import com.tpay.sdk.api.models.BlikAlias
|
|
4
|
+
import org.json.JSONObject
|
|
5
|
+
|
|
6
|
+
private const val VALUE = "value"
|
|
7
|
+
private const val LABEL = "label"
|
|
8
|
+
private const val IS_REGISTERED = "isRegistered"
|
|
9
|
+
|
|
10
|
+
fun JSONObject.getBlikAlias(): BlikAlias {
|
|
11
|
+
val value = getString(VALUE)
|
|
12
|
+
val label = getString(LABEL)
|
|
13
|
+
return if (getBoolean(IS_REGISTERED)) {
|
|
14
|
+
BlikAlias.Registered(value, label)
|
|
15
|
+
} else {
|
|
16
|
+
BlikAlias.NotRegistered(value, label)
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
package com.tpay.extension
|
|
2
|
+
|
|
3
|
+
import com.tpay.sdk.api.cardTokenPayment.CardTokenTransaction
|
|
4
|
+
import com.tpay.util.ValidationMessages
|
|
5
|
+
|
|
6
|
+
fun CardTokenTransaction.validate() {
|
|
7
|
+
if (amount <= 0) {
|
|
8
|
+
throw ValidationException(ValidationMessages.AMOUNT_NEGATIVE)
|
|
9
|
+
}
|
|
10
|
+
if (description.isBlank()) {
|
|
11
|
+
throw ValidationException(ValidationMessages.DESCRIPTION_BLANK)
|
|
12
|
+
}
|
|
13
|
+
if (cardToken.isBlank()) {
|
|
14
|
+
throw ValidationException(ValidationMessages.CARD_TOKEN_BLANK)
|
|
15
|
+
}
|
|
16
|
+
if (payer.name.isBlank() || payer.email.isBlank()) {
|
|
17
|
+
throw ValidationException(ValidationMessages.PAYER_REQUIRED_TOKEN_PAYMENT)
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
package com.tpay.extension
|
|
2
|
+
|
|
3
|
+
import com.tpay.sdk.api.screenless.channelMethods.*
|
|
4
|
+
import org.json.JSONArray
|
|
5
|
+
import org.json.JSONObject
|
|
6
|
+
|
|
7
|
+
fun List<PaymentChannel>.toJsonArray(): JSONArray {
|
|
8
|
+
return JSONArray().apply {
|
|
9
|
+
forEach { channel ->
|
|
10
|
+
put(channel.toJsonObject())
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
fun PaymentChannel.toJsonObject(): JSONObject {
|
|
16
|
+
return JSONObject().apply {
|
|
17
|
+
put("id", id)
|
|
18
|
+
put("name", name)
|
|
19
|
+
put("imageUrl", imageUrl)
|
|
20
|
+
put("constraints", constraints.toJsonArray())
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
package com.tpay.extension
|
|
2
|
+
|
|
3
|
+
import com.tpay.sdk.api.screenless.channelMethods.*
|
|
4
|
+
import com.tpay.model.screenless.PaymentConstraintType
|
|
5
|
+
import org.json.JSONObject
|
|
6
|
+
import org.json.JSONArray
|
|
7
|
+
|
|
8
|
+
fun List<PaymentConstraint>.toJsonArray(): JSONArray {
|
|
9
|
+
return JSONArray().apply {
|
|
10
|
+
forEach { constraint -> put(constraint.toJsonObject()) }
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
fun PaymentConstraint.toJsonObject(): JSONObject {
|
|
15
|
+
return JSONObject().apply {
|
|
16
|
+
when (this@toJsonObject) {
|
|
17
|
+
is PaymentConstraint.Amount -> {
|
|
18
|
+
put("type", PaymentConstraintType.AMOUNT.name.lowercase())
|
|
19
|
+
put("minimum", minimum)
|
|
20
|
+
put("maximum", maximum)
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
package com.tpay.extension
|
|
2
|
+
|
|
3
|
+
import com.tpay.sdk.api.screenless.channelMethods.*
|
|
4
|
+
import org.json.JSONObject
|
|
5
|
+
import org.json.JSONArray
|
|
6
|
+
|
|
7
|
+
fun List<PaymentGroup>.toJsonArray(): JSONArray {
|
|
8
|
+
return JSONArray().apply {
|
|
9
|
+
forEach { group ->
|
|
10
|
+
put(group.toJsonObject())
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
fun PaymentGroup.toJsonObject(): JSONObject {
|
|
16
|
+
return JSONObject().apply {
|
|
17
|
+
put("id", id)
|
|
18
|
+
put("name", name)
|
|
19
|
+
put("imageUrl", imageUrl)
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
package com.tpay.extension
|
|
2
|
+
|
|
3
|
+
import com.tpay.sdk.api.models.transaction.SingleTransaction
|
|
4
|
+
import com.tpay.util.ValidationMessages
|
|
5
|
+
import com.tpay.extension.ValidationException
|
|
6
|
+
|
|
7
|
+
fun SingleTransaction.validate() {
|
|
8
|
+
if (amount <= 0) {
|
|
9
|
+
throw ValidationException(ValidationMessages.AMOUNT_NEGATIVE)
|
|
10
|
+
}
|
|
11
|
+
if (description.isBlank()) {
|
|
12
|
+
throw ValidationException(ValidationMessages.DESCRIPTION_BLANK)
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
package com.tpay.extension
|
|
2
|
+
|
|
3
|
+
import java.util.regex.Matcher
|
|
4
|
+
import java.util.regex.Pattern
|
|
5
|
+
import com.tpay.sdk.api.models.Environment
|
|
6
|
+
import com.tpay.util.ValidationMessages
|
|
7
|
+
|
|
8
|
+
fun String.isValidBLIKCode(): Boolean {
|
|
9
|
+
return this.matches(Regex("^[0-9]{6}$"))
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
fun String.isEmailValid(): Boolean {
|
|
13
|
+
return if (isBlank()) {
|
|
14
|
+
false
|
|
15
|
+
} else {
|
|
16
|
+
val matcher: Matcher =
|
|
17
|
+
Pattern
|
|
18
|
+
.compile("(?:[a-zA-Z0-9!#\$%&'*+/=?^_`{|}~-]+(?:\\.[a-zA-Z0-9!#\$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-zA-Z0-9-]*[a-zA-Z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)])")
|
|
19
|
+
.matcher(this)
|
|
20
|
+
return matcher.matches()
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
fun String.toEnvironment(): Environment {
|
|
25
|
+
return when (this) {
|
|
26
|
+
Environment.PRODUCTION.name.lowercase() -> Environment.PRODUCTION
|
|
27
|
+
Environment.SANDBOX.name.lowercase() -> Environment.SANDBOX
|
|
28
|
+
else -> throw IllegalArgumentException(ValidationMessages.UNKNOWN_ENVIRONMENT)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
package com.tpay.model
|
|
2
|
+
|
|
3
|
+
import org.json.JSONObject
|
|
4
|
+
|
|
5
|
+
data class CertificateConfiguration(
|
|
6
|
+
val pinnedDomain: String,
|
|
7
|
+
val publicKeyHash: String
|
|
8
|
+
) {
|
|
9
|
+
companion object {
|
|
10
|
+
private const val PINNED_DOMAIN = "pinnedDomain"
|
|
11
|
+
private const val PUBLIC_KEY_HASH = "publicKeyHash"
|
|
12
|
+
|
|
13
|
+
fun fromJson(json: JSONObject): CertificateConfiguration {
|
|
14
|
+
return CertificateConfiguration(
|
|
15
|
+
pinnedDomain = json.getString(PINNED_DOMAIN),
|
|
16
|
+
publicKeyHash = json.getString(PUBLIC_KEY_HASH)
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
package com.tpay.model
|
|
2
|
+
|
|
3
|
+
import org.json.JSONObject
|
|
4
|
+
import com.tpay.sdk.api.models.PaymentMethod
|
|
5
|
+
import com.tpay.extension.ValidationException
|
|
6
|
+
import com.tpay.util.*
|
|
7
|
+
import com.tpay.sdk.api.models.Environment
|
|
8
|
+
import com.tpay.extension.*
|
|
9
|
+
|
|
10
|
+
data class ConfigurationMerchant(
|
|
11
|
+
val authorization: MerchantAuthorization,
|
|
12
|
+
val environment: Environment,
|
|
13
|
+
val certificateConfiguration: CertificateConfiguration,
|
|
14
|
+
val walletConfiguration: WalletConfiguration?
|
|
15
|
+
) {
|
|
16
|
+
companion object {
|
|
17
|
+
private const val AUTHORIZATION = "authorization"
|
|
18
|
+
private const val ENVIRONMENT = "environment"
|
|
19
|
+
private const val CERTIFICATE_PINNING_CONFIGURATION = "certificatePinningConfiguration"
|
|
20
|
+
private const val WALLET_CONFIGURATION = "walletConfiguration"
|
|
21
|
+
|
|
22
|
+
fun fromJson(json: JSONObject): ConfigurationMerchant = json.run {
|
|
23
|
+
ConfigurationMerchant(
|
|
24
|
+
authorization = MerchantAuthorization.fromJson(getJSONObject(AUTHORIZATION)),
|
|
25
|
+
environment = getString(ENVIRONMENT).toEnvironment(),
|
|
26
|
+
certificateConfiguration = CertificateConfiguration.fromJson(
|
|
27
|
+
getJSONObject(CERTIFICATE_PINNING_CONFIGURATION)
|
|
28
|
+
),
|
|
29
|
+
walletConfiguration = optJSONObject(WALLET_CONFIGURATION)?.run(WalletConfiguration::fromJson)
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
package com.tpay.model
|
|
2
|
+
|
|
3
|
+
import com.tpay.sdk.api.models.Language
|
|
4
|
+
import org.json.JSONObject
|
|
5
|
+
|
|
6
|
+
data class Languages(
|
|
7
|
+
val preferredLanguage: Language,
|
|
8
|
+
val supportedLanguages: List<Language>
|
|
9
|
+
) {
|
|
10
|
+
companion object {
|
|
11
|
+
private const val PREFERRED_LANGUAGE = "preferredLanguage"
|
|
12
|
+
private const val SUPPORTED_LANGUAGES_ARRAY = "supportedLanguages"
|
|
13
|
+
|
|
14
|
+
fun fromJson(json: JSONObject): Languages {
|
|
15
|
+
val supportedLanguagesArray = json.getJSONArray(SUPPORTED_LANGUAGES_ARRAY)
|
|
16
|
+
return Languages(
|
|
17
|
+
preferredLanguage = Language.valueOf(json.getString(PREFERRED_LANGUAGE).uppercase()),
|
|
18
|
+
supportedLanguages = (0 until supportedLanguagesArray.length()).map { index ->
|
|
19
|
+
Language.valueOf(supportedLanguagesArray.getString(index).uppercase())
|
|
20
|
+
}
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
package com.tpay.model
|
|
2
|
+
|
|
3
|
+
import com.tpay.sdk.api.models.Language
|
|
4
|
+
import org.json.JSONObject
|
|
5
|
+
|
|
6
|
+
class LocalizedString(
|
|
7
|
+
val language: Language,
|
|
8
|
+
val value: String
|
|
9
|
+
) {
|
|
10
|
+
companion object {
|
|
11
|
+
private const val LANGUAGE = "language"
|
|
12
|
+
private const val VALUE = "value"
|
|
13
|
+
|
|
14
|
+
fun fromJson(json: JSONObject): LocalizedString {
|
|
15
|
+
return LocalizedString(
|
|
16
|
+
language = Language.valueOf(json.getString(LANGUAGE).uppercase()),
|
|
17
|
+
value = json.getString(VALUE)
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
package com.tpay.model
|
|
2
|
+
|
|
3
|
+
import org.json.JSONObject
|
|
4
|
+
|
|
5
|
+
data class MerchantAuthorization(
|
|
6
|
+
val clientId: String,
|
|
7
|
+
val clientSecret: String
|
|
8
|
+
) {
|
|
9
|
+
companion object {
|
|
10
|
+
private const val CLIENT_ID = "clientId"
|
|
11
|
+
private const val CLIENT_SECRET = "clientSecret"
|
|
12
|
+
|
|
13
|
+
fun fromJson(json: JSONObject): MerchantAuthorization {
|
|
14
|
+
return MerchantAuthorization(
|
|
15
|
+
clientId = json.getString(CLIENT_ID),
|
|
16
|
+
clientSecret = json.getString(CLIENT_SECRET)
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
package com.tpay.model
|
|
2
|
+
|
|
3
|
+
import org.json.JSONObject
|
|
4
|
+
|
|
5
|
+
data class MerchantDetails(
|
|
6
|
+
val displayNames: List<LocalizedString>,
|
|
7
|
+
val merchantHeadquarters: List<LocalizedString>,
|
|
8
|
+
val regulations: List<LocalizedString>,
|
|
9
|
+
) {
|
|
10
|
+
companion object {
|
|
11
|
+
private const val MERCHANT_DISPLAY_NAMES = "merchantDisplayName"
|
|
12
|
+
private const val MERCHANT_CITIES = "merchantHeadquarters"
|
|
13
|
+
private const val REGULATIONS = "regulations"
|
|
14
|
+
|
|
15
|
+
fun fromJson(json: JSONObject): MerchantDetails {
|
|
16
|
+
val displayNamesArray = json.getJSONArray(MERCHANT_DISPLAY_NAMES)
|
|
17
|
+
val merchantHeadquartersArray = json.getJSONArray(MERCHANT_CITIES)
|
|
18
|
+
val regulationsArray = json.getJSONArray(REGULATIONS)
|
|
19
|
+
return MerchantDetails(
|
|
20
|
+
displayNames = (0 until displayNamesArray.length()).map {
|
|
21
|
+
LocalizedString.fromJson(displayNamesArray.getJSONObject(it))
|
|
22
|
+
},
|
|
23
|
+
merchantHeadquarters = (0 until merchantHeadquartersArray.length()).map {
|
|
24
|
+
LocalizedString.fromJson(merchantHeadquartersArray.getJSONObject(it))
|
|
25
|
+
},
|
|
26
|
+
regulations = (0 until regulationsArray.length()).map {
|
|
27
|
+
LocalizedString.fromJson(regulationsArray.getJSONObject(it))
|
|
28
|
+
}
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
package com.tpay.model
|
|
2
|
+
|
|
3
|
+
import org.json.JSONObject
|
|
4
|
+
import com.tpay.sdk.api.models.PaymentMethod
|
|
5
|
+
import com.tpay.sdk.api.models.DigitalWallet
|
|
6
|
+
import com.tpay.sdk.api.models.InstallmentPayment
|
|
7
|
+
import com.tpay.extension.ValidationException
|
|
8
|
+
|
|
9
|
+
class PaymentMethods(val methods: List<PaymentMethod>) {
|
|
10
|
+
companion object {
|
|
11
|
+
private const val UNKNOWN_PAYMENT_METHOD_MESSAGE = "Unknown payment method"
|
|
12
|
+
private const val UNKNOWN_DIGITAL_WALLET_MESSAGE = "Unknown digital wallet"
|
|
13
|
+
private const val UNKNOWN_INSTALLMENT_PAYMENT_MESSAGE = "Unknown installment payment"
|
|
14
|
+
private const val DEFINE_PAYMENT_METHODS_MESSAGE = "Define payment methods"
|
|
15
|
+
private const val APPLE_PAY_INDEX = 1
|
|
16
|
+
private const val METHODS_ARRAY = "methods"
|
|
17
|
+
private const val WALLETS_ARRAY = "wallets"
|
|
18
|
+
private const val INSTALLMENT_PAYMENTS_ARRAY = "installmentPayments"
|
|
19
|
+
private const val BLIK_INDEX = 0
|
|
20
|
+
private const val TRANSFER_INDEX = 1
|
|
21
|
+
private const val CARD_INDEX = 2
|
|
22
|
+
private const val RATY_PEKAO_INDEX = 0
|
|
23
|
+
private const val APPLE_PAY = "applePay"
|
|
24
|
+
private const val GOOGLE_PAY = "googlePay"
|
|
25
|
+
private const val RATY_PEKAO = "ratyPekao"
|
|
26
|
+
private const val BLIK = "blik"
|
|
27
|
+
private const val CARD = "card"
|
|
28
|
+
private const val TRANSFER = "transfer"
|
|
29
|
+
|
|
30
|
+
fun fromJson(json: JSONObject): PaymentMethods {
|
|
31
|
+
val paymentMethodsArray = json.getJSONArray(METHODS_ARRAY)
|
|
32
|
+
val digitalWalletsArray = json.optJSONArray(WALLETS_ARRAY)
|
|
33
|
+
val installmentPaymentsArray = json.optJSONArray(INSTALLMENT_PAYMENTS_ARRAY)
|
|
34
|
+
|
|
35
|
+
val wallets = digitalWalletsArray?.let { array ->
|
|
36
|
+
(0 until array.length())
|
|
37
|
+
.map { index -> array.getString(index) }
|
|
38
|
+
.filter { value -> value != APPLE_PAY }
|
|
39
|
+
.map { value ->
|
|
40
|
+
when (value) {
|
|
41
|
+
GOOGLE_PAY -> DigitalWallet.GOOGLE_PAY
|
|
42
|
+
else -> throw ValidationException(UNKNOWN_DIGITAL_WALLET_MESSAGE)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
} ?: emptyList()
|
|
46
|
+
|
|
47
|
+
val installmentPayments = installmentPaymentsArray?.let { array ->
|
|
48
|
+
(0 until array.length())
|
|
49
|
+
.map { index -> array.getString(index) }
|
|
50
|
+
.map { value ->
|
|
51
|
+
when (value) {
|
|
52
|
+
RATY_PEKAO -> InstallmentPayment.RATY_PEKAO
|
|
53
|
+
else -> throw ValidationException(UNKNOWN_INSTALLMENT_PAYMENT_MESSAGE)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
} ?: emptyList()
|
|
57
|
+
|
|
58
|
+
val paymentMethods = (0 until paymentMethodsArray.length())
|
|
59
|
+
.map { index -> paymentMethodsArray.getString(index) }
|
|
60
|
+
.map { index ->
|
|
61
|
+
when (index) {
|
|
62
|
+
BLIK -> PaymentMethod.Blik
|
|
63
|
+
TRANSFER -> PaymentMethod.Pbl
|
|
64
|
+
CARD -> PaymentMethod.Card
|
|
65
|
+
else -> throw ValidationException(UNKNOWN_PAYMENT_METHOD_MESSAGE)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
.let { methods ->
|
|
69
|
+
if (wallets.isNotEmpty()) {
|
|
70
|
+
methods + PaymentMethod.DigitalWallets(wallets)
|
|
71
|
+
} else {
|
|
72
|
+
methods
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
.let { methods ->
|
|
76
|
+
if (installmentPayments.isNotEmpty()) {
|
|
77
|
+
methods + PaymentMethod.InstallmentPayments(installmentPayments)
|
|
78
|
+
} else {
|
|
79
|
+
methods
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (paymentMethods.isEmpty()) {
|
|
84
|
+
throw ValidationException(DEFINE_PAYMENT_METHODS_MESSAGE)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return PaymentMethods(methods = paymentMethods)
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
package com.tpay.model
|
|
2
|
+
|
|
3
|
+
import org.json.JSONObject
|
|
4
|
+
import com.tpay.sdk.api.models.PaymentMethod
|
|
5
|
+
import com.tpay.extension.ValidationException
|
|
6
|
+
import com.tpay.util.*
|
|
7
|
+
import com.tpay.sdk.api.models.Environment
|
|
8
|
+
import com.tpay.extension.*
|
|
9
|
+
|
|
10
|
+
data class TpayConfiguration(
|
|
11
|
+
val merchant: ConfigurationMerchant,
|
|
12
|
+
val merchantDetails: MerchantDetails,
|
|
13
|
+
val languages: Languages,
|
|
14
|
+
val paymentMethods: PaymentMethods,
|
|
15
|
+
) : Configuration {
|
|
16
|
+
override fun validate() {
|
|
17
|
+
val allLanguages = (languages.supportedLanguages + languages.preferredLanguage).distinct()
|
|
18
|
+
val displayNameLanguages = merchantDetails.displayNames.map { localization -> localization.language }
|
|
19
|
+
val merchantHeadquartersLanguages = merchantDetails.merchantHeadquarters.map { localization -> localization.language }
|
|
20
|
+
val regulationLanguages = merchantDetails.regulations.map { localization -> localization.language }
|
|
21
|
+
if (
|
|
22
|
+
!displayNameLanguages.containsAll(allLanguages) ||
|
|
23
|
+
!merchantHeadquartersLanguages.containsAll(allLanguages) ||
|
|
24
|
+
!regulationLanguages.containsAll(allLanguages)
|
|
25
|
+
) {
|
|
26
|
+
throw ValidationException(ValidationMessages.PROVIDE_LOCALIZATION_MESSAGE)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (merchant.authorization.clientId.isBlank() || merchant.authorization.clientSecret.isBlank()) {
|
|
30
|
+
throw ValidationException(ValidationMessages.CREDENTIALS_BLANK)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
companion object {
|
|
35
|
+
private const val MERCHANT = "merchant"
|
|
36
|
+
private const val MERCHANT_DETAILS = "merchantDetails"
|
|
37
|
+
private const val LANGUAGES = "languages"
|
|
38
|
+
private const val PAYMENT_METHODS = "paymentMethods"
|
|
39
|
+
|
|
40
|
+
fun fromJson(json: String): TpayConfiguration = JSONObject(json).run {
|
|
41
|
+
TpayConfiguration(
|
|
42
|
+
merchant = ConfigurationMerchant.fromJson(getJSONObject(MERCHANT)),
|
|
43
|
+
merchantDetails = MerchantDetails.fromJson(getJSONObject(MERCHANT_DETAILS)),
|
|
44
|
+
languages = Languages.fromJson(getJSONObject(LANGUAGES)),
|
|
45
|
+
paymentMethods = PaymentMethods.fromJson(getJSONObject(PAYMENT_METHODS)),
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|