Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion DemoApp/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
6 changes: 5 additions & 1 deletion DemoApp/ios/DemoAppUITests/DemoAppUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
12 changes: 6 additions & 6 deletions DemoApp/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions RNTrueLayerPaymentsSDK/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,5 @@ repositories {

dependencies {
implementation 'com.facebook.react:react-native:+'
implementation 'com.truelayer.payments:ui:3.9.1'
}
implementation 'com.truelayer.payments:ui:4.0.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ private class TLReactNativeUtils {
| "ProcessorContextNotAvailable"
| "Unknown";
*/

return when (reason) {
ProcessorResult.FailureReason.NoInternet -> "NoInternet"
ProcessorResult.FailureReason.UserAborted -> "UserAborted"
Expand Down Expand Up @@ -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<Promise> = SparseArray()
var trueLayerUI: TrueLayerUI? = null
var themeMap: HashMap<String, Any>? = null

val scope = CoroutineScope(
Expand Down Expand Up @@ -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
Expand Down
28 changes: 18 additions & 10 deletions RNTrueLayerPaymentsSDK/ios/RNTrueLayerHelpers.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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";
}
}

Expand Down Expand Up @@ -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";
}
}

Expand Down Expand Up @@ -245,6 +247,12 @@ + (NSString *)reasonFromMandateError:(TrueLayerMandateError)error {

case TrueLayerMandateErrorUnknownError:
return @"Unknown";

case TrueLayerMandateErrorInvalidMandateState:
return @"InvalidMandateState";

case TrueLayerMandateErrorConstraintViolation:
return @"ConstraintViolation";
}
}

Expand Down
12 changes: 7 additions & 5 deletions RNTrueLayerPaymentsSDK/js/models/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion RNTrueLayerPaymentsSDK/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion RNTrueLayerPaymentsSDK/rn-truelayer-payments-sdk.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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