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/DemoApp/ios/DemoAppUITests/DemoAppUITests.swift b/DemoApp/ios/DemoAppUITests/DemoAppUITests.swift index a35670c..842e821 100644 --- a/DemoApp/ios/DemoAppUITests/DemoAppUITests.swift +++ b/DemoApp/ios/DemoAppUITests/DemoAppUITests.swift @@ -31,9 +31,13 @@ final class DemoAppUITests: XCTestCase { startSDKButton.tap() processSinglePaymentButton.tap() - let providersTitle = app.staticTexts["Choose your bank"] + let changeProviderButton = app.buttons["Change"] + let _ = changeProviderButton.waitForExistence(timeout: TimeInterval(integerLiteral: 30)) + changeProviderButton.tap() + let providersTitle = app.staticTexts["Select your bank"] let _ = providersTitle.waitForExistence(timeout: TimeInterval(integerLiteral: 30)) + XCTAssertTrue(providersTitle.isHittable) } } diff --git a/DemoApp/ios/Podfile.lock b/DemoApp/ios/Podfile.lock index 05e49e1..49d436d 100644 --- a/DemoApp/ios/Podfile.lock +++ b/DemoApp/ios/Podfile.lock @@ -1499,7 +1499,7 @@ PODS: - React-logger (= 0.77.0) - React-perflogger (= 0.77.0) - React-utils (= 0.77.0) - - rn-truelayer-payments-sdk (2.3.0): + - rn-truelayer-payments-sdk (3.0.0): - DoubleConversion - glog - hermes-engine @@ -1519,7 +1519,7 @@ PODS: - ReactCodegen - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - - TrueLayerPaymentsSDK (= 3.9.0) + - TrueLayerPaymentsSDK (= 4.0.1) - Yoga - RNCAsyncStorage (2.1.0): - DoubleConversion @@ -1543,7 +1543,7 @@ PODS: - ReactCommon/turbomodule/core - Yoga - SocketRocket (0.7.1) - - TrueLayerPaymentsSDK (3.9.0) + - TrueLayerPaymentsSDK (4.0.1) - Yoga (0.0.0) DEPENDENCIES: @@ -1770,7 +1770,7 @@ SPEC CHECKSUMS: fmt: a40bb5bd0294ea969aaaba240a927bd33d878cdd glog: eb93e2f488219332457c3c4eafd2738ddc7e80b8 hermes-engine: 1f783c3d53940aed0d2c84586f0b7a85ab7827ef - RCT-Folly: e78785aa9ba2ed998ea4151e314036f6c49e6d82 + RCT-Folly: 36fe2295e44b10d831836cc0d1daec5f8abcf809 RCTDeprecation: f5c19ebdb8804b53ed029123eb69914356192fc8 RCTRequired: 6ae6cebe470486e0e0ce89c1c0eabb998e7c51f4 RCTTypeSafety: 50d6ec72a3d13cf77e041ff43a0617050fb98e3f @@ -1828,10 +1828,10 @@ SPEC CHECKSUMS: ReactAppDependencyProvider: 6e8d68583f39dc31ee65235110287277eb8556ef ReactCodegen: c08a5113d9c9c895fe10f3c296f74c6b705a60a9 ReactCommon: 1bd2dc684d7992acbf0dfee887b89a57a1ead86d - rn-truelayer-payments-sdk: 48918c5f26fba02c6c694cf146d36bcb11387af7 + rn-truelayer-payments-sdk: a9b36f3882138423d95d6208dd3a768e8a07825c RNCAsyncStorage: 73773ca1dd29378bf0fe8dd7d67870d422e2fc05 SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748 - TrueLayerPaymentsSDK: 1486cf735dcc1223d3ceb30b20a43af5628019a6 + TrueLayerPaymentsSDK: a7ee1fe3e371d05f33dcd3165eeeb9c3a059fd74 Yoga: 78d74e245ed67bb94275a1316cdc170b9b7fe884 PODFILE CHECKSUM: fee8dbd43718634d5b71c544195045b9ec1e33e6 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