diff --git a/3ds2/src/main/java/com/adyen/checkout/adyen3ds2/Adyen3DS2Component.kt b/3ds2/src/main/java/com/adyen/checkout/adyen3ds2/Adyen3DS2Component.kt index 5ccfd32c0d..315b870599 100644 --- a/3ds2/src/main/java/com/adyen/checkout/adyen3ds2/Adyen3DS2Component.kt +++ b/3ds2/src/main/java/com/adyen/checkout/adyen3ds2/Adyen3DS2Component.kt @@ -39,8 +39,10 @@ import com.adyen.checkout.redirect.RedirectDelegate import com.adyen.threeds2.AuthenticationRequestParameters import com.adyen.threeds2.ChallengeResult import com.adyen.threeds2.ChallengeStatusHandler +import com.adyen.threeds2.InitializeResult import com.adyen.threeds2.ThreeDS2Service import com.adyen.threeds2.Transaction +import com.adyen.threeds2.TransactionResult import com.adyen.threeds2.customization.UiCustomization import com.adyen.threeds2.exception.InvalidInputException import com.adyen.threeds2.exception.SDKAlreadyInitializedException @@ -117,12 +119,14 @@ class Adyen3DS2Component( } identifyShopper(activity, action.token.orEmpty(), submitFingerprintAutomatically = false) } + is Threeds2ChallengeAction -> { if (action.token.isNullOrEmpty()) { throw ComponentException("Challenge token not found.") } challengeShopper(activity, action.token.orEmpty()) } + is Threeds2Action -> { if (action.token.isNullOrEmpty()) { throw ComponentException("3DS2 token not found.") @@ -196,9 +200,13 @@ class Adyen3DS2Component( } } - @Suppress("LongMethod") + @Suppress("LongMethod", "DestructuringDeclarationWithTooManyEntries", "ComplexMethod") @Throws(ComponentException::class) - private fun identifyShopper(activity: Activity, encodedFingerprintToken: String, submitFingerprintAutomatically: Boolean) { + private fun identifyShopper( + activity: Activity, + encodedFingerprintToken: String, + submitFingerprintAutomatically: Boolean + ) { Logger.d(TAG, "identifyShopper - submitFingerprintAutomatically: $submitFingerprintAutomatically") val decodedFingerprintToken = Base64Encoder.decode(encodedFingerprintToken) @@ -209,10 +217,18 @@ class Adyen3DS2Component( } val fingerprintToken = FingerprintToken.SERIALIZER.deserialize(fingerprintJson) + val (directoryServerId, directoryServerPublicKey, directoryServerRootCertificates, _, _) = fingerprintToken + if (directoryServerId == null || directoryServerPublicKey == null || directoryServerRootCertificates == null) { + val message = "directoryServerId, directoryServerPublicKey or directoryServerRootCertificates is null." + Logger.d(TAG, message) + notifyException(ComponentException(message)) + return + } + val configParameters = AdyenConfigParameters.Builder( - /* directoryServerId = */ fingerprintToken.directoryServerId, - /* directoryServerPublicKey = */ fingerprintToken.directoryServerPublicKey, - /* directoryServerRootCertificates = */ fingerprintToken.directoryServerRootCertificates, + /* directoryServerId = */ directoryServerId, + /* directoryServerPublicKey = */ directoryServerPublicKey, + /* directoryServerRootCertificates = */ directoryServerRootCertificates, ) .deviceParameterBlockList(setOf(PHONE_NUMBER_PARAMETER)) .build() @@ -226,7 +242,12 @@ class Adyen3DS2Component( closeTransaction(getApplication()) try { Logger.d(TAG, "initialize 3DS2 SDK") - ThreeDS2Service.INSTANCE.initialize(activity, configParameters, null, mUiCustomization) + val result = ThreeDS2Service.INSTANCE.initialize(activity, configParameters, null, mUiCustomization) + + if (result is InitializeResult.Failure) { + val details = makeDetails(result.transactionStatus, result.additionalDetails) + notifyDetails(details) + } } catch (e: SDKRuntimeException) { notifyException(ComponentException("Failed to initialize 3DS2 SDK", e)) return@launch @@ -237,12 +258,22 @@ class Adyen3DS2Component( mTransaction = try { Logger.d(TAG, "create transaction") - if (fingerprintToken.threeDSMessageVersion != null) { - ThreeDS2Service.INSTANCE.createTransaction(null, fingerprintToken.threeDSMessageVersion) - } else { + if (fingerprintToken.threeDSMessageVersion == null) { notifyException(ComponentException("Failed to create 3DS2 Transaction. Missing threeDSMessageVersion inside fingerprintToken.")) return@launch } + + when ( + val result = ThreeDS2Service.INSTANCE.createTransaction(null, fingerprintToken.threeDSMessageVersion) + ) { + is TransactionResult.Failure -> { + val details = makeDetails(result.transactionStatus, result.additionalDetails) + notifyDetails(details) + null + } + + is TransactionResult.Success -> result.transaction + } } catch (e: SDKNotInitializedException) { notifyException(ComponentException("Failed to create 3DS2 Transaction", e)) return@launch @@ -279,9 +310,11 @@ class Adyen3DS2Component( notifyDetails(result.details) } } + is SubmitFingerprintResult.Redirect -> { redirectDelegate.makeRedirect(activity, result.action) } + is SubmitFingerprintResult.Threeds2 -> { handleAction(activity, result.action) } diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 66859838fc..10837e2e27 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -8,14 +8,8 @@ [//]: # ( # Deprecated) [//]: # ( - Configurations public constructor are deprecated, please use each Configuration's builder to make a Configuration object) -## Note -If you are using WeChat Pay please update to this version or migrate to 5.x.x to make sure WeChat Pay will work for all Android versions. - -## Fixed -- WeChatPay now works correctly on [Android 11](https://www.android.com/android-11/) and later. This fixes a known issue from previous 4.x.x versions. - ## Changed - Dependency versions: | Name | Version | |--------------------------------------------------------------------------------------------------------|-------------------------------| - | [WeChat Pay](https://developers.weixin.qq.com/doc/oplatform/en/Mobile_App/Access_Guide/Android.html) | **6.8.0** | \ No newline at end of file + | [Adyen 3DS2](https://github.com/Adyen/adyen-3ds2-android/releases/tag/2.2.17) | **2.2.17** | \ No newline at end of file diff --git a/build.gradle b/build.gradle index c5b762d943..dee46e6cb6 100644 --- a/build.gradle +++ b/build.gradle @@ -63,7 +63,7 @@ allprojects { ext.browser_version = "1.3.0" // Adyen Dependencies - ext.adyen3ds2_version = "2.2.15" + ext.adyen3ds2_version = "2.2.17" // External Dependencies ext.play_services_wallet_version = '18.1.3' diff --git a/config/gradle/checksums.gradle b/config/gradle/checksums.gradle index 259b6c80a8..026cc40119 100644 --- a/config/gradle/checksums.gradle +++ b/config/gradle/checksums.gradle @@ -9,7 +9,7 @@ if (!hasProperty("checksums")) { final checksums = [ // Adyen dependencies - "com.adyen.threeds:adyen-3ds2:2.2.15:876c1cda05d330e57c62dc4de35b6c91:MD5", + "com.adyen.threeds:adyen-3ds2:2.2.17:65ee27c86c8bf420b95e9d6877d2d8f7:MD5", // Kotlin "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.20:2097cb28602f5a6320bcc1bd74914db9:MD5", diff --git a/example-app/src/main/AndroidManifest.xml b/example-app/src/main/AndroidManifest.xml index b45d2d8a4b..07c0a23658 100644 --- a/example-app/src/main/AndroidManifest.xml +++ b/example-app/src/main/AndroidManifest.xml @@ -6,14 +6,15 @@