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,67 @@
|
|
|
1
|
+
package com.tpay.util
|
|
2
|
+
|
|
3
|
+
import com.tpay.model.*
|
|
4
|
+
import com.tpay.sdk.api.tpayModule.TpayModule
|
|
5
|
+
import com.tpay.sdk.api.providers.*
|
|
6
|
+
import com.tpay.sdk.api.models.*
|
|
7
|
+
import com.tpay.sdk.api.models.merchant.*
|
|
8
|
+
import com.tpay.sdk.api.models.transaction.SingleTransaction
|
|
9
|
+
import com.tpay.model.Configuration
|
|
10
|
+
|
|
11
|
+
object TpayUtil {
|
|
12
|
+
private const val EMPTY_MERCHANT_ID = "EMPTY_ID"
|
|
13
|
+
|
|
14
|
+
fun configure(configuration: Configuration) {
|
|
15
|
+
when (configuration) {
|
|
16
|
+
is TpayConfiguration -> configureStandard(configuration)
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
private fun configureStandard(configuration: TpayConfiguration) {
|
|
21
|
+
configuration.run {
|
|
22
|
+
merchant.walletConfiguration?.googlePay?.run {
|
|
23
|
+
if (merchantId.isNotBlank()) {
|
|
24
|
+
TpayModule.configure(GooglePayConfiguration(merchantId))
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
TpayModule
|
|
29
|
+
.configure(object : SSLCertificatesProvider {
|
|
30
|
+
override var apiConfiguration: CertificatePinningConfiguration = CertificatePinningConfiguration(
|
|
31
|
+
publicKeyHash = merchant.certificateConfiguration.publicKeyHash
|
|
32
|
+
)
|
|
33
|
+
})
|
|
34
|
+
.configure(merchant.environment)
|
|
35
|
+
.configure(paymentMethods.methods)
|
|
36
|
+
.configure(languages.preferredLanguage, languages.supportedLanguages)
|
|
37
|
+
.configure(Compatibility.Flutter)
|
|
38
|
+
.configure(object : MerchantDetailsProvider {
|
|
39
|
+
override fun merchantDisplayName(language: Language): String {
|
|
40
|
+
return merchantDetails.displayNames
|
|
41
|
+
.first { localization -> localization.language == language }
|
|
42
|
+
.value
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
override fun merchantCity(language: Language): String? {
|
|
46
|
+
return merchantDetails.merchantHeadquarters
|
|
47
|
+
.first { localization -> localization.language == language }
|
|
48
|
+
.value
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
override fun regulationsLink(language: Language): String {
|
|
52
|
+
return merchantDetails.regulations
|
|
53
|
+
.first { localization -> localization.language == language }
|
|
54
|
+
.value
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
.configure(
|
|
58
|
+
Merchant(
|
|
59
|
+
authorization = Merchant.Authorization(
|
|
60
|
+
merchant.authorization.clientId,
|
|
61
|
+
merchant.authorization.clientSecret
|
|
62
|
+
)
|
|
63
|
+
)
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
package com.tpay.util
|
|
2
|
+
|
|
3
|
+
object ValidationMessages {
|
|
4
|
+
const val AMOUNT_NEGATIVE = "Amount has to be greater than 0"
|
|
5
|
+
const val DESCRIPTION_BLANK = "Description cannot be blank"
|
|
6
|
+
const val CARD_TOKEN_BLANK = "Card token cannot be blank"
|
|
7
|
+
const val BLIK_CODE_AND_ALIAS_NULL = "Please provide BLIK code or alias"
|
|
8
|
+
const val BLIK_CODE_INVALID = "BLIK code is invalid"
|
|
9
|
+
const val LONG_POLLING_DELAY_NEGATIVE = "Long polling delay has to be greater than 0"
|
|
10
|
+
const val LONG_POLLING_MAX_REQUEST_COUNT_NEGATIVE = "Long polling max request count has to be greater than 0"
|
|
11
|
+
const val NOTIFICATION_EMAIL_INVALID = "Notification email is invalid"
|
|
12
|
+
const val PAYER_EMAIL_INVALID = "Payer email is invalid"
|
|
13
|
+
const val CREDIT_CARD_DATA_NULL = "Please provide credit card data or credit card token"
|
|
14
|
+
const val PROVIDE_LOCALIZATION_MESSAGE = "Provide display names and regulations for all defined languages"
|
|
15
|
+
const val UNKNOWN_ENVIRONMENT = "Unknown Tpay environment"
|
|
16
|
+
const val CREDENTIALS_BLANK = "Credentials cannot be blank"
|
|
17
|
+
const val GOOGLE_PAY_TOKEN_BLANK = "Google Pay token cannot be blank"
|
|
18
|
+
const val PAYER_REQUIRED_TOKEN_PAYMENT = "Payer's name and email are required for credit card token payment"
|
|
19
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import Security
|
|
2
|
+
import Tpay
|
|
3
|
+
|
|
4
|
+
final class MerchantConfiguration {
|
|
5
|
+
|
|
6
|
+
// MARK: - Properties
|
|
7
|
+
|
|
8
|
+
private let configuration: T.MerchantConfiguration
|
|
9
|
+
|
|
10
|
+
// MARK: - Initializers
|
|
11
|
+
|
|
12
|
+
init?(configuration: String) {
|
|
13
|
+
guard let configurationData = configuration.data(using: .utf8),
|
|
14
|
+
let configuration = try? JSONDecoder().decode(T.MerchantConfiguration.self, from: configurationData) else { return nil }
|
|
15
|
+
self.configuration = configuration
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// MARK: - API
|
|
19
|
+
|
|
20
|
+
func merchant() -> Merchant? {
|
|
21
|
+
let merchant = configuration.merchant
|
|
22
|
+
guard let environment = makeEnvironment(from: merchant.environment) else { return nil }
|
|
23
|
+
|
|
24
|
+
let cardApi = makeCardApi(from: merchant.certificatePinningConfiguration)
|
|
25
|
+
let blikConfiguration = makeBlikConfiguration(from: merchant.blikAliasToRegister)
|
|
26
|
+
let walletConfiguration = makeWalletConfiguration(from: merchant.walletConfiguration?.applePay)
|
|
27
|
+
return .init(authorization: .init(clientId: merchant.authorization.clientId, clientSecret: merchant.authorization.clientSecret),
|
|
28
|
+
cardsConfiguration: cardApi,
|
|
29
|
+
environment: environment,
|
|
30
|
+
blikConfiguration: blikConfiguration,
|
|
31
|
+
walletConfiguration: walletConfiguration)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
func paymentMethods() -> [PaymentMethod]? {
|
|
35
|
+
guard let configurationPaymentMethods = configuration.paymentMethods else { return nil }
|
|
36
|
+
|
|
37
|
+
let methods = configurationPaymentMethods.methods.compactMap { T.PaymentMethod(rawValue: $0) }.sorted { $0.paymentOrder < $1.paymentOrder }.map { $0.tpayPaymentMethod }
|
|
38
|
+
let installmentPayments = (configurationPaymentMethods.installmentPayments ?? []).compactMap { T.PaymentMethod(rawValue: $0) }.sorted { $0.paymentOrder < $1.paymentOrder }.map { $0.tpayPaymentMethod }
|
|
39
|
+
let wallets = (configurationPaymentMethods.wallets ?? []).compactMap { T.PaymentMethod(rawValue: $0) }.sorted { $0.paymentOrder < $1.paymentOrder }.map { $0.tpayPaymentMethod }
|
|
40
|
+
|
|
41
|
+
let paymentMethods = (methods + installmentPayments + wallets)
|
|
42
|
+
|
|
43
|
+
return paymentMethods.isEmpty ? nil : paymentMethods
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
func preferredLanguage() -> Language? {
|
|
47
|
+
guard let preferredLanguage = configuration.languages?.preferredLanguage else { return nil }
|
|
48
|
+
return .init(rawValue: preferredLanguage)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
func supportedLanguage() -> [Language] {
|
|
52
|
+
guard let supportedLanguages = configuration.languages?.supportedLanguages else { return [] }
|
|
53
|
+
return supportedLanguages.compactMap { Language(rawValue: $0) }
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
func detailsProvider() -> DefaultMerchantDetailsProvider {
|
|
57
|
+
let details = configuration.merchantDetails
|
|
58
|
+
|
|
59
|
+
var merchantDisplayName: [Language: String] = [:]
|
|
60
|
+
if let displayNames = details.merchantDisplayName {
|
|
61
|
+
displayNames.forEach { detail in
|
|
62
|
+
if let language = Language(rawValue: detail.language) {
|
|
63
|
+
merchantDisplayName[language] = detail.value
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
var merchantHeadquarters: [Language: String] = [:]
|
|
69
|
+
if let headquaters = details.merchantHeadquarters {
|
|
70
|
+
headquaters.forEach { detail in
|
|
71
|
+
if let language = Language(rawValue: detail.language) {
|
|
72
|
+
merchantHeadquarters[language] = detail.value
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
var regulationsLink: [Language: URL] = [:]
|
|
78
|
+
if let links = details.regulations {
|
|
79
|
+
links.forEach { detail in
|
|
80
|
+
if let language = Language(rawValue: detail.language), let url = URL(string: detail.value) {
|
|
81
|
+
regulationsLink[language] = url
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return .init(merchantDisplayName: merchantDisplayName, merchantHeadquarters: merchantHeadquarters, regulationsLink: regulationsLink)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
func sslCertificatesProvider() -> DefaultSSLCertificatesProvider? {
|
|
90
|
+
guard let publicKeyHash = configuration.merchant.certificatePinningConfiguration?.publicKeyHash else { return nil }
|
|
91
|
+
return .init(apiConfiguration: .init(publicKeyHashes: [publicKeyHash]))
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// MARK: - Private
|
|
95
|
+
|
|
96
|
+
private func makeCardApi(from certificatePinningConfiguration: T.Merchant.CertificatePinning?) -> Merchant.CardsAPI? {
|
|
97
|
+
guard let publicKeyHash = certificatePinningConfiguration?.publicKeyHash else { return nil }
|
|
98
|
+
return try? .init(publicKey: publicKeyHash)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
private func makeEnvironment(from environment: String) -> Merchant.Environment? {
|
|
102
|
+
guard let environment = T.Environment(rawValue: environment) else { return nil }
|
|
103
|
+
return environment.tpayEnvironment
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
private func makeBlikConfiguration(from blikAliasToRegister: String?) -> Merchant.BlikConfiguration? {
|
|
107
|
+
guard let blikAliasToRegister = blikAliasToRegister else { return nil }
|
|
108
|
+
|
|
109
|
+
return .init(aliasToBeRegistered: .init(value: .uid(blikAliasToRegister)))
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
private func makeWalletConfiguration(from applePayConfiguration: T.Merchant.WalletConfiguration.ApplePay?) -> Merchant.WalletConfiguration? {
|
|
113
|
+
guard let applePayConfiguration = applePayConfiguration,
|
|
114
|
+
let countryCode = Merchant.WalletConfiguration.ApplePayConfiguration.CountryCode(rawValue: applePayConfiguration.countryCode)
|
|
115
|
+
else { return nil }
|
|
116
|
+
|
|
117
|
+
return .init(applePayConfiguration: .init(merchantIdentifier: applePayConfiguration.merchantIdentifier,
|
|
118
|
+
countryCode: countryCode))
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import Tpay
|
|
2
|
+
|
|
3
|
+
final class PaymentMethodsConfiguration {
|
|
4
|
+
|
|
5
|
+
// MARK: - Constants
|
|
6
|
+
|
|
7
|
+
enum Constants {
|
|
8
|
+
static let amount = "amount"
|
|
9
|
+
static let min = "min"
|
|
10
|
+
static let max = "max"
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// MARK: - API
|
|
14
|
+
|
|
15
|
+
static func configuration(for paymentChannels: [Headless.Models.PaymentChannel]) -> [T.PaymentChannel] {
|
|
16
|
+
makePaymentChannelsInfo(from: paymentChannels)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// MARK: - Private
|
|
20
|
+
|
|
21
|
+
private static func makePaymentChannelsInfo(from paymentChannels: [Headless.Models.PaymentChannel]) -> [T.PaymentChannel] {
|
|
22
|
+
paymentChannels.map { makeTransportationPaymentChanel(from: $0) }
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
private static func makeTransportationPaymentChanel(from paymentChanel: Headless.Models.PaymentChannel) -> T.PaymentChannel {
|
|
26
|
+
T.PaymentChannel(id: paymentChanel.id,
|
|
27
|
+
name: paymentChanel.fullName,
|
|
28
|
+
imageUrl: paymentChanel.imageUrl?.absoluteString,
|
|
29
|
+
constraints: makeDomainConstains(from: paymentChanel.constraints ?? []))
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
private static func makeDomainConstains(from constains: [Headless.Models.PaymentChannel.Constraint]) -> [T.PaymentChannel.Constraint] {
|
|
33
|
+
let amountConstraints = constains.filter { $0.field == Constants.amount }
|
|
34
|
+
let min = amountConstraints.filter { $0.type == Constants.min }.map { Double($0.value) }.first ?? nil
|
|
35
|
+
let max = amountConstraints.filter { $0.type == Constants.max }.map { Double($0.value) }.first ?? nil
|
|
36
|
+
if min == nil, max == nil {
|
|
37
|
+
return []
|
|
38
|
+
}
|
|
39
|
+
return [.init(type: Constants.amount.uppercased(), minimum: min, maximum: max)]
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import Tpay
|
|
2
|
+
|
|
3
|
+
final class TransactionConfiguration {
|
|
4
|
+
|
|
5
|
+
// MARK: - Constants
|
|
6
|
+
|
|
7
|
+
private enum Defaults {
|
|
8
|
+
static let successRedirectUrl = URL(string: "https://secure.tpay.com/mobile-sdk/success/")!
|
|
9
|
+
static let errorRedirectUrl = URL(string: "https://secure.tpay.com/mobile-sdk/error/")!
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// MARK: - API
|
|
13
|
+
|
|
14
|
+
static func single(transactionConfiguration: String) -> Transaction? {
|
|
15
|
+
guard let trancationData = transactionConfiguration.data(using: .utf8),
|
|
16
|
+
let signleTransaction = try? JSONDecoder().decode(T.SingleTransaction.self, from: trancationData) else {
|
|
17
|
+
return nil
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
let payerContext = makeTransactionPayerContext(from: signleTransaction)
|
|
21
|
+
|
|
22
|
+
return SingleTransaction(amount: signleTransaction.amount, description: signleTransaction.description, payerContext: payerContext)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
static func cardTokenTransaction(transactionConfiguration: String) -> Transaction? {
|
|
26
|
+
guard let trancationData = transactionConfiguration.data(using: .utf8),
|
|
27
|
+
let tokenPayment = try? JSONDecoder().decode(T.TokenPayment.self, from: trancationData) else {
|
|
28
|
+
return nil
|
|
29
|
+
}
|
|
30
|
+
let payerContext = makeTokenPayerContext(from: tokenPayment)
|
|
31
|
+
return SingleTransaction(amount: tokenPayment.amount, description: tokenPayment.description, payerContext: payerContext)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static func addCard(tokenisationConfiguration: String) -> TokenizationData? {
|
|
35
|
+
guard let tokenisationData = tokenisationConfiguration.data(using: .utf8),
|
|
36
|
+
let tokenisation = try? JSONDecoder().decode(T.Tokenisation.self, from: tokenisationData),
|
|
37
|
+
let payer = makePayer(from: tokenisation.payer)
|
|
38
|
+
else {
|
|
39
|
+
return nil
|
|
40
|
+
}
|
|
41
|
+
return TokenizationData.init(payer: payer, notificationUrl: tokenisation.notificationUrl, successRedirectUrl: tokenisation.successRedirectUrl, errorRedirectUrl: tokenisation.errorRedirectUrl)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
static func cardPayment(cardPaymentConfiguration: String, paymentChannels: [Headless.Models.PaymentChannel]) -> CardPayment? {
|
|
45
|
+
guard let cardPaymentData = cardPaymentConfiguration.data(using: .utf8),
|
|
46
|
+
let cardPayment = try? JSONDecoder().decode(T.CardPayment.self, from: cardPaymentData),
|
|
47
|
+
let payer = makePayer(from: cardPayment.payer),
|
|
48
|
+
let paymentChannel = paymentChannels.first(where: { $0.paymentKind == .card }) else {
|
|
49
|
+
return nil
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
let callbacks = makeCallbacksConfiguration(from: cardPayment.callbacks)
|
|
53
|
+
|
|
54
|
+
let card = cardPayment.creditCard.flatMap { creditCard -> Headless.Models.Card? in
|
|
55
|
+
Headless.Models.Card(number: creditCard.number, expiryDate: .init(month: creditCard.expiryDate.month, year: creditCard.expiryDate.year), securityCode: creditCard.securityCode, shouldTokenize: creditCard.config.shouldSave)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
let cardToken = cardPayment.creditCardToken.flatMap { token -> Headless.Models.CardToken? in
|
|
59
|
+
try? Headless.Models.CardToken(token: token, cardTail: "1234", brand: .other(""))
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return .init(amount: cardPayment.paymentDetails.amount,
|
|
63
|
+
description: cardPayment.paymentDetails.description,
|
|
64
|
+
payerContext: .init(payer: payer),
|
|
65
|
+
paymentChannel: paymentChannel,
|
|
66
|
+
card: card,
|
|
67
|
+
cardToken: cardToken,
|
|
68
|
+
callbacks: callbacks)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
static func blikPayment(blikPaymentConfiguration: String, paymentChannels: [Headless.Models.PaymentChannel]) -> BlikPayment? {
|
|
72
|
+
guard let blikPaymentData = blikPaymentConfiguration.data(using: .utf8),
|
|
73
|
+
let blikPayment = try? JSONDecoder().decode(T.BlikPayment.self, from: blikPaymentData),
|
|
74
|
+
let payer = makePayer(from: blikPayment.payer),
|
|
75
|
+
let paymentChannel = paymentChannels.first(where: { $0.paymentKind == .blik }) else {
|
|
76
|
+
return nil
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
let callbacks = makeCallbacksConfiguration(from: blikPayment.callbacks)
|
|
80
|
+
|
|
81
|
+
return .init(amount: blikPayment.paymentDetails.amount,
|
|
82
|
+
description: blikPayment.paymentDetails.description,
|
|
83
|
+
payerContext: .init(payer: payer),
|
|
84
|
+
token: blikPayment.code,
|
|
85
|
+
alias: blikPayment.alias?.value,
|
|
86
|
+
paymentChannel: paymentChannel,
|
|
87
|
+
callbacks: callbacks)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
static func bankPayment(bankPaymentConfiguration: String, paymentChannels: [Headless.Models.PaymentChannel]) -> BankPayment? {
|
|
91
|
+
guard let bankPaymentData = bankPaymentConfiguration.data(using: .utf8),
|
|
92
|
+
let bankPayment = try? JSONDecoder().decode(T.BankPayment.self, from: bankPaymentData),
|
|
93
|
+
let payer = makePayer(from: bankPayment.payer),
|
|
94
|
+
let paymentChannel = paymentChannels.first(where: { $0.paymentKind == .pbl }) else {
|
|
95
|
+
return nil
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
let callbacks = makeCallbacksConfiguration(from: bankPayment.callbacks)
|
|
99
|
+
|
|
100
|
+
return .init(amount: bankPayment.paymentDetails.amount,
|
|
101
|
+
description: bankPayment.paymentDetails.description,
|
|
102
|
+
payerContext: .init(payer: payer),
|
|
103
|
+
paymentChannel: paymentChannel,
|
|
104
|
+
callbacks: callbacks)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
static func digitalWalletPayment(digitalWalletPaymentConfiguration: String, paymentChannels: [Headless.Models.PaymentChannel]) -> DigitalWalletPayment? {
|
|
108
|
+
guard let digitalWalletPaymentData = digitalWalletPaymentConfiguration.data(using: .utf8),
|
|
109
|
+
let digitalWalletPayment = try? JSONDecoder().decode(T.DigitalWalletPayment.self, from: digitalWalletPaymentData),
|
|
110
|
+
let payer = makePayer(from: digitalWalletPayment.payer),
|
|
111
|
+
let paymentChannel = paymentChannels.first(where: { $0.paymentKind == .applePay }) else {
|
|
112
|
+
return nil
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
let callbacks = makeCallbacksConfiguration(from: digitalWalletPayment.callbacks)
|
|
116
|
+
|
|
117
|
+
return .init(amount: digitalWalletPayment.paymentDetails.amount,
|
|
118
|
+
description: digitalWalletPayment.paymentDetails.description,
|
|
119
|
+
payerContext: .init(payer: payer),
|
|
120
|
+
paymentChannel: paymentChannel,
|
|
121
|
+
token: digitalWalletPayment.applePayToken,
|
|
122
|
+
callbacks: callbacks)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
static func continuePayment(continuePaymentConfiguration: String) -> ContinuePayment? {
|
|
126
|
+
guard let continuePaymentData = continuePaymentConfiguration.data(using: .utf8),
|
|
127
|
+
let continuePayment = try? JSONDecoder().decode(T.ContinuePayment.self, from: continuePaymentData) else {
|
|
128
|
+
return nil
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return .init(id: continuePayment.transactionId, alias: continuePayment.blikAlias.value, ambiguousAlias: continuePayment.ambiguousBlikAlias)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
static func makeAliases(from aliases: [Headless.Models.Blik.AmbiguousBlikAlias.Application]) -> [T.AmbiguousAlias] {
|
|
135
|
+
aliases.map { T.AmbiguousAlias(name: $0.name, code: $0.key) }
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// MARK: - Private
|
|
139
|
+
|
|
140
|
+
private static func makeTransactionPayerContext(from signleTransaction: T.SingleTransaction) -> PayerContext? {
|
|
141
|
+
guard let payerContext = signleTransaction.payerContext else { return nil }
|
|
142
|
+
|
|
143
|
+
let payer = makePayer(from: payerContext.payer)
|
|
144
|
+
let blikAllias = payerContext.automaticPaymentMethods?.blikAlias?.value
|
|
145
|
+
let registredBlikAlias = blikAllias != nil ? RegisteredBlikAlias(value: .uid(blikAllias!)) : nil
|
|
146
|
+
let tokenizedCards = payerContext.automaticPaymentMethods?.tokenizedCards?.compactMap { makeCardToken(from: $0) }
|
|
147
|
+
|
|
148
|
+
return .init(payer: payer, automaticPaymentMethods: .init(registeredBlikAlias: registredBlikAlias, tokenizedCards: tokenizedCards))
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
private static func makeTokenPayerContext(from tokenPayment: T.TokenPayment) -> PayerContext {
|
|
152
|
+
let payer = makePayer(from: tokenPayment.payer)
|
|
153
|
+
let tokenizedCard = makeCardToken(from: tokenPayment)
|
|
154
|
+
|
|
155
|
+
return .init(payer: payer, automaticPaymentMethods: .init(tokenizedCards: tokenizedCard != nil ? [tokenizedCard!] : []))
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
private static func makePayer(from contexPayer: T.Payer?) -> Payer? {
|
|
159
|
+
guard let contexPayer = contexPayer else { return nil }
|
|
160
|
+
|
|
161
|
+
let address = makeAddress(from: contexPayer.address)
|
|
162
|
+
|
|
163
|
+
return .init(name: contexPayer.name, email: contexPayer.email, phone: contexPayer.phone, address: address)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
private static func makeAddress(from contextAddress: T.Payer.Address?) -> Address? {
|
|
167
|
+
guard let contextAddress = contextAddress else { return nil }
|
|
168
|
+
|
|
169
|
+
return .init(address: contextAddress.address,
|
|
170
|
+
city: contextAddress.city,
|
|
171
|
+
country: contextAddress.countryCode,
|
|
172
|
+
postalCode: contextAddress.postalCode)
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
private static func makeCardToken(from tokenPayment: T.TokenPayment) -> CardToken? {
|
|
176
|
+
return try? .init(token: tokenPayment.cardToken, cardTail: "1234", brand: .other(""))
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
private static func makeCardToken(from tokenData: T.CardToken?) -> CardToken? {
|
|
180
|
+
guard let tokenData = tokenData else { return nil }
|
|
181
|
+
return try? .init(token: tokenData.token, cardTail: tokenData.cardTail, brand: makeCardBrand(from: tokenData.brand))
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
private static func makeCallbacksConfiguration(from callbacks: T.Callbacks) -> CallbacksConfiguration {
|
|
185
|
+
return .init(successRedirectUrl: URL(string: callbacks.redirects?.successUrl ?? Defaults.successRedirectUrl.absoluteString) ?? Defaults.successRedirectUrl,
|
|
186
|
+
errorRedirectUrl: URL(string: callbacks.redirects?.errorUrl ?? Defaults.errorRedirectUrl.absoluteString) ?? Defaults.errorRedirectUrl,
|
|
187
|
+
notificationsUrl: callbacks.notifications.flatMap { URL(string: $0.url) })
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
private static func makeCardBrand(from brand: String) -> CardToken.Brand {
|
|
191
|
+
switch brand {
|
|
192
|
+
case "visa":
|
|
193
|
+
return CardToken.Brand.visa
|
|
194
|
+
case "mastercard":
|
|
195
|
+
return CardToken.Brand.mastercard
|
|
196
|
+
default:
|
|
197
|
+
return CardToken.Brand.other(brand)
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import Tpay
|
|
2
|
+
|
|
3
|
+
extension TpayModule {
|
|
4
|
+
|
|
5
|
+
// MARK: - API
|
|
6
|
+
|
|
7
|
+
static func setup(merchant: Merchant,
|
|
8
|
+
paymentMethods: [PaymentMethod]?,
|
|
9
|
+
preferredLanguage: Language?,
|
|
10
|
+
supportedLanguages: [Language],
|
|
11
|
+
sslCertificatesProvider: SSLCertificatesProvider?,
|
|
12
|
+
detailsProvider: MerchantDetailsProvider) throws {
|
|
13
|
+
try TpayModule.configure(merchant: merchant)
|
|
14
|
+
.configure(merchantDetailsProvider: detailsProvider)
|
|
15
|
+
|
|
16
|
+
if let preferredLanguage = preferredLanguage {
|
|
17
|
+
try TpayModule.configure(preferredLanguage: preferredLanguage, supportedLanguages: supportedLanguages)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if let paymentMethods = paymentMethods {
|
|
21
|
+
try TpayModule.configure(paymentMethods: paymentMethods)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if let sslCertificatesProvider = sslCertificatesProvider {
|
|
25
|
+
TpayModule.configure(sslCertificatesProvider: sslCertificatesProvider)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if case let .invalid(error) = TpayModule.checkConfiguration() {
|
|
29
|
+
throw error
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Tpay
|
|
2
|
+
|
|
3
|
+
struct BankPayment: Transaction {
|
|
4
|
+
|
|
5
|
+
// MARK: - Properties
|
|
6
|
+
|
|
7
|
+
let amount: Double
|
|
8
|
+
let description: String
|
|
9
|
+
let payerContext: PayerContext?
|
|
10
|
+
let paymentChannel: Headless.Models.PaymentChannel
|
|
11
|
+
let callbacks: CallbacksConfiguration
|
|
12
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Tpay
|
|
2
|
+
|
|
3
|
+
struct BlikPayment: Transaction {
|
|
4
|
+
|
|
5
|
+
// MARK: - Properties
|
|
6
|
+
|
|
7
|
+
let amount: Double
|
|
8
|
+
let description: String
|
|
9
|
+
let payerContext: PayerContext?
|
|
10
|
+
let token: String?
|
|
11
|
+
let alias: String?
|
|
12
|
+
let paymentChannel: Headless.Models.PaymentChannel
|
|
13
|
+
let callbacks: CallbacksConfiguration
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Tpay
|
|
2
|
+
|
|
3
|
+
struct CardPayment: Transaction {
|
|
4
|
+
|
|
5
|
+
// MARK: - Properties
|
|
6
|
+
|
|
7
|
+
let amount: Double
|
|
8
|
+
let description: String
|
|
9
|
+
let payerContext: PayerContext?
|
|
10
|
+
let paymentChannel: Headless.Models.PaymentChannel
|
|
11
|
+
let card: Headless.Models.Card?
|
|
12
|
+
let cardToken: Headless.Models.CardToken?
|
|
13
|
+
let callbacks: CallbacksConfiguration
|
|
14
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
|
|
3
|
+
struct ConfigurationResult: Encodable {
|
|
4
|
+
|
|
5
|
+
// MARK: - Constants
|
|
6
|
+
|
|
7
|
+
private enum Constant {
|
|
8
|
+
static let configurationSuccess = "configurationSuccess"
|
|
9
|
+
static let configurationFailure = "configurationFailure"
|
|
10
|
+
static let paymentCompleted = "paymentCompleted"
|
|
11
|
+
static let paymentCancelled = "paymentCancelled"
|
|
12
|
+
static let paymentError = "paymentError"
|
|
13
|
+
static let tokenPaymentCompleted = "tokenPaymentCompleted"
|
|
14
|
+
static let tokenPaymentCancelled = "tokenPaymentCancelled"
|
|
15
|
+
static let tokenPaymentError = "tokenPaymentError"
|
|
16
|
+
static let tokenizationCompleted = "tokenizationCompleted"
|
|
17
|
+
static let tokenizationCancelled = "tokenizationCancelled"
|
|
18
|
+
static let unknownHandleMethod = "unknownHandleMethod"
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// MARK: - Properties
|
|
22
|
+
|
|
23
|
+
let type: String
|
|
24
|
+
let message: String?
|
|
25
|
+
|
|
26
|
+
// MARK: - Results
|
|
27
|
+
|
|
28
|
+
static func configurationValid() -> ConfigurationResult {
|
|
29
|
+
return .init(type: Constant.configurationSuccess, message: nil)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
static func configurationFailure() -> ConfigurationResult {
|
|
33
|
+
return .init(type: Constant.configurationFailure, message: nil)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
static func configurationFailure(error: Error) -> ConfigurationResult {
|
|
37
|
+
return .errorResult(type: Constant.configurationFailure, error: error)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static func paymentCompleted(transactionId: String) -> ConfigurationResult {
|
|
41
|
+
return .init(type: Constant.paymentCompleted, message: transactionId)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
static func paymentCancelled(transactionId: String) -> ConfigurationResult {
|
|
45
|
+
return .init(type: Constant.paymentCancelled, message: transactionId)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
static func payment(error: Error) -> ConfigurationResult {
|
|
49
|
+
return .errorResult(type: Constant.paymentError, error: error)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
static func tokenPaymentCompleted(transactionId: String) -> ConfigurationResult {
|
|
53
|
+
return .init(type: Constant.tokenPaymentCompleted, message: transactionId)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
static func tokenPaymentCancelled(transactionId: String) -> ConfigurationResult {
|
|
57
|
+
return .init(type: Constant.tokenPaymentCancelled, message: transactionId)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
static func tokenPayment(error: Error) -> ConfigurationResult {
|
|
61
|
+
return .errorResult(type: Constant.tokenPaymentError, error: error)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
static func tokenizationCompleted() -> ConfigurationResult {
|
|
65
|
+
return .init(type: Constant.tokenizationCompleted, message: nil)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
static func tokenizationCancelled() -> ConfigurationResult {
|
|
69
|
+
return .init(type: Constant.tokenizationCancelled, message: nil)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
static func unknownHandleMethod() -> ConfigurationResult {
|
|
73
|
+
return .init(type: Constant.unknownHandleMethod, message: nil)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// MARK: - Private
|
|
77
|
+
|
|
78
|
+
private static func errorResult(type: String, error: Error) -> ConfigurationResult {
|
|
79
|
+
.init(type: type, message: "\(error)")
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// MARK: - Extensions
|
|
84
|
+
|
|
85
|
+
extension ConfigurationResult {
|
|
86
|
+
|
|
87
|
+
func toJson() -> String {
|
|
88
|
+
do {
|
|
89
|
+
let jsonData = try JSONEncoder().encode(self)
|
|
90
|
+
if let jsonString = String(data: jsonData, encoding: .utf8) {
|
|
91
|
+
return jsonString
|
|
92
|
+
}
|
|
93
|
+
} catch {
|
|
94
|
+
debugPrint("Error converting ConfigurationResult to JSON: \(error)")
|
|
95
|
+
}
|
|
96
|
+
return ""
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import Tpay
|
|
2
|
+
|
|
3
|
+
struct DigitalWalletPayment: Transaction {
|
|
4
|
+
|
|
5
|
+
// MARK: - Properties
|
|
6
|
+
|
|
7
|
+
let amount: Double
|
|
8
|
+
let description: String
|
|
9
|
+
let payerContext: PayerContext?
|
|
10
|
+
let paymentChannel: Headless.Models.PaymentChannel
|
|
11
|
+
let token: String
|
|
12
|
+
let callbacks: CallbacksConfiguration
|
|
13
|
+
}
|