Skip to content
Closed
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
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