diff --git a/CHANGELOG.md b/CHANGELOG.md index 49583d5..9f309b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,18 @@ # CHANGELOG All notable changes to this project will be documented in this file. To know better on how to write and maintain a changelog, refer to [this link](https://keepachangelog.com/en/1.0.0/). +## [3.0.0] + +### Changed + +- Updated the underlying Android SDK to version [4.0.0](https://docs.truelayer.com/docs/android-sdk-release-history). +- Updated the underlying iOS SDK to version [4.0.1](https://docs.truelayer.com/docs/ios-sdk-release-history). + +### Fixes + +- Workaround to address [Issue 87](https://github.com/TrueLayer/truelayer-react-native-sdk/issues/87) + TrueLayerPaymentsSDKWrapper.configure fails on Android: "TrueLayerUI was not initialised" (works fine on iOS and most of Android devices) + ## [2.3.0] ### Changed diff --git a/DemoApp/android/app/build.gradle b/DemoApp/android/app/build.gradle index 4afed0c..6bfc38b 100644 --- a/DemoApp/android/app/build.gradle +++ b/DemoApp/android/app/build.gradle @@ -118,7 +118,7 @@ android { } dependencies { - coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:2.1.3" + coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:2.1.5" // The version of react-native is set by the React Native Gradle Plugin implementation("com.facebook.react:react-android") diff --git a/RNTrueLayerPaymentsSDK/android/build.gradle b/RNTrueLayerPaymentsSDK/android/build.gradle index 4a64829..f50882f 100644 --- a/RNTrueLayerPaymentsSDK/android/build.gradle +++ b/RNTrueLayerPaymentsSDK/android/build.gradle @@ -67,5 +67,5 @@ repositories { dependencies { implementation 'com.facebook.react:react-native:+' - implementation 'com.truelayer.payments:ui:3.9.1' -} \ No newline at end of file + implementation 'com.truelayer.payments:ui:4.0.0' +} diff --git a/RNTrueLayerPaymentsSDK/android/src/main/java/com/truelayer/RNTrueLayerPaymentsSDK/TlPaymentSdkModule.kt b/RNTrueLayerPaymentsSDK/android/src/main/java/com/truelayer/RNTrueLayerPaymentsSDK/TlPaymentSdkModule.kt index c865774..a2742fb 100644 --- a/RNTrueLayerPaymentsSDK/android/src/main/java/com/truelayer/RNTrueLayerPaymentsSDK/TlPaymentSdkModule.kt +++ b/RNTrueLayerPaymentsSDK/android/src/main/java/com/truelayer/RNTrueLayerPaymentsSDK/TlPaymentSdkModule.kt @@ -118,7 +118,7 @@ private class TLReactNativeUtils { | "ProcessorContextNotAvailable" | "Unknown"; */ - + return when (reason) { ProcessorResult.FailureReason.NoInternet -> "NoInternet" ProcessorResult.FailureReason.UserAborted -> "UserAborted" @@ -317,11 +317,12 @@ private fun WritableMap.concatenate(map: WritableMap) { } } +private var trueLayerUI: TrueLayerUI? = null + class TlPaymentSdkModule(reactContext: ReactApplicationContext) : NativeTrueLayerPaymentsSDKSpec(reactContext), ActivityEventListener { val mPromises: SparseArray = SparseArray() - var trueLayerUI: TrueLayerUI? = null var themeMap: HashMap? = null val scope = CoroutineScope( @@ -357,6 +358,15 @@ class TlPaymentSdkModule(reactContext: ReactApplicationContext) : themeMap = tempMapNonNullValues } + // TrueLayerUI can not be init twice + if (trueLayerUI != null) { + // This is a workaround to be able to call init more than once + // This will ignore any configuration setup and will + // continue to use the previously configured instance + promise?.resolve(null) + return + } + // we ignore the outcome in here for now val out = TrueLayerUI.init(reactApplicationContext) { this.environment = env diff --git a/RNTrueLayerPaymentsSDK/ios/RNTrueLayerHelpers.mm b/RNTrueLayerPaymentsSDK/ios/RNTrueLayerHelpers.mm index fedf0bb..5445ee8 100644 --- a/RNTrueLayerPaymentsSDK/ios/RNTrueLayerHelpers.mm +++ b/RNTrueLayerPaymentsSDK/ios/RNTrueLayerHelpers.mm @@ -13,11 +13,6 @@ + (NSString *)stepFromSinglePaymentState:(TrueLayerSinglePaymentState)state { case TrueLayerSinglePaymentStateExecuted: return @"Executed"; - // `TrueLayerSinglePaymentStateRedirect` is deprecated and will be removed in the future versions. - // Starting from SDK version 3.8.0, it's safe to assume that this case will never be triggered. - case TrueLayerSinglePaymentStateRedirect: - return @"Redirect"; - case TrueLayerSinglePaymentStateSettled: return @"Settled"; @@ -111,6 +106,18 @@ + (NSString *)reasonFromSinglePaymentError:(TrueLayerSinglePaymentError)error { case TrueLayerSinglePaymentErrorUserCanceledAtProvider: return @"UserCanceledAtProvider"; + + case TrueLayerSinglePaymentErrorInvalidBeneficiaryAccount: + return @"InvalidBeneficiaryAccount"; + + case TrueLayerSinglePaymentErrorInvalidOtp: + return @"InvalidOtp"; + + case TrueLayerSinglePaymentErrorSchemeUnavailable: + return @"SchemeUnavailable"; + + case TrueLayerSinglePaymentErrorVerificationDeclined: + return @"VerificationDeclined"; } } @@ -179,11 +186,6 @@ + (NSString *)stepFromMandateState:(TrueLayerMandateState)state { switch (state) { case TrueLayerMandateStateAuthorized: return @"Authorized"; - - // `TrueLayerMandateStateRedirect` is deprecated and will be removed in the future versions. - // Starting from SDK version 3.8.0, it's safe to assume that this case will never be triggered. - case TrueLayerMandateStateRedirect: - return @"Redirect"; } } @@ -245,6 +247,12 @@ + (NSString *)reasonFromMandateError:(TrueLayerMandateError)error { case TrueLayerMandateErrorUnknownError: return @"Unknown"; + + case TrueLayerMandateErrorInvalidMandateState: + return @"InvalidMandateState"; + + case TrueLayerMandateErrorConstraintViolation: + return @"ConstraintViolation"; } } diff --git a/RNTrueLayerPaymentsSDK/js/models/types.ts b/RNTrueLayerPaymentsSDK/js/models/types.ts index 3f2c8f9..ea4ace5 100644 --- a/RNTrueLayerPaymentsSDK/js/models/types.ts +++ b/RNTrueLayerPaymentsSDK/js/models/types.ts @@ -35,10 +35,6 @@ export type ProcessorResult = | { type: ResultType.Failure; reason: FailureReason, resultShown: ResultShown }; export enum ProcessorStep { - /** - * @deprecated `Redirect` is no longer a valid case sent by the SDK and will be removed in the future. - */ - Redirect = "Redirect", Wait = "Wait", Authorized = "Authorized", Executed = "Executed", @@ -82,7 +78,13 @@ export type FailureReason = | "ProviderError" | "ProviderExpired" | "ProviderRejected" - | "UserCanceledAtProvider"; + | "UserCanceledAtProvider" + | "InvalidBeneficiaryAccount" + | "InvalidOtp" + | "SchemeUnavailable" + | "VerificationDeclined" + | "InvalidMandateState" + | "ConstraintViolation"; /** * Provides more detailed information about the error. diff --git a/RNTrueLayerPaymentsSDK/package.json b/RNTrueLayerPaymentsSDK/package.json index b2a7d89..4bb3343 100644 --- a/RNTrueLayerPaymentsSDK/package.json +++ b/RNTrueLayerPaymentsSDK/package.json @@ -1,6 +1,6 @@ { "name": "rn-truelayer-payments-sdk", - "version": "2.3.0", + "version": "3.0.0", "description": "RN wrapper for TrueLayer's payments SDK", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/RNTrueLayerPaymentsSDK/rn-truelayer-payments-sdk.podspec b/RNTrueLayerPaymentsSDK/rn-truelayer-payments-sdk.podspec index 1cce0d8..e398d84 100644 --- a/RNTrueLayerPaymentsSDK/rn-truelayer-payments-sdk.podspec +++ b/RNTrueLayerPaymentsSDK/rn-truelayer-payments-sdk.podspec @@ -41,5 +41,5 @@ Pod::Spec.new do |s| s.dependency "ReactCommon/turbomodule/core" end end - s.dependency "TrueLayerPaymentsSDK", '3.9.0' + s.dependency "TrueLayerPaymentsSDK", '4.0.1' end