Skip to content

Commit 760f71f

Browse files
cttsai-stripeclaude
andcommitted
Fix shouldShowCardBrandDropdown not passed to test fakes and simplify createEditCardDetailsInteractorForCard
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Committed-By-Agent: claude
1 parent af3b6b4 commit 760f71f

3 files changed

Lines changed: 10 additions & 9 deletions

File tree

paymentsheet/src/main/java/com/stripe/android/paymentsheet/ui/UpdatePaymentMethodInteractor.kt

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -187,17 +187,12 @@ internal class DefaultUpdatePaymentMethodInteractor(
187187
private fun createEditCardDetailsInteractorForCard(
188188
savedPaymentMethodCard: SavedPaymentMethod.Card,
189189
): EditCardDetailsInteractor {
190-
val isModifiable = displayableSavedPaymentMethod.paymentMethod.isModifiable(
191-
canUpdateCardExpiryAndBillingDetails = canUpdateCardExpiryAndBillingDetails,
192-
canChangeCbc = canChangeCbc,
193-
)
194190
val payload = EditCardPayload.create(savedPaymentMethodCard.card, savedPaymentMethodCard.billingDetails)
195191
val cardEditConfiguration = CardEditConfiguration(
196192
cardBrandFilter = cardBrandFilter,
197-
isCbcModifiable = isModifiable &&
198-
canChangeCbc &&
199-
displayableSavedPaymentMethod.paymentMethod.hasMultipleNetworks(),
200-
areExpiryDateAndAddressModificationSupported = isModifiable && canUpdateCardExpiryAndBillingDetails,
193+
isCbcModifiable = shouldShowCardBrandDropdown,
194+
areExpiryDateAndAddressModificationSupported =
195+
isModifiablePaymentMethod && canUpdateCardExpiryAndBillingDetails,
201196
)
202197
return editCardDetailsInteractorFactory.create(
203198
payload = payload,

paymentsheet/src/test/java/com/stripe/android/paymentsheet/ui/PaymentSheetScreenUpdatePaymentMethodScreenshotTest.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ internal class PaymentSheetScreenUpdatePaymentMethodScreenshotTest {
3737
.toDisplayableSavedPaymentMethod(),
3838
canRemove = false,
3939
isModifiablePaymentMethod = true,
40+
shouldShowCardBrandDropdown = true,
4041
)
4142
}
4243
}
@@ -204,6 +205,7 @@ internal class PaymentSheetScreenUpdatePaymentMethodScreenshotTest {
204205
isExpiredCard: Boolean = false,
205206
error: String? = null,
206207
shouldShowSetAsDefaultCheckbox: Boolean = false,
208+
shouldShowCardBrandDropdown: Boolean = false,
207209
canUpdateCardExpiryAndBillingDetails: Boolean = false,
208210
addressCollectionMode: AddressCollectionMode = AddressCollectionMode.Never,
209211
useDefaultBillingDetails: Boolean = true,
@@ -214,6 +216,7 @@ internal class PaymentSheetScreenUpdatePaymentMethodScreenshotTest {
214216
canRemove = canRemove,
215217
isExpiredCard = isExpiredCard,
216218
isModifiablePaymentMethod = isModifiablePaymentMethod,
219+
shouldShowCardBrandDropdown = shouldShowCardBrandDropdown,
217220
shouldShowSetAsDefaultCheckbox = shouldShowSetAsDefaultCheckbox,
218221
setAsDefaultCheckboxEnabled = true,
219222
viewActionRecorder = null,

paymentsheet/src/test/java/com/stripe/android/paymentsheet/ui/UpdatePaymentMethodUITest.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ class UpdatePaymentMethodUITest {
171171
runScenario(
172172
displayableSavedPaymentMethod = PaymentMethodFixtures
173173
.CARD_WITH_NETWORKS_PAYMENT_METHOD
174-
.toDisplayableSavedPaymentMethod()
174+
.toDisplayableSavedPaymentMethod(),
175+
shouldShowCardBrandDropdown = true,
175176
) {
176177
composeRule.onNodeWithTag(UPDATE_PM_DETAILS_SUBTITLE_TEST_TAG).assertTextEquals(
177178
"Only card brand can be changed."
@@ -318,6 +319,7 @@ class UpdatePaymentMethodUITest {
318319
canRemove: Boolean = true,
319320
isModifiablePaymentMethod: Boolean = true,
320321
hasValidBrandChoices: Boolean = true,
322+
shouldShowCardBrandDropdown: Boolean = false,
321323
setAsDefaultCheckboxChecked: Boolean = false,
322324
setAsDefaultCheckboxEnabled: Boolean = true,
323325
cardBrandFilter: CardBrandFilter = DefaultCardBrandFilter,
@@ -336,6 +338,7 @@ class UpdatePaymentMethodUITest {
336338
cardBrandFilter = cardBrandFilter,
337339
viewActionRecorder = viewActionRecorder,
338340
hasValidBrandChoices = hasValidBrandChoices,
341+
shouldShowCardBrandDropdown = shouldShowCardBrandDropdown,
339342
shouldShowSetAsDefaultCheckbox = shouldShowSetAsDefaultCheckbox,
340343
shouldShowSaveButton = shouldShowSaveButton,
341344
setAsDefaultCheckboxEnabled = setAsDefaultCheckboxEnabled,

0 commit comments

Comments
 (0)