From a976f158476b8e3b1282ad68e634be322d93945f Mon Sep 17 00:00:00 2001 From: Bella Koch <160939932+amk-stripe@users.noreply.github.com> Date: Wed, 4 Dec 2024 14:28:19 -0800 Subject: [PATCH] Navigate to new update PM screen when editing card brand from vertical mode screen (#9742) --- .../PaymentMethodVerticalLayoutInteractor.kt | 6 +++++- ...ltPaymentMethodVerticalLayoutInteractorTest.kt | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/paymentsheet/src/main/java/com/stripe/android/paymentsheet/verticalmode/PaymentMethodVerticalLayoutInteractor.kt b/paymentsheet/src/main/java/com/stripe/android/paymentsheet/verticalmode/PaymentMethodVerticalLayoutInteractor.kt index 00489de8913..413b383213e 100644 --- a/paymentsheet/src/main/java/com/stripe/android/paymentsheet/verticalmode/PaymentMethodVerticalLayoutInteractor.kt +++ b/paymentsheet/src/main/java/com/stripe/android/paymentsheet/verticalmode/PaymentMethodVerticalLayoutInteractor.kt @@ -412,7 +412,11 @@ internal class DefaultPaymentMethodVerticalLayoutInteractor( } } is ViewAction.EditPaymentMethod -> { - onEditPaymentMethod(viewAction.savedPaymentMethod) + if (FeatureFlags.useNewUpdateCardScreen.isEnabled) { + onUpdatePaymentMethod(viewAction.savedPaymentMethod) + } else { + onEditPaymentMethod(viewAction.savedPaymentMethod) + } } } } diff --git a/paymentsheet/src/test/java/com/stripe/android/paymentsheet/verticalmode/DefaultPaymentMethodVerticalLayoutInteractorTest.kt b/paymentsheet/src/test/java/com/stripe/android/paymentsheet/verticalmode/DefaultPaymentMethodVerticalLayoutInteractorTest.kt index 905eb7dc249..52022852548 100644 --- a/paymentsheet/src/test/java/com/stripe/android/paymentsheet/verticalmode/DefaultPaymentMethodVerticalLayoutInteractorTest.kt +++ b/paymentsheet/src/test/java/com/stripe/android/paymentsheet/verticalmode/DefaultPaymentMethodVerticalLayoutInteractorTest.kt @@ -815,6 +815,21 @@ class DefaultPaymentMethodVerticalLayoutInteractorTest { } } + @Test + fun handleViewAction_OnEditPaymentMethod_transitionsToUpdateScreen_whenFeatureEnabled() { + var updatedPaymentMethod: DisplayableSavedPaymentMethod? = null + runScenario( + onUpdatePaymentMethod = { + updatedPaymentMethod = it + }, + useNewUpdatePaymentMethodScreen = true, + ) { + val paymentMethod = PaymentMethodFixtures.displayableCard() + interactor.handleViewAction(ViewAction.EditPaymentMethod(paymentMethod)) + assertThat(updatedPaymentMethod).isEqualTo(paymentMethod) + } + } + @Test fun handleViewAction_SelectSavedPaymentMethod_selectsSavedPm() { val savedPaymentMethod = PaymentMethodFixtures.displayableCard()