From b510df009b36d71221c1075d3714e926e3cb941b Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Thu, 7 Sep 2023 09:19:32 +0000
Subject: [PATCH 01/23] Update dependency androidx.annotation:annotation to
v1.7.0
---
dependencies.gradle | 2 +-
gradle/verification-metadata.xml | 16 ++++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/dependencies.gradle b/dependencies.gradle
index c29d9cf41f..695e356ffe 100644
--- a/dependencies.gradle
+++ b/dependencies.gradle
@@ -31,7 +31,7 @@ ext {
ktlint_version = '0.50.0'
// Android Dependencies
- annotation_version = "1.6.0"
+ annotation_version = "1.7.0"
appcompat_version = "1.6.1"
browser_version = "1.6.0"
coroutines_version = "1.6.4"
diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml
index e8be133501..15ef5d56e9 100644
--- a/gradle/verification-metadata.xml
+++ b/gradle/verification-metadata.xml
@@ -187,6 +187,14 @@
+
+
+
+
+
+
+
+
@@ -216,6 +224,14 @@
+
+
+
+
+
+
+
+
From 5544b7bba96aec3eb863856e032535092c7415e9 Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Thu, 7 Sep 2023 09:48:26 +0000
Subject: [PATCH 02/23] Update hilt_version to v2.48
---
dependencies.gradle | 2 +-
gradle/verification-metadata.xml | 90 ++++++++++++++++++++++++++++++++
2 files changed, 91 insertions(+), 1 deletion(-)
diff --git a/dependencies.gradle b/dependencies.gradle
index 695e356ffe..1d8423610e 100644
--- a/dependencies.gradle
+++ b/dependencies.gradle
@@ -23,7 +23,7 @@ ext {
kotlin_version = '1.9.10'
detekt_gradle_plugin_version = "1.23.1"
dokka_version = "1.8.20"
- hilt_version = "2.47"
+ hilt_version = "2.48"
compose_compiler_version = '1.5.3'
// Code quality
diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml
index 15ef5d56e9..9ab761fd1a 100644
--- a/gradle/verification-metadata.xml
+++ b/gradle/verification-metadata.xml
@@ -3886,6 +3886,14 @@
+
+
+
+
+
+
+
+
@@ -3902,6 +3910,14 @@
+
+
+
+
+
+
+
+
@@ -3918,6 +3934,14 @@
+
+
+
+
+
+
+
+
@@ -3934,6 +3958,14 @@
+
+
+
+
+
+
+
+
@@ -3950,6 +3982,14 @@
+
+
+
+
+
+
+
+
@@ -3966,6 +4006,14 @@
+
+
+
+
+
+
+
+
@@ -3982,6 +4030,14 @@
+
+
+
+
+
+
+
+
@@ -3998,6 +4054,14 @@
+
+
+
+
+
+
+
+
@@ -4014,6 +4078,14 @@
+
+
+
+
+
+
+
+
@@ -4024,6 +4096,11 @@
+
+
+
+
+
@@ -4032,6 +4109,14 @@
+
+
+
+
+
+
+
+
@@ -6956,6 +7041,11 @@
+
+
+
+
+
From 5b932a9756f71526e9afef6e7d16bd9847eb4cc1 Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Thu, 7 Sep 2023 10:19:02 +0000
Subject: [PATCH 03/23] Update plugin org.jetbrains.dokka to v1.9.0
---
dependencies.gradle | 2 +-
gradle/verification-metadata.xml | 109 +++++++++++++++++++++++++++++++
2 files changed, 110 insertions(+), 1 deletion(-)
diff --git a/dependencies.gradle b/dependencies.gradle
index 1d8423610e..db9a1c5d71 100644
--- a/dependencies.gradle
+++ b/dependencies.gradle
@@ -22,7 +22,7 @@ ext {
android_gradle_plugin_version = '8.1.1'
kotlin_version = '1.9.10'
detekt_gradle_plugin_version = "1.23.1"
- dokka_version = "1.8.20"
+ dokka_version = "1.9.0"
hilt_version = "2.48"
compose_compiler_version = '1.5.3'
diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml
index 9ab761fd1a..b3f34859ad 100644
--- a/gradle/verification-metadata.xml
+++ b/gradle/verification-metadata.xml
@@ -6733,6 +6733,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -6765,6 +6789,14 @@
+
+
+
+
+
+
+
+
@@ -6781,6 +6813,14 @@
+
+
+
+
+
+
+
+
@@ -6797,6 +6837,14 @@
+
+
+
+
+
+
+
+
@@ -6813,6 +6861,14 @@
+
+
+
+
+
+
+
+
@@ -6829,6 +6885,14 @@
+
+
+
+
+
+
+
+
@@ -6845,6 +6909,14 @@
+
+
+
+
+
+
+
+
@@ -6861,6 +6933,14 @@
+
+
+
+
+
+
+
+
@@ -6877,6 +6957,14 @@
+
+
+
+
+
+
+
+
@@ -6925,6 +7013,14 @@
+
+
+
+
+
+
+
+
@@ -6935,6 +7031,11 @@
+
+
+
+
+
@@ -6951,6 +7052,14 @@
+
+
+
+
+
+
+
+
From 8ea3baad11a6bbc538ba8d3c844612454feea3d9 Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Thu, 7 Sep 2023 10:19:07 +0000
Subject: [PATCH 04/23] Update actions/checkout action to v4
---
.github/workflows/assemble.yml | 2 +-
.github/workflows/check_release.yml | 2 +-
.github/workflows/code_analysis.yml | 4 ++--
.github/workflows/generate_dependency_graph.yml | 2 +-
.github/workflows/publish_docs.yml | 2 +-
.github/workflows/publish_release.yml | 2 +-
.github/workflows/run_tests.yml | 4 ++--
.github/workflows/update_verification_metadata.yml | 2 +-
8 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/.github/workflows/assemble.yml b/.github/workflows/assemble.yml
index 72044a1db1..ddf64463e6 100644
--- a/.github/workflows/assemble.yml
+++ b/.github/workflows/assemble.yml
@@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v3
diff --git a/.github/workflows/check_release.yml b/.github/workflows/check_release.yml
index 305fd606b6..fa4bcfcea2 100644
--- a/.github/workflows/check_release.yml
+++ b/.github/workflows/check_release.yml
@@ -15,7 +15,7 @@ jobs:
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
# https://github.com/marketplace/actions/checkout
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
# Setup Java 17
# https://github.com/marketplace/actions/setup-java-jdk
diff --git a/.github/workflows/code_analysis.yml b/.github/workflows/code_analysis.yml
index 704a254692..a9f947c96f 100644
--- a/.github/workflows/code_analysis.yml
+++ b/.github/workflows/code_analysis.yml
@@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v3
@@ -29,7 +29,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v3
diff --git a/.github/workflows/generate_dependency_graph.yml b/.github/workflows/generate_dependency_graph.yml
index 9abac8c053..a58817f3e8 100644
--- a/.github/workflows/generate_dependency_graph.yml
+++ b/.github/workflows/generate_dependency_graph.yml
@@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
diff --git a/.github/workflows/publish_docs.yml b/.github/workflows/publish_docs.yml
index 57a5aac54a..ada8db7a53 100644
--- a/.github/workflows/publish_docs.yml
+++ b/.github/workflows/publish_docs.yml
@@ -14,7 +14,7 @@ jobs:
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
# https://github.com/marketplace/actions/checkout
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
# Setup Java 17
# https://github.com/marketplace/actions/setup-java-jdk
diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml
index 6802194b69..7fe8eaeb22 100644
--- a/.github/workflows/publish_release.yml
+++ b/.github/workflows/publish_release.yml
@@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
with:
ref: main
diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml
index e9153f842a..5220997b56 100644
--- a/.github/workflows/run_tests.yml
+++ b/.github/workflows/run_tests.yml
@@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v3
@@ -34,7 +34,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v3
diff --git a/.github/workflows/update_verification_metadata.yml b/.github/workflows/update_verification_metadata.yml
index c4a5349a86..ece0fc2ff0 100644
--- a/.github/workflows/update_verification_metadata.yml
+++ b/.github/workflows/update_verification_metadata.yml
@@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
From 97ec42b8ecca6870566b1740af9e6bc37c32cac1 Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Thu, 7 Sep 2023 11:52:31 +0000
Subject: [PATCH 05/23] Update dependency androidx.compose:compose-bom to
v2023.09.00
---
dependencies.gradle | 2 +-
gradle/verification-metadata.xml | 106 +++++++++++++++++++++++++++++++
2 files changed, 107 insertions(+), 1 deletion(-)
diff --git a/dependencies.gradle b/dependencies.gradle
index db9a1c5d71..be28ac41bb 100644
--- a/dependencies.gradle
+++ b/dependencies.gradle
@@ -43,7 +43,7 @@ ext {
// Compose Dependencies
compose_activity_version = '1.7.2'
- compose_bom_version = '2023.08.00'
+ compose_bom_version = '2023.09.00'
compose_viewmodel_version = '2.6.1'
// Adyen Dependencies
diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml
index b3f34859ad..9a21d528da 100644
--- a/gradle/verification-metadata.xml
+++ b/gradle/verification-metadata.xml
@@ -425,6 +425,11 @@
+
+
+
+
+
@@ -486,6 +491,14 @@
+
+
+
+
+
+
+
+
@@ -494,6 +507,11 @@
+
+
+
+
+
@@ -518,6 +536,14 @@
+
+
+
+
+
+
+
+
@@ -526,6 +552,11 @@
+
+
+
+
+
@@ -555,6 +586,14 @@
+
+
+
+
+
+
+
+
@@ -563,6 +602,11 @@
+
+
+
+
+
@@ -587,6 +631,14 @@
+
+
+
+
+
+
+
+
@@ -595,6 +647,11 @@
+
+
+
+
+
@@ -619,6 +676,14 @@
+
+
+
+
+
+
+
+
@@ -627,6 +692,11 @@
+
+
+
+
+
@@ -651,6 +721,14 @@
+
+
+
+
+
+
+
+
@@ -659,6 +737,11 @@
+
+
+
+
+
@@ -683,6 +766,14 @@
+
+
+
+
+
+
+
+
@@ -691,6 +782,11 @@
+
+
+
+
+
@@ -712,6 +808,11 @@
+
+
+
+
+
@@ -720,6 +821,11 @@
+
+
+
+
+
From ee47451ebb9bd0faa1da47e3fa34234306487625 Mon Sep 17 00:00:00 2001
From: jreij
Date: Thu, 7 Sep 2023 14:05:49 +0200
Subject: [PATCH 06/23] Update gradle verification metadata
---
gradle/verification-metadata.xml | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml
index 9a21d528da..15d6467b36 100644
--- a/gradle/verification-metadata.xml
+++ b/gradle/verification-metadata.xml
@@ -511,6 +511,9 @@
+
+
+
@@ -556,6 +559,9 @@
+
+
+
@@ -606,6 +612,9 @@
+
+
+
@@ -651,6 +660,9 @@
+
+
+
@@ -696,6 +708,9 @@
+
+
+
@@ -741,6 +756,9 @@
+
+
+
@@ -786,6 +804,9 @@
+
+
+
@@ -825,6 +846,9 @@
+
+
+
From 7b13123d9a45d881dadbe5e829ab2a0039aa3d15 Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Thu, 7 Sep 2023 12:42:07 +0000
Subject: [PATCH 07/23] Update dependency
androidx.lifecycle:lifecycle-viewmodel-compose to v2.6.2
---
dependencies.gradle | 2 +-
gradle/verification-metadata.xml | 84 ++++++++++++++++++++++++++++++++
2 files changed, 85 insertions(+), 1 deletion(-)
diff --git a/dependencies.gradle b/dependencies.gradle
index be28ac41bb..82e81b9ea7 100644
--- a/dependencies.gradle
+++ b/dependencies.gradle
@@ -44,7 +44,7 @@ ext {
// Compose Dependencies
compose_activity_version = '1.7.2'
compose_bom_version = '2023.09.00'
- compose_viewmodel_version = '2.6.1'
+ compose_viewmodel_version = '2.6.2'
// Adyen Dependencies
adyen3ds2_version = "2.2.15"
diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml
index 15d6467b36..22c2ba7a71 100644
--- a/gradle/verification-metadata.xml
+++ b/gradle/verification-metadata.xml
@@ -1349,6 +1349,14 @@
+
+
+
+
+
+
+
+
@@ -1357,6 +1365,14 @@
+
+
+
+
+
+
+
+
@@ -1373,6 +1389,11 @@
+
+
+
+
+
@@ -1415,6 +1436,14 @@
+
+
+
+
+
+
+
+
@@ -1439,6 +1468,11 @@
+
+
+
+
+
@@ -1460,6 +1494,11 @@
+
+
+
+
+
@@ -1505,6 +1544,14 @@
+
+
+
+
+
+
+
+
@@ -1529,6 +1576,11 @@
+
+
+
+
+
@@ -1579,6 +1631,14 @@
+
+
+
+
+
+
+
+
@@ -1587,6 +1647,14 @@
+
+
+
+
+
+
+
+
@@ -1611,6 +1679,14 @@
+
+
+
+
+
+
+
+
@@ -1645,6 +1721,14 @@
+
+
+
+
+
+
+
+
From 345c7d856e267d2dc922ee06b657696985bc57b6 Mon Sep 17 00:00:00 2001
From: jreij
Date: Thu, 7 Sep 2023 14:44:34 +0200
Subject: [PATCH 08/23] Update gradle verification metadata
---
gradle/verification-metadata.xml | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml
index 22c2ba7a71..09381ed462 100644
--- a/gradle/verification-metadata.xml
+++ b/gradle/verification-metadata.xml
@@ -1390,6 +1390,9 @@
+
+
+
@@ -1469,6 +1472,9 @@
+
+
+
@@ -1495,6 +1501,9 @@
+
+
+
@@ -1577,6 +1586,9 @@
+
+
+
From 9cd9bc4220308537272b881cfc39ab824387dc6b Mon Sep 17 00:00:00 2001
From: Oscar Spruit
Date: Tue, 19 Sep 2023 11:41:59 +0200
Subject: [PATCH 09/23] Display new view in drop-in on next render
The drop-in bottom sheet was jumping position when a new view was
loaded into it and navigating to another activity at the same time.
Having a slight delay prevents the jumping from happening.
COAND-792
---
.../com/adyen/checkout/ui/core/AdyenComponentView.kt | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/ui-core/src/main/java/com/adyen/checkout/ui/core/AdyenComponentView.kt b/ui-core/src/main/java/com/adyen/checkout/ui/core/AdyenComponentView.kt
index 493ed25ac8..b38a9e8a48 100644
--- a/ui-core/src/main/java/com/adyen/checkout/ui/core/AdyenComponentView.kt
+++ b/ui-core/src/main/java/com/adyen/checkout/ui/core/AdyenComponentView.kt
@@ -13,6 +13,7 @@ import android.view.LayoutInflater
import android.view.MotionEvent
import android.widget.LinearLayout
import androidx.core.view.children
+import androidx.core.view.doOnNextLayout
import androidx.core.view.isVisible
import androidx.core.view.updateLayoutParams
import androidx.lifecycle.LifecycleOwner
@@ -124,9 +125,11 @@ class AdyenComponentView @JvmOverloads constructor(
val localizedContext = context.createLocalizedContext(componentParams.shopperLocale)
- val view = componentView.getView()
- binding.frameLayoutComponentContainer.addView(view)
- view.updateLayoutParams { width = LayoutParams.MATCH_PARENT }
+ binding.frameLayoutComponentContainer.doOnNextLayout {
+ val view = componentView.getView()
+ binding.frameLayoutComponentContainer.addView(view)
+ view.updateLayoutParams { width = LayoutParams.MATCH_PARENT }
+ }
componentView.initView(delegate, coroutineScope, localizedContext)
From 827b3727e8c9df5caf116a8bfd9a5260ccb1c0cf Mon Sep 17 00:00:00 2001
From: Oscar Spruit
Date: Tue, 19 Sep 2023 16:12:18 +0200
Subject: [PATCH 10/23] Propagate view errors to the component for WeChat
This fixes the issue where the cancel button in the PiPView is
unresponsive during the WeChat flow.
COAND-798
---
.../checkout/wechatpay/internal/ui/DefaultWeChatDelegate.kt | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/wechatpay/src/main/java/com/adyen/checkout/wechatpay/internal/ui/DefaultWeChatDelegate.kt b/wechatpay/src/main/java/com/adyen/checkout/wechatpay/internal/ui/DefaultWeChatDelegate.kt
index 6f45fe34d9..cb7811ff7f 100644
--- a/wechatpay/src/main/java/com/adyen/checkout/wechatpay/internal/ui/DefaultWeChatDelegate.kt
+++ b/wechatpay/src/main/java/com/adyen/checkout/wechatpay/internal/ui/DefaultWeChatDelegate.kt
@@ -39,6 +39,7 @@ import kotlinx.coroutines.flow.receiveAsFlow
import org.json.JSONException
import org.json.JSONObject
+@Suppress("TooManyFunctions")
internal class DefaultWeChatDelegate(
private val observerRepository: ActionObserverRepository,
override val componentParams: GenericComponentParams,
@@ -155,6 +156,10 @@ internal class DefaultWeChatDelegate(
)
}
+ override fun onError(e: CheckoutException) {
+ exceptionChannel.trySend(e)
+ }
+
override fun onCleared() {
removeObserver()
}
From e9d2d7e0abcb8e8e9423b2bbc5531950e75fd902 Mon Sep 17 00:00:00 2001
From: Oscar Spruit
Date: Wed, 20 Sep 2023 11:31:50 +0200
Subject: [PATCH 11/23] Send customer id for one time Cash App payment
COAND-799
---
.../cashapppay/internal/ui/DefaultCashAppPayDelegate.kt | 5 +++--
.../cashapppay/internal/ui/model/CashAppPayOutputData.kt | 1 +
.../cashapppay/internal/ui/DefaultCashAppPayDelegateTest.kt | 4 ++--
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/cashapppay/src/main/java/com/adyen/checkout/cashapppay/internal/ui/DefaultCashAppPayDelegate.kt b/cashapppay/src/main/java/com/adyen/checkout/cashapppay/internal/ui/DefaultCashAppPayDelegate.kt
index cad086be9b..8839b2165e 100644
--- a/cashapppay/src/main/java/com/adyen/checkout/cashapppay/internal/ui/DefaultCashAppPayDelegate.kt
+++ b/cashapppay/src/main/java/com/adyen/checkout/cashapppay/internal/ui/DefaultCashAppPayDelegate.kt
@@ -171,7 +171,7 @@ constructor(
type = paymentMethod.type,
checkoutAttemptId = analyticsRepository.getCheckoutAttemptId(),
grantId = oneTimeData?.grantId,
- customerId = onFileData?.customerId,
+ customerId = onFileData?.customerId ?: oneTimeData?.customerId,
onFileGrantId = onFileData?.grantId,
cashtag = onFileData?.cashTag,
)
@@ -292,7 +292,8 @@ constructor(
private fun createAuthorizationData(customerResponseData: CustomerResponseData): CashAppPayAuthorizationData {
val grants = customerResponseData.grants.orEmpty()
- val oneTimeData = grants.find { it.type == GrantType.ONE_TIME }?.let { CashAppPayOneTimeData(it.id) }
+ val oneTimeData =
+ grants.find { it.type == GrantType.ONE_TIME }?.let { CashAppPayOneTimeData(it.id, it.customerId) }
val onFileData = grants.find { it.type == GrantType.EXTENDED }?.let {
CashAppPayOnFileData(
grantId = it.id,
diff --git a/cashapppay/src/main/java/com/adyen/checkout/cashapppay/internal/ui/model/CashAppPayOutputData.kt b/cashapppay/src/main/java/com/adyen/checkout/cashapppay/internal/ui/model/CashAppPayOutputData.kt
index b8fe8a9fad..ebc29ce717 100644
--- a/cashapppay/src/main/java/com/adyen/checkout/cashapppay/internal/ui/model/CashAppPayOutputData.kt
+++ b/cashapppay/src/main/java/com/adyen/checkout/cashapppay/internal/ui/model/CashAppPayOutputData.kt
@@ -26,6 +26,7 @@ internal data class CashAppPayAuthorizationData(
internal data class CashAppPayOneTimeData(
val grantId: String?,
+ val customerId: String?,
)
internal data class CashAppPayOnFileData(
diff --git a/cashapppay/src/test/java/com/adyen/checkout/cashapppay/internal/ui/DefaultCashAppPayDelegateTest.kt b/cashapppay/src/test/java/com/adyen/checkout/cashapppay/internal/ui/DefaultCashAppPayDelegateTest.kt
index 0abead8fc1..ca12cb0e2c 100644
--- a/cashapppay/src/test/java/com/adyen/checkout/cashapppay/internal/ui/DefaultCashAppPayDelegateTest.kt
+++ b/cashapppay/src/test/java/com/adyen/checkout/cashapppay/internal/ui/DefaultCashAppPayDelegateTest.kt
@@ -120,7 +120,7 @@ internal class DefaultCashAppPayDelegateTest(
delegate.updateInputData {
isStorePaymentSelected = true
authorizationData = CashAppPayAuthorizationData(
- oneTimeData = CashAppPayOneTimeData("grantId"),
+ oneTimeData = CashAppPayOneTimeData("grantId", "customerId"),
onFileData = CashAppPayOnFileData("grantId", "cashTag", "customerId")
)
}
@@ -465,7 +465,7 @@ internal class DefaultCashAppPayDelegateTest(
delegate.updateInputData {
authorizationData = CashAppPayAuthorizationData(
- oneTimeData = CashAppPayOneTimeData("grantId"),
+ oneTimeData = CashAppPayOneTimeData("grantId", "customerId"),
onFileData = CashAppPayOnFileData("grantId", "cashTag", "customerId")
)
}
From 848515ce0ed1dc5ba2992afd53b264519d2b8c9d Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Mon, 25 Sep 2023 08:14:58 +0000
Subject: [PATCH 12/23] Update dependency
com.google.android.gms:play-services-wallet to v19.2.1
---
dependencies.gradle | 2 +-
gradle/verification-metadata.xml | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/dependencies.gradle b/dependencies.gradle
index 82e81b9ea7..5c2846941d 100644
--- a/dependencies.gradle
+++ b/dependencies.gradle
@@ -52,7 +52,7 @@ ext {
// External Dependencies
cash_app_pay_version = '2.3.0'
okhttp_version = "4.11.0"
- play_services_wallet_version = '19.2.0'
+ play_services_wallet_version = '19.2.1'
wechat_pay_version = "6.8.0"
// Example app
diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml
index 09381ed462..82c569f038 100644
--- a/gradle/verification-metadata.xml
+++ b/gradle/verification-metadata.xml
@@ -3973,6 +3973,14 @@
+
+
+
+
+
+
+
+
From 0e3d59204004a5865086efd8a8b0e57d0d531312 Mon Sep 17 00:00:00 2001
From: Oscar Spruit
Date: Thu, 28 Sep 2023 15:29:15 +0200
Subject: [PATCH 13/23] Set loading state before calling remove stored payment
method callback
This fixes an issue where a loading spinner would show infinitely
when an error is returned in the remove stored payment method callback.
COAND-801
---
.../com/adyen/checkout/dropin/internal/ui/DropInActivity.kt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drop-in/src/main/java/com/adyen/checkout/dropin/internal/ui/DropInActivity.kt b/drop-in/src/main/java/com/adyen/checkout/dropin/internal/ui/DropInActivity.kt
index 8e797e82ce..b4ac5e4857 100644
--- a/drop-in/src/main/java/com/adyen/checkout/dropin/internal/ui/DropInActivity.kt
+++ b/drop-in/src/main/java/com/adyen/checkout/dropin/internal/ui/DropInActivity.kt
@@ -380,8 +380,8 @@ internal class DropInActivity :
}
override fun removeStoredPaymentMethod(storedPaymentMethod: StoredPaymentMethod) {
- dropInService?.requestRemoveStoredPaymentMethod(storedPaymentMethod)
setLoading(true)
+ dropInService?.requestRemoveStoredPaymentMethod(storedPaymentMethod)
}
private fun handleDropInServiceResult(dropInServiceResult: BaseDropInServiceResult) {
From c19743774eb118c9e841b72e301fe5ff92efd97f Mon Sep 17 00:00:00 2001
From: Oscar Spruit
Date: Wed, 20 Sep 2023 13:48:30 +0200
Subject: [PATCH 14/23] Handle deep links for instant example correctly
COAND-796
---
example-app/src/main/AndroidManifest.xml | 17 ++++++++++++++++
.../example/ui/instant/InstantFragment.kt | 10 ++++++++--
.../checkout/example/ui/main/MainActivity.kt | 20 +++++++++++++++++++
3 files changed, 45 insertions(+), 2 deletions(-)
diff --git a/example-app/src/main/AndroidManifest.xml b/example-app/src/main/AndroidManifest.xml
index 9d5cd2f4e9..3d1907b53a 100644
--- a/example-app/src/main/AndroidManifest.xml
+++ b/example-app/src/main/AndroidManifest.xml
@@ -21,6 +21,7 @@
android:value=".ui.main.MainActivity" />
+
+
+
+
+
+
+
+
+
+
+
{
+ (supportFragmentManager.findFragmentByTag(InstantFragment.TAG) as? InstantFragment)
+ ?.onNewIntent(intent)
+ }
+ }
+ }
+
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.main_menu, menu)
return super.onCreateOptionsMenu(menu)
@@ -135,6 +146,7 @@ class MainActivity : AppCompatActivity() {
ExampleAdvancedDropInService::class.java,
)
}
+
is MainNavigation.DropInWithSession -> {
DropIn.startPayment(
this,
@@ -143,6 +155,7 @@ class MainActivity : AppCompatActivity() {
navigation.dropInConfiguration,
)
}
+
is MainNavigation.DropInWithCustomSession -> {
DropIn.startPayment(
this,
@@ -152,31 +165,38 @@ class MainActivity : AppCompatActivity() {
ExampleSessionsDropInService::class.java
)
}
+
is MainNavigation.Bacs -> BacsFragment.show(supportFragmentManager)
is MainNavigation.Blik -> {
val intent = Intent(this, BlikActivity::class.java)
startActivity(intent)
}
+
MainNavigation.Card -> {
val intent = Intent(this, CardActivity::class.java)
startActivity(intent)
}
+
MainNavigation.CardWithSession -> {
val intent = Intent(this, SessionsCardActivity::class.java)
startActivity(intent)
}
+
MainNavigation.GiftCard -> {
val intent = Intent(this, GiftCardActivity::class.java)
startActivity(intent)
}
+
MainNavigation.GiftCardWithSession -> {
val intent = Intent(this, SessionsGiftCardActivity::class.java)
startActivity(intent)
}
+
MainNavigation.CardWithSessionTakenOver -> {
val intent = Intent(this, SessionsCardTakenOverActivity::class.java)
startActivity(intent)
}
+
is MainNavigation.Instant -> {
InstantFragment.show(supportFragmentManager, navigation.paymentMethodType)
}
From d74aa659088bbdf55bdbceb96e1d5e8bb5d90859 Mon Sep 17 00:00:00 2001
From: ozgur <6615094+ozgur00@users.noreply.github.com>
Date: Fri, 29 Sep 2023 10:40:28 +0200
Subject: [PATCH 15/23] Remove Amount.EMPTY
COAND-797
---
.../checkout/adyen3ds2/Adyen3DS2Configuration.kt | 2 +-
.../internal/ui/model/Adyen3DS2ComponentParams.kt | 2 +-
.../ui/model/Adyen3DS2ComponentParamsMapperTest.kt | 2 +-
.../checkout/ach/ACHDirectDebitConfiguration.kt | 2 +-
.../ach/internal/ui/DefaultACHDirectDebitDelegate.kt | 3 +--
.../ach/internal/ui/StoredACHDirectDebitDelegate.kt | 3 +--
.../ui/model/ACHDirectDebitComponentParams.kt | 2 +-
.../internal/ui/DefaultACHDirectDebitDelegateTest.kt | 2 +-
.../internal/ui/StoredACHDirectDebitDelegateTest.kt | 2 +-
.../model/ACHDirectDebitComponentParamsMapperTest.kt | 2 +-
.../action/core/GenericActionConfiguration.kt | 2 +-
.../adyen/checkout/action/core/TestActionDelegate.kt | 2 +-
.../com/adyen/checkout/await/AwaitConfiguration.kt | 2 +-
.../checkout/bacs/BacsDirectDebitConfiguration.kt | 2 +-
.../internal/ui/DefaultBacsDirectDebitDelegate.kt | 6 ++++--
.../internal/ui/view/BacsDirectDebitInputView.kt | 6 +++---
.../internal/DefaultBacsDirectDebitDelegateTest.kt | 2 +-
.../com/adyen/checkout/bcmc/BcmcConfiguration.kt | 2 +-
.../checkout/bcmc/internal/ui/DefaultBcmcDelegate.kt | 3 +--
.../bcmc/internal/ui/model/BcmcComponentParams.kt | 2 +-
.../bcmc/internal/ui/DefaultBcmcDelegateTest.kt | 2 +-
.../ui/model/BcmcComponentParamsMapperTest.kt | 2 +-
.../com/adyen/checkout/blik/BlikConfiguration.kt | 2 +-
.../checkout/blik/internal/ui/DefaultBlikDelegate.kt | 3 +--
.../checkout/blik/internal/ui/StoredBlikDelegate.kt | 3 +--
.../blik/internal/ui/DefaultBlikDelegateTest.kt | 2 +-
.../com/adyen/checkout/boleto/BoletoConfiguration.kt | 2 +-
.../boleto/internal/ui/DefaultBoletoDelegate.kt | 3 +--
.../internal/ui/model/BoletoComponentParams.kt | 2 +-
.../boleto/internal/ui/DefaultBoletoDelegateTest.kt | 2 +-
.../ui/model/BoletoComponentParamsMapperTest.kt | 2 +-
.../com/adyen/checkout/card/CardConfiguration.kt | 2 +-
.../checkout/card/internal/ui/DefaultCardDelegate.kt | 3 +--
.../checkout/card/internal/ui/StoredCardDelegate.kt | 3 +--
.../card/internal/ui/model/CardComponentParams.kt | 2 +-
.../card/internal/ui/DefaultCardDelegateTest.kt | 2 +-
.../card/internal/ui/StoredCardDelegateTest.kt | 2 +-
.../ui/model/CardComponentParamsMapperTest.kt | 2 +-
.../checkout/cashapppay/CashAppPayConfiguration.kt | 2 +-
.../internal/ui/DefaultCashAppPayDelegate.kt | 6 ++----
.../internal/ui/StoredCashAppPayDelegate.kt | 3 +--
.../internal/ui/model/CashAppPayComponentParams.kt | 2 +-
.../internal/ui/DefaultCashAppPayDelegateTest.kt | 2 +-
.../internal/ui/StoredCashAppPayDelegateTest.kt | 2 +-
.../ui/model/CashAppPayComponentParamsMapperTest.kt | 2 +-
.../com/adyen/checkout/components/core/Amount.kt | 3 ---
.../adyen/checkout/components/core/BalanceResult.kt | 2 +-
.../core/internal/BaseConfigurationBuilder.kt | 4 ++--
.../components/core/internal/Configuration.kt | 2 +-
.../core/internal/data/api/AnalyticsMapper.kt | 2 +-
.../internal/data/api/AnalyticsRepositoryData.kt | 2 +-
.../core/internal/data/model/OrderPaymentMethod.kt | 5 ++---
.../core/internal/data/model/OrderStatusResponse.kt | 4 ++--
.../core/internal/ui/model/ButtonComponentParams.kt | 2 +-
.../core/internal/ui/model/ComponentParams.kt | 2 +-
.../core/internal/ui/model/GenericComponentParams.kt | 2 +-
.../core/internal/util/AmountExtensions.kt | 12 +++++-------
.../components/core/ButtonTestConfiguration.kt | 2 +-
.../checkout/components/core/TestConfiguration.kt | 2 +-
.../ui/model/ButtonComponentParamsMapperTest.kt | 2 +-
.../ui/model/GenericComponentParamsMapperTest.kt | 2 +-
.../ConvenienceStoresJPConfiguration.kt | 2 +-
.../com/adyen/checkout/dotpay/DotpayConfiguration.kt | 2 +-
.../com/adyen/checkout/dropin/DropInConfiguration.kt | 2 +-
.../internal/provider/ComponentParsingProvider.kt | 10 +++++-----
.../checkout/dropin/internal/ui/DropInViewModel.kt | 10 +++++-----
.../dropin/internal/ui/DropInViewModelFactory.kt | 2 +-
.../internal/ui/PaymentMethodsListViewModel.kt | 2 +-
.../internal/ui/PreselectedStoredPaymentViewModel.kt | 4 ++--
.../internal/ui/model/DropInComponentParams.kt | 2 +-
.../internal/ui/model/DropInComponentParamsMapper.kt | 2 +-
.../checkout/dropin/internal/ui/model/OrderModel.kt | 2 +-
.../econtext/internal/ui/DefaultEContextDelegate.kt | 3 +--
.../checkout/econtext/TestEContextConfiguration.kt | 2 +-
.../internal/ui/DefaultEContextDelegateTest.kt | 2 +-
.../checkout/entercash/EntercashConfiguration.kt | 2 +-
.../java/com/adyen/checkout/eps/EPSConfiguration.kt | 2 +-
.../example/data/api/model/PaymentsRequest.kt | 2 +-
.../checkout/example/service/ExampleDropInService.kt | 2 +-
.../adyen/checkout/example/service/RequestUtils.kt | 2 +-
.../adyen/checkout/giftcard/GiftCardConfiguration.kt | 2 +-
.../giftcard/internal/ui/DefaultGiftCardDelegate.kt | 7 +++++--
.../giftcard/internal/util/GiftCardBalanceUtils.kt | 6 +++---
.../adyen/checkout/giftcard/GiftCardComponentTest.kt | 5 ++---
.../internal/ui/DefaultGiftCardDelegateTest.kt | 2 +-
.../internal/util/GiftCardBalanceUtilsTest.kt | 4 ++--
.../checkout/googlepay/GooglePayConfiguration.kt | 2 +-
.../internal/ui/DefaultGooglePayDelegate.kt | 3 +--
.../ui/model/GooglePayComponentParamsMapper.kt | 5 ++---
.../internal/ui/DefaultGooglePayDelegateTest.kt | 2 +-
.../ui/model/GooglePayComponentParamsMapperTest.kt | 4 ++--
.../com/adyen/checkout/ideal/IdealConfiguration.kt | 2 +-
.../checkout/instant/InstantPaymentConfiguration.kt | 2 +-
.../internal/ui/DefaultInstantPaymentDelegate.kt | 3 +--
.../internal/ui/DefaultInstantPaymentDelegateTest.kt | 2 +-
.../internal/ui/DefaultIssuerListDelegate.kt | 3 +--
.../internal/ui/model/IssuerListComponentParams.kt | 2 +-
.../internal/ui/DefaultIssuerListDelegateTest.kt | 2 +-
.../ui/model/IssuerListComponentParamsMapperTest.kt | 4 ++--
.../issuerlist/utils/TestIssuerListConfiguration.kt | 2 +-
.../com/adyen/checkout/mbway/MBWayConfiguration.kt | 2 +-
.../mbway/internal/ui/DefaultMBWayDelegate.kt | 3 +--
.../mbway/internal/ui/DefaultMBWayDelegateTest.kt | 2 +-
.../com/adyen/checkout/molpay/MolpayConfiguration.kt | 2 +-
.../internal/ui/DefaultOnlineBankingDelegate.kt | 3 +--
.../internal/ui/DefaultOnlineBankingDelegateTest.kt | 2 +-
.../utils/TestOnlineBankingConfiguration.kt | 2 +-
.../onlinebankingcz/OnlineBankingCZConfiguration.kt | 2 +-
.../onlinebankingjp/OnlineBankingJPConfiguration.kt | 2 +-
.../onlinebankingpl/OnlineBankingPLConfiguration.kt | 2 +-
.../onlinebankingsk/OnlineBankingSKConfiguration.kt | 2 +-
.../checkout/openbanking/OpenBankingConfiguration.kt | 2 +-
.../checkout/paybybank/PayByBankConfiguration.kt | 2 +-
.../internal/ui/DefaultPayByBankDelegate.kt | 3 +--
.../internal/ui/DefaultPayByBankDelegateTest.kt | 2 +-
.../adyen/checkout/payeasy/PayEasyConfiguration.kt | 2 +-
.../com/adyen/checkout/qrcode/QRCodeConfiguration.kt | 2 +-
.../qrcode/internal/ui/view/FullQRCodeView.kt | 7 ++++---
.../adyen/checkout/redirect/RedirectConfiguration.kt | 2 +-
.../com/adyen/checkout/sepa/SepaConfiguration.kt | 2 +-
.../checkout/sepa/internal/ui/DefaultSepaDelegate.kt | 3 +--
.../sepa/internal/ui/DefaultSepaDelegateTest.kt | 2 +-
.../core/internal/data/model/SessionDetails.kt | 2 +-
.../checkout/seveneleven/SevenElevenConfiguration.kt | 2 +-
.../ui/core/internal/util/PayButtonFormatter.kt | 7 ++++---
.../java/com/adyen/checkout/upi/UPIConfiguration.kt | 2 +-
.../checkout/upi/internal/ui/DefaultUPIDelegate.kt | 3 +--
.../upi/internal/ui/DefaultUPIDelegateTest.kt | 2 +-
.../adyen/checkout/voucher/VoucherConfiguration.kt | 2 +-
.../wechatpay/WeChatPayActionConfiguration.kt | 2 +-
130 files changed, 168 insertions(+), 189 deletions(-)
diff --git a/3ds2/src/main/java/com/adyen/checkout/adyen3ds2/Adyen3DS2Configuration.kt b/3ds2/src/main/java/com/adyen/checkout/adyen3ds2/Adyen3DS2Configuration.kt
index 3965182fe3..1315698c9d 100644
--- a/3ds2/src/main/java/com/adyen/checkout/adyen3ds2/Adyen3DS2Configuration.kt
+++ b/3ds2/src/main/java/com/adyen/checkout/adyen3ds2/Adyen3DS2Configuration.kt
@@ -29,7 +29,7 @@ class Adyen3DS2Configuration private constructor(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount,
+ override val amount: Amount?,
val uiCustomization: UiCustomization?,
val threeDSRequestorAppURL: String?,
) : Configuration {
diff --git a/3ds2/src/main/java/com/adyen/checkout/adyen3ds2/internal/ui/model/Adyen3DS2ComponentParams.kt b/3ds2/src/main/java/com/adyen/checkout/adyen3ds2/internal/ui/model/Adyen3DS2ComponentParams.kt
index 3624de1131..9c9f3495e7 100644
--- a/3ds2/src/main/java/com/adyen/checkout/adyen3ds2/internal/ui/model/Adyen3DS2ComponentParams.kt
+++ b/3ds2/src/main/java/com/adyen/checkout/adyen3ds2/internal/ui/model/Adyen3DS2ComponentParams.kt
@@ -21,7 +21,7 @@ internal data class Adyen3DS2ComponentParams(
override val clientKey: String,
override val analyticsParams: AnalyticsParams,
override val isCreatedByDropIn: Boolean,
- override val amount: Amount,
+ override val amount: Amount?,
val uiCustomization: UiCustomization?,
val threeDSRequestorAppURL: String?,
) : ComponentParams
diff --git a/3ds2/src/test/java/com/adyen/checkout/adyen3ds2/internal/ui/model/Adyen3DS2ComponentParamsMapperTest.kt b/3ds2/src/test/java/com/adyen/checkout/adyen3ds2/internal/ui/model/Adyen3DS2ComponentParamsMapperTest.kt
index ea36034302..e58f8579cb 100644
--- a/3ds2/src/test/java/com/adyen/checkout/adyen3ds2/internal/ui/model/Adyen3DS2ComponentParamsMapperTest.kt
+++ b/3ds2/src/test/java/com/adyen/checkout/adyen3ds2/internal/ui/model/Adyen3DS2ComponentParamsMapperTest.kt
@@ -105,7 +105,7 @@ internal class Adyen3DS2ComponentParamsMapperTest {
clientKey: String = TEST_CLIENT_KEY_1,
analyticsParams: AnalyticsParams = AnalyticsParams(AnalyticsParamsLevel.ALL),
isCreatedByDropIn: Boolean = false,
- amount: Amount = Amount.EMPTY,
+ amount: Amount? = null,
uiCustomization: UiCustomization? = null,
threeDSRequestorAppURL: String? = null,
) = Adyen3DS2ComponentParams(
diff --git a/ach/src/main/java/com/adyen/checkout/ach/ACHDirectDebitConfiguration.kt b/ach/src/main/java/com/adyen/checkout/ach/ACHDirectDebitConfiguration.kt
index 40f7971713..550ab4f8ac 100644
--- a/ach/src/main/java/com/adyen/checkout/ach/ACHDirectDebitConfiguration.kt
+++ b/ach/src/main/java/com/adyen/checkout/ach/ACHDirectDebitConfiguration.kt
@@ -30,7 +30,7 @@ class ACHDirectDebitConfiguration private constructor(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount,
+ override val amount: Amount?,
override val isSubmitButtonVisible: Boolean?,
internal val genericActionConfiguration: GenericActionConfiguration,
val addressConfiguration: ACHDirectDebitAddressConfiguration?,
diff --git a/ach/src/main/java/com/adyen/checkout/ach/internal/ui/DefaultACHDirectDebitDelegate.kt b/ach/src/main/java/com/adyen/checkout/ach/internal/ui/DefaultACHDirectDebitDelegate.kt
index 41e33bf57c..c300fcc50d 100644
--- a/ach/src/main/java/com/adyen/checkout/ach/internal/ui/DefaultACHDirectDebitDelegate.kt
+++ b/ach/src/main/java/com/adyen/checkout/ach/internal/ui/DefaultACHDirectDebitDelegate.kt
@@ -23,7 +23,6 @@ import com.adyen.checkout.components.core.internal.PaymentObserverRepository
import com.adyen.checkout.components.core.internal.data.api.AnalyticsRepository
import com.adyen.checkout.components.core.internal.data.api.PublicKeyRepository
import com.adyen.checkout.components.core.internal.util.bufferedChannel
-import com.adyen.checkout.components.core.internal.util.isEmpty
import com.adyen.checkout.components.core.paymentmethod.ACHDirectDebitPaymentMethod
import com.adyen.checkout.core.exception.CheckoutException
import com.adyen.checkout.core.exception.ComponentException
@@ -300,7 +299,7 @@ internal class DefaultACHDirectDebitDelegate(
order = order,
storePaymentMethod = if (showStorePaymentField()) outputData.shouldStorePaymentMethod else null,
paymentMethod = achPaymentMethod,
- amount = componentParams.amount.takeUnless { it.isEmpty },
+ amount = componentParams.amount,
)
if (isAddressRequired(outputData.addressUIState)) {
diff --git a/ach/src/main/java/com/adyen/checkout/ach/internal/ui/StoredACHDirectDebitDelegate.kt b/ach/src/main/java/com/adyen/checkout/ach/internal/ui/StoredACHDirectDebitDelegate.kt
index 1891ffa054..fbb33c6980 100644
--- a/ach/src/main/java/com/adyen/checkout/ach/internal/ui/StoredACHDirectDebitDelegate.kt
+++ b/ach/src/main/java/com/adyen/checkout/ach/internal/ui/StoredACHDirectDebitDelegate.kt
@@ -23,7 +23,6 @@ import com.adyen.checkout.components.core.internal.data.api.AnalyticsRepository
import com.adyen.checkout.components.core.internal.ui.model.FieldState
import com.adyen.checkout.components.core.internal.ui.model.Validation
import com.adyen.checkout.components.core.internal.util.bufferedChannel
-import com.adyen.checkout.components.core.internal.util.isEmpty
import com.adyen.checkout.components.core.paymentmethod.ACHDirectDebitPaymentMethod
import com.adyen.checkout.core.exception.CheckoutException
import com.adyen.checkout.core.internal.util.LogUtil
@@ -122,7 +121,7 @@ internal class StoredACHDirectDebitDelegate(
val paymentComponentData = PaymentComponentData(
paymentMethod = paymentMethod,
order = order,
- amount = componentParams.amount.takeUnless { it.isEmpty },
+ amount = componentParams.amount,
)
return ACHDirectDebitComponentState(
diff --git a/ach/src/main/java/com/adyen/checkout/ach/internal/ui/model/ACHDirectDebitComponentParams.kt b/ach/src/main/java/com/adyen/checkout/ach/internal/ui/model/ACHDirectDebitComponentParams.kt
index cef0ef5fc5..d433a1c019 100644
--- a/ach/src/main/java/com/adyen/checkout/ach/internal/ui/model/ACHDirectDebitComponentParams.kt
+++ b/ach/src/main/java/com/adyen/checkout/ach/internal/ui/model/ACHDirectDebitComponentParams.kt
@@ -22,7 +22,7 @@ internal data class ACHDirectDebitComponentParams(
override val clientKey: String,
override val analyticsParams: AnalyticsParams,
override val isCreatedByDropIn: Boolean,
- override val amount: Amount,
+ override val amount: Amount?,
override val isSubmitButtonVisible: Boolean,
val addressParams: AddressParams,
val isStorePaymentFieldVisible: Boolean,
diff --git a/ach/src/test/java/com/adyen/checkout/ach/internal/ui/DefaultACHDirectDebitDelegateTest.kt b/ach/src/test/java/com/adyen/checkout/ach/internal/ui/DefaultACHDirectDebitDelegateTest.kt
index ff542c12f7..abd8899460 100644
--- a/ach/src/test/java/com/adyen/checkout/ach/internal/ui/DefaultACHDirectDebitDelegateTest.kt
+++ b/ach/src/test/java/com/adyen/checkout/ach/internal/ui/DefaultACHDirectDebitDelegateTest.kt
@@ -733,7 +733,7 @@ internal class DefaultACHDirectDebitDelegateTest(
// configurationValue, expectedComponentStateValue
arguments(Amount("EUR", 100), Amount("EUR", 100)),
arguments(Amount("USD", 0), Amount("USD", 0)),
- arguments(Amount.EMPTY, null),
+ arguments(null, null),
arguments(null, null),
)
}
diff --git a/ach/src/test/java/com/adyen/checkout/ach/internal/ui/StoredACHDirectDebitDelegateTest.kt b/ach/src/test/java/com/adyen/checkout/ach/internal/ui/StoredACHDirectDebitDelegateTest.kt
index 473e3b78e1..1fb8a405c9 100644
--- a/ach/src/test/java/com/adyen/checkout/ach/internal/ui/StoredACHDirectDebitDelegateTest.kt
+++ b/ach/src/test/java/com/adyen/checkout/ach/internal/ui/StoredACHDirectDebitDelegateTest.kt
@@ -133,7 +133,7 @@ internal class StoredACHDirectDebitDelegateTest(
// configurationValue, expectedComponentStateValue
arguments(Amount("EUR", 100), Amount("EUR", 100)),
arguments(Amount("USD", 0), Amount("USD", 0)),
- arguments(Amount.EMPTY, null),
+ arguments(null, null),
arguments(null, null),
)
}
diff --git a/ach/src/test/java/com/adyen/checkout/ach/internal/ui/model/ACHDirectDebitComponentParamsMapperTest.kt b/ach/src/test/java/com/adyen/checkout/ach/internal/ui/model/ACHDirectDebitComponentParamsMapperTest.kt
index 5d076a292f..4bdd0f2bc9 100644
--- a/ach/src/test/java/com/adyen/checkout/ach/internal/ui/model/ACHDirectDebitComponentParamsMapperTest.kt
+++ b/ach/src/test/java/com/adyen/checkout/ach/internal/ui/model/ACHDirectDebitComponentParamsMapperTest.kt
@@ -238,7 +238,7 @@ internal class ACHDirectDebitComponentParamsMapperTest {
clientKey: String = TEST_CLIENT_KEY_1,
analyticsParams: AnalyticsParams = AnalyticsParams(AnalyticsParamsLevel.ALL),
isCreatedByDropIn: Boolean = false,
- amount: Amount = Amount.EMPTY,
+ amount: Amount? = null,
isSubmitButtonVisible: Boolean = true,
addressParams: AddressParams = AddressParams.FullAddress(
supportedCountryCodes = SUPPORTED_COUNTRY_LIST,
diff --git a/action-core/src/main/java/com/adyen/checkout/action/core/GenericActionConfiguration.kt b/action-core/src/main/java/com/adyen/checkout/action/core/GenericActionConfiguration.kt
index e832a81690..069a8a87c8 100644
--- a/action-core/src/main/java/com/adyen/checkout/action/core/GenericActionConfiguration.kt
+++ b/action-core/src/main/java/com/adyen/checkout/action/core/GenericActionConfiguration.kt
@@ -41,7 +41,7 @@ class GenericActionConfiguration private constructor(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount,
+ override val amount: Amount?,
private val availableActionConfigs: HashMap, Configuration>,
) : Configuration {
diff --git a/action-core/src/test/java/com/adyen/checkout/action/core/TestActionDelegate.kt b/action-core/src/test/java/com/adyen/checkout/action/core/TestActionDelegate.kt
index e3504680cd..8f5edbf825 100644
--- a/action-core/src/test/java/com/adyen/checkout/action/core/TestActionDelegate.kt
+++ b/action-core/src/test/java/com/adyen/checkout/action/core/TestActionDelegate.kt
@@ -71,7 +71,7 @@ internal class TestActionDelegate :
override val environment: Environment = Environment.TEST
override val clientKey: String = ""
override val analyticsConfiguration: AnalyticsConfiguration? = null
- override val amount: Amount = Amount.EMPTY
+ override val amount: Amount? = null
override fun describeContents(): Int {
throw NotImplementedError("This method shouldn't be used in tests")
diff --git a/await/src/main/java/com/adyen/checkout/await/AwaitConfiguration.kt b/await/src/main/java/com/adyen/checkout/await/AwaitConfiguration.kt
index 287a2acd44..8922b1d87f 100644
--- a/await/src/main/java/com/adyen/checkout/await/AwaitConfiguration.kt
+++ b/await/src/main/java/com/adyen/checkout/await/AwaitConfiguration.kt
@@ -25,7 +25,7 @@ class AwaitConfiguration private constructor(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount
+ override val amount: Amount?
) : Configuration {
/**
diff --git a/bacs/src/main/java/com/adyen/checkout/bacs/BacsDirectDebitConfiguration.kt b/bacs/src/main/java/com/adyen/checkout/bacs/BacsDirectDebitConfiguration.kt
index 1f2fd01f38..d74f20df88 100644
--- a/bacs/src/main/java/com/adyen/checkout/bacs/BacsDirectDebitConfiguration.kt
+++ b/bacs/src/main/java/com/adyen/checkout/bacs/BacsDirectDebitConfiguration.kt
@@ -30,7 +30,7 @@ class BacsDirectDebitConfiguration private constructor(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount,
+ override val amount: Amount?,
override val isSubmitButtonVisible: Boolean?,
internal val genericActionConfiguration: GenericActionConfiguration,
) : Configuration, ButtonConfiguration {
diff --git a/bacs/src/main/java/com/adyen/checkout/bacs/internal/ui/DefaultBacsDirectDebitDelegate.kt b/bacs/src/main/java/com/adyen/checkout/bacs/internal/ui/DefaultBacsDirectDebitDelegate.kt
index 28e98f4b10..6db7f21f55 100644
--- a/bacs/src/main/java/com/adyen/checkout/bacs/internal/ui/DefaultBacsDirectDebitDelegate.kt
+++ b/bacs/src/main/java/com/adyen/checkout/bacs/internal/ui/DefaultBacsDirectDebitDelegate.kt
@@ -22,7 +22,6 @@ import com.adyen.checkout.components.core.internal.PaymentComponentEvent
import com.adyen.checkout.components.core.internal.PaymentObserverRepository
import com.adyen.checkout.components.core.internal.data.api.AnalyticsRepository
import com.adyen.checkout.components.core.internal.ui.model.ButtonComponentParams
-import com.adyen.checkout.components.core.internal.util.isEmpty
import com.adyen.checkout.components.core.paymentmethod.BacsDirectDebitPaymentMethod
import com.adyen.checkout.core.internal.util.LogUtil
import com.adyen.checkout.core.internal.util.Logger
@@ -105,10 +104,12 @@ internal class DefaultBacsDirectDebitDelegate(
Logger.e(TAG, "Current mode is already $mode")
false
}
+
mode == BacsDirectDebitMode.CONFIRMATION && !outputData.isValid -> {
Logger.e(TAG, "Cannot set confirmation view when input is not valid")
false
}
+
else -> {
Logger.d(TAG, "Setting mode to $mode")
updateInputData { this.mode = mode }
@@ -133,6 +134,7 @@ internal class DefaultBacsDirectDebitDelegate(
submitHandler.onSubmit(state)
}
}
+
BacsDirectDebitMode.CONFIRMATION -> {
submitHandler.onSubmit(state)
}
@@ -199,7 +201,7 @@ internal class DefaultBacsDirectDebitDelegate(
shopperEmail = outputData.shopperEmailState.value,
paymentMethod = bacsDirectDebitPaymentMethod,
order = order,
- amount = componentParams.amount.takeUnless { it.isEmpty },
+ amount = componentParams.amount,
)
return BacsDirectDebitComponentState(
diff --git a/bacs/src/main/java/com/adyen/checkout/bacs/internal/ui/view/BacsDirectDebitInputView.kt b/bacs/src/main/java/com/adyen/checkout/bacs/internal/ui/view/BacsDirectDebitInputView.kt
index 6e7087bc5d..56730eb014 100644
--- a/bacs/src/main/java/com/adyen/checkout/bacs/internal/ui/view/BacsDirectDebitInputView.kt
+++ b/bacs/src/main/java/com/adyen/checkout/bacs/internal/ui/view/BacsDirectDebitInputView.kt
@@ -24,7 +24,6 @@ import com.adyen.checkout.components.core.internal.ui.model.ButtonComponentParam
import com.adyen.checkout.components.core.internal.ui.model.FieldState
import com.adyen.checkout.components.core.internal.ui.model.Validation
import com.adyen.checkout.components.core.internal.util.CurrencyUtils
-import com.adyen.checkout.components.core.internal.util.isEmpty
import com.adyen.checkout.core.internal.util.LogUtil
import com.adyen.checkout.core.internal.util.Logger
import com.adyen.checkout.ui.core.internal.ui.ComponentView
@@ -258,9 +257,10 @@ internal class BacsDirectDebitInputView @JvmOverloads constructor(
}
private fun setAmountConsentSwitchText(componentParams: ButtonComponentParams) {
- if (!componentParams.amount.isEmpty) {
+ val amount = componentParams.amount
+ if (amount != null) {
val formattedAmount = CurrencyUtils.formatAmount(
- componentParams.amount,
+ amount,
componentParams.shopperLocale
)
binding.switchConsentAmount.text =
diff --git a/bacs/src/test/java/com/adyen/checkout/bacs/internal/DefaultBacsDirectDebitDelegateTest.kt b/bacs/src/test/java/com/adyen/checkout/bacs/internal/DefaultBacsDirectDebitDelegateTest.kt
index f3dfa59a1e..e463c42620 100644
--- a/bacs/src/test/java/com/adyen/checkout/bacs/internal/DefaultBacsDirectDebitDelegateTest.kt
+++ b/bacs/src/test/java/com/adyen/checkout/bacs/internal/DefaultBacsDirectDebitDelegateTest.kt
@@ -610,7 +610,7 @@ internal class DefaultBacsDirectDebitDelegateTest(
// configurationValue, expectedComponentStateValue
arguments(Amount("EUR", 100), Amount("EUR", 100)),
arguments(Amount("USD", 0), Amount("USD", 0)),
- arguments(Amount.EMPTY, null),
+ arguments(null, null),
arguments(null, null),
)
}
diff --git a/bcmc/src/main/java/com/adyen/checkout/bcmc/BcmcConfiguration.kt b/bcmc/src/main/java/com/adyen/checkout/bcmc/BcmcConfiguration.kt
index e3b0a0ece3..6c0a5e1c9c 100644
--- a/bcmc/src/main/java/com/adyen/checkout/bcmc/BcmcConfiguration.kt
+++ b/bcmc/src/main/java/com/adyen/checkout/bcmc/BcmcConfiguration.kt
@@ -30,7 +30,7 @@ class BcmcConfiguration private constructor(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount,
+ override val amount: Amount?,
override val isSubmitButtonVisible: Boolean?,
val isHolderNameRequired: Boolean?,
val shopperReference: String?,
diff --git a/bcmc/src/main/java/com/adyen/checkout/bcmc/internal/ui/DefaultBcmcDelegate.kt b/bcmc/src/main/java/com/adyen/checkout/bcmc/internal/ui/DefaultBcmcDelegate.kt
index 64264aa5f8..36d3877425 100644
--- a/bcmc/src/main/java/com/adyen/checkout/bcmc/internal/ui/DefaultBcmcDelegate.kt
+++ b/bcmc/src/main/java/com/adyen/checkout/bcmc/internal/ui/DefaultBcmcDelegate.kt
@@ -32,7 +32,6 @@ import com.adyen.checkout.components.core.internal.data.api.PublicKeyRepository
import com.adyen.checkout.components.core.internal.ui.model.FieldState
import com.adyen.checkout.components.core.internal.ui.model.Validation
import com.adyen.checkout.components.core.internal.util.bufferedChannel
-import com.adyen.checkout.components.core.internal.util.isEmpty
import com.adyen.checkout.components.core.paymentmethod.CardPaymentMethod
import com.adyen.checkout.core.exception.CheckoutException
import com.adyen.checkout.core.exception.ComponentException
@@ -238,7 +237,7 @@ internal class DefaultBcmcDelegate(
paymentMethod = cardPaymentMethod,
storePaymentMethod = if (showStorePaymentField()) outputData.shouldStorePaymentMethod else null,
shopperReference = componentParams.shopperReference,
- amount = componentParams.amount.takeUnless { it.isEmpty },
+ amount = componentParams.amount,
)
return BcmcComponentState(paymentComponentData, isInputValid = true, isReady = true)
diff --git a/bcmc/src/main/java/com/adyen/checkout/bcmc/internal/ui/model/BcmcComponentParams.kt b/bcmc/src/main/java/com/adyen/checkout/bcmc/internal/ui/model/BcmcComponentParams.kt
index f91376cc41..a888d5a2bb 100644
--- a/bcmc/src/main/java/com/adyen/checkout/bcmc/internal/ui/model/BcmcComponentParams.kt
+++ b/bcmc/src/main/java/com/adyen/checkout/bcmc/internal/ui/model/BcmcComponentParams.kt
@@ -21,7 +21,7 @@ internal data class BcmcComponentParams(
override val clientKey: String,
override val analyticsParams: AnalyticsParams,
override val isCreatedByDropIn: Boolean,
- override val amount: Amount,
+ override val amount: Amount?,
override val isSubmitButtonVisible: Boolean,
val isHolderNameRequired: Boolean,
val shopperReference: String?,
diff --git a/bcmc/src/test/java/com/adyen/checkout/bcmc/internal/ui/DefaultBcmcDelegateTest.kt b/bcmc/src/test/java/com/adyen/checkout/bcmc/internal/ui/DefaultBcmcDelegateTest.kt
index e59be8076d..5c40543c2b 100644
--- a/bcmc/src/test/java/com/adyen/checkout/bcmc/internal/ui/DefaultBcmcDelegateTest.kt
+++ b/bcmc/src/test/java/com/adyen/checkout/bcmc/internal/ui/DefaultBcmcDelegateTest.kt
@@ -480,7 +480,7 @@ internal class DefaultBcmcDelegateTest(
// configurationValue, expectedComponentStateValue
arguments(Amount("EUR", 100), Amount("EUR", 100)),
arguments(Amount("USD", 0), Amount("USD", 0)),
- arguments(Amount.EMPTY, null),
+ arguments(null, null),
arguments(null, null),
)
}
diff --git a/bcmc/src/test/java/com/adyen/checkout/bcmc/internal/ui/model/BcmcComponentParamsMapperTest.kt b/bcmc/src/test/java/com/adyen/checkout/bcmc/internal/ui/model/BcmcComponentParamsMapperTest.kt
index 9642c0e857..88784bed80 100644
--- a/bcmc/src/test/java/com/adyen/checkout/bcmc/internal/ui/model/BcmcComponentParamsMapperTest.kt
+++ b/bcmc/src/test/java/com/adyen/checkout/bcmc/internal/ui/model/BcmcComponentParamsMapperTest.kt
@@ -168,7 +168,7 @@ internal class BcmcComponentParamsMapperTest {
clientKey: String = TEST_CLIENT_KEY_1,
analyticsParams: AnalyticsParams = AnalyticsParams(AnalyticsParamsLevel.ALL),
isCreatedByDropIn: Boolean = false,
- amount: Amount = Amount.EMPTY,
+ amount: Amount? = null,
isSubmitButtonVisible: Boolean = true,
isHolderNameRequired: Boolean = false,
shopperReference: String? = null,
diff --git a/blik/src/main/java/com/adyen/checkout/blik/BlikConfiguration.kt b/blik/src/main/java/com/adyen/checkout/blik/BlikConfiguration.kt
index fe85192783..e3c42ddbb2 100644
--- a/blik/src/main/java/com/adyen/checkout/blik/BlikConfiguration.kt
+++ b/blik/src/main/java/com/adyen/checkout/blik/BlikConfiguration.kt
@@ -29,7 +29,7 @@ class BlikConfiguration private constructor(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount,
+ override val amount: Amount?,
override val isSubmitButtonVisible: Boolean?,
internal val genericActionConfiguration: GenericActionConfiguration,
) : Configuration, ButtonConfiguration {
diff --git a/blik/src/main/java/com/adyen/checkout/blik/internal/ui/DefaultBlikDelegate.kt b/blik/src/main/java/com/adyen/checkout/blik/internal/ui/DefaultBlikDelegate.kt
index 9e30649741..08b73e6515 100644
--- a/blik/src/main/java/com/adyen/checkout/blik/internal/ui/DefaultBlikDelegate.kt
+++ b/blik/src/main/java/com/adyen/checkout/blik/internal/ui/DefaultBlikDelegate.kt
@@ -21,7 +21,6 @@ import com.adyen.checkout.components.core.internal.PaymentComponentEvent
import com.adyen.checkout.components.core.internal.PaymentObserverRepository
import com.adyen.checkout.components.core.internal.data.api.AnalyticsRepository
import com.adyen.checkout.components.core.internal.ui.model.ButtonComponentParams
-import com.adyen.checkout.components.core.internal.util.isEmpty
import com.adyen.checkout.components.core.paymentmethod.BlikPaymentMethod
import com.adyen.checkout.core.internal.util.LogUtil
import com.adyen.checkout.core.internal.util.Logger
@@ -140,7 +139,7 @@ internal class DefaultBlikDelegate(
val paymentComponentData = PaymentComponentData(
paymentMethod = paymentMethod,
order = order,
- amount = componentParams.amount.takeUnless { it.isEmpty },
+ amount = componentParams.amount,
)
return BlikComponentState(
diff --git a/blik/src/main/java/com/adyen/checkout/blik/internal/ui/StoredBlikDelegate.kt b/blik/src/main/java/com/adyen/checkout/blik/internal/ui/StoredBlikDelegate.kt
index 4bbb9b481e..9995b8ef0a 100644
--- a/blik/src/main/java/com/adyen/checkout/blik/internal/ui/StoredBlikDelegate.kt
+++ b/blik/src/main/java/com/adyen/checkout/blik/internal/ui/StoredBlikDelegate.kt
@@ -20,7 +20,6 @@ import com.adyen.checkout.components.core.internal.PaymentComponentEvent
import com.adyen.checkout.components.core.internal.PaymentObserverRepository
import com.adyen.checkout.components.core.internal.data.api.AnalyticsRepository
import com.adyen.checkout.components.core.internal.ui.model.ButtonComponentParams
-import com.adyen.checkout.components.core.internal.util.isEmpty
import com.adyen.checkout.components.core.paymentmethod.BlikPaymentMethod
import com.adyen.checkout.core.internal.util.LogUtil
import com.adyen.checkout.core.internal.util.Logger
@@ -118,7 +117,7 @@ internal class StoredBlikDelegate(
val paymentComponentData = PaymentComponentData(
paymentMethod = paymentMethod,
order = order,
- amount = componentParams.amount.takeUnless { it.isEmpty },
+ amount = componentParams.amount,
)
return BlikComponentState(
diff --git a/blik/src/test/java/com/adyen/checkout/blik/internal/ui/DefaultBlikDelegateTest.kt b/blik/src/test/java/com/adyen/checkout/blik/internal/ui/DefaultBlikDelegateTest.kt
index c49ece3220..51e0155e2d 100644
--- a/blik/src/test/java/com/adyen/checkout/blik/internal/ui/DefaultBlikDelegateTest.kt
+++ b/blik/src/test/java/com/adyen/checkout/blik/internal/ui/DefaultBlikDelegateTest.kt
@@ -297,7 +297,7 @@ internal class DefaultBlikDelegateTest(
// configurationValue, expectedComponentStateValue
arguments(Amount("EUR", 100), Amount("EUR", 100)),
arguments(Amount("USD", 0), Amount("USD", 0)),
- arguments(Amount.EMPTY, null),
+ arguments(null, null),
arguments(null, null),
)
}
diff --git a/boleto/src/main/java/com/adyen/checkout/boleto/BoletoConfiguration.kt b/boleto/src/main/java/com/adyen/checkout/boleto/BoletoConfiguration.kt
index d76f90a252..2152b819a6 100644
--- a/boleto/src/main/java/com/adyen/checkout/boleto/BoletoConfiguration.kt
+++ b/boleto/src/main/java/com/adyen/checkout/boleto/BoletoConfiguration.kt
@@ -30,7 +30,7 @@ class BoletoConfiguration private constructor(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount,
+ override val amount: Amount?,
override val isSubmitButtonVisible: Boolean?,
val genericActionConfiguration: GenericActionConfiguration,
val isEmailVisible: Boolean?
diff --git a/boleto/src/main/java/com/adyen/checkout/boleto/internal/ui/DefaultBoletoDelegate.kt b/boleto/src/main/java/com/adyen/checkout/boleto/internal/ui/DefaultBoletoDelegate.kt
index 48f91f88dd..4fc2d4355b 100644
--- a/boleto/src/main/java/com/adyen/checkout/boleto/internal/ui/DefaultBoletoDelegate.kt
+++ b/boleto/src/main/java/com/adyen/checkout/boleto/internal/ui/DefaultBoletoDelegate.kt
@@ -23,7 +23,6 @@ import com.adyen.checkout.components.core.ShopperName
import com.adyen.checkout.components.core.internal.PaymentComponentEvent
import com.adyen.checkout.components.core.internal.PaymentObserverRepository
import com.adyen.checkout.components.core.internal.data.api.AnalyticsRepository
-import com.adyen.checkout.components.core.internal.util.isEmpty
import com.adyen.checkout.components.core.paymentmethod.GenericPaymentMethod
import com.adyen.checkout.core.internal.util.LogUtil
import com.adyen.checkout.core.internal.util.Logger
@@ -238,7 +237,7 @@ internal class DefaultBoletoDelegate(
checkoutAttemptId = analyticsRepository.getCheckoutAttemptId(),
),
order = order,
- amount = componentParams.amount.takeUnless { it.isEmpty },
+ amount = componentParams.amount,
socialSecurityNumber = outputData.socialSecurityNumberState.value,
shopperName = ShopperName(
firstName = outputData.firstNameState.value,
diff --git a/boleto/src/main/java/com/adyen/checkout/boleto/internal/ui/model/BoletoComponentParams.kt b/boleto/src/main/java/com/adyen/checkout/boleto/internal/ui/model/BoletoComponentParams.kt
index 4900ee9902..bf9f3ea206 100644
--- a/boleto/src/main/java/com/adyen/checkout/boleto/internal/ui/model/BoletoComponentParams.kt
+++ b/boleto/src/main/java/com/adyen/checkout/boleto/internal/ui/model/BoletoComponentParams.kt
@@ -23,7 +23,7 @@ internal data class BoletoComponentParams(
override val clientKey: String,
override val analyticsParams: AnalyticsParams,
override val isCreatedByDropIn: Boolean,
- override val amount: Amount,
+ override val amount: Amount?,
val addressParams: AddressParams,
val isEmailVisible: Boolean,
) : ComponentParams, ButtonParams
diff --git a/boleto/src/test/java/com/adyen/checkout/boleto/internal/ui/DefaultBoletoDelegateTest.kt b/boleto/src/test/java/com/adyen/checkout/boleto/internal/ui/DefaultBoletoDelegateTest.kt
index db9ee23b01..2e27a7289b 100644
--- a/boleto/src/test/java/com/adyen/checkout/boleto/internal/ui/DefaultBoletoDelegateTest.kt
+++ b/boleto/src/test/java/com/adyen/checkout/boleto/internal/ui/DefaultBoletoDelegateTest.kt
@@ -560,7 +560,7 @@ internal class DefaultBoletoDelegateTest(
// configurationValue, expectedComponentStateValue
Arguments.arguments(Amount("EUR", 100), Amount("EUR", 100)),
Arguments.arguments(Amount("USD", 0), Amount("USD", 0)),
- Arguments.arguments(Amount.EMPTY, null),
+ Arguments.arguments(null, null),
Arguments.arguments(null, null),
)
}
diff --git a/boleto/src/test/java/com/adyen/checkout/boleto/internal/ui/model/BoletoComponentParamsMapperTest.kt b/boleto/src/test/java/com/adyen/checkout/boleto/internal/ui/model/BoletoComponentParamsMapperTest.kt
index 9d3e928f0c..7f663adbd6 100644
--- a/boleto/src/test/java/com/adyen/checkout/boleto/internal/ui/model/BoletoComponentParamsMapperTest.kt
+++ b/boleto/src/test/java/com/adyen/checkout/boleto/internal/ui/model/BoletoComponentParamsMapperTest.kt
@@ -153,7 +153,7 @@ internal class BoletoComponentParamsMapperTest {
clientKey: String = TEST_CLIENT_KEY_1,
analyticsParams: AnalyticsParams = AnalyticsParams(AnalyticsParamsLevel.ALL),
isCreatedByDropIn: Boolean = false,
- amount: Amount = Amount.EMPTY,
+ amount: Amount? = null,
addressParams: AddressParams = AddressParams.FullAddress(
defaultCountryCode = BRAZIL_COUNTRY_CODE,
supportedCountryCodes = SUPPORTED_COUNTRY_LIST_1,
diff --git a/card/src/main/java/com/adyen/checkout/card/CardConfiguration.kt b/card/src/main/java/com/adyen/checkout/card/CardConfiguration.kt
index a6b8e74cd9..c715f79bac 100644
--- a/card/src/main/java/com/adyen/checkout/card/CardConfiguration.kt
+++ b/card/src/main/java/com/adyen/checkout/card/CardConfiguration.kt
@@ -31,7 +31,7 @@ class CardConfiguration private constructor(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount,
+ override val amount: Amount?,
override val isSubmitButtonVisible: Boolean?,
val isHolderNameRequired: Boolean?,
val supportedCardBrands: List?,
diff --git a/card/src/main/java/com/adyen/checkout/card/internal/ui/DefaultCardDelegate.kt b/card/src/main/java/com/adyen/checkout/card/internal/ui/DefaultCardDelegate.kt
index a57df41906..786f81cf77 100644
--- a/card/src/main/java/com/adyen/checkout/card/internal/ui/DefaultCardDelegate.kt
+++ b/card/src/main/java/com/adyen/checkout/card/internal/ui/DefaultCardDelegate.kt
@@ -44,7 +44,6 @@ import com.adyen.checkout.components.core.internal.data.api.PublicKeyRepository
import com.adyen.checkout.components.core.internal.ui.model.FieldState
import com.adyen.checkout.components.core.internal.ui.model.Validation
import com.adyen.checkout.components.core.internal.util.bufferedChannel
-import com.adyen.checkout.components.core.internal.util.isEmpty
import com.adyen.checkout.components.core.paymentmethod.CardPaymentMethod
import com.adyen.checkout.core.exception.CheckoutException
import com.adyen.checkout.core.exception.ComponentException
@@ -704,7 +703,7 @@ internal class DefaultCardDelegate(
storePaymentMethod = if (showStorePaymentField()) stateOutputData.shouldStorePaymentMethod else null,
shopperReference = componentParams.shopperReference,
order = order,
- amount = componentParams.amount.takeUnless { it.isEmpty },
+ amount = componentParams.amount,
).apply {
if (isSocialSecurityNumberRequired()) {
socialSecurityNumber = stateOutputData.socialSecurityNumberState.value
diff --git a/card/src/main/java/com/adyen/checkout/card/internal/ui/StoredCardDelegate.kt b/card/src/main/java/com/adyen/checkout/card/internal/ui/StoredCardDelegate.kt
index ae7bcff348..238c6175c2 100644
--- a/card/src/main/java/com/adyen/checkout/card/internal/ui/StoredCardDelegate.kt
+++ b/card/src/main/java/com/adyen/checkout/card/internal/ui/StoredCardDelegate.kt
@@ -33,7 +33,6 @@ import com.adyen.checkout.components.core.internal.data.api.PublicKeyRepository
import com.adyen.checkout.components.core.internal.ui.model.FieldState
import com.adyen.checkout.components.core.internal.ui.model.Validation
import com.adyen.checkout.components.core.internal.util.bufferedChannel
-import com.adyen.checkout.components.core.internal.util.isEmpty
import com.adyen.checkout.components.core.paymentmethod.CardPaymentMethod
import com.adyen.checkout.core.exception.CheckoutException
import com.adyen.checkout.core.exception.ComponentException
@@ -360,7 +359,7 @@ internal class StoredCardDelegate(
paymentMethod = cardPaymentMethod,
shopperReference = componentParams.shopperReference,
order = order,
- amount = componentParams.amount.takeUnless { it.isEmpty },
+ amount = componentParams.amount,
)
}
diff --git a/card/src/main/java/com/adyen/checkout/card/internal/ui/model/CardComponentParams.kt b/card/src/main/java/com/adyen/checkout/card/internal/ui/model/CardComponentParams.kt
index d810b42ace..13c47c9467 100644
--- a/card/src/main/java/com/adyen/checkout/card/internal/ui/model/CardComponentParams.kt
+++ b/card/src/main/java/com/adyen/checkout/card/internal/ui/model/CardComponentParams.kt
@@ -25,7 +25,7 @@ internal data class CardComponentParams(
override val clientKey: String,
override val analyticsParams: AnalyticsParams,
override val isCreatedByDropIn: Boolean,
- override val amount: Amount,
+ override val amount: Amount?,
override val isSubmitButtonVisible: Boolean,
val isHolderNameRequired: Boolean,
val supportedCardBrands: List,
diff --git a/card/src/test/java/com/adyen/checkout/card/internal/ui/DefaultCardDelegateTest.kt b/card/src/test/java/com/adyen/checkout/card/internal/ui/DefaultCardDelegateTest.kt
index 552c2e6241..de44d012c0 100644
--- a/card/src/test/java/com/adyen/checkout/card/internal/ui/DefaultCardDelegateTest.kt
+++ b/card/src/test/java/com/adyen/checkout/card/internal/ui/DefaultCardDelegateTest.kt
@@ -1346,7 +1346,7 @@ internal class DefaultCardDelegateTest(
// configurationValue, expectedComponentStateValue
arguments(Amount("EUR", 100), Amount("EUR", 100)),
arguments(Amount("USD", 0), Amount("USD", 0)),
- arguments(Amount.EMPTY, null),
+ arguments(null, null),
arguments(null, null),
)
}
diff --git a/card/src/test/java/com/adyen/checkout/card/internal/ui/StoredCardDelegateTest.kt b/card/src/test/java/com/adyen/checkout/card/internal/ui/StoredCardDelegateTest.kt
index 1882cf07ae..219801313c 100644
--- a/card/src/test/java/com/adyen/checkout/card/internal/ui/StoredCardDelegateTest.kt
+++ b/card/src/test/java/com/adyen/checkout/card/internal/ui/StoredCardDelegateTest.kt
@@ -604,7 +604,7 @@ internal class StoredCardDelegateTest(
// configurationValue, expectedComponentStateValue
arguments(Amount("EUR", 100), Amount("EUR", 100)),
arguments(Amount("USD", 0), Amount("USD", 0)),
- arguments(Amount.EMPTY, null),
+ arguments(null, null),
arguments(null, null),
)
}
diff --git a/card/src/test/java/com/adyen/checkout/card/internal/ui/model/CardComponentParamsMapperTest.kt b/card/src/test/java/com/adyen/checkout/card/internal/ui/model/CardComponentParamsMapperTest.kt
index 10888159b8..83e65786a0 100644
--- a/card/src/test/java/com/adyen/checkout/card/internal/ui/model/CardComponentParamsMapperTest.kt
+++ b/card/src/test/java/com/adyen/checkout/card/internal/ui/model/CardComponentParamsMapperTest.kt
@@ -445,7 +445,7 @@ internal class CardComponentParamsMapperTest {
clientKey: String = TEST_CLIENT_KEY_1,
analyticsParams: AnalyticsParams = AnalyticsParams(AnalyticsParamsLevel.ALL),
isCreatedByDropIn: Boolean = false,
- amount: Amount = Amount.EMPTY,
+ amount: Amount? = null,
isHolderNameRequired: Boolean = false,
isSubmitButtonVisible: Boolean = true,
supportedCardBrands: List = CardConfiguration.DEFAULT_SUPPORTED_CARDS_LIST,
diff --git a/cashapppay/src/main/java/com/adyen/checkout/cashapppay/CashAppPayConfiguration.kt b/cashapppay/src/main/java/com/adyen/checkout/cashapppay/CashAppPayConfiguration.kt
index 17312c37eb..45e04a229b 100644
--- a/cashapppay/src/main/java/com/adyen/checkout/cashapppay/CashAppPayConfiguration.kt
+++ b/cashapppay/src/main/java/com/adyen/checkout/cashapppay/CashAppPayConfiguration.kt
@@ -31,7 +31,7 @@ private constructor(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount,
+ override val amount: Amount?,
override val isSubmitButtonVisible: Boolean?,
val genericActionConfiguration: GenericActionConfiguration,
val cashAppPayEnvironment: CashAppPayEnvironment?,
diff --git a/cashapppay/src/main/java/com/adyen/checkout/cashapppay/internal/ui/DefaultCashAppPayDelegate.kt b/cashapppay/src/main/java/com/adyen/checkout/cashapppay/internal/ui/DefaultCashAppPayDelegate.kt
index 8839b2165e..b700e2544b 100644
--- a/cashapppay/src/main/java/com/adyen/checkout/cashapppay/internal/ui/DefaultCashAppPayDelegate.kt
+++ b/cashapppay/src/main/java/com/adyen/checkout/cashapppay/internal/ui/DefaultCashAppPayDelegate.kt
@@ -35,7 +35,6 @@ import com.adyen.checkout.components.core.internal.PaymentComponentEvent
import com.adyen.checkout.components.core.internal.PaymentObserverRepository
import com.adyen.checkout.components.core.internal.data.api.AnalyticsRepository
import com.adyen.checkout.components.core.internal.util.bufferedChannel
-import com.adyen.checkout.components.core.internal.util.isEmpty
import com.adyen.checkout.components.core.paymentmethod.CashAppPayPaymentMethod
import com.adyen.checkout.core.exception.CheckoutException
import com.adyen.checkout.core.exception.ComponentException
@@ -179,7 +178,7 @@ constructor(
val paymentComponentData = PaymentComponentData(
paymentMethod = cashAppPayPaymentMethod,
order = order,
- amount = componentParams.amount.takeUnless { it.isEmpty },
+ amount = componentParams.amount,
storePaymentMethod = onFileData != null,
)
@@ -223,8 +222,7 @@ constructor(
private fun getOneTimeAction(): CashAppPayPaymentAction.OneTimeAction? {
val amount = componentParams.amount
- // We don't create an OneTimeAction for transactions with no amount
- if (amount.value <= 0) return null
+ if (amount?.value == null || amount.value == 0L) return null
val cashAppPayCurrency = when (amount.currency) {
CheckoutCurrency.USD.name -> CashAppPayCurrency.USD
diff --git a/cashapppay/src/main/java/com/adyen/checkout/cashapppay/internal/ui/StoredCashAppPayDelegate.kt b/cashapppay/src/main/java/com/adyen/checkout/cashapppay/internal/ui/StoredCashAppPayDelegate.kt
index 59361fa57c..37b1c49e3b 100644
--- a/cashapppay/src/main/java/com/adyen/checkout/cashapppay/internal/ui/StoredCashAppPayDelegate.kt
+++ b/cashapppay/src/main/java/com/adyen/checkout/cashapppay/internal/ui/StoredCashAppPayDelegate.kt
@@ -21,7 +21,6 @@ import com.adyen.checkout.components.core.internal.PaymentComponentEvent
import com.adyen.checkout.components.core.internal.PaymentObserverRepository
import com.adyen.checkout.components.core.internal.data.api.AnalyticsRepository
import com.adyen.checkout.components.core.internal.util.bufferedChannel
-import com.adyen.checkout.components.core.internal.util.isEmpty
import com.adyen.checkout.components.core.paymentmethod.CashAppPayPaymentMethod
import com.adyen.checkout.core.internal.util.LogUtil
import com.adyen.checkout.core.internal.util.Logger
@@ -106,7 +105,7 @@ internal class StoredCashAppPayDelegate(
val paymentComponentData = PaymentComponentData(
paymentMethod = cashAppPayPaymentMethod,
order = order,
- amount = componentParams.amount.takeUnless { it.isEmpty },
+ amount = componentParams.amount,
)
return CashAppPayComponentState(
diff --git a/cashapppay/src/main/java/com/adyen/checkout/cashapppay/internal/ui/model/CashAppPayComponentParams.kt b/cashapppay/src/main/java/com/adyen/checkout/cashapppay/internal/ui/model/CashAppPayComponentParams.kt
index 652e187f27..19990d3590 100644
--- a/cashapppay/src/main/java/com/adyen/checkout/cashapppay/internal/ui/model/CashAppPayComponentParams.kt
+++ b/cashapppay/src/main/java/com/adyen/checkout/cashapppay/internal/ui/model/CashAppPayComponentParams.kt
@@ -23,7 +23,7 @@ internal data class CashAppPayComponentParams(
override val clientKey: String,
override val analyticsParams: AnalyticsParams,
override val isCreatedByDropIn: Boolean,
- override val amount: Amount,
+ override val amount: Amount?,
val cashAppPayEnvironment: CashAppPayEnvironment,
val returnUrl: String?,
val showStorePaymentField: Boolean,
diff --git a/cashapppay/src/test/java/com/adyen/checkout/cashapppay/internal/ui/DefaultCashAppPayDelegateTest.kt b/cashapppay/src/test/java/com/adyen/checkout/cashapppay/internal/ui/DefaultCashAppPayDelegateTest.kt
index ca12cb0e2c..c34af4cf0f 100644
--- a/cashapppay/src/test/java/com/adyen/checkout/cashapppay/internal/ui/DefaultCashAppPayDelegateTest.kt
+++ b/cashapppay/src/test/java/com/adyen/checkout/cashapppay/internal/ui/DefaultCashAppPayDelegateTest.kt
@@ -516,7 +516,7 @@ internal class DefaultCashAppPayDelegateTest(
// configurationValue, expectedComponentStateValue
arguments(Amount("EUR", 100), Amount("EUR", 100)),
arguments(Amount("USD", 0), Amount("USD", 0)),
- arguments(Amount.EMPTY, null),
+ arguments(null, null),
arguments(null, null),
)
}
diff --git a/cashapppay/src/test/java/com/adyen/checkout/cashapppay/internal/ui/StoredCashAppPayDelegateTest.kt b/cashapppay/src/test/java/com/adyen/checkout/cashapppay/internal/ui/StoredCashAppPayDelegateTest.kt
index 73a9c6e0b1..3c951b2fa8 100644
--- a/cashapppay/src/test/java/com/adyen/checkout/cashapppay/internal/ui/StoredCashAppPayDelegateTest.kt
+++ b/cashapppay/src/test/java/com/adyen/checkout/cashapppay/internal/ui/StoredCashAppPayDelegateTest.kt
@@ -151,7 +151,7 @@ internal class StoredCashAppPayDelegateTest(
// configurationValue, expectedComponentStateValue
arguments(Amount("EUR", 100), Amount("EUR", 100)),
arguments(Amount("USD", 0), Amount("USD", 0)),
- arguments(Amount.EMPTY, null),
+ arguments(null, null),
arguments(null, null),
)
}
diff --git a/cashapppay/src/test/java/com/adyen/checkout/cashapppay/internal/ui/model/CashAppPayComponentParamsMapperTest.kt b/cashapppay/src/test/java/com/adyen/checkout/cashapppay/internal/ui/model/CashAppPayComponentParamsMapperTest.kt
index b479587a50..52509fed20 100644
--- a/cashapppay/src/test/java/com/adyen/checkout/cashapppay/internal/ui/model/CashAppPayComponentParamsMapperTest.kt
+++ b/cashapppay/src/test/java/com/adyen/checkout/cashapppay/internal/ui/model/CashAppPayComponentParamsMapperTest.kt
@@ -276,7 +276,7 @@ internal class CashAppPayComponentParamsMapperTest {
clientKey: String = TEST_CLIENT_KEY_1,
analyticsParams: AnalyticsParams = AnalyticsParams(AnalyticsParamsLevel.ALL),
isCreatedByDropIn: Boolean = false,
- amount: Amount = Amount.EMPTY,
+ amount: Amount? = null,
isSubmitButtonVisible: Boolean = true,
cashAppPayEnvironment: CashAppPayEnvironment = CashAppPayEnvironment.SANDBOX,
returnUrl: String = TEST_RETURN_URL,
diff --git a/components-core/src/main/java/com/adyen/checkout/components/core/Amount.kt b/components-core/src/main/java/com/adyen/checkout/components/core/Amount.kt
index eda3589802..f92adf12c4 100644
--- a/components-core/src/main/java/com/adyen/checkout/components/core/Amount.kt
+++ b/components-core/src/main/java/com/adyen/checkout/components/core/Amount.kt
@@ -7,7 +7,6 @@
*/
package com.adyen.checkout.components.core
-import com.adyen.checkout.components.core.internal.util.EMPTY_CURRENCY
import com.adyen.checkout.components.core.internal.util.EMPTY_VALUE
import com.adyen.checkout.core.exception.ModelSerializationException
import com.adyen.checkout.core.internal.data.model.ModelObject
@@ -26,8 +25,6 @@ data class Amount(
private const val CURRENCY = "currency"
private const val VALUE = "value"
- val EMPTY = Amount(EMPTY_CURRENCY, EMPTY_VALUE)
-
@JvmField
val SERIALIZER: Serializer = object : Serializer {
override fun serialize(modelObject: Amount): JSONObject {
diff --git a/components-core/src/main/java/com/adyen/checkout/components/core/BalanceResult.kt b/components-core/src/main/java/com/adyen/checkout/components/core/BalanceResult.kt
index d9eb80118e..e91bc8773d 100644
--- a/components-core/src/main/java/com/adyen/checkout/components/core/BalanceResult.kt
+++ b/components-core/src/main/java/com/adyen/checkout/components/core/BalanceResult.kt
@@ -17,7 +17,7 @@ import org.json.JSONObject
@Parcelize
data class BalanceResult(
- val balance: Amount,
+ val balance: Amount?,
val transactionLimit: Amount?
) : ModelObject() {
diff --git a/components-core/src/main/java/com/adyen/checkout/components/core/internal/BaseConfigurationBuilder.kt b/components-core/src/main/java/com/adyen/checkout/components/core/internal/BaseConfigurationBuilder.kt
index 7073f9ab9e..b94f86f511 100644
--- a/components-core/src/main/java/com/adyen/checkout/components/core/internal/BaseConfigurationBuilder.kt
+++ b/components-core/src/main/java/com/adyen/checkout/components/core/internal/BaseConfigurationBuilder.kt
@@ -30,7 +30,7 @@ constructor(
) {
protected var analyticsConfiguration: AnalyticsConfiguration? = null
- protected var amount: Amount = Amount.EMPTY
+ protected var amount: Amount? = null
init {
if (!ValidationUtils.isClientKeyValid(clientKey)) {
@@ -69,7 +69,7 @@ constructor(
/**
* Sets the amount of the transaction.
*
- * Default is [Amount.EMPTY].
+ * Default is null.
*
* @param amount Amount of the transaction.
*/
diff --git a/components-core/src/main/java/com/adyen/checkout/components/core/internal/Configuration.kt b/components-core/src/main/java/com/adyen/checkout/components/core/internal/Configuration.kt
index a665a765e9..7f72f72514 100644
--- a/components-core/src/main/java/com/adyen/checkout/components/core/internal/Configuration.kt
+++ b/components-core/src/main/java/com/adyen/checkout/components/core/internal/Configuration.kt
@@ -14,5 +14,5 @@ interface Configuration : Parcelable {
val environment: Environment
val clientKey: String
val analyticsConfiguration: AnalyticsConfiguration?
- val amount: Amount
+ val amount: Amount?
}
diff --git a/components-core/src/main/java/com/adyen/checkout/components/core/internal/data/api/AnalyticsMapper.kt b/components-core/src/main/java/com/adyen/checkout/components/core/internal/data/api/AnalyticsMapper.kt
index 238392724f..df21b258e4 100644
--- a/components-core/src/main/java/com/adyen/checkout/components/core/internal/data/api/AnalyticsMapper.kt
+++ b/components-core/src/main/java/com/adyen/checkout/components/core/internal/data/api/AnalyticsMapper.kt
@@ -24,7 +24,7 @@ class AnalyticsMapper {
packageName: String,
locale: Locale,
source: AnalyticsSource,
- amount: Amount,
+ amount: Amount?,
screenWidth: Long,
paymentMethods: List,
sessionId: String?,
diff --git a/components-core/src/main/java/com/adyen/checkout/components/core/internal/data/api/AnalyticsRepositoryData.kt b/components-core/src/main/java/com/adyen/checkout/components/core/internal/data/api/AnalyticsRepositoryData.kt
index e72a1d8a4e..c6717301e3 100644
--- a/components-core/src/main/java/com/adyen/checkout/components/core/internal/data/api/AnalyticsRepositoryData.kt
+++ b/components-core/src/main/java/com/adyen/checkout/components/core/internal/data/api/AnalyticsRepositoryData.kt
@@ -26,7 +26,7 @@ data class AnalyticsRepositoryData(
val locale: Locale,
val source: AnalyticsSource,
val clientKey: String,
- val amount: Amount,
+ val amount: Amount?,
val screenWidth: Int,
val paymentMethods: List,
val sessionId: String?,
diff --git a/components-core/src/main/java/com/adyen/checkout/components/core/internal/data/model/OrderPaymentMethod.kt b/components-core/src/main/java/com/adyen/checkout/components/core/internal/data/model/OrderPaymentMethod.kt
index ac1c95f0d6..b55131b14b 100644
--- a/components-core/src/main/java/com/adyen/checkout/components/core/internal/data/model/OrderPaymentMethod.kt
+++ b/components-core/src/main/java/com/adyen/checkout/components/core/internal/data/model/OrderPaymentMethod.kt
@@ -21,7 +21,7 @@ import org.json.JSONObject
@Parcelize
data class OrderPaymentMethod(
val type: String,
- val amount: Amount,
+ val amount: Amount?,
val lastFour: String,
val transactionLimit: Amount?
) : ModelObject() {
@@ -55,8 +55,7 @@ data class OrderPaymentMethod(
OrderPaymentMethod(
type = jsonObject.getString(TYPE),
lastFour = jsonObject.getString(LAST_FOUR),
- amount = ModelUtils.deserializeOpt(jsonObject.optJSONObject(AMOUNT), Amount.SERIALIZER)
- ?: Amount.EMPTY,
+ amount = ModelUtils.deserializeOpt(jsonObject.optJSONObject(AMOUNT), Amount.SERIALIZER),
transactionLimit = ModelUtils.deserializeOpt(
jsonObject.optJSONObject(TRANSACTION_LIMIT),
Amount.SERIALIZER
diff --git a/components-core/src/main/java/com/adyen/checkout/components/core/internal/data/model/OrderStatusResponse.kt b/components-core/src/main/java/com/adyen/checkout/components/core/internal/data/model/OrderStatusResponse.kt
index 0751b4faf1..93c45c44e4 100644
--- a/components-core/src/main/java/com/adyen/checkout/components/core/internal/data/model/OrderStatusResponse.kt
+++ b/components-core/src/main/java/com/adyen/checkout/components/core/internal/data/model/OrderStatusResponse.kt
@@ -21,7 +21,7 @@ import org.json.JSONObject
@Parcelize
data class OrderStatusResponse(
val paymentMethods: List,
- val remainingAmount: Amount
+ val remainingAmount: Amount?
) : ModelObject() {
companion object {
@@ -54,7 +54,7 @@ data class OrderStatusResponse(
remainingAmount = ModelUtils.deserializeOpt(
jsonObject.optJSONObject(REMAINING_AMOUNT),
Amount.SERIALIZER
- ) ?: Amount.EMPTY
+ )
)
} catch (e: JSONException) {
throw ModelSerializationException(OrderStatusResponse::class.java, e)
diff --git a/components-core/src/main/java/com/adyen/checkout/components/core/internal/ui/model/ButtonComponentParams.kt b/components-core/src/main/java/com/adyen/checkout/components/core/internal/ui/model/ButtonComponentParams.kt
index 9b24f2c6c2..02ead71ea0 100644
--- a/components-core/src/main/java/com/adyen/checkout/components/core/internal/ui/model/ButtonComponentParams.kt
+++ b/components-core/src/main/java/com/adyen/checkout/components/core/internal/ui/model/ButtonComponentParams.kt
@@ -20,6 +20,6 @@ data class ButtonComponentParams(
override val clientKey: String,
override val analyticsParams: AnalyticsParams,
override val isCreatedByDropIn: Boolean,
- override val amount: Amount,
+ override val amount: Amount?,
override val isSubmitButtonVisible: Boolean,
) : ComponentParams, ButtonParams
diff --git a/components-core/src/main/java/com/adyen/checkout/components/core/internal/ui/model/ComponentParams.kt b/components-core/src/main/java/com/adyen/checkout/components/core/internal/ui/model/ComponentParams.kt
index a41326bdd4..9666b39150 100644
--- a/components-core/src/main/java/com/adyen/checkout/components/core/internal/ui/model/ComponentParams.kt
+++ b/components-core/src/main/java/com/adyen/checkout/components/core/internal/ui/model/ComponentParams.kt
@@ -20,5 +20,5 @@ interface ComponentParams {
val clientKey: String
val analyticsParams: AnalyticsParams
val isCreatedByDropIn: Boolean
- val amount: Amount
+ val amount: Amount?
}
diff --git a/components-core/src/main/java/com/adyen/checkout/components/core/internal/ui/model/GenericComponentParams.kt b/components-core/src/main/java/com/adyen/checkout/components/core/internal/ui/model/GenericComponentParams.kt
index 71e3350a64..1fcc53294f 100644
--- a/components-core/src/main/java/com/adyen/checkout/components/core/internal/ui/model/GenericComponentParams.kt
+++ b/components-core/src/main/java/com/adyen/checkout/components/core/internal/ui/model/GenericComponentParams.kt
@@ -20,5 +20,5 @@ data class GenericComponentParams(
override val clientKey: String,
override val analyticsParams: AnalyticsParams,
override val isCreatedByDropIn: Boolean,
- override val amount: Amount,
+ override val amount: Amount?,
) : ComponentParams
diff --git a/components-core/src/main/java/com/adyen/checkout/components/core/internal/util/AmountExtensions.kt b/components-core/src/main/java/com/adyen/checkout/components/core/internal/util/AmountExtensions.kt
index d69b08ef41..1c5e734441 100644
--- a/components-core/src/main/java/com/adyen/checkout/components/core/internal/util/AmountExtensions.kt
+++ b/components-core/src/main/java/com/adyen/checkout/components/core/internal/util/AmountExtensions.kt
@@ -18,12 +18,10 @@ val Amount.isZero: Boolean
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
fun Amount.validate() {
- if (!isEmpty) {
- if (!CheckoutCurrency.isSupported(currency)) {
- throw CheckoutException("Currency code is not valid.")
- }
- if (value < 0) {
- throw CheckoutException("Value cannot be less than 0.")
- }
+ if (!CheckoutCurrency.isSupported(currency)) {
+ throw CheckoutException("Currency code is not valid.")
+ }
+ if (value < 0) {
+ throw CheckoutException("Value cannot be less than 0.")
}
}
diff --git a/components-core/src/test/java/com/adyen/checkout/components/core/ButtonTestConfiguration.kt b/components-core/src/test/java/com/adyen/checkout/components/core/ButtonTestConfiguration.kt
index 3081549c2f..b8cd4cd41f 100644
--- a/components-core/src/test/java/com/adyen/checkout/components/core/ButtonTestConfiguration.kt
+++ b/components-core/src/test/java/com/adyen/checkout/components/core/ButtonTestConfiguration.kt
@@ -15,7 +15,7 @@ class ButtonTestConfiguration private constructor(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount,
+ override val amount: Amount?,
override val isSubmitButtonVisible: Boolean?,
) : Configuration, ButtonConfiguration {
diff --git a/components-core/src/test/java/com/adyen/checkout/components/core/TestConfiguration.kt b/components-core/src/test/java/com/adyen/checkout/components/core/TestConfiguration.kt
index 1378e9de61..9299e3ceae 100644
--- a/components-core/src/test/java/com/adyen/checkout/components/core/TestConfiguration.kt
+++ b/components-core/src/test/java/com/adyen/checkout/components/core/TestConfiguration.kt
@@ -21,7 +21,7 @@ class TestConfiguration private constructor(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount
+ override val amount: Amount?
) : Configuration {
class Builder : BaseConfigurationBuilder {
diff --git a/components-core/src/test/java/com/adyen/checkout/components/core/internal/ui/model/ButtonComponentParamsMapperTest.kt b/components-core/src/test/java/com/adyen/checkout/components/core/internal/ui/model/ButtonComponentParamsMapperTest.kt
index 70faf6079e..1f5914bc77 100644
--- a/components-core/src/test/java/com/adyen/checkout/components/core/internal/ui/model/ButtonComponentParamsMapperTest.kt
+++ b/components-core/src/test/java/com/adyen/checkout/components/core/internal/ui/model/ButtonComponentParamsMapperTest.kt
@@ -108,7 +108,7 @@ internal class ButtonComponentParamsMapperTest {
clientKey = TEST_CLIENT_KEY_1,
analyticsParams = AnalyticsParams(AnalyticsParamsLevel.ALL),
isCreatedByDropIn = false,
- amount = Amount.EMPTY,
+ amount = null,
isSubmitButtonVisible = true,
)
}
diff --git a/components-core/src/test/java/com/adyen/checkout/components/core/internal/ui/model/GenericComponentParamsMapperTest.kt b/components-core/src/test/java/com/adyen/checkout/components/core/internal/ui/model/GenericComponentParamsMapperTest.kt
index 3d0b5fd14b..9bcc37b004 100644
--- a/components-core/src/test/java/com/adyen/checkout/components/core/internal/ui/model/GenericComponentParamsMapperTest.kt
+++ b/components-core/src/test/java/com/adyen/checkout/components/core/internal/ui/model/GenericComponentParamsMapperTest.kt
@@ -119,7 +119,7 @@ internal class GenericComponentParamsMapperTest {
clientKey = TEST_CLIENT_KEY_1,
analyticsParams = AnalyticsParams(AnalyticsParamsLevel.ALL),
isCreatedByDropIn = false,
- amount = Amount.EMPTY
+ amount = null
)
}
diff --git a/convenience-stores-jp/src/main/java/com/adyen/checkout/conveniencestoresjp/ConvenienceStoresJPConfiguration.kt b/convenience-stores-jp/src/main/java/com/adyen/checkout/conveniencestoresjp/ConvenienceStoresJPConfiguration.kt
index 21d14cdebf..beecdbd543 100644
--- a/convenience-stores-jp/src/main/java/com/adyen/checkout/conveniencestoresjp/ConvenienceStoresJPConfiguration.kt
+++ b/convenience-stores-jp/src/main/java/com/adyen/checkout/conveniencestoresjp/ConvenienceStoresJPConfiguration.kt
@@ -27,7 +27,7 @@ class ConvenienceStoresJPConfiguration private constructor(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount,
+ override val amount: Amount?,
override val isSubmitButtonVisible: Boolean?,
override val genericActionConfiguration: GenericActionConfiguration,
) : EContextConfiguration() {
diff --git a/dotpay/src/main/java/com/adyen/checkout/dotpay/DotpayConfiguration.kt b/dotpay/src/main/java/com/adyen/checkout/dotpay/DotpayConfiguration.kt
index 1df21bba25..d3ec92724a 100644
--- a/dotpay/src/main/java/com/adyen/checkout/dotpay/DotpayConfiguration.kt
+++ b/dotpay/src/main/java/com/adyen/checkout/dotpay/DotpayConfiguration.kt
@@ -27,7 +27,7 @@ class DotpayConfiguration private constructor(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount,
+ override val amount: Amount?,
override val viewType: IssuerListViewType?,
override val isSubmitButtonVisible: Boolean?,
override val hideIssuerLogos: Boolean?,
diff --git a/drop-in/src/main/java/com/adyen/checkout/dropin/DropInConfiguration.kt b/drop-in/src/main/java/com/adyen/checkout/dropin/DropInConfiguration.kt
index c361a6cf9f..6244c8fb33 100644
--- a/drop-in/src/main/java/com/adyen/checkout/dropin/DropInConfiguration.kt
+++ b/drop-in/src/main/java/com/adyen/checkout/dropin/DropInConfiguration.kt
@@ -59,7 +59,7 @@ class DropInConfiguration private constructor(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount,
+ override val amount: Amount?,
private val availablePaymentConfigs: HashMap,
internal val genericActionConfiguration: GenericActionConfiguration,
val showPreselectedStoredPaymentMethod: Boolean,
diff --git a/drop-in/src/main/java/com/adyen/checkout/dropin/internal/provider/ComponentParsingProvider.kt b/drop-in/src/main/java/com/adyen/checkout/dropin/internal/provider/ComponentParsingProvider.kt
index 317b6bdd81..310e307287 100644
--- a/drop-in/src/main/java/com/adyen/checkout/dropin/internal/provider/ComponentParsingProvider.kt
+++ b/drop-in/src/main/java/com/adyen/checkout/dropin/internal/provider/ComponentParsingProvider.kt
@@ -450,7 +450,7 @@ internal fun checkPaymentMethodAvailability(
application: Application,
paymentMethod: PaymentMethod,
dropInConfiguration: DropInConfiguration,
- amount: Amount,
+ amount: Amount?,
sessionDetails: SessionDetails?,
callback: ComponentAvailableCallback,
) {
@@ -476,7 +476,7 @@ internal fun checkPaymentMethodAvailability(
internal fun getPaymentMethodAvailabilityCheck(
dropInConfiguration: DropInConfiguration,
paymentMethodType: String,
- amount: Amount,
+ amount: Amount?,
sessionDetails: SessionDetails?,
): PaymentMethodAvailabilityCheck {
val dropInParams = dropInConfiguration.mapToParams(amount)
@@ -508,7 +508,7 @@ internal fun getComponentFor(
fragment: Fragment,
storedPaymentMethod: StoredPaymentMethod,
dropInConfiguration: DropInConfiguration,
- amount: Amount,
+ amount: Amount?,
componentCallback: ComponentCallback<*>,
sessionDetails: SessionDetails?,
analyticsRepository: AnalyticsRepository,
@@ -585,7 +585,7 @@ internal fun getComponentFor(
fragment: Fragment,
paymentMethod: PaymentMethod,
dropInConfiguration: DropInConfiguration,
- amount: Amount,
+ amount: Amount?,
componentCallback: ComponentCallback<*>,
sessionDetails: SessionDetails?,
analyticsRepository: AnalyticsRepository,
@@ -900,7 +900,7 @@ internal fun getComponentFor(
}
}
-internal fun DropInConfiguration.mapToParams(amount: Amount): DropInComponentParams {
+internal fun DropInConfiguration.mapToParams(amount: Amount?): DropInComponentParams {
return DropInComponentParamsMapper().mapToParams(this, amount)
}
diff --git a/drop-in/src/main/java/com/adyen/checkout/dropin/internal/ui/DropInViewModel.kt b/drop-in/src/main/java/com/adyen/checkout/dropin/internal/ui/DropInViewModel.kt
index 12d38a708a..78324ac66c 100644
--- a/drop-in/src/main/java/com/adyen/checkout/dropin/internal/ui/DropInViewModel.kt
+++ b/drop-in/src/main/java/com/adyen/checkout/dropin/internal/ui/DropInViewModel.kt
@@ -62,8 +62,8 @@ internal class DropInViewModel(
val serviceComponentName: ComponentName = requireNotNull(bundleHandler.serviceComponentName)
- var amount: Amount
- get() = requireNotNull(bundleHandler.amount)
+ var amount: Amount?
+ get() = bundleHandler.amount
private set(value) {
bundleHandler.amount = value
}
@@ -151,7 +151,7 @@ internal class DropInViewModel(
return noStored && singlePm && paymentMethodHasComponent
}
- private fun getInitialAmount(): Amount {
+ private fun getInitialAmount(): Amount? {
return sessionDetails?.amount ?: dropInConfiguration.amount
}
@@ -325,11 +325,11 @@ internal class DropInViewModel(
// include amount value if merchant passed it to the DropIn
val existingAmount = paymentComponentState.data.amount
when {
- existingAmount != null && !existingAmount.isEmpty -> {
+ existingAmount != null -> {
Logger.d(TAG, "Payment amount already set: $existingAmount")
}
- !amount.isEmpty -> {
+ amount != null -> {
paymentComponentState.data.amount = amount
Logger.d(TAG, "Payment amount set: $amount")
}
diff --git a/drop-in/src/main/java/com/adyen/checkout/dropin/internal/ui/DropInViewModelFactory.kt b/drop-in/src/main/java/com/adyen/checkout/dropin/internal/ui/DropInViewModelFactory.kt
index ddb12eb2f5..b00eef5814 100644
--- a/drop-in/src/main/java/com/adyen/checkout/dropin/internal/ui/DropInViewModelFactory.kt
+++ b/drop-in/src/main/java/com/adyen/checkout/dropin/internal/ui/DropInViewModelFactory.kt
@@ -36,7 +36,7 @@ internal class DropInViewModelFactory(
val bundleHandler = DropInSavedStateHandleContainer(handle)
val dropInConfiguration: DropInConfiguration = requireNotNull(bundleHandler.dropInConfiguration)
- val amount: Amount = requireNotNull(bundleHandler.amount)
+ val amount: Amount? = bundleHandler.amount
val paymentMethods = bundleHandler.paymentMethodsApiResponse?.paymentMethods?.mapNotNull { it.type }.orEmpty()
val session = bundleHandler.sessionDetails
diff --git a/drop-in/src/main/java/com/adyen/checkout/dropin/internal/ui/PaymentMethodsListViewModel.kt b/drop-in/src/main/java/com/adyen/checkout/dropin/internal/ui/PaymentMethodsListViewModel.kt
index c5c25741e4..7c3a9fd8ac 100644
--- a/drop-in/src/main/java/com/adyen/checkout/dropin/internal/ui/PaymentMethodsListViewModel.kt
+++ b/drop-in/src/main/java/com/adyen/checkout/dropin/internal/ui/PaymentMethodsListViewModel.kt
@@ -50,7 +50,7 @@ internal class PaymentMethodsListViewModel(
storedPaymentMethods: List,
private val order: OrderModel?,
private val dropInConfiguration: DropInConfiguration,
- private val amount: Amount,
+ private val amount: Amount?,
private val sessionDetails: SessionDetails?,
) : ViewModel(), ComponentAvailableCallback, ComponentCallback> {
diff --git a/drop-in/src/main/java/com/adyen/checkout/dropin/internal/ui/PreselectedStoredPaymentViewModel.kt b/drop-in/src/main/java/com/adyen/checkout/dropin/internal/ui/PreselectedStoredPaymentViewModel.kt
index bb8e26ff39..16ae431946 100644
--- a/drop-in/src/main/java/com/adyen/checkout/dropin/internal/ui/PreselectedStoredPaymentViewModel.kt
+++ b/drop-in/src/main/java/com/adyen/checkout/dropin/internal/ui/PreselectedStoredPaymentViewModel.kt
@@ -29,7 +29,7 @@ import java.util.Locale
internal class PreselectedStoredPaymentViewModel(
private val storedPaymentMethod: StoredPaymentMethod,
- private val amount: Amount,
+ private val amount: Amount?,
private val dropInConfiguration: DropInConfiguration,
) : ViewModel(), ComponentCallback> {
@@ -111,7 +111,7 @@ internal data class PreselectedStoredState(
internal sealed class ButtonState {
object Loading : ButtonState()
data class ContinueButton(@StringRes val labelResId: Int = R.string.continue_button) : ButtonState()
- data class PayButton(val amount: Amount, val shopperLocale: Locale) : ButtonState()
+ data class PayButton(val amount: Amount?, val shopperLocale: Locale) : ButtonState()
}
internal sealed class PreselectedStoredEvent {
diff --git a/drop-in/src/main/java/com/adyen/checkout/dropin/internal/ui/model/DropInComponentParams.kt b/drop-in/src/main/java/com/adyen/checkout/dropin/internal/ui/model/DropInComponentParams.kt
index 6391503de3..59a24cff04 100644
--- a/drop-in/src/main/java/com/adyen/checkout/dropin/internal/ui/model/DropInComponentParams.kt
+++ b/drop-in/src/main/java/com/adyen/checkout/dropin/internal/ui/model/DropInComponentParams.kt
@@ -21,7 +21,7 @@ internal data class DropInComponentParams(
override val clientKey: String,
override val analyticsParams: AnalyticsParams,
override val isCreatedByDropIn: Boolean,
- override val amount: Amount,
+ override val amount: Amount?,
val showPreselectedStoredPaymentMethod: Boolean,
val skipListWhenSinglePaymentMethod: Boolean,
val isRemovingStoredPaymentMethodsEnabled: Boolean,
diff --git a/drop-in/src/main/java/com/adyen/checkout/dropin/internal/ui/model/DropInComponentParamsMapper.kt b/drop-in/src/main/java/com/adyen/checkout/dropin/internal/ui/model/DropInComponentParamsMapper.kt
index c67af1cff7..802955ab71 100644
--- a/drop-in/src/main/java/com/adyen/checkout/dropin/internal/ui/model/DropInComponentParamsMapper.kt
+++ b/drop-in/src/main/java/com/adyen/checkout/dropin/internal/ui/model/DropInComponentParamsMapper.kt
@@ -16,7 +16,7 @@ internal class DropInComponentParamsMapper {
fun mapToParams(
dropInConfiguration: DropInConfiguration,
- overrideAmount: Amount,
+ overrideAmount: Amount?,
): DropInComponentParams {
with(dropInConfiguration) {
return DropInComponentParams(
diff --git a/drop-in/src/main/java/com/adyen/checkout/dropin/internal/ui/model/OrderModel.kt b/drop-in/src/main/java/com/adyen/checkout/dropin/internal/ui/model/OrderModel.kt
index f021b02655..df83bdc02a 100644
--- a/drop-in/src/main/java/com/adyen/checkout/dropin/internal/ui/model/OrderModel.kt
+++ b/drop-in/src/main/java/com/adyen/checkout/dropin/internal/ui/model/OrderModel.kt
@@ -17,6 +17,6 @@ import kotlinx.parcelize.Parcelize
internal data class OrderModel(
val orderData: String,
val pspReference: String,
- val remainingAmount: Amount,
+ val remainingAmount: Amount?,
val paymentMethods: List
) : Parcelable
diff --git a/econtext/src/main/java/com/adyen/checkout/econtext/internal/ui/DefaultEContextDelegate.kt b/econtext/src/main/java/com/adyen/checkout/econtext/internal/ui/DefaultEContextDelegate.kt
index fb6f490b13..c7e1c1b9b1 100644
--- a/econtext/src/main/java/com/adyen/checkout/econtext/internal/ui/DefaultEContextDelegate.kt
+++ b/econtext/src/main/java/com/adyen/checkout/econtext/internal/ui/DefaultEContextDelegate.kt
@@ -22,7 +22,6 @@ import com.adyen.checkout.components.core.internal.ui.model.ButtonComponentParam
import com.adyen.checkout.components.core.internal.ui.model.FieldState
import com.adyen.checkout.components.core.internal.ui.model.Validation
import com.adyen.checkout.components.core.internal.util.ValidationUtils
-import com.adyen.checkout.components.core.internal.util.isEmpty
import com.adyen.checkout.components.core.paymentmethod.EContextPaymentMethod
import com.adyen.checkout.core.internal.util.LogUtil
import com.adyen.checkout.core.internal.util.Logger
@@ -128,7 +127,7 @@ internal class DefaultEContextDelegate<
val paymentComponentData = PaymentComponentData(
paymentMethod = eContextPaymentMethod,
order = order,
- amount = componentParams.amount.takeUnless { it.isEmpty },
+ amount = componentParams.amount,
)
return componentStateFactory(paymentComponentData, isInputValid, true)
}
diff --git a/econtext/src/test/java/com/adyen/checkout/econtext/TestEContextConfiguration.kt b/econtext/src/test/java/com/adyen/checkout/econtext/TestEContextConfiguration.kt
index cc437e2e4b..5bd298f6e5 100644
--- a/econtext/src/test/java/com/adyen/checkout/econtext/TestEContextConfiguration.kt
+++ b/econtext/src/test/java/com/adyen/checkout/econtext/TestEContextConfiguration.kt
@@ -26,7 +26,7 @@ private constructor(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount,
+ override val amount: Amount?,
override val genericActionConfiguration: GenericActionConfiguration
) : EContextConfiguration() {
diff --git a/econtext/src/test/java/com/adyen/checkout/econtext/internal/ui/DefaultEContextDelegateTest.kt b/econtext/src/test/java/com/adyen/checkout/econtext/internal/ui/DefaultEContextDelegateTest.kt
index 3061a91f82..3a4d013595 100644
--- a/econtext/src/test/java/com/adyen/checkout/econtext/internal/ui/DefaultEContextDelegateTest.kt
+++ b/econtext/src/test/java/com/adyen/checkout/econtext/internal/ui/DefaultEContextDelegateTest.kt
@@ -317,7 +317,7 @@ internal class DefaultEContextDelegateTest(
// configurationValue, expectedComponentStateValue
arguments(Amount("EUR", 100), Amount("EUR", 100)),
arguments(Amount("USD", 0), Amount("USD", 0)),
- arguments(Amount.EMPTY, null),
+ arguments(null, null),
arguments(null, null),
)
}
diff --git a/entercash/src/main/java/com/adyen/checkout/entercash/EntercashConfiguration.kt b/entercash/src/main/java/com/adyen/checkout/entercash/EntercashConfiguration.kt
index bcc433e799..1d76d2f743 100644
--- a/entercash/src/main/java/com/adyen/checkout/entercash/EntercashConfiguration.kt
+++ b/entercash/src/main/java/com/adyen/checkout/entercash/EntercashConfiguration.kt
@@ -27,7 +27,7 @@ class EntercashConfiguration private constructor(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount,
+ override val amount: Amount?,
override val viewType: IssuerListViewType?,
override val isSubmitButtonVisible: Boolean?,
override val hideIssuerLogos: Boolean?,
diff --git a/eps/src/main/java/com/adyen/checkout/eps/EPSConfiguration.kt b/eps/src/main/java/com/adyen/checkout/eps/EPSConfiguration.kt
index 17c27d2f84..ef16d489d2 100644
--- a/eps/src/main/java/com/adyen/checkout/eps/EPSConfiguration.kt
+++ b/eps/src/main/java/com/adyen/checkout/eps/EPSConfiguration.kt
@@ -27,7 +27,7 @@ class EPSConfiguration private constructor(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount,
+ override val amount: Amount?,
override val viewType: IssuerListViewType?,
override val isSubmitButtonVisible: Boolean?,
override val hideIssuerLogos: Boolean?,
diff --git a/example-app/src/main/java/com/adyen/checkout/example/data/api/model/PaymentsRequest.kt b/example-app/src/main/java/com/adyen/checkout/example/data/api/model/PaymentsRequest.kt
index 80824d42f3..49a53541b3 100644
--- a/example-app/src/main/java/com/adyen/checkout/example/data/api/model/PaymentsRequest.kt
+++ b/example-app/src/main/java/com/adyen/checkout/example/data/api/model/PaymentsRequest.kt
@@ -26,7 +26,7 @@ data class PaymentsRequest(
@Keep
data class PaymentsRequestData(
val shopperReference: String,
- val amount: Amount,
+ val amount: Amount?,
val countryCode: String,
val merchantAccount: String,
val returnUrl: String,
diff --git a/example-app/src/main/java/com/adyen/checkout/example/service/ExampleDropInService.kt b/example-app/src/main/java/com/adyen/checkout/example/service/ExampleDropInService.kt
index 58c6b44fb1..fd0483f49c 100644
--- a/example-app/src/main/java/com/adyen/checkout/example/service/ExampleDropInService.kt
+++ b/example-app/src/main/java/com/adyen/checkout/example/service/ExampleDropInService.kt
@@ -56,7 +56,7 @@ class ExampleDropInService : DropInService() {
val paymentRequest = createPaymentRequest(
paymentComponentData = paymentComponentJson,
shopperReference = keyValueStorage.getShopperReference(),
- amount = keyValueStorage.getAmount(),
+ amount = state.data.amount,
countryCode = keyValueStorage.getCountry(),
merchantAccount = keyValueStorage.getMerchantAccount(),
redirectUrl = RedirectComponent.getReturnUrl(applicationContext),
diff --git a/example-app/src/main/java/com/adyen/checkout/example/service/RequestUtils.kt b/example-app/src/main/java/com/adyen/checkout/example/service/RequestUtils.kt
index 33a28acf7a..83be3db1b6 100644
--- a/example-app/src/main/java/com/adyen/checkout/example/service/RequestUtils.kt
+++ b/example-app/src/main/java/com/adyen/checkout/example/service/RequestUtils.kt
@@ -97,7 +97,7 @@ fun getSessionRequest(
fun createPaymentRequest(
paymentComponentData: JSONObject,
shopperReference: String,
- amount: Amount,
+ amount: Amount?,
countryCode: String,
merchantAccount: String,
redirectUrl: String,
diff --git a/giftcard/src/main/java/com/adyen/checkout/giftcard/GiftCardConfiguration.kt b/giftcard/src/main/java/com/adyen/checkout/giftcard/GiftCardConfiguration.kt
index 2c38d54a9d..c7f49e8363 100644
--- a/giftcard/src/main/java/com/adyen/checkout/giftcard/GiftCardConfiguration.kt
+++ b/giftcard/src/main/java/com/adyen/checkout/giftcard/GiftCardConfiguration.kt
@@ -29,7 +29,7 @@ class GiftCardConfiguration private constructor(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount,
+ override val amount: Amount?,
override val isSubmitButtonVisible: Boolean?,
internal val genericActionConfiguration: GenericActionConfiguration,
) : Configuration, ButtonConfiguration {
diff --git a/giftcard/src/main/java/com/adyen/checkout/giftcard/internal/ui/DefaultGiftCardDelegate.kt b/giftcard/src/main/java/com/adyen/checkout/giftcard/internal/ui/DefaultGiftCardDelegate.kt
index 2942b432fc..3ac8d96e87 100644
--- a/giftcard/src/main/java/com/adyen/checkout/giftcard/internal/ui/DefaultGiftCardDelegate.kt
+++ b/giftcard/src/main/java/com/adyen/checkout/giftcard/internal/ui/DefaultGiftCardDelegate.kt
@@ -23,7 +23,6 @@ import com.adyen.checkout.components.core.internal.data.api.AnalyticsRepository
import com.adyen.checkout.components.core.internal.data.api.PublicKeyRepository
import com.adyen.checkout.components.core.internal.ui.model.ButtonComponentParams
import com.adyen.checkout.components.core.internal.util.bufferedChannel
-import com.adyen.checkout.components.core.internal.util.isEmpty
import com.adyen.checkout.components.core.paymentmethod.GiftCardPaymentMethod
import com.adyen.checkout.core.exception.CheckoutException
import com.adyen.checkout.core.exception.ComponentException
@@ -206,7 +205,7 @@ internal class DefaultGiftCardDelegate(
val paymentComponentData = PaymentComponentData(
paymentMethod = giftCardPaymentMethod,
order = order,
- amount = componentParams.amount.takeUnless { it.isEmpty },
+ amount = componentParams.amount,
)
return GiftCardComponentState(
@@ -272,11 +271,13 @@ internal class DefaultGiftCardDelegate(
_componentStateFlow.tryEmit(updatedState)
submitHandler.onSubmit(updatedState)
}
+
is GiftCardBalanceStatus.NonMatchingCurrencies -> {
exceptionChannel.trySend(
GiftCardException("Currency of the gift card does not match the currency of transaction.")
)
}
+
is GiftCardBalanceStatus.PartialPayment -> {
val updatedState = if (order == null) {
currentState.copy(giftCardAction = GiftCardAction.CreateOrder)
@@ -292,11 +293,13 @@ internal class DefaultGiftCardDelegate(
_componentStateFlow.tryEmit(updatedState)
submitHandler.onSubmit(updatedState)
}
+
is GiftCardBalanceStatus.ZeroAmountToBePaid -> {
exceptionChannel.trySend(
GiftCardException("Amount of the transaction is zero.")
)
}
+
is GiftCardBalanceStatus.ZeroBalance -> {
exceptionChannel.trySend(
GiftCardException("Gift card has no balance.")
diff --git a/giftcard/src/main/java/com/adyen/checkout/giftcard/internal/util/GiftCardBalanceUtils.kt b/giftcard/src/main/java/com/adyen/checkout/giftcard/internal/util/GiftCardBalanceUtils.kt
index 0b8ecae0fb..916d827898 100644
--- a/giftcard/src/main/java/com/adyen/checkout/giftcard/internal/util/GiftCardBalanceUtils.kt
+++ b/giftcard/src/main/java/com/adyen/checkout/giftcard/internal/util/GiftCardBalanceUtils.kt
@@ -25,10 +25,10 @@ object GiftCardBalanceUtils {
* @param amountToBePaid the desired amount to be paid using this gift card.
* @return the result of the balance check.
*/
- fun checkBalance(balance: Amount, transactionLimit: Amount?, amountToBePaid: Amount): GiftCardBalanceStatus {
+ fun checkBalance(balance: Amount?, transactionLimit: Amount?, amountToBePaid: Amount?): GiftCardBalanceStatus {
return when {
- amountToBePaid.isEmpty || amountToBePaid.value <= 0 -> GiftCardBalanceStatus.ZeroAmountToBePaid
- balance.isEmpty || balance.value <= 0 -> GiftCardBalanceStatus.ZeroBalance
+ amountToBePaid == null || amountToBePaid.value <= 0 -> GiftCardBalanceStatus.ZeroAmountToBePaid
+ balance == null || balance.value <= 0 -> GiftCardBalanceStatus.ZeroBalance
amountToBePaid.currency != balance.currency -> GiftCardBalanceStatus.NonMatchingCurrencies
transactionLimit != null && amountToBePaid.currency != transactionLimit.currency ->
GiftCardBalanceStatus.NonMatchingCurrencies
diff --git a/giftcard/src/test/java/com/adyen/checkout/giftcard/GiftCardComponentTest.kt b/giftcard/src/test/java/com/adyen/checkout/giftcard/GiftCardComponentTest.kt
index 715cc205bc..7cab73cc15 100644
--- a/giftcard/src/test/java/com/adyen/checkout/giftcard/GiftCardComponentTest.kt
+++ b/giftcard/src/test/java/com/adyen/checkout/giftcard/GiftCardComponentTest.kt
@@ -13,7 +13,6 @@ import androidx.lifecycle.viewModelScope
import app.cash.turbine.test
import com.adyen.checkout.action.core.internal.DefaultActionHandlingComponent
import com.adyen.checkout.action.core.internal.ui.GenericActionDelegate
-import com.adyen.checkout.components.core.Amount
import com.adyen.checkout.components.core.BalanceResult
import com.adyen.checkout.components.core.OrderResponse
import com.adyen.checkout.components.core.internal.ComponentEventHandler
@@ -204,8 +203,8 @@ internal class GiftCardComponentTest(
companion object {
private val BALANCE_RESULT = BalanceResult(
- balance = Amount.EMPTY,
- transactionLimit = Amount.EMPTY
+ balance = null,
+ transactionLimit = null
)
private val ORDER_RESPONSE = OrderResponse(
diff --git a/giftcard/src/test/java/com/adyen/checkout/giftcard/internal/ui/DefaultGiftCardDelegateTest.kt b/giftcard/src/test/java/com/adyen/checkout/giftcard/internal/ui/DefaultGiftCardDelegateTest.kt
index 9f3d88fc23..3d78fdd9cc 100644
--- a/giftcard/src/test/java/com/adyen/checkout/giftcard/internal/ui/DefaultGiftCardDelegateTest.kt
+++ b/giftcard/src/test/java/com/adyen/checkout/giftcard/internal/ui/DefaultGiftCardDelegateTest.kt
@@ -403,7 +403,7 @@ internal class DefaultGiftCardDelegateTest(
// configurationValue, expectedComponentStateValue
arguments(Amount("EUR", 100), Amount("EUR", 100)),
arguments(Amount("USD", 0), Amount("USD", 0)),
- arguments(Amount.EMPTY, null),
+ arguments(null, null),
arguments(null, null),
)
}
diff --git a/giftcard/src/test/java/com/adyen/checkout/giftcard/internal/util/GiftCardBalanceUtilsTest.kt b/giftcard/src/test/java/com/adyen/checkout/giftcard/internal/util/GiftCardBalanceUtilsTest.kt
index 66c3060829..db189a445a 100644
--- a/giftcard/src/test/java/com/adyen/checkout/giftcard/internal/util/GiftCardBalanceUtilsTest.kt
+++ b/giftcard/src/test/java/com/adyen/checkout/giftcard/internal/util/GiftCardBalanceUtilsTest.kt
@@ -156,7 +156,7 @@ internal class GiftCardBalanceUtilsTest {
val result = GiftCardBalanceUtils.checkBalance(
balance = createAmount(100),
transactionLimit = createAmount(10),
- amountToBePaid = Amount.EMPTY
+ amountToBePaid = null
)
assert(result is GiftCardBalanceStatus.ZeroAmountToBePaid)
@@ -176,7 +176,7 @@ internal class GiftCardBalanceUtilsTest {
@Test
fun checkBalance_EmptyBalance_ExpectZeroBalance() {
val result = GiftCardBalanceUtils.checkBalance(
- balance = Amount.EMPTY,
+ balance = null,
transactionLimit = createAmount(10),
amountToBePaid = createAmount(100)
)
diff --git a/googlepay/src/main/java/com/adyen/checkout/googlepay/GooglePayConfiguration.kt b/googlepay/src/main/java/com/adyen/checkout/googlepay/GooglePayConfiguration.kt
index 7b04da718c..78f48e7eaf 100644
--- a/googlepay/src/main/java/com/adyen/checkout/googlepay/GooglePayConfiguration.kt
+++ b/googlepay/src/main/java/com/adyen/checkout/googlepay/GooglePayConfiguration.kt
@@ -34,7 +34,7 @@ class GooglePayConfiguration private constructor(
override val analyticsConfiguration: AnalyticsConfiguration?,
val merchantAccount: String?,
val googlePayEnvironment: Int?,
- override val amount: Amount,
+ override val amount: Amount?,
val totalPriceStatus: String?,
val countryCode: String?,
val merchantInfo: MerchantInfo?,
diff --git a/googlepay/src/main/java/com/adyen/checkout/googlepay/internal/ui/DefaultGooglePayDelegate.kt b/googlepay/src/main/java/com/adyen/checkout/googlepay/internal/ui/DefaultGooglePayDelegate.kt
index e110856f5e..f1f6c38d5c 100644
--- a/googlepay/src/main/java/com/adyen/checkout/googlepay/internal/ui/DefaultGooglePayDelegate.kt
+++ b/googlepay/src/main/java/com/adyen/checkout/googlepay/internal/ui/DefaultGooglePayDelegate.kt
@@ -20,7 +20,6 @@ import com.adyen.checkout.components.core.internal.PaymentComponentEvent
import com.adyen.checkout.components.core.internal.PaymentObserverRepository
import com.adyen.checkout.components.core.internal.data.api.AnalyticsRepository
import com.adyen.checkout.components.core.internal.util.bufferedChannel
-import com.adyen.checkout.components.core.internal.util.isEmpty
import com.adyen.checkout.core.exception.CheckoutException
import com.adyen.checkout.core.exception.ComponentException
import com.adyen.checkout.core.internal.util.LogUtil
@@ -118,7 +117,7 @@ internal class DefaultGooglePayDelegate(
val paymentComponentData = PaymentComponentData(
paymentMethod = paymentMethod,
order = order,
- amount = componentParams.amount.takeUnless { it.isEmpty },
+ amount = componentParams.amount,
)
return GooglePayComponentState(
diff --git a/googlepay/src/main/java/com/adyen/checkout/googlepay/internal/ui/model/GooglePayComponentParamsMapper.kt b/googlepay/src/main/java/com/adyen/checkout/googlepay/internal/ui/model/GooglePayComponentParamsMapper.kt
index 41e5176d45..4bf0568af4 100644
--- a/googlepay/src/main/java/com/adyen/checkout/googlepay/internal/ui/model/GooglePayComponentParamsMapper.kt
+++ b/googlepay/src/main/java/com/adyen/checkout/googlepay/internal/ui/model/GooglePayComponentParamsMapper.kt
@@ -14,7 +14,6 @@ import com.adyen.checkout.components.core.PaymentMethod
import com.adyen.checkout.components.core.internal.ui.model.AnalyticsParams
import com.adyen.checkout.components.core.internal.ui.model.ComponentParams
import com.adyen.checkout.components.core.internal.ui.model.SessionParams
-import com.adyen.checkout.components.core.internal.util.isEmpty
import com.adyen.checkout.core.Environment
import com.adyen.checkout.core.exception.ComponentException
import com.adyen.checkout.core.internal.util.LogUtil
@@ -53,7 +52,7 @@ internal class GooglePayComponentParamsMapper(
allowedAuthMethods = getAvailableAuthMethods(),
allowedCardNetworks = getAvailableCardNetworks(paymentMethod),
googlePayEnvironment = getGooglePayEnvironment(),
- amount = if (amount.isEmpty) DEFAULT_AMOUNT else amount,
+ amount = amount ?: DEFAULT_AMOUNT,
totalPriceStatus = totalPriceStatus ?: DEFAULT_TOTAL_PRICE_STATUS,
countryCode = countryCode,
merchantInfo = merchantInfo,
@@ -124,7 +123,7 @@ internal class GooglePayComponentParamsMapper(
private fun GooglePayComponentParams.override(overrideComponentParams: ComponentParams?): GooglePayComponentParams {
if (overrideComponentParams == null) return this
- val amount = if (overrideComponentParams.amount.isEmpty) DEFAULT_AMOUNT else overrideComponentParams.amount
+ val amount = overrideComponentParams.amount ?: DEFAULT_AMOUNT
return copy(
shopperLocale = overrideComponentParams.shopperLocale,
environment = overrideComponentParams.environment,
diff --git a/googlepay/src/test/java/com/adyen/checkout/googlepay/internal/ui/DefaultGooglePayDelegateTest.kt b/googlepay/src/test/java/com/adyen/checkout/googlepay/internal/ui/DefaultGooglePayDelegateTest.kt
index a1cb5649ab..d716ba0424 100644
--- a/googlepay/src/test/java/com/adyen/checkout/googlepay/internal/ui/DefaultGooglePayDelegateTest.kt
+++ b/googlepay/src/test/java/com/adyen/checkout/googlepay/internal/ui/DefaultGooglePayDelegateTest.kt
@@ -187,7 +187,7 @@ internal class DefaultGooglePayDelegateTest(
// configurationValue, expectedComponentStateValue
arguments(Amount("EUR", 100), Amount("EUR", 100)),
arguments(Amount("USD", 0), Amount("USD", 0)),
- arguments(Amount.EMPTY, Amount("USD", 0)),
+ arguments(null, Amount("USD", 0)),
arguments(null, Amount("USD", 0)),
)
}
diff --git a/googlepay/src/test/java/com/adyen/checkout/googlepay/internal/ui/model/GooglePayComponentParamsMapperTest.kt b/googlepay/src/test/java/com/adyen/checkout/googlepay/internal/ui/model/GooglePayComponentParamsMapperTest.kt
index 934ceca890..6d55e88b43 100644
--- a/googlepay/src/test/java/com/adyen/checkout/googlepay/internal/ui/model/GooglePayComponentParamsMapperTest.kt
+++ b/googlepay/src/test/java/com/adyen/checkout/googlepay/internal/ui/model/GooglePayComponentParamsMapperTest.kt
@@ -291,7 +291,7 @@ internal class GooglePayComponentParamsMapperTest {
clientKey = TEST_CLIENT_KEY_1,
analyticsParams = AnalyticsParams(AnalyticsParamsLevel.ALL),
isCreatedByDropIn = false,
- amount = Amount.EMPTY
+ amount = null
)
val params = GooglePayComponentParamsMapper(overrideParams, null).mapToParams(
@@ -332,7 +332,7 @@ internal class GooglePayComponentParamsMapperTest {
clientKey = TEST_CLIENT_KEY_1,
analyticsParams = AnalyticsParams(AnalyticsParamsLevel.ALL),
isCreatedByDropIn = false,
- amount = Amount.EMPTY
+ amount = null
)
val params = GooglePayComponentParamsMapper(overrideParams, null).mapToParams(
diff --git a/ideal/src/main/java/com/adyen/checkout/ideal/IdealConfiguration.kt b/ideal/src/main/java/com/adyen/checkout/ideal/IdealConfiguration.kt
index 785f2a39ec..c1c4255242 100644
--- a/ideal/src/main/java/com/adyen/checkout/ideal/IdealConfiguration.kt
+++ b/ideal/src/main/java/com/adyen/checkout/ideal/IdealConfiguration.kt
@@ -27,7 +27,7 @@ class IdealConfiguration private constructor(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount,
+ override val amount: Amount?,
override val viewType: IssuerListViewType?,
override val isSubmitButtonVisible: Boolean?,
override val hideIssuerLogos: Boolean?,
diff --git a/instant/src/main/java/com/adyen/checkout/instant/InstantPaymentConfiguration.kt b/instant/src/main/java/com/adyen/checkout/instant/InstantPaymentConfiguration.kt
index 8ebfecee6f..fda228e79d 100644
--- a/instant/src/main/java/com/adyen/checkout/instant/InstantPaymentConfiguration.kt
+++ b/instant/src/main/java/com/adyen/checkout/instant/InstantPaymentConfiguration.kt
@@ -27,7 +27,7 @@ class InstantPaymentConfiguration private constructor(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount,
+ override val amount: Amount?,
internal val genericActionConfiguration: GenericActionConfiguration,
) : Configuration {
diff --git a/instant/src/main/java/com/adyen/checkout/instant/internal/ui/DefaultInstantPaymentDelegate.kt b/instant/src/main/java/com/adyen/checkout/instant/internal/ui/DefaultInstantPaymentDelegate.kt
index 7bb68eca18..d79e742685 100644
--- a/instant/src/main/java/com/adyen/checkout/instant/internal/ui/DefaultInstantPaymentDelegate.kt
+++ b/instant/src/main/java/com/adyen/checkout/instant/internal/ui/DefaultInstantPaymentDelegate.kt
@@ -18,7 +18,6 @@ import com.adyen.checkout.components.core.internal.PaymentObserverRepository
import com.adyen.checkout.components.core.internal.data.api.AnalyticsRepository
import com.adyen.checkout.components.core.internal.ui.model.GenericComponentParams
import com.adyen.checkout.components.core.internal.util.bufferedChannel
-import com.adyen.checkout.components.core.internal.util.isEmpty
import com.adyen.checkout.components.core.paymentmethod.GenericPaymentMethod
import com.adyen.checkout.components.core.paymentmethod.PaymentMethodDetails
import com.adyen.checkout.core.internal.util.LogUtil
@@ -58,7 +57,7 @@ internal class DefaultInstantPaymentDelegate(
checkoutAttemptId = analyticsRepository.getCheckoutAttemptId(),
),
order = order,
- amount = componentParams.amount.takeUnless { it.isEmpty },
+ amount = componentParams.amount,
)
return InstantComponentState(paymentComponentData, isInputValid = true, isReady = true)
}
diff --git a/instant/src/test/java/com/adyen/checkout/instant/internal/ui/DefaultInstantPaymentDelegateTest.kt b/instant/src/test/java/com/adyen/checkout/instant/internal/ui/DefaultInstantPaymentDelegateTest.kt
index 61298586d4..d4b02df721 100644
--- a/instant/src/test/java/com/adyen/checkout/instant/internal/ui/DefaultInstantPaymentDelegateTest.kt
+++ b/instant/src/test/java/com/adyen/checkout/instant/internal/ui/DefaultInstantPaymentDelegateTest.kt
@@ -137,7 +137,7 @@ class DefaultInstantPaymentDelegateTest(
// configurationValue, expectedComponentStateValue
arguments(Amount("EUR", 100), Amount("EUR", 100)),
arguments(Amount("USD", 0), Amount("USD", 0)),
- arguments(Amount.EMPTY, null),
+ arguments(null, null),
arguments(null, null),
)
}
diff --git a/issuer-list/src/main/java/com/adyen/checkout/issuerlist/internal/ui/DefaultIssuerListDelegate.kt b/issuer-list/src/main/java/com/adyen/checkout/issuerlist/internal/ui/DefaultIssuerListDelegate.kt
index bd7dd2bccd..1861cdd2a0 100644
--- a/issuer-list/src/main/java/com/adyen/checkout/issuerlist/internal/ui/DefaultIssuerListDelegate.kt
+++ b/issuer-list/src/main/java/com/adyen/checkout/issuerlist/internal/ui/DefaultIssuerListDelegate.kt
@@ -18,7 +18,6 @@ import com.adyen.checkout.components.core.PaymentMethodTypes
import com.adyen.checkout.components.core.internal.PaymentComponentEvent
import com.adyen.checkout.components.core.internal.PaymentObserverRepository
import com.adyen.checkout.components.core.internal.data.api.AnalyticsRepository
-import com.adyen.checkout.components.core.internal.util.isEmpty
import com.adyen.checkout.components.core.paymentmethod.IssuerListPaymentMethod
import com.adyen.checkout.core.internal.util.LogUtil
import com.adyen.checkout.core.internal.util.Logger
@@ -154,7 +153,7 @@ internal class DefaultIssuerListDelegate<
val paymentComponentData = PaymentComponentData(
paymentMethod = issuerListPaymentMethod,
order = order,
- amount = componentParams.amount.takeUnless { it.isEmpty },
+ amount = componentParams.amount,
)
return componentStateFactory(paymentComponentData, outputData.isValid, true)
diff --git a/issuer-list/src/main/java/com/adyen/checkout/issuerlist/internal/ui/model/IssuerListComponentParams.kt b/issuer-list/src/main/java/com/adyen/checkout/issuerlist/internal/ui/model/IssuerListComponentParams.kt
index 4a7881123f..2aff4e5281 100644
--- a/issuer-list/src/main/java/com/adyen/checkout/issuerlist/internal/ui/model/IssuerListComponentParams.kt
+++ b/issuer-list/src/main/java/com/adyen/checkout/issuerlist/internal/ui/model/IssuerListComponentParams.kt
@@ -24,7 +24,7 @@ data class IssuerListComponentParams(
override val clientKey: String,
override val analyticsParams: AnalyticsParams,
override val isCreatedByDropIn: Boolean,
- override val amount: Amount,
+ override val amount: Amount?,
override val isSubmitButtonVisible: Boolean,
val viewType: IssuerListViewType,
val hideIssuerLogos: Boolean,
diff --git a/issuer-list/src/test/java/com/adyen/checkout/issuerlist/internal/ui/DefaultIssuerListDelegateTest.kt b/issuer-list/src/test/java/com/adyen/checkout/issuerlist/internal/ui/DefaultIssuerListDelegateTest.kt
index f256011dbd..f27bf9b5e5 100644
--- a/issuer-list/src/test/java/com/adyen/checkout/issuerlist/internal/ui/DefaultIssuerListDelegateTest.kt
+++ b/issuer-list/src/test/java/com/adyen/checkout/issuerlist/internal/ui/DefaultIssuerListDelegateTest.kt
@@ -337,7 +337,7 @@ internal class DefaultIssuerListDelegateTest(
// configurationValue, expectedComponentStateValue
arguments(Amount("EUR", 100), Amount("EUR", 100)),
arguments(Amount("USD", 0), Amount("USD", 0)),
- arguments(Amount.EMPTY, null),
+ arguments(null, null),
arguments(null, null),
)
}
diff --git a/issuer-list/src/test/java/com/adyen/checkout/issuerlist/internal/ui/model/IssuerListComponentParamsMapperTest.kt b/issuer-list/src/test/java/com/adyen/checkout/issuerlist/internal/ui/model/IssuerListComponentParamsMapperTest.kt
index 5c99d862d0..f770d1ff30 100644
--- a/issuer-list/src/test/java/com/adyen/checkout/issuerlist/internal/ui/model/IssuerListComponentParamsMapperTest.kt
+++ b/issuer-list/src/test/java/com/adyen/checkout/issuerlist/internal/ui/model/IssuerListComponentParamsMapperTest.kt
@@ -58,7 +58,7 @@ internal class IssuerListComponentParamsMapperTest {
isCreatedByDropIn = false,
viewType = IssuerListViewType.SPINNER_VIEW,
hideIssuerLogos = true,
- amount = Amount.EMPTY,
+ amount = null,
isSubmitButtonVisible = false
)
@@ -158,7 +158,7 @@ internal class IssuerListComponentParamsMapperTest {
isCreatedByDropIn = false,
viewType = IssuerListViewType.RECYCLER_VIEW,
hideIssuerLogos = false,
- amount = Amount.EMPTY,
+ amount = null,
isSubmitButtonVisible = true
)
}
diff --git a/issuer-list/src/test/java/com/adyen/checkout/issuerlist/utils/TestIssuerListConfiguration.kt b/issuer-list/src/test/java/com/adyen/checkout/issuerlist/utils/TestIssuerListConfiguration.kt
index 423f435a0b..d3e1e5219b 100644
--- a/issuer-list/src/test/java/com/adyen/checkout/issuerlist/utils/TestIssuerListConfiguration.kt
+++ b/issuer-list/src/test/java/com/adyen/checkout/issuerlist/utils/TestIssuerListConfiguration.kt
@@ -26,7 +26,7 @@ private constructor(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount,
+ override val amount: Amount?,
override val viewType: IssuerListViewType?,
override val isSubmitButtonVisible: Boolean?,
override val hideIssuerLogos: Boolean?,
diff --git a/mbway/src/main/java/com/adyen/checkout/mbway/MBWayConfiguration.kt b/mbway/src/main/java/com/adyen/checkout/mbway/MBWayConfiguration.kt
index 472eb950bd..44a9eb4743 100644
--- a/mbway/src/main/java/com/adyen/checkout/mbway/MBWayConfiguration.kt
+++ b/mbway/src/main/java/com/adyen/checkout/mbway/MBWayConfiguration.kt
@@ -29,7 +29,7 @@ class MBWayConfiguration private constructor(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount,
+ override val amount: Amount?,
override val isSubmitButtonVisible: Boolean?,
internal val genericActionConfiguration: GenericActionConfiguration,
) : Configuration, ButtonConfiguration {
diff --git a/mbway/src/main/java/com/adyen/checkout/mbway/internal/ui/DefaultMBWayDelegate.kt b/mbway/src/main/java/com/adyen/checkout/mbway/internal/ui/DefaultMBWayDelegate.kt
index 62695711e6..962bbfde51 100644
--- a/mbway/src/main/java/com/adyen/checkout/mbway/internal/ui/DefaultMBWayDelegate.kt
+++ b/mbway/src/main/java/com/adyen/checkout/mbway/internal/ui/DefaultMBWayDelegate.kt
@@ -20,7 +20,6 @@ import com.adyen.checkout.components.core.internal.data.api.AnalyticsRepository
import com.adyen.checkout.components.core.internal.ui.model.ButtonComponentParams
import com.adyen.checkout.components.core.internal.util.CountryInfo
import com.adyen.checkout.components.core.internal.util.CountryUtils
-import com.adyen.checkout.components.core.internal.util.isEmpty
import com.adyen.checkout.components.core.paymentmethod.MBWayPaymentMethod
import com.adyen.checkout.core.internal.util.LogUtil
import com.adyen.checkout.core.internal.util.Logger
@@ -144,7 +143,7 @@ internal class DefaultMBWayDelegate(
val paymentComponentData = PaymentComponentData(
paymentMethod = paymentMethod,
order = order,
- amount = componentParams.amount.takeUnless { it.isEmpty },
+ amount = componentParams.amount,
)
return MBWayComponentState(
diff --git a/mbway/src/test/java/com/adyen/checkout/mbway/internal/ui/DefaultMBWayDelegateTest.kt b/mbway/src/test/java/com/adyen/checkout/mbway/internal/ui/DefaultMBWayDelegateTest.kt
index ed14b61ea8..a39db78f7b 100644
--- a/mbway/src/test/java/com/adyen/checkout/mbway/internal/ui/DefaultMBWayDelegateTest.kt
+++ b/mbway/src/test/java/com/adyen/checkout/mbway/internal/ui/DefaultMBWayDelegateTest.kt
@@ -301,7 +301,7 @@ internal class DefaultMBWayDelegateTest(
// configurationValue, expectedComponentStateValue
arguments(Amount("EUR", 100), Amount("EUR", 100)),
arguments(Amount("USD", 0), Amount("USD", 0)),
- arguments(Amount.EMPTY, null),
+ arguments(null, null),
arguments(null, null),
)
}
diff --git a/molpay/src/main/java/com/adyen/checkout/molpay/MolpayConfiguration.kt b/molpay/src/main/java/com/adyen/checkout/molpay/MolpayConfiguration.kt
index 36c4b20052..f619b836ac 100644
--- a/molpay/src/main/java/com/adyen/checkout/molpay/MolpayConfiguration.kt
+++ b/molpay/src/main/java/com/adyen/checkout/molpay/MolpayConfiguration.kt
@@ -27,7 +27,7 @@ class MolpayConfiguration private constructor(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount,
+ override val amount: Amount?,
override val viewType: IssuerListViewType?,
override val isSubmitButtonVisible: Boolean?,
override val hideIssuerLogos: Boolean?,
diff --git a/online-banking-core/src/main/java/com/adyen/checkout/onlinebankingcore/internal/ui/DefaultOnlineBankingDelegate.kt b/online-banking-core/src/main/java/com/adyen/checkout/onlinebankingcore/internal/ui/DefaultOnlineBankingDelegate.kt
index 19d2a033cf..7a8c18ebfc 100644
--- a/online-banking-core/src/main/java/com/adyen/checkout/onlinebankingcore/internal/ui/DefaultOnlineBankingDelegate.kt
+++ b/online-banking-core/src/main/java/com/adyen/checkout/onlinebankingcore/internal/ui/DefaultOnlineBankingDelegate.kt
@@ -21,7 +21,6 @@ import com.adyen.checkout.components.core.internal.PaymentObserverRepository
import com.adyen.checkout.components.core.internal.data.api.AnalyticsRepository
import com.adyen.checkout.components.core.internal.ui.model.ButtonComponentParams
import com.adyen.checkout.components.core.internal.util.bufferedChannel
-import com.adyen.checkout.components.core.internal.util.isEmpty
import com.adyen.checkout.components.core.paymentmethod.IssuerListPaymentMethod
import com.adyen.checkout.core.exception.CheckoutException
import com.adyen.checkout.core.internal.util.LogUtil
@@ -162,7 +161,7 @@ internal class DefaultOnlineBankingDelegate<
val paymentComponentData = PaymentComponentData(
paymentMethod = issuerListPaymentMethod,
order = order,
- amount = componentParams.amount.takeUnless { it.isEmpty },
+ amount = componentParams.amount,
)
return componentStateFactory(paymentComponentData, outputData.isValid, true)
diff --git a/online-banking-core/src/test/java/com/adyen/checkout/onlinebankingcore/internal/ui/DefaultOnlineBankingDelegateTest.kt b/online-banking-core/src/test/java/com/adyen/checkout/onlinebankingcore/internal/ui/DefaultOnlineBankingDelegateTest.kt
index 307231be60..013872a08e 100644
--- a/online-banking-core/src/test/java/com/adyen/checkout/onlinebankingcore/internal/ui/DefaultOnlineBankingDelegateTest.kt
+++ b/online-banking-core/src/test/java/com/adyen/checkout/onlinebankingcore/internal/ui/DefaultOnlineBankingDelegateTest.kt
@@ -294,7 +294,7 @@ internal class DefaultOnlineBankingDelegateTest(
// configurationValue, expectedComponentStateValue
arguments(Amount("EUR", 100), Amount("EUR", 100)),
arguments(Amount("USD", 0), Amount("USD", 0)),
- arguments(Amount.EMPTY, null),
+ arguments(null, null),
arguments(null, null),
)
}
diff --git a/online-banking-core/src/test/java/com/adyen/checkout/onlinebankingcore/utils/TestOnlineBankingConfiguration.kt b/online-banking-core/src/test/java/com/adyen/checkout/onlinebankingcore/utils/TestOnlineBankingConfiguration.kt
index 7012921550..0f27d6d4ba 100644
--- a/online-banking-core/src/test/java/com/adyen/checkout/onlinebankingcore/utils/TestOnlineBankingConfiguration.kt
+++ b/online-banking-core/src/test/java/com/adyen/checkout/onlinebankingcore/utils/TestOnlineBankingConfiguration.kt
@@ -25,7 +25,7 @@ internal class TestOnlineBankingConfiguration private constructor(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount,
+ override val amount: Amount?,
override val isSubmitButtonVisible: Boolean?,
) : Configuration,
ButtonConfiguration {
diff --git a/online-banking-cz/src/main/java/com/adyen/checkout/onlinebankingcz/OnlineBankingCZConfiguration.kt b/online-banking-cz/src/main/java/com/adyen/checkout/onlinebankingcz/OnlineBankingCZConfiguration.kt
index 48ab569fcc..505bcc827a 100644
--- a/online-banking-cz/src/main/java/com/adyen/checkout/onlinebankingcz/OnlineBankingCZConfiguration.kt
+++ b/online-banking-cz/src/main/java/com/adyen/checkout/onlinebankingcz/OnlineBankingCZConfiguration.kt
@@ -27,7 +27,7 @@ class OnlineBankingCZConfiguration private constructor(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount,
+ override val amount: Amount?,
override val isSubmitButtonVisible: Boolean?,
override val genericActionConfiguration: GenericActionConfiguration,
) : OnlineBankingConfiguration() {
diff --git a/online-banking-jp/src/main/java/com/adyen/checkout/onlinebankingjp/OnlineBankingJPConfiguration.kt b/online-banking-jp/src/main/java/com/adyen/checkout/onlinebankingjp/OnlineBankingJPConfiguration.kt
index 573cd1b6da..b66f701e0d 100644
--- a/online-banking-jp/src/main/java/com/adyen/checkout/onlinebankingjp/OnlineBankingJPConfiguration.kt
+++ b/online-banking-jp/src/main/java/com/adyen/checkout/onlinebankingjp/OnlineBankingJPConfiguration.kt
@@ -27,7 +27,7 @@ class OnlineBankingJPConfiguration private constructor(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount,
+ override val amount: Amount?,
override val isSubmitButtonVisible: Boolean?,
override val genericActionConfiguration: GenericActionConfiguration,
) : EContextConfiguration() {
diff --git a/online-banking-pl/src/main/java/com/adyen/checkout/onlinebankingpl/OnlineBankingPLConfiguration.kt b/online-banking-pl/src/main/java/com/adyen/checkout/onlinebankingpl/OnlineBankingPLConfiguration.kt
index 6460b489c0..0098beee93 100644
--- a/online-banking-pl/src/main/java/com/adyen/checkout/onlinebankingpl/OnlineBankingPLConfiguration.kt
+++ b/online-banking-pl/src/main/java/com/adyen/checkout/onlinebankingpl/OnlineBankingPLConfiguration.kt
@@ -28,7 +28,7 @@ class OnlineBankingPLConfiguration private constructor(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount,
+ override val amount: Amount?,
override val viewType: IssuerListViewType?,
override val isSubmitButtonVisible: Boolean?,
override val hideIssuerLogos: Boolean?,
diff --git a/online-banking-sk/src/main/java/com/adyen/checkout/onlinebankingsk/OnlineBankingSKConfiguration.kt b/online-banking-sk/src/main/java/com/adyen/checkout/onlinebankingsk/OnlineBankingSKConfiguration.kt
index 63b4905450..909f622c41 100644
--- a/online-banking-sk/src/main/java/com/adyen/checkout/onlinebankingsk/OnlineBankingSKConfiguration.kt
+++ b/online-banking-sk/src/main/java/com/adyen/checkout/onlinebankingsk/OnlineBankingSKConfiguration.kt
@@ -27,7 +27,7 @@ class OnlineBankingSKConfiguration private constructor(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount,
+ override val amount: Amount?,
override val isSubmitButtonVisible: Boolean?,
override val genericActionConfiguration: GenericActionConfiguration,
) : OnlineBankingConfiguration() {
diff --git a/openbanking/src/main/java/com/adyen/checkout/openbanking/OpenBankingConfiguration.kt b/openbanking/src/main/java/com/adyen/checkout/openbanking/OpenBankingConfiguration.kt
index edad7f8594..8aa1f2338b 100644
--- a/openbanking/src/main/java/com/adyen/checkout/openbanking/OpenBankingConfiguration.kt
+++ b/openbanking/src/main/java/com/adyen/checkout/openbanking/OpenBankingConfiguration.kt
@@ -27,7 +27,7 @@ class OpenBankingConfiguration private constructor(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount,
+ override val amount: Amount?,
override val viewType: IssuerListViewType?,
override val isSubmitButtonVisible: Boolean?,
override val hideIssuerLogos: Boolean?,
diff --git a/paybybank/src/main/java/com/adyen/checkout/paybybank/PayByBankConfiguration.kt b/paybybank/src/main/java/com/adyen/checkout/paybybank/PayByBankConfiguration.kt
index 1fd18d2d84..45605fe515 100644
--- a/paybybank/src/main/java/com/adyen/checkout/paybybank/PayByBankConfiguration.kt
+++ b/paybybank/src/main/java/com/adyen/checkout/paybybank/PayByBankConfiguration.kt
@@ -27,7 +27,7 @@ class PayByBankConfiguration private constructor(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount,
+ override val amount: Amount?,
internal val genericActionConfiguration: GenericActionConfiguration,
) : Configuration {
diff --git a/paybybank/src/main/java/com/adyen/checkout/paybybank/internal/ui/DefaultPayByBankDelegate.kt b/paybybank/src/main/java/com/adyen/checkout/paybybank/internal/ui/DefaultPayByBankDelegate.kt
index 87520d774c..1ffc5c20ca 100644
--- a/paybybank/src/main/java/com/adyen/checkout/paybybank/internal/ui/DefaultPayByBankDelegate.kt
+++ b/paybybank/src/main/java/com/adyen/checkout/paybybank/internal/ui/DefaultPayByBankDelegate.kt
@@ -20,7 +20,6 @@ import com.adyen.checkout.components.core.internal.PaymentComponentEvent
import com.adyen.checkout.components.core.internal.PaymentObserverRepository
import com.adyen.checkout.components.core.internal.data.api.AnalyticsRepository
import com.adyen.checkout.components.core.internal.ui.model.GenericComponentParams
-import com.adyen.checkout.components.core.internal.util.isEmpty
import com.adyen.checkout.components.core.paymentmethod.PayByBankPaymentMethod
import com.adyen.checkout.core.internal.util.LogUtil
import com.adyen.checkout.core.internal.util.Logger
@@ -152,7 +151,7 @@ internal class DefaultPayByBankDelegate(
val paymentComponentData = PaymentComponentData(
paymentMethod = payByBankPaymentMethod,
order = order,
- amount = componentParams.amount.takeUnless { it.isEmpty },
+ amount = componentParams.amount,
)
return PayByBankComponentState(
diff --git a/paybybank/src/test/java/com/adyen/checkout/paybybank/internal/ui/DefaultPayByBankDelegateTest.kt b/paybybank/src/test/java/com/adyen/checkout/paybybank/internal/ui/DefaultPayByBankDelegateTest.kt
index d0c7266f12..208d2c2bea 100644
--- a/paybybank/src/test/java/com/adyen/checkout/paybybank/internal/ui/DefaultPayByBankDelegateTest.kt
+++ b/paybybank/src/test/java/com/adyen/checkout/paybybank/internal/ui/DefaultPayByBankDelegateTest.kt
@@ -311,7 +311,7 @@ internal class DefaultPayByBankDelegateTest(
// configurationValue, expectedComponentStateValue
arguments(Amount("EUR", 100), Amount("EUR", 100)),
arguments(Amount("USD", 0), Amount("USD", 0)),
- arguments(Amount.EMPTY, null),
+ arguments(null, null),
arguments(null, null),
)
}
diff --git a/payeasy/src/main/java/com/adyen/checkout/payeasy/PayEasyConfiguration.kt b/payeasy/src/main/java/com/adyen/checkout/payeasy/PayEasyConfiguration.kt
index 91724e7b53..6be74bf957 100644
--- a/payeasy/src/main/java/com/adyen/checkout/payeasy/PayEasyConfiguration.kt
+++ b/payeasy/src/main/java/com/adyen/checkout/payeasy/PayEasyConfiguration.kt
@@ -27,7 +27,7 @@ class PayEasyConfiguration private constructor(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount,
+ override val amount: Amount?,
override val isSubmitButtonVisible: Boolean?,
override val genericActionConfiguration: GenericActionConfiguration,
) : EContextConfiguration() {
diff --git a/qr-code/src/main/java/com/adyen/checkout/qrcode/QRCodeConfiguration.kt b/qr-code/src/main/java/com/adyen/checkout/qrcode/QRCodeConfiguration.kt
index 826b8abda3..7648eb2ba1 100644
--- a/qr-code/src/main/java/com/adyen/checkout/qrcode/QRCodeConfiguration.kt
+++ b/qr-code/src/main/java/com/adyen/checkout/qrcode/QRCodeConfiguration.kt
@@ -25,7 +25,7 @@ class QRCodeConfiguration private constructor(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount
+ override val amount: Amount?
) : Configuration {
/**
diff --git a/qr-code/src/main/java/com/adyen/checkout/qrcode/internal/ui/view/FullQRCodeView.kt b/qr-code/src/main/java/com/adyen/checkout/qrcode/internal/ui/view/FullQRCodeView.kt
index e999e04f65..21c3e09d11 100644
--- a/qr-code/src/main/java/com/adyen/checkout/qrcode/internal/ui/view/FullQRCodeView.kt
+++ b/qr-code/src/main/java/com/adyen/checkout/qrcode/internal/ui/view/FullQRCodeView.kt
@@ -23,7 +23,6 @@ import com.adyen.checkout.components.core.internal.ui.ComponentDelegate
import com.adyen.checkout.components.core.internal.ui.model.ComponentParams
import com.adyen.checkout.components.core.internal.ui.model.TimerData
import com.adyen.checkout.components.core.internal.util.CurrencyUtils
-import com.adyen.checkout.components.core.internal.util.isEmpty
import com.adyen.checkout.components.core.internal.util.toast
import com.adyen.checkout.core.exception.PermissionException
import com.adyen.checkout.core.internal.util.LogUtil
@@ -117,9 +116,10 @@ internal class FullQRCodeView @JvmOverloads constructor(
}
private fun updateAmount(componentParams: ComponentParams) {
- if (!componentParams.amount.isEmpty) {
+ val amount = componentParams.amount
+ if (amount != null) {
val formattedAmount = CurrencyUtils.formatAmount(
- componentParams.amount,
+ amount,
componentParams.shopperLocale
)
binding.textviewAmount.isVisible = true
@@ -172,6 +172,7 @@ internal class FullQRCodeView @JvmOverloads constructor(
QrCodeUIEvent.QrImageDownloadResult.Success -> {
context.toast(localizedContext.getString(R.string.checkout_qr_code_download_image_succeeded))
}
+
is QrCodeUIEvent.QrImageDownloadResult.Failure -> {
context.toast(localizedContext.getString(R.string.checkout_qr_code_download_image_failed))
Logger.e(TAG, "download file failed", event.throwable)
diff --git a/redirect/src/main/java/com/adyen/checkout/redirect/RedirectConfiguration.kt b/redirect/src/main/java/com/adyen/checkout/redirect/RedirectConfiguration.kt
index 01b53703fb..342e85017c 100644
--- a/redirect/src/main/java/com/adyen/checkout/redirect/RedirectConfiguration.kt
+++ b/redirect/src/main/java/com/adyen/checkout/redirect/RedirectConfiguration.kt
@@ -25,7 +25,7 @@ class RedirectConfiguration private constructor(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount
+ override val amount: Amount?
) : Configuration {
/**
diff --git a/sepa/src/main/java/com/adyen/checkout/sepa/SepaConfiguration.kt b/sepa/src/main/java/com/adyen/checkout/sepa/SepaConfiguration.kt
index ecafe2a694..7970b63ab7 100644
--- a/sepa/src/main/java/com/adyen/checkout/sepa/SepaConfiguration.kt
+++ b/sepa/src/main/java/com/adyen/checkout/sepa/SepaConfiguration.kt
@@ -29,7 +29,7 @@ class SepaConfiguration private constructor(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount,
+ override val amount: Amount?,
override val isSubmitButtonVisible: Boolean?,
internal val genericActionConfiguration: GenericActionConfiguration,
) : Configuration, ButtonConfiguration {
diff --git a/sepa/src/main/java/com/adyen/checkout/sepa/internal/ui/DefaultSepaDelegate.kt b/sepa/src/main/java/com/adyen/checkout/sepa/internal/ui/DefaultSepaDelegate.kt
index 887442039f..9efcf29c80 100644
--- a/sepa/src/main/java/com/adyen/checkout/sepa/internal/ui/DefaultSepaDelegate.kt
+++ b/sepa/src/main/java/com/adyen/checkout/sepa/internal/ui/DefaultSepaDelegate.kt
@@ -18,7 +18,6 @@ import com.adyen.checkout.components.core.internal.PaymentComponentEvent
import com.adyen.checkout.components.core.internal.PaymentObserverRepository
import com.adyen.checkout.components.core.internal.data.api.AnalyticsRepository
import com.adyen.checkout.components.core.internal.ui.model.ButtonComponentParams
-import com.adyen.checkout.components.core.internal.util.isEmpty
import com.adyen.checkout.components.core.paymentmethod.SepaPaymentMethod
import com.adyen.checkout.core.internal.util.LogUtil
import com.adyen.checkout.core.internal.util.Logger
@@ -131,7 +130,7 @@ internal class DefaultSepaDelegate(
val paymentComponentData = PaymentComponentData(
paymentMethod = paymentMethod,
order = order,
- amount = componentParams.amount.takeUnless { it.isEmpty },
+ amount = componentParams.amount,
)
return SepaComponentState(
data = paymentComponentData,
diff --git a/sepa/src/test/java/com/adyen/checkout/sepa/internal/ui/DefaultSepaDelegateTest.kt b/sepa/src/test/java/com/adyen/checkout/sepa/internal/ui/DefaultSepaDelegateTest.kt
index 805b0b76b4..3ad2ad8370 100644
--- a/sepa/src/test/java/com/adyen/checkout/sepa/internal/ui/DefaultSepaDelegateTest.kt
+++ b/sepa/src/test/java/com/adyen/checkout/sepa/internal/ui/DefaultSepaDelegateTest.kt
@@ -229,7 +229,7 @@ internal class DefaultSepaDelegateTest(
// configurationValue, expectedComponentStateValue
arguments(Amount("EUR", 100), Amount("EUR", 100)),
arguments(Amount("USD", 0), Amount("USD", 0)),
- arguments(Amount.EMPTY, null),
+ arguments(null, null),
arguments(null, null),
)
}
diff --git a/sessions-core/src/main/java/com/adyen/checkout/sessions/core/internal/data/model/SessionDetails.kt b/sessions-core/src/main/java/com/adyen/checkout/sessions/core/internal/data/model/SessionDetails.kt
index 807e8640e2..f7e059e2b5 100644
--- a/sessions-core/src/main/java/com/adyen/checkout/sessions/core/internal/data/model/SessionDetails.kt
+++ b/sessions-core/src/main/java/com/adyen/checkout/sessions/core/internal/data/model/SessionDetails.kt
@@ -50,7 +50,7 @@ fun SessionDetails.mapToModel(): SessionModel {
}
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
-fun SessionDetails.mapToParams(amount: Amount): SessionParams {
+fun SessionDetails.mapToParams(amount: Amount?): SessionParams {
// TODO: Once Backend provides the correct amount in the SessionSetupResponse use that in SessionDetails
return SessionParamsFactory.create(this.copy(amount = amount))
}
diff --git a/seven-eleven/src/main/java/com/adyen/checkout/seveneleven/SevenElevenConfiguration.kt b/seven-eleven/src/main/java/com/adyen/checkout/seveneleven/SevenElevenConfiguration.kt
index 44dc9f13ff..1eead288db 100644
--- a/seven-eleven/src/main/java/com/adyen/checkout/seveneleven/SevenElevenConfiguration.kt
+++ b/seven-eleven/src/main/java/com/adyen/checkout/seveneleven/SevenElevenConfiguration.kt
@@ -27,7 +27,7 @@ class SevenElevenConfiguration private constructor(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount,
+ override val amount: Amount?,
override val isSubmitButtonVisible: Boolean?,
override val genericActionConfiguration: GenericActionConfiguration,
) : EContextConfiguration() {
diff --git a/ui-core/src/main/java/com/adyen/checkout/ui/core/internal/util/PayButtonFormatter.kt b/ui-core/src/main/java/com/adyen/checkout/ui/core/internal/util/PayButtonFormatter.kt
index 4790c135b4..3aa7502cca 100644
--- a/ui-core/src/main/java/com/adyen/checkout/ui/core/internal/util/PayButtonFormatter.kt
+++ b/ui-core/src/main/java/com/adyen/checkout/ui/core/internal/util/PayButtonFormatter.kt
@@ -13,7 +13,6 @@ import androidx.annotation.RestrictTo
import androidx.annotation.StringRes
import com.adyen.checkout.components.core.Amount
import com.adyen.checkout.components.core.internal.util.CurrencyUtils
-import com.adyen.checkout.components.core.internal.util.isEmpty
import com.adyen.checkout.components.core.internal.util.isZero
import com.adyen.checkout.ui.core.R
import java.util.Locale
@@ -23,7 +22,7 @@ object PayButtonFormatter {
@Suppress("LongParameterList")
fun getPayButtonText(
- amount: Amount,
+ amount: Amount?,
locale: Locale,
localizedContext: Context,
@StringRes emptyAmountStringResId: Int = R.string.pay_button,
@@ -31,12 +30,14 @@ object PayButtonFormatter {
@StringRes positiveAmountStringResId: Int = R.string.pay_button_with_value,
): String {
return when {
- amount.isEmpty -> {
+ amount == null -> {
localizedContext.getString(emptyAmountStringResId)
}
+
amount.isZero -> {
localizedContext.getString(zeroAmountStringResId)
}
+
else -> {
localizedContext.getString(positiveAmountStringResId, CurrencyUtils.formatAmount(amount, locale))
}
diff --git a/upi/src/main/java/com/adyen/checkout/upi/UPIConfiguration.kt b/upi/src/main/java/com/adyen/checkout/upi/UPIConfiguration.kt
index 9368862963..90cd643d9b 100644
--- a/upi/src/main/java/com/adyen/checkout/upi/UPIConfiguration.kt
+++ b/upi/src/main/java/com/adyen/checkout/upi/UPIConfiguration.kt
@@ -30,7 +30,7 @@ class UPIConfiguration(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount,
+ override val amount: Amount?,
override val isSubmitButtonVisible: Boolean?,
internal val genericActionConfiguration: GenericActionConfiguration,
) : Configuration, ButtonConfiguration {
diff --git a/upi/src/main/java/com/adyen/checkout/upi/internal/ui/DefaultUPIDelegate.kt b/upi/src/main/java/com/adyen/checkout/upi/internal/ui/DefaultUPIDelegate.kt
index 7688db9192..60ff8d9fc1 100644
--- a/upi/src/main/java/com/adyen/checkout/upi/internal/ui/DefaultUPIDelegate.kt
+++ b/upi/src/main/java/com/adyen/checkout/upi/internal/ui/DefaultUPIDelegate.kt
@@ -18,7 +18,6 @@ import com.adyen.checkout.components.core.internal.PaymentComponentEvent
import com.adyen.checkout.components.core.internal.PaymentObserverRepository
import com.adyen.checkout.components.core.internal.data.api.AnalyticsRepository
import com.adyen.checkout.components.core.internal.ui.model.ButtonComponentParams
-import com.adyen.checkout.components.core.internal.util.isEmpty
import com.adyen.checkout.components.core.paymentmethod.UPIPaymentMethod
import com.adyen.checkout.core.internal.util.LogUtil
import com.adyen.checkout.core.internal.util.Logger
@@ -141,7 +140,7 @@ internal class DefaultUPIDelegate(
val paymentComponentData = PaymentComponentData(
paymentMethod = paymentMethod,
order = order,
- amount = componentParams.amount.takeUnless { it.isEmpty },
+ amount = componentParams.amount,
)
return UPIComponentState(
diff --git a/upi/src/test/java/com/adyen/checkout/upi/internal/ui/DefaultUPIDelegateTest.kt b/upi/src/test/java/com/adyen/checkout/upi/internal/ui/DefaultUPIDelegateTest.kt
index ec19b57452..a2e510da30 100644
--- a/upi/src/test/java/com/adyen/checkout/upi/internal/ui/DefaultUPIDelegateTest.kt
+++ b/upi/src/test/java/com/adyen/checkout/upi/internal/ui/DefaultUPIDelegateTest.kt
@@ -264,7 +264,7 @@ internal class DefaultUPIDelegateTest(
// configurationValue, expectedComponentStateValue
arguments(Amount("EUR", 100), Amount("EUR", 100)),
arguments(Amount("USD", 0), Amount("USD", 0)),
- arguments(Amount.EMPTY, null),
+ arguments(null, null),
arguments(null, null),
)
}
diff --git a/voucher/src/main/java/com/adyen/checkout/voucher/VoucherConfiguration.kt b/voucher/src/main/java/com/adyen/checkout/voucher/VoucherConfiguration.kt
index 3381accfce..6488c45999 100644
--- a/voucher/src/main/java/com/adyen/checkout/voucher/VoucherConfiguration.kt
+++ b/voucher/src/main/java/com/adyen/checkout/voucher/VoucherConfiguration.kt
@@ -26,7 +26,7 @@ class VoucherConfiguration private constructor(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount,
+ override val amount: Amount?,
) : Configuration {
/**
diff --git a/wechatpay/src/main/java/com/adyen/checkout/wechatpay/WeChatPayActionConfiguration.kt b/wechatpay/src/main/java/com/adyen/checkout/wechatpay/WeChatPayActionConfiguration.kt
index e89fadfa93..60fcfc3681 100644
--- a/wechatpay/src/main/java/com/adyen/checkout/wechatpay/WeChatPayActionConfiguration.kt
+++ b/wechatpay/src/main/java/com/adyen/checkout/wechatpay/WeChatPayActionConfiguration.kt
@@ -25,7 +25,7 @@ class WeChatPayActionConfiguration private constructor(
override val environment: Environment,
override val clientKey: String,
override val analyticsConfiguration: AnalyticsConfiguration?,
- override val amount: Amount,
+ override val amount: Amount?,
) : Configuration {
/**
From 72405b0a865b20b6d73b0ea7695289f036b6df3b Mon Sep 17 00:00:00 2001
From: Oscar Spruit
Date: Fri, 29 Sep 2023 16:01:15 +0200
Subject: [PATCH 16/23] Disable phone number collection of 3DS2 SDK
AUTHN-967
---
.../adyen3ds2/internal/ui/DefaultAdyen3DS2Delegate.kt | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/3ds2/src/main/java/com/adyen/checkout/adyen3ds2/internal/ui/DefaultAdyen3DS2Delegate.kt b/3ds2/src/main/java/com/adyen/checkout/adyen3ds2/internal/ui/DefaultAdyen3DS2Delegate.kt
index d818898ced..6d5ecfc5af 100644
--- a/3ds2/src/main/java/com/adyen/checkout/adyen3ds2/internal/ui/DefaultAdyen3DS2Delegate.kt
+++ b/3ds2/src/main/java/com/adyen/checkout/adyen3ds2/internal/ui/DefaultAdyen3DS2Delegate.kt
@@ -204,7 +204,9 @@ internal class DefaultAdyen3DS2Delegate(
fingerprintToken.directoryServerPublicKey,
// directoryServerRootCertificates
fingerprintToken.directoryServerRootCertificates,
- ).build()
+ )
+ .deviceParameterBlockList(setOf(PHONE_NUMBER_PARAMETER))
+ .build()
val coroutineExceptionHandler = CoroutineExceptionHandler { _, throwable ->
Logger.e(TAG, "Unexpected uncaught 3DS2 Exception", throwable)
@@ -491,5 +493,6 @@ internal class DefaultAdyen3DS2Delegate(
private const val AUTHORIZATION_TOKEN_KEY = "authorization_token"
private const val DEFAULT_CHALLENGE_TIME_OUT = 10
private const val PROTOCOL_VERSION_2_1_0 = "2.1.0"
+ private const val PHONE_NUMBER_PARAMETER = "A005"
}
}
From acb75a88afd619b68b5db1c03f6580af727869ed Mon Sep 17 00:00:00 2001
From: Oscar Spruit
Date: Mon, 2 Oct 2023 15:28:49 +0200
Subject: [PATCH 17/23] Move 3DS2 param block list to component parameters
This makes the delegate testable again and also allows to make this
param configurable in the future.
AUTHN-967
---
.../adyen3ds2/internal/ui/DefaultAdyen3DS2Delegate.kt | 3 +--
.../internal/ui/model/Adyen3DS2ComponentParams.kt | 1 +
.../ui/model/Adyen3DS2ComponentParamsMapper.kt | 10 ++++++++++
.../internal/ui/DefaultAdyen3DS2DelegateTest.kt | 6 +++---
.../ui/model/Adyen3DS2ComponentParamsMapperTest.kt | 1 +
5 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/3ds2/src/main/java/com/adyen/checkout/adyen3ds2/internal/ui/DefaultAdyen3DS2Delegate.kt b/3ds2/src/main/java/com/adyen/checkout/adyen3ds2/internal/ui/DefaultAdyen3DS2Delegate.kt
index 6d5ecfc5af..ecd48c3b4a 100644
--- a/3ds2/src/main/java/com/adyen/checkout/adyen3ds2/internal/ui/DefaultAdyen3DS2Delegate.kt
+++ b/3ds2/src/main/java/com/adyen/checkout/adyen3ds2/internal/ui/DefaultAdyen3DS2Delegate.kt
@@ -205,7 +205,7 @@ internal class DefaultAdyen3DS2Delegate(
// directoryServerRootCertificates
fingerprintToken.directoryServerRootCertificates,
)
- .deviceParameterBlockList(setOf(PHONE_NUMBER_PARAMETER))
+ .deviceParameterBlockList(componentParams.deviceParameterBlockList)
.build()
val coroutineExceptionHandler = CoroutineExceptionHandler { _, throwable ->
@@ -493,6 +493,5 @@ internal class DefaultAdyen3DS2Delegate(
private const val AUTHORIZATION_TOKEN_KEY = "authorization_token"
private const val DEFAULT_CHALLENGE_TIME_OUT = 10
private const val PROTOCOL_VERSION_2_1_0 = "2.1.0"
- private const val PHONE_NUMBER_PARAMETER = "A005"
}
}
diff --git a/3ds2/src/main/java/com/adyen/checkout/adyen3ds2/internal/ui/model/Adyen3DS2ComponentParams.kt b/3ds2/src/main/java/com/adyen/checkout/adyen3ds2/internal/ui/model/Adyen3DS2ComponentParams.kt
index 9c9f3495e7..670b5cba66 100644
--- a/3ds2/src/main/java/com/adyen/checkout/adyen3ds2/internal/ui/model/Adyen3DS2ComponentParams.kt
+++ b/3ds2/src/main/java/com/adyen/checkout/adyen3ds2/internal/ui/model/Adyen3DS2ComponentParams.kt
@@ -24,4 +24,5 @@ internal data class Adyen3DS2ComponentParams(
override val amount: Amount?,
val uiCustomization: UiCustomization?,
val threeDSRequestorAppURL: String?,
+ val deviceParameterBlockList: Set?,
) : ComponentParams
diff --git a/3ds2/src/main/java/com/adyen/checkout/adyen3ds2/internal/ui/model/Adyen3DS2ComponentParamsMapper.kt b/3ds2/src/main/java/com/adyen/checkout/adyen3ds2/internal/ui/model/Adyen3DS2ComponentParamsMapper.kt
index 50c9d234c1..c17730ced5 100644
--- a/3ds2/src/main/java/com/adyen/checkout/adyen3ds2/internal/ui/model/Adyen3DS2ComponentParamsMapper.kt
+++ b/3ds2/src/main/java/com/adyen/checkout/adyen3ds2/internal/ui/model/Adyen3DS2ComponentParamsMapper.kt
@@ -8,6 +8,7 @@
package com.adyen.checkout.adyen3ds2.internal.ui.model
+import androidx.annotation.VisibleForTesting
import com.adyen.checkout.adyen3ds2.Adyen3DS2Configuration
import com.adyen.checkout.components.core.internal.ui.model.AnalyticsParams
import com.adyen.checkout.components.core.internal.ui.model.ComponentParams
@@ -38,6 +39,8 @@ internal class Adyen3DS2ComponentParamsMapper(
amount = amount,
uiCustomization = uiCustomization,
threeDSRequestorAppURL = threeDSRequestorAppURL,
+ // Hardcoded for now, but in the feature we could make this configurable
+ deviceParameterBlockList = DEVICE_PARAMETER_BLOCK_LIST,
)
}
@@ -63,4 +66,11 @@ internal class Adyen3DS2ComponentParamsMapper(
amount = sessionParams.amount ?: amount,
)
}
+
+ companion object {
+ private const val PHONE_NUMBER_PARAMETER = "A005"
+
+ @VisibleForTesting
+ internal val DEVICE_PARAMETER_BLOCK_LIST = setOf(PHONE_NUMBER_PARAMETER)
+ }
}
diff --git a/3ds2/src/test/java/com/adyen/checkout/adyen3ds2/internal/ui/DefaultAdyen3DS2DelegateTest.kt b/3ds2/src/test/java/com/adyen/checkout/adyen3ds2/internal/ui/DefaultAdyen3DS2DelegateTest.kt
index 01996dd770..c2b41c4163 100644
--- a/3ds2/src/test/java/com/adyen/checkout/adyen3ds2/internal/ui/DefaultAdyen3DS2DelegateTest.kt
+++ b/3ds2/src/test/java/com/adyen/checkout/adyen3ds2/internal/ui/DefaultAdyen3DS2DelegateTest.kt
@@ -43,7 +43,6 @@ import com.adyen.threeds2.exception.InvalidInputException
import com.adyen.threeds2.exception.SDKRuntimeException
import com.adyen.threeds2.parameters.ChallengeParameters
import kotlinx.coroutines.CoroutineScope
-import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.TestDispatcher
import kotlinx.coroutines.test.runTest
import org.json.JSONException
@@ -66,7 +65,6 @@ import org.mockito.kotlin.whenever
import java.io.IOException
import java.util.Locale
-@OptIn(ExperimentalCoroutinesApi::class)
@ExtendWith(MockitoExtension::class, TestDispatcherExtension::class)
internal class DefaultAdyen3DS2DelegateTest(
@Mock private val submitFingerprintRepository: SubmitFingerprintRepository,
@@ -89,7 +87,9 @@ internal class DefaultAdyen3DS2DelegateTest(
observerRepository = ActionObserverRepository(),
savedStateHandle = SavedStateHandle(),
componentParams = Adyen3DS2ComponentParamsMapper(null, null)
- .mapToParams(configuration, null),
+ .mapToParams(configuration, null)
+ // Set it to null to avoid a crash in 3DS2 library (they use Android APIs)
+ .copy(deviceParameterBlockList = null),
submitFingerprintRepository = submitFingerprintRepository,
paymentDataRepository = paymentDataRepository,
adyen3DS2Serializer = adyen3DS2Serializer,
diff --git a/3ds2/src/test/java/com/adyen/checkout/adyen3ds2/internal/ui/model/Adyen3DS2ComponentParamsMapperTest.kt b/3ds2/src/test/java/com/adyen/checkout/adyen3ds2/internal/ui/model/Adyen3DS2ComponentParamsMapperTest.kt
index e58f8579cb..2c0076351f 100644
--- a/3ds2/src/test/java/com/adyen/checkout/adyen3ds2/internal/ui/model/Adyen3DS2ComponentParamsMapperTest.kt
+++ b/3ds2/src/test/java/com/adyen/checkout/adyen3ds2/internal/ui/model/Adyen3DS2ComponentParamsMapperTest.kt
@@ -117,6 +117,7 @@ internal class Adyen3DS2ComponentParamsMapperTest {
amount = amount,
uiCustomization = uiCustomization,
threeDSRequestorAppURL = threeDSRequestorAppURL,
+ deviceParameterBlockList = Adyen3DS2ComponentParamsMapper.DEVICE_PARAMETER_BLOCK_LIST,
)
companion object {
From bb4d6a4dbe7ba73e5ba264f2e795929a872bee24 Mon Sep 17 00:00:00 2001
From: Oscar Spruit
Date: Mon, 2 Oct 2023 15:36:01 +0200
Subject: [PATCH 18/23] Add ProGuard rules for Retrofit
---
example-app/proguard-rules.pro | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/example-app/proguard-rules.pro b/example-app/proguard-rules.pro
index c95d789c06..82c173a12d 100644
--- a/example-app/proguard-rules.pro
+++ b/example-app/proguard-rules.pro
@@ -23,3 +23,8 @@
# Temporary rules to fix an issue with the Cash App SDK
-dontwarn kotlinx.serialization.KSerializer
-dontwarn kotlinx.serialization.Serializable
+
+# Temporary rules to fix an issue with Retrofit
+-keep,allowobfuscation,allowshrinking interface retrofit2.Call
+-keep,allowobfuscation,allowshrinking class retrofit2.Response
+-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation
From 9a8e42e012aab11816cc8039e2344a125606be4d Mon Sep 17 00:00:00 2001
From: Oscar Spruit
Date: Wed, 11 Oct 2023 15:23:27 +0200
Subject: [PATCH 19/23] Remove @RestrictTo from classes that are indirectly
exposed
COAND-803
---
.../internal/ActionHandlingPaymentMethodConfigurationBuilder.kt | 2 --
.../components/core/internal/BaseConfigurationBuilder.kt | 2 --
.../core/internal/provider/PaymentComponentProvider.kt | 2 --
.../core/internal/provider/StoredPaymentComponentProvider.kt | 2 --
.../core/internal/provider/SessionPaymentComponentProvider.kt | 2 --
.../internal/provider/SessionStoredPaymentComponentProvider.kt | 2 --
6 files changed, 12 deletions(-)
diff --git a/action-core/src/main/java/com/adyen/checkout/action/core/internal/ActionHandlingPaymentMethodConfigurationBuilder.kt b/action-core/src/main/java/com/adyen/checkout/action/core/internal/ActionHandlingPaymentMethodConfigurationBuilder.kt
index db2032318f..befec4b98f 100644
--- a/action-core/src/main/java/com/adyen/checkout/action/core/internal/ActionHandlingPaymentMethodConfigurationBuilder.kt
+++ b/action-core/src/main/java/com/adyen/checkout/action/core/internal/ActionHandlingPaymentMethodConfigurationBuilder.kt
@@ -9,7 +9,6 @@
package com.adyen.checkout.action.core.internal
import android.content.Context
-import androidx.annotation.RestrictTo
import com.adyen.checkout.action.core.GenericActionConfiguration
import com.adyen.checkout.adyen3ds2.Adyen3DS2Configuration
import com.adyen.checkout.await.AwaitConfiguration
@@ -24,7 +23,6 @@ import com.adyen.checkout.wechatpay.WeChatPayActionConfiguration
import java.util.Locale
@Suppress("UNCHECKED_CAST")
-@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
abstract class ActionHandlingPaymentMethodConfigurationBuilder<
ConfigurationT : Configuration,
BuilderT : BaseConfigurationBuilder
diff --git a/components-core/src/main/java/com/adyen/checkout/components/core/internal/BaseConfigurationBuilder.kt b/components-core/src/main/java/com/adyen/checkout/components/core/internal/BaseConfigurationBuilder.kt
index b94f86f511..d6cef5a123 100644
--- a/components-core/src/main/java/com/adyen/checkout/components/core/internal/BaseConfigurationBuilder.kt
+++ b/components-core/src/main/java/com/adyen/checkout/components/core/internal/BaseConfigurationBuilder.kt
@@ -1,7 +1,6 @@
package com.adyen.checkout.components.core.internal
import android.content.Context
-import androidx.annotation.RestrictTo
import com.adyen.checkout.components.core.Amount
import com.adyen.checkout.components.core.AnalyticsConfiguration
import com.adyen.checkout.components.core.internal.util.ValidationUtils
@@ -11,7 +10,6 @@ import com.adyen.checkout.core.exception.CheckoutException
import com.adyen.checkout.core.internal.util.LocaleUtil
import java.util.Locale
-@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
abstract class BaseConfigurationBuilder<
ConfigurationT : Configuration,
BuilderT : BaseConfigurationBuilder
diff --git a/components-core/src/main/java/com/adyen/checkout/components/core/internal/provider/PaymentComponentProvider.kt b/components-core/src/main/java/com/adyen/checkout/components/core/internal/provider/PaymentComponentProvider.kt
index a278ec9215..d3da63fbbf 100644
--- a/components-core/src/main/java/com/adyen/checkout/components/core/internal/provider/PaymentComponentProvider.kt
+++ b/components-core/src/main/java/com/adyen/checkout/components/core/internal/provider/PaymentComponentProvider.kt
@@ -9,7 +9,6 @@ package com.adyen.checkout.components.core.internal.provider
import android.app.Application
import androidx.activity.ComponentActivity
-import androidx.annotation.RestrictTo
import androidx.fragment.app.Fragment
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.ViewModelStoreOwner
@@ -22,7 +21,6 @@ import com.adyen.checkout.components.core.internal.Configuration
import com.adyen.checkout.components.core.internal.PaymentComponent
import com.adyen.checkout.components.core.internal.util.requireApplication
-@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
interface PaymentComponentProvider<
ComponentT : PaymentComponent,
ConfigurationT : Configuration,
diff --git a/components-core/src/main/java/com/adyen/checkout/components/core/internal/provider/StoredPaymentComponentProvider.kt b/components-core/src/main/java/com/adyen/checkout/components/core/internal/provider/StoredPaymentComponentProvider.kt
index 7d68143491..5167df31e8 100644
--- a/components-core/src/main/java/com/adyen/checkout/components/core/internal/provider/StoredPaymentComponentProvider.kt
+++ b/components-core/src/main/java/com/adyen/checkout/components/core/internal/provider/StoredPaymentComponentProvider.kt
@@ -9,7 +9,6 @@ package com.adyen.checkout.components.core.internal.provider
import android.app.Application
import androidx.activity.ComponentActivity
-import androidx.annotation.RestrictTo
import androidx.fragment.app.Fragment
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.ViewModelStoreOwner
@@ -22,7 +21,6 @@ import com.adyen.checkout.components.core.internal.Configuration
import com.adyen.checkout.components.core.internal.PaymentComponent
import com.adyen.checkout.components.core.internal.util.requireApplication
-@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
interface StoredPaymentComponentProvider<
ComponentT : PaymentComponent,
ConfigurationT : Configuration,
diff --git a/sessions-core/src/main/java/com/adyen/checkout/sessions/core/internal/provider/SessionPaymentComponentProvider.kt b/sessions-core/src/main/java/com/adyen/checkout/sessions/core/internal/provider/SessionPaymentComponentProvider.kt
index 85b46e2592..9d5b3a1241 100644
--- a/sessions-core/src/main/java/com/adyen/checkout/sessions/core/internal/provider/SessionPaymentComponentProvider.kt
+++ b/sessions-core/src/main/java/com/adyen/checkout/sessions/core/internal/provider/SessionPaymentComponentProvider.kt
@@ -10,7 +10,6 @@ package com.adyen.checkout.sessions.core.internal.provider
import android.app.Application
import androidx.activity.ComponentActivity
-import androidx.annotation.RestrictTo
import androidx.fragment.app.Fragment
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.ViewModelStoreOwner
@@ -23,7 +22,6 @@ import com.adyen.checkout.components.core.internal.util.requireApplication
import com.adyen.checkout.sessions.core.CheckoutSession
import com.adyen.checkout.sessions.core.SessionComponentCallback
-@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
interface SessionPaymentComponentProvider<
ComponentT : PaymentComponent,
ConfigurationT : Configuration,
diff --git a/sessions-core/src/main/java/com/adyen/checkout/sessions/core/internal/provider/SessionStoredPaymentComponentProvider.kt b/sessions-core/src/main/java/com/adyen/checkout/sessions/core/internal/provider/SessionStoredPaymentComponentProvider.kt
index 15d8a45eea..321b3cf944 100644
--- a/sessions-core/src/main/java/com/adyen/checkout/sessions/core/internal/provider/SessionStoredPaymentComponentProvider.kt
+++ b/sessions-core/src/main/java/com/adyen/checkout/sessions/core/internal/provider/SessionStoredPaymentComponentProvider.kt
@@ -10,7 +10,6 @@ package com.adyen.checkout.sessions.core.internal.provider
import android.app.Application
import androidx.activity.ComponentActivity
-import androidx.annotation.RestrictTo
import androidx.fragment.app.Fragment
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.ViewModelStoreOwner
@@ -23,7 +22,6 @@ import com.adyen.checkout.components.core.internal.util.requireApplication
import com.adyen.checkout.sessions.core.CheckoutSession
import com.adyen.checkout.sessions.core.SessionComponentCallback
-@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
interface SessionStoredPaymentComponentProvider<
ComponentT : PaymentComponent,
ConfigurationT : Configuration,
From 6ad8d34cf5c97dd137887460e50698d24e150e04 Mon Sep 17 00:00:00 2001
From: josephj
Date: Fri, 13 Oct 2023 15:16:04 +0200
Subject: [PATCH 20/23] Update version to 5.0.0
---
README.md | 4 ++--
.../components/core/internal/data/api/AnalyticsMapperTest.kt | 2 +-
dependencies.gradle | 2 +-
example-app/build.gradle | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/README.md b/README.md
index d9154e4983..c81f09caf9 100644
--- a/README.md
+++ b/README.md
@@ -33,11 +33,11 @@ If you are upgrading from 3.x.x to a current release, check out our [migration g
Import the Component module for the Payment Method you want to use by adding it to your `build.gradle` file.
For example, for the Drop-in solution you should add:
```groovy
-implementation "com.adyen.checkout:drop-in:4.13.1"
+implementation "com.adyen.checkout:drop-in:5.0.0"
```
For a Credit Card component you should add:
```groovy
-implementation "com.adyen.checkout:card:4.13.1"
+implementation "com.adyen.checkout:card:5.0.0"
```
### Client Key
diff --git a/components-core/src/test/java/com/adyen/checkout/components/core/internal/data/api/AnalyticsMapperTest.kt b/components-core/src/test/java/com/adyen/checkout/components/core/internal/data/api/AnalyticsMapperTest.kt
index 21aa1e2171..e5ec977831 100644
--- a/components-core/src/test/java/com/adyen/checkout/components/core/internal/data/api/AnalyticsMapperTest.kt
+++ b/components-core/src/test/java/com/adyen/checkout/components/core/internal/data/api/AnalyticsMapperTest.kt
@@ -110,7 +110,7 @@ internal class AnalyticsMapperTest {
)
val expected = AnalyticsSetupRequest(
- version = "5.0.0-beta01",
+ version = "5.0.0",
channel = "android",
platform = "android",
locale = "en_US",
diff --git a/dependencies.gradle b/dependencies.gradle
index 5c2846941d..2152c041d1 100644
--- a/dependencies.gradle
+++ b/dependencies.gradle
@@ -16,7 +16,7 @@ ext {
// just for example app, don't need to increment
version_code = 1
// The version_name format is "major.minor.patch(-(alpha|beta|rc)[0-9]{2}){0,1}" (e.g. 3.0.0, 3.1.1-alpha04 or 3.1.4-rc01 etc).
- version_name = "5.0.0-beta01"
+ version_name = "5.0.0"
// Build Script
android_gradle_plugin_version = '8.1.1'
diff --git a/example-app/build.gradle b/example-app/build.gradle
index f760245eaa..8274070c5c 100644
--- a/example-app/build.gradle
+++ b/example-app/build.gradle
@@ -62,7 +62,7 @@ android {
dependencies {
// Checkout
implementation project(':drop-in')
-// implementation "com.adyen.checkout:drop-in:4.13.1"
+// implementation "com.adyen.checkout:drop-in:5.0.0"
// Dependencies
implementation libraries.kotlinCoroutines
From 505e9494f6f2e2201bf302902635b129d92bf330 Mon Sep 17 00:00:00 2001
From: josephj
Date: Fri, 13 Oct 2023 16:18:07 +0200
Subject: [PATCH 21/23] Update README.md
---
README.md | 224 +++++++++++++++---------------------------------------
1 file changed, 60 insertions(+), 164 deletions(-)
diff --git a/README.md b/README.md
index c81f09caf9..ca66e3a561 100644
--- a/README.md
+++ b/README.md
@@ -1,14 +1,14 @@
![Checkout Android Logo][header.image]
-[![Maven Central](https://img.shields.io/maven-central/v/com.adyen.checkout/drop-in)](https://mvnrepository.com/artifact/com.adyen.checkout)
-[![Build status](https://github.com/Adyen/adyen-android/actions/workflows/check_release.yml/badge.svg)](https://github.com/Adyen/adyen-android/actions)
-[![GitHub](https://img.shields.io/github/license/Adyen/adyen-android)](https://raw.githubusercontent.com/Adyen/adyen-android/develop/LICENSE)
+[![Maven Central][shield.mavenCentral.image]][shield.mavenCentral.link]
+[![Build status][shield.buildStatus.image]][shield.buildStatus.link]
+[![License][shield.license.image]][shield.license.link]
# Adyen Android
Adyen Android allows you to accept in-app payments by providing you with the building blocks you need to create a checkout experience.
-For an overview of how you can integrate with Adyen on Android check out the [Documentation Website][docs.android]
+For an overview of how you can integrate with Adyen on Android check out the [documentation][docs.android].
@@ -16,204 +16,100 @@ For an overview of how you can integrate with Adyen on Android check out the [Do
-## Support
+## Prerequisites
-If you have a feature request, or spotted a bug or a technical problem, create a GitHub issue. For other questions, contact our [support team][adyen.support].
+* [Adyen test account][adyen.testAccount]
+* [API key][docs.apiKey]
+* [Client key][docs.clientKey]
## Installation
-The Components are available through [Maven Central][dl], you only need to add the Gradle dependency.
-
-### Migrate from v3
-
-If you are upgrading from 3.x.x to a current release, check out our [migration guide][migration.guide].
+There are two main integration types: [Drop-in][docs.dropIn] and [Components][docs.components].
+Import the corresponding module in your `build.gradle` file.
-### Import with Gradle
+### With Jetpack Compose
-Import the Component module for the Payment Method you want to use by adding it to your `build.gradle` file.
-For example, for the Drop-in solution you should add:
+For Drop-in:
```groovy
-implementation "com.adyen.checkout:drop-in:5.0.0"
+implementation "com.adyen.checkout:drop-in-compose:5.0.0"
```
-For a Credit Card component you should add:
+For the Credit Card component:
```groovy
implementation "com.adyen.checkout:card:5.0.0"
+implementation "com.adyen.checkout:components-compose:5.0.0"
```
-### Client Key
-
-Drop-in and Components require a [client key][client.key], that should be provided in the `Configuration.Builder` constructors.
-
-## Drop-in
-
-The Drop-in is the implementation that handles the presentation of all available payment methods and the subsequent entry of a customer's payment details. It is initialized with the response of [`/paymentMethods`][apiExplorer.paymentMethods], and provides everything you need to make an API call to [`/payments`][apiExplorer.payments] and [`/payments/details`][apiExplorer.paymentsDetails].
-
-### Usage
-
-The Drop-in requires the response of the `/paymentMethods` endpoint to be initialized. To pass the response to Drop-in, decode the response to the `PaymentMethodsApiResponse` class.
-
-You can provide the raw JSONObject to the `SERIALIZER` object to deserialize the data.
-```kotlin
-val paymentMethodsApiResponse = PaymentMethodsApiResponse.SERIALIZER.deserialize(jsonObject)
-```
-
-The Drop-in relies on you to implement the calls to your server.
-When calling [`/payments`][apiExplorer.payments] or [`/payments/details`][apiExplorer.paymentsDetails] is required, it will trigger an intent to the `DropInService` which you need to extend.
-The data comes as a `JSONObject` that you can use to compose your final `/payments` call on your back end.
-After the call, you return a `DropInServiceResult` with a certain type, each type expects different parameters.
-- `DropInServiceResult.Action` - If the result contains an `action` object, return it in the `actionJSON` param to continue the payment flow.
-- `DropInServiceResult.Finished` - If there is no `action` the payment flow is finished, the `result` will be passed along.
-- `DropInServiceResult.Error` - If an error happened during the connection.
-
-```kotlin
-class YourDropInService : DropInService() {
- // Submitting a payment request
- override fun makePaymentsCall(paymentComponentJson: JSONObject): DropInServiceResult {
- // Your server should make a /payments call containing the `paymentComponentJson`
- // Create the `DropInServiceResult` based on the /payments response
- return DropInServiceResult.Action("action JSON object")
- }
- // Submitting additional payment details
- override fun makeDetailsCall(actionComponentJson: JSONObject): DropInServiceResult {
- // Your server should make a /payments/details call containing the `actionComponentJson`
- // Create the `DropInServiceResult` based on the /payments/details response
- return DropInServiceResult.Finished("Authorised")
- }
-}
-```
-
-Don't forget to also add the service your manifest.
-```xml
-
-```
-
-Configure Drop-in:
-
-```kotlin
-// Optional, if you want to display the amount and currency. In this example, the Pay button will display 10 EUR.
-val amount = Amount().apply {
- currency = "EUR"
- value = 10_00
-}
-
-val dropInConfiguration = DropInConfiguration.Builder(YourContext, YourDropInService::class.java, "YOUR_CLIENT_KEY")
- .setAmount(amount)
- .setShopperLocale(shopperLocale)
- .build()
-```
-
-Optional - Configure specific payment methods:
-
-```kotlin
-val cardConfiguration = CardConfiguration.Builder(YourContext, "YOUR_CLIENT_KEY")
- .build()
+### Without Jetpack Compose
-val dropInConfiguration = DropInConfiguration.Builder(YourContext, YourDropInService::class.java, "YOUR_CLIENT_KEY")
- // ...
- .addCardConfiguration(cardConfiguration)
- .build()
+For Drop-in:
+```groovy
+implementation "com.adyen.checkout:drop-in:5.0.0"
```
-
-You can find an example on how to create the `cardConfiguration` in the [Components](#components) section.
-
-After serializing the payment methods and creating the configuration, the Drop-in is ready to be initialized. Just call the `DropIn.startPayment()` method. Optionally, you can pass a `resultIntent` to be launched after Drop-in finishes (for example, a `ResultActivity`).
-
-```kotlin
-//Optional. In this example, ResultActivity will be launched after Drop-in finishes
-val resultIntent = Intent(YourContext, ResultActivity::class.java)
-
-DropIn.startPayment(YourContext, paymentMethodsApiResponse, dropInConfiguration, resultIntent)
+For the Credit Card component:
+```groovy
+implementation "com.adyen.checkout:card:5.0.0"
```
-To handle the Drop-in result, call `DropIn.handleActivityResult` inside `onActivityResult` within the activity that initiated the payment (`DropIn.startPayment`). The result is obtained in the `DropInResult` wrapper class:
-
-```kotlin
-class CheckoutActivity : Activity() {
- override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
- super.onActivityResult(requestCode, resultCode, data)
- val dropInResult = DropIn.handleActivityResult(requestCode, resultCode, data) ?: return
- when (dropInResult) {
- is DropInResult.Finished -> handleFinished(dropInResult.result) // will not be called if a resultIntent was passed to DropIn.startPayment
- is DropInResult.Error -> handleError(dropInResult.reason)
- is DropInResult.CancelledByUser -> handleCancelled()
- }
- }
-}
-```
+The library is available on [Maven Central][mavenRepo].
-Additionally, if you specified a `resultIntent` when calling `DropIn.startPayment`, simply call `DropIn.getDropInResultFromIntent` inside `onCreate` within the newly launched activity:
+## Migrate from v4
-```kotlin
-class ResultActivity : Activity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- val result = DropIn.getDropInResultFromIntent(intent)
- }
-}
-```
+If you are upgrading from 4.x.x to a current release, check out our [migration guide][migration.guide].
-## Components
+## ProGuard
-In order to have more flexibility over the checkout flow, you can use our Components to present each payment method individually in your own Activity.
+If you use ProGuard or R8, you do not need to manually add any rules, as they are automatically embedded in the artifacts.
+Please let us know if you find any issues.
-To do that you need the data of that specific payment method parsed to the `PaymentMethod` class, and to create the configuration object (check out the [docs][docs.cardConfiguration] for a more detailed guide on how to initialize the `CardConfiguration.Builder`).
+## Support
-```kotlin
-val cardConfiguration = CardConfiguration.Builder(context, "YOUR_CLIENT_KEY") .build()
+If you have a feature request, or spotted a bug or a technical problem, [create an issue here][github.newIssue].
-val cardComponent = CardComponent.PROVIDER.get(this@YourActivity, paymentMethod, cardConfiguration)
-```
+For other questions, [contact our support team][adyen.support].
-Then you need to add the Component View to your layout.
-```xml
-
-```
+## Analytics and data tracking
-Then, after the component is initialized, you can attach it to the view to start getting user data.
-```kotlin
-cardView.attach(cardComponent, this@YourActivity)
-```
+Starting [5.0.0][analytics.firstVersion] the Drop-in and Components integrations contain analytics and tracking features that are turned on by default. Find out more about [what we track and how you can control it][docs.analytics].
-From this moment you will start receiving updates when the user inputs data. When the data is valid, you can send it to the `/payments` endpoint.
-```kotlin
-cardComponent.observe(this) { paymentComponentState ->
- if (paymentComponentState?.isValid == true) {
- // When the shopper proceeds to pay, pass the `paymentComponentState.data` to your server to send a /payments request
- sendPayment(paymentComponentState.data)
- }
-}
-```
+## Contributing
-## ProGuard
+We merge every pull request into the `develop` branch. We aim to keep `develop` in good shape, which allows us to release a new version whenever we need to.
-If you use ProGuard or R8, you do not need to manually add any rules, as they are automatically embedded in the artifacts.
-Please let us know if you find any issues.
+Have a look at our [contributing guidelines][contributing.guidelines] to find out how to raise a pull request.
## See also
-* [Android Documentation][docs.android]
+* [Android API documentation][dokka]
* [Adyen Checkout Documentation][docs.checkout]
-* [API Reference][docs.apiReference]
+* [Adyen API Explorer][docs.apiExplorer]
## License
-This repository is open source and available under the MIT license. For more information, see the LICENSE file.
+This repository is available under the [MIT license](LICENSE).
[header.image]: https://user-images.githubusercontent.com/9079915/198013698-139bf6f1-a15a-447d-8eed-97ce1354b43f.png
+[shield.mavenCentral.image]: https://img.shields.io/maven-central/v/com.adyen.checkout/drop-in
+[shield.mavenCentral.link]: https://mvnrepository.com/artifact/com.adyen.checkout
+[shield.buildStatus.image]: https://github.com/Adyen/adyen-android/actions/workflows/check_release.yml/badge.svg
+[shield.buildStatus.link]: https://github.com/Adyen/adyen-android/actions
+[shield.license.image]: https://img.shields.io/github/license/Adyen/adyen-android
+[shield.license.link]: LICENSE
+[docs.android]: https://docs.adyen.com/online-payments/build-your-integration/?platform=Android
[header.preview]: config/docs/dropin-android.jpg
+[adyen.testAccount]: https://www.adyen.com/signup
+[docs.apiKey]: https://docs.adyen.com/development-resources/how-to-get-the-api-key
+[docs.clientKey]: https://docs.adyen.com/development-resources/client-side-authentication#get-your-client-key
+[docs.dropIn]: https://docs.adyen.com/online-payments/build-your-integration/?platform=Android&integration=Drop-in
+[docs.components]: https://docs.adyen.com/online-payments/build-your-integration/?platform=Android&integration=Components
+[mavenRepo]: https://repo1.maven.org/maven2/com/adyen/checkout/
+[migration.guide]: https://docs.adyen.com/online-payments/build-your-integration/migrate-to-android-5-0-0
+[github.newIssue]: https://github.com/Adyen/adyen-android/issues/new/choose
+[adyen.support]: https://www.adyen.help/hc/en-us/requests/new
+[analytics.firstVersion]: https://github.com/Adyen/adyen-android/releases/tag/5.0.0
+[docs.analytics]: https://docs.adyen.com/online-payments/analytics-and-data-tracking
+[contributing.guidelines]: https://github.com/Adyen/.github/blob/main/CONTRIBUTING.md
+[dokka]: https://adyen.github.io/adyen-android/
[docs.checkout]: https://docs.adyen.com/online-payments/
-[docs.android]: https://docs.adyen.com/online-payments/android/
-[dl]: https://repo1.maven.org/maven2/com/adyen/checkout/
-[apiExplorer.paymentMethods]: https://docs.adyen.com/api-explorer/#/CheckoutService/v67/post/paymentMethods
-[apiExplorer.payments]: https://docs.adyen.com/api-explorer/#/CheckoutService/v67/post/payments
-[apiExplorer.paymentsDetails]: https://docs.adyen.com/api-explorer/#/CheckoutService/v67/post/payments/details
-[adyen.support]: https://support.adyen.com/hc/en-us/requests/new?ticket_form_id=360000705420
-[docs.cardConfiguration]: https://docs.adyen.com/online-payments/android/components#step-1-set-up-components
-[client.key]: https://docs.adyen.com/online-payments/android/drop-in#client-key
-[migration.guide]: https://docs.adyen.com/online-payments/android/migrate-to-android-4-0-0
-[docs.apiReference]: https://docs.adyen.com/online-payments/api-only/
+[docs.apiExplorer]: https://docs.adyen.com/api-explorer/
From e24f8c37de4f29facc13d27cd5cb183ec03b86a5 Mon Sep 17 00:00:00 2001
From: josephj
Date: Fri, 13 Oct 2023 16:40:34 +0200
Subject: [PATCH 22/23] Update RELEASE_NOTES.md for 5.0.0
---
RELEASE_NOTES.md | 50 +++++++++---------------------------------------
1 file changed, 9 insertions(+), 41 deletions(-)
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index 18ea1a10e3..399a9e5e18 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -8,54 +8,22 @@
[//]: # ( # Deprecated)
[//]: # ( - Configurations public constructor are deprecated, please use each Configuration's builder to make a Configuration object)
-⚠️ This is a beta release. Don't use it to accept payments in your live environment.
+For guidance on integrating with this version, have a look at the [integration guide](https://docs.adyen.com/online-payments/build-your-integration/?platform=Android).
-For guidance on integrating with this version, have a look at the [integration guide](https://docs.adyen.com/online-payments/build-your-integration/android-5-0-0-beta-release/).
+If your integration uses Android v4.13.3 and earlier, and you're upgrading it to use v5.0.0, you can follow the [migration guide](https://docs.adyen.com/online-payments/build-your-integration/migrate-to-android-5-0-0/).
-## Breaking changes
-- For Drop-in, you can now configure if you show a dialog to dismiss Drop-in with either a finished state or error state.
- - `DropInServiceResult.Error` now requires the `ErrorDialog` parameter.
- - `DropInServiceResult.Finished` now has an optional `FinishedDialog` parameter.
-- Analytics feature turned on by default. Find out [what we track and how you can configure it](https://docs.adyen.com/online-payments/analytics-and-data-tracking).
- - The method for setting analytics configuration has changed:
-
- | v5.0.0-beta01 | Earlier versions |
- |-----------------------------------------------------------------------------|----------------------------------------------------|
- | `setAnalyticsConfiguration(analyticsConfiguration: AnalyticsConfiguration)` | `setAnalyticsEnabled(isAnalyticsEnabled: Boolean)` |
+These are the changes between the beta and stable release. For the full release notes that include all the changes from v4.13.3, see the [release notes in our Docs](https://docs.adyen.com/online-payments/release-notes/?version=5.0.0&integration_type=android).
-- `PaymentMethodDetails` and its subclasses now have the `checkoutAttemptId` field.
-- You can no longer manually instantiate the `Environment` class and the `baseUrl` field has been removed.
-
-## New
-- You can now safely exclude any payment method from Drop-in. Do this by excluding the Adyen Checkout module that includes the payment method. For example:
- ```Groovy
- implementation('com.adyen.checkout:drop-in:5.0.0-beta01') {
- exclude group: 'com.adyen.checkout', module: 'card'
- exclude group: 'com.adyen.checkout', module: 'ideal'
- }
- ```
-- For cards:
- - The [BIN value callback](https://github.com/Adyen/adyen-android/blob/4fe3ddbfdfa29c702037bcd7d1bf48f4fb965a4d/card/src/main/java/com/adyen/checkout/card/CardComponent.kt#L98) is invoked while the shopper inputs their card number. The callback uses up to the first 8 digits.
- - The [BIN lookup callback](https://github.com/Adyen/adyen-android/blob/4fe3ddbfdfa29c702037bcd7d1bf48f4fb965a4d/card/src/main/java/com/adyen/checkout/card/CardComponent.kt#L108) is invoked when brands are detected on the card.
-- When the shopper is redirected to another app or browser, [a new callback](https://github.com/Adyen/adyen-android/blob/a1d5b55ad048581e86eccd8f3f6c95b6c8e6a7eb/action-core/src/main/java/com/adyen/checkout/action/core/internal/ActionHandlingComponent.kt#L48C8-L48C8) is invoked.
-- For Drop-in, you can now navigate the shopper back to the payment methods list, for example to load new payment methods. To do this, use [DropInServiceResult.ToPaymentMethodsList](https://github.com/Adyen/adyen-android/blob/a1d5b55ad048581e86eccd8f3f6c95b6c8e6a7eb/drop-in/src/main/java/com/adyen/checkout/dropin/DropInServiceResult.kt#L96).
+## Breaking changes
+- `Amount.EMPTY` is removed. Make sure you pass amounts with a valid value and currency.
## Fixed
-- QR code payment methods no longer crash in some cases.
-- Rotating a device during the redirect flow no longer causes a crash.
+- `@RestrictTo` annotations no longer cause false errors with Android Studio Hedgehog (Beta).
+- The Drop-in bottom sheet will no longer shift position on the screen when launching some flows like redirect and 3D Secure 2.
## Changed
-- The `compileSdkVersion` and `targetSdkVersion` are now set to 34 (Android 14).
- Dependency versions:
| Name | Version |
|--------------------------------------------------------------------------------------------------------|-------------------------------|
- | [Adyen 3DS2](https://github.com/Adyen/adyen-3ds2-android) | **2.2.15** |
- | [Android Gradle plugin](https://developer.android.com/build/releases/gradle-plugin) | **8.1.1** |
- | [AndroidX Browser](https://developer.android.com/jetpack/androidx/releases/browser#1.6.0) | **1.6.0** |
- | [AndroidX Compose BoM](https://developer.android.com/jetpack/compose/bom/bom-mapping) | **2023.08.00** |
- | [AndroidX Compose compiler](https://developer.android.com/jetpack/androidx/releases/compose-compiler) | **1.5.3** |
- | [AndroidX Fragment](https://developer.android.com/jetpack/androidx/releases/fragment#1.6.1) | **1.6.1** |
- | [AndroidX Recyclerview](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.3.1) | **1.3.1** |
- | [Cash App Pay](https://github.com/cashapp/cash-app-pay-android-sdk) | **2.3.0** |
- | [Kotlin Gradle plugin](https://plugins.gradle.org/plugin/org.jetbrains.kotlin.android) | **1.9.10** |
- | [WeChat Pay](https://developers.weixin.qq.com/doc/oplatform/en/Mobile_App/Access_Guide/Android.html) | **6.8.0** |
+ | [Google Pay](https://developers.google.com/pay/api/android/support/release-notes#sept-14) | **19.2.1** |
+ | [AndroidX Compose BoM](https://developer.android.com/jetpack/compose/bom/bom-mapping) | **2023.09.00** |
From ce611234d0dcb4a5337bf0f423c3bd0217ca0573 Mon Sep 17 00:00:00 2001
From: josephj
Date: Wed, 18 Oct 2023 11:08:11 +0200
Subject: [PATCH 23/23] Improve error handling and logging for analytics and
image loader
---
.../checkout/core/exception/HttpException.kt | 6 +--
.../core/internal/data/api/OkHttpClient.kt | 40 +++++++++++++------
.../internal/data/model/ErrorResponseBody.kt | 8 ++--
.../data/api/DefaultAnalyticsRepository.kt | 3 +-
.../internal/ui/ImageLoadingExtensions.kt | 2 +-
5 files changed, 38 insertions(+), 21 deletions(-)
diff --git a/checkout-core/src/main/java/com/adyen/checkout/core/exception/HttpException.kt b/checkout-core/src/main/java/com/adyen/checkout/core/exception/HttpException.kt
index 7a9eb2c87b..26058a7b8a 100644
--- a/checkout-core/src/main/java/com/adyen/checkout/core/exception/HttpException.kt
+++ b/checkout-core/src/main/java/com/adyen/checkout/core/exception/HttpException.kt
@@ -14,7 +14,7 @@ import com.adyen.checkout.core.internal.data.model.ErrorResponseBody
* Indicates that an internal API call has failed.
*/
class HttpException(
- val code: Int,
- override val message: String,
+ code: Int,
+ message: String,
val errorBody: ErrorResponseBody?,
-) : CheckoutException(message)
+) : CheckoutException("$code $message")
diff --git a/checkout-core/src/main/java/com/adyen/checkout/core/internal/data/api/OkHttpClient.kt b/checkout-core/src/main/java/com/adyen/checkout/core/internal/data/api/OkHttpClient.kt
index 738bcf3a23..4434c8c3e8 100644
--- a/checkout-core/src/main/java/com/adyen/checkout/core/internal/data/api/OkHttpClient.kt
+++ b/checkout-core/src/main/java/com/adyen/checkout/core/internal/data/api/OkHttpClient.kt
@@ -83,8 +83,11 @@ internal class OkHttpClient(
response.body?.close()
return bytes
} else {
- val errorBody = response.errorBody()
- val exception = HttpException(response.code, response.message, errorBody)
+ val exception = HttpException(
+ code = response.code,
+ message = response.message,
+ errorBody = response.errorBody()
+ )
response.body?.close()
throw exception
}
@@ -98,16 +101,29 @@ internal class OkHttpClient(
(defaultHeaders + this).toHeaders()
@Suppress("SwallowedException")
- private fun Response.errorBody(): ErrorResponseBody? = try {
- body?.string()
- ?.let { JSONObject(it) }
- ?.let { ErrorResponseBody.SERIALIZER.deserialize(it) }
- } catch (e: IOException) {
- null
- } catch (e: JSONException) {
- null
- } catch (e: ModelSerializationException) {
- null
+ private fun Response.errorBody(): ErrorResponseBody? {
+ val stringBody = try {
+ body?.string()
+ } catch (e: IOException) {
+ null
+ }
+
+ val parsedErrorResponseBody = try {
+ stringBody
+ ?.let { JSONObject(it) }
+ ?.let { ErrorResponseBody.SERIALIZER.deserialize(it) }
+ } catch (e: JSONException) {
+ null
+ } catch (e: ModelSerializationException) {
+ null
+ }
+
+ return parsedErrorResponseBody ?: ErrorResponseBody(
+ status = null,
+ errorCode = null,
+ message = stringBody,
+ errorType = null,
+ )
}
companion object {
diff --git a/checkout-core/src/main/java/com/adyen/checkout/core/internal/data/model/ErrorResponseBody.kt b/checkout-core/src/main/java/com/adyen/checkout/core/internal/data/model/ErrorResponseBody.kt
index a1a4fb5237..54ab2d68e4 100644
--- a/checkout-core/src/main/java/com/adyen/checkout/core/internal/data/model/ErrorResponseBody.kt
+++ b/checkout-core/src/main/java/com/adyen/checkout/core/internal/data/model/ErrorResponseBody.kt
@@ -17,10 +17,10 @@ import org.json.JSONObject
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
@Parcelize
data class ErrorResponseBody(
- val status: Int,
- val errorCode: String,
- val message: String,
- val errorType: String,
+ val status: Int?,
+ val errorCode: String?,
+ val message: String?,
+ val errorType: String?,
) : ModelObject() {
companion object {
diff --git a/components-core/src/main/java/com/adyen/checkout/components/core/internal/data/api/DefaultAnalyticsRepository.kt b/components-core/src/main/java/com/adyen/checkout/components/core/internal/data/api/DefaultAnalyticsRepository.kt
index de206c393f..922cc5718b 100644
--- a/components-core/src/main/java/com/adyen/checkout/components/core/internal/data/api/DefaultAnalyticsRepository.kt
+++ b/components-core/src/main/java/com/adyen/checkout/components/core/internal/data/api/DefaultAnalyticsRepository.kt
@@ -58,7 +58,8 @@ class DefaultAnalyticsRepository(
Logger.v(TAG, "Analytics setup call successful")
}.onFailure { e ->
state = State.Failed
- Logger.e(TAG, "Failed to send analytics setup call", e)
+ // TODO change back to error when all analytic endpoints are live
+ Logger.w(TAG, "Failed to send analytics setup call - ${e::class.simpleName}: ${e.message}")
}
}
diff --git a/ui-core/src/main/java/com/adyen/checkout/ui/core/internal/ui/ImageLoadingExtensions.kt b/ui-core/src/main/java/com/adyen/checkout/ui/core/internal/ui/ImageLoadingExtensions.kt
index 5c60f04d4b..67bb0223df 100644
--- a/ui-core/src/main/java/com/adyen/checkout/ui/core/internal/ui/ImageLoadingExtensions.kt
+++ b/ui-core/src/main/java/com/adyen/checkout/ui/core/internal/ui/ImageLoadingExtensions.kt
@@ -60,7 +60,7 @@ fun ImageView.load(
url,
onSuccess = { setImageBitmap(it) },
onError = { e ->
- Logger.e(TAG, "Failed loading image for $url", e)
+ Logger.w(TAG, "Failed loading image for $url - ${e::class.simpleName}: ${e.message}")
setImageResource(errorFallback)
}
)