From 310b942f2af62d07c551008a66f233efd514276e Mon Sep 17 00:00:00 2001 From: Robert Schulze Dieckhoff Date: Fri, 8 Sep 2023 10:40:27 +0200 Subject: [PATCH] Upgraded Android checkout sdk to beta01 --- android/build.gradle | 6 ++-- .../gradle/wrapper/gradle-wrapper.properties | 5 ++++ .../AdvancedFlowDropInService.kt | 30 +++++++++++++++---- example/android/app/build.gradle | 2 +- example/android/build.gradle | 2 +- .../repositories/drop_in_outcome_handler.dart | 1 + 6 files changed, 36 insertions(+), 10 deletions(-) create mode 100644 android/gradle/wrapper/gradle-wrapper.properties diff --git a/android/build.gradle b/android/build.gradle index eb1d199d..4bbe2344 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -2,7 +2,7 @@ group 'com.adyen.adyen_checkout' version '1.0-SNAPSHOT' buildscript { - ext.kotlin_version = '1.7.10' + ext.kotlin_version = '1.9.0' repositories { google() mavenCentral() @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android' android { namespace = "com.adyen.adyen_checkout" - compileSdkVersion 33 + compileSdk 34 compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 @@ -47,7 +47,7 @@ android { } dependencies { - implementation 'com.adyen.checkout:drop-in:5.0.0-alpha02' + implementation 'com.adyen.checkout:drop-in:5.0.0-beta01' implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' testImplementation 'org.jetbrains.kotlin:kotlin-test' testImplementation 'org.mockito:mockito-core:5.5.0' diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..8bc9958a --- /dev/null +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/AdvancedFlowDropInService.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/AdvancedFlowDropInService.kt index 1e493172..ce5f7b17 100644 --- a/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/AdvancedFlowDropInService.kt +++ b/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/AdvancedFlowDropInService.kt @@ -27,7 +27,13 @@ class AdvancedFlowDropInService : DropInService(), LifecycleOwner { val actionComponentJson = ActionComponentData.SERIALIZER.serialize(actionComponentData) DropInAdditionalDetailsPlatformMessenger.sendResult(actionComponentJson) } catch (exception: Exception) { - sendResult(DropInServiceResult.Error(errorMessage = exception.message)) + sendResult( + DropInServiceResult.Error( + errorDialog = null, + reason = exception.message, + dismissDropIn = true + ) + ) } } @@ -41,7 +47,13 @@ class AdvancedFlowDropInService : DropInService(), LifecycleOwner { PaymentComponentData.SERIALIZER.serialize(paymentComponentState.data) DropInServiceResultMessenger.sendResult(paymentComponentJson) } catch (exception: Exception) { - sendResult(DropInServiceResult.Error(errorMessage = exception.message)) + sendResult( + DropInServiceResult.Error( + errorDialog = null, + reason = exception.message, + dismissDropIn = true + ) + ) } } @@ -74,21 +86,29 @@ class AdvancedFlowDropInService : DropInService(), LifecycleOwner { FINISHED -> DropInServiceResult.Finished(result = "${dropInResult.result}") ERROR -> DropInServiceResult.Error( - errorMessage = dropInResult.error?.errorMessage, + errorDialog = null, reason = dropInResult.error?.reason, dismissDropIn = dropInResult.error?.dismissDropIn ?: false ) ACTION -> { if (dropInResult.actionResponse == null) { - DropInServiceResult.Error(reason = "Action response not provided") + DropInServiceResult.Error( + errorDialog = null, + reason = "Action response not provided", + dismissDropIn = true + ) } else { val actionJson = JSONObject(dropInResult.actionResponse) DropInServiceResult.Action(action = Action.SERIALIZER.deserialize(actionJson)) } } - null -> DropInServiceResult.Error(reason = "IOException") + null -> DropInServiceResult.Error( + errorDialog = null, + reason = "IOException", + dismissDropIn = true + ) } } diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 57ac5107..777162a5 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -27,7 +27,7 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { namespace "com.adyen.adyen_checkout_example" - compileSdkVersion flutter.compileSdkVersion + compileSdk 34 ndkVersion flutter.ndkVersion compileOptions { diff --git a/example/android/build.gradle b/example/android/build.gradle index 34d0a899..482db1b0 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlin_version = '1.7.10' + ext.kotlin_version = '1.9.0' repositories { google() mavenCentral() diff --git a/example/lib/repositories/drop_in_outcome_handler.dart b/example/lib/repositories/drop_in_outcome_handler.dart index a6d0e614..b803df6e 100644 --- a/example/lib/repositories/drop_in_outcome_handler.dart +++ b/example/lib/repositories/drop_in_outcome_handler.dart @@ -20,6 +20,7 @@ class DropInOutcomeHandler { if (_isError(jsonResponse)) { return Error( errorMessage: jsonResponse[messageKey], + reason: jsonResponse[messageKey], dismissDropIn: true, ); }