Skip to content

Commit

Permalink
Merge pull request #1637 from Adyen/fix/stored_payment_methods_remova…
Browse files Browse the repository at this point in the history
…l_old_integration_fix

Fix storedPaymentMethod removal for older integrations
  • Loading branch information
araratthehero authored May 28, 2024
2 parents 0d77481 + d1d9cb0 commit 6947855
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ CheckoutConfiguration(
- Actions no longer crash when your app uses obfuscation.
- Drop-in no longer throws an error while handling a 3DS2 challenge on API 66 and below.
- When the app process dies during action handling, then the state will now be restored and the payment can be continued.
- Fixed ignoring `setEnableRemovingStoredPaymentMethods` flag set in Drop-in configuration for sessions.

## Changed
- Flags are replaced by ISO codes in the phone number inputs (affected payment methods: MB Way, Pay Easy, Convenience Stores Japan, Online Banking Japan and Seven-Eleven).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ package com.adyen.checkout.sessions.core

import com.adyen.checkout.core.exception.ModelSerializationException
import com.adyen.checkout.core.internal.data.model.ModelObject
import com.adyen.checkout.core.internal.data.model.getBooleanOrNull
import com.adyen.checkout.core.internal.data.model.jsonToMap
import kotlinx.parcelize.Parcelize
import org.json.JSONException
Expand All @@ -20,7 +21,7 @@ data class SessionSetupConfiguration(
val enableStoreDetails: Boolean? = null,
val showInstallmentAmount: Boolean = false,
val installmentOptions: Map<String, SessionSetupInstallmentOptions?>? = null,
val showRemovePaymentMethodButton: Boolean = false,
val showRemovePaymentMethodButton: Boolean? = null,
) : ModelObject() {

companion object {
Expand Down Expand Up @@ -50,11 +51,11 @@ data class SessionSetupConfiguration(
override fun deserialize(jsonObject: JSONObject): SessionSetupConfiguration {
return try {
SessionSetupConfiguration(
enableStoreDetails = jsonObject.optBoolean(ENABLE_STORE_DETAILS),
enableStoreDetails = jsonObject.getBooleanOrNull(ENABLE_STORE_DETAILS),
showInstallmentAmount = jsonObject.optBoolean(SHOW_INSTALLMENT_AMOUNT),
installmentOptions = jsonObject.optJSONObject(INSTALLMENT_OPTIONS)
?.jsonToMap(SessionSetupInstallmentOptions.SERIALIZER),
showRemovePaymentMethodButton = jsonObject.optBoolean(SHOW_REMOVE_PAYMENT_METHOD_BUTTON),
showRemovePaymentMethodButton = jsonObject.getBooleanOrNull(SHOW_REMOVE_PAYMENT_METHOD_BUTTON),
)
} catch (e: JSONException) {
throw ModelSerializationException(SessionSetupConfiguration::class.java, e)
Expand Down

0 comments on commit 6947855

Please sign in to comment.