Skip to content

Commit 672ec5e

Browse files
Added a flag for default spm navigation (#4271)
## Summary <!-- Simple summary of what was changed. --> Added a flag defaultSPMNavigation in PaymentSheet and CustomerSheet. Off by default. When on, edit icon shows for all cards regardless of cbc eligibility. ## Motivation <!-- Why are you making this change? If it's for fixing a bug, if possible, please include a code snippet or example project that demonstrates the issue. --> [MOBILESDK-2663](https://jira.corp.stripe.com/browse/MOBILESDK-2663) [MOBILESDK-2664](https://jira.corp.stripe.com/browse/MOBILESDK-2664) ## Testing <!-- How was the code tested? Be as specific as possible. --> Simple UI tests that check to make sure that both the cbc card and non-cbc card have edit buttons ## Changelog <!-- Is this a notable change that affects users? If so, add a line to `CHANGELOG.md` and prefix the line with one of the following: - [Added] for new features. - [Changed] for changes in existing functionality. - [Deprecated] for soon-to-be removed features. - [Removed] for now removed features. - [Fixed] for any bug fixes. - [Security] in case of vulnerabilities. -->
1 parent 094db6c commit 672ec5e

30 files changed

+268
-43
lines changed

Example/PaymentSheet Example/PaymentSheet Example-Shard1.xctestplan

+4
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@
4040
"PaymentSheetCardBrandFilteringUITests",
4141
"PaymentSheetCustomerSessionCBCUITests",
4242
"PaymentSheetCustomerSessionDedupeUITests",
43+
"PaymentSheetDefaultSPMUITests",
44+
"PaymentSheetDefaultSPMUITests\/testDefaultSPMHorizontalNavigation()",
45+
"PaymentSheetDefaultSPMUITests\/testDefaultSPMNavigationFlagOff()",
46+
"PaymentSheetDefaultSPMUITests\/testDefaultSPMVerticalNavigation()",
4347
"PaymentSheetDeferredServerSideUITests",
4448
"PaymentSheetDeferredUIBankAccountTests",
4549
"PaymentSheetDeferredUITests",

Example/PaymentSheet Example/PaymentSheet Example-Shard2.xctestplan

+4
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141
"PaymentSheetBillingCollectionUICardTests",
4242
"PaymentSheetBillingCollectionUITestCase",
4343
"PaymentSheetCardBrandFilteringUITests",
44+
"PaymentSheetDefaultSPMUITests",
45+
"PaymentSheetDefaultSPMUITests\/testDefaultSPMHorizontalNavigation()",
46+
"PaymentSheetDefaultSPMUITests\/testDefaultSPMNavigationFlagOff()",
47+
"PaymentSheetDefaultSPMUITests\/testDefaultSPMVerticalNavigation()",
4448
"PaymentSheetDeferredUIBankAccountTests",
4549
"PaymentSheetDeferredUITests",
4650
"PaymentSheetGDPRUITests",

Example/PaymentSheet Example/PaymentSheet Example-Shard3.xctestplan

+4
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141
"PaymentSheetCardBrandFilteringUITests",
4242
"PaymentSheetCustomerSessionCBCUITests",
4343
"PaymentSheetCustomerSessionDedupeUITests",
44+
"PaymentSheetDefaultSPMUITests",
45+
"PaymentSheetDefaultSPMUITests\/testDefaultSPMHorizontalNavigation()",
46+
"PaymentSheetDefaultSPMUITests\/testDefaultSPMNavigationFlagOff()",
47+
"PaymentSheetDefaultSPMUITests\/testDefaultSPMVerticalNavigation()",
4448
"PaymentSheetDeferredServerSideUITests",
4549
"PaymentSheetExternalPMUITests",
4650
"PaymentSheetStandardLPMUICBCTests",

Example/PaymentSheet Example/PaymentSheet Example/CustomerSheetTestPlayground.swift

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ struct CustomerSheetTestPlayground: View {
7474
SettingView(setting: $playgroundController.settings.autoreload)
7575
TextField("headerTextForSelectionScreen", text: headerTextForSelectionScreenBinding)
7676
SettingView(setting: $playgroundController.settings.allowsRemovalOfLastSavedPaymentMethod)
77+
SettingView(setting: $playgroundController.settings.alternateUpdatePaymentMethodNavigation)
7778
HStack {
7879
Text("Macros").font(.headline)
7980
Spacer()

Example/PaymentSheet Example/PaymentSheet Example/CustomerSheetTestPlaygroundController.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//
55

66
import Combine
7-
@_spi(STP) @_spi(CustomerSessionBetaAccess) @_spi(CardBrandFilteringBeta) import StripePaymentSheet
7+
@_spi(STP) @_spi(CustomerSessionBetaAccess) @_spi(CardBrandFilteringBeta) @_spi(AlternateUpdatePaymentMethodNavigation) import StripePaymentSheet
88
import SwiftUI
99

1010
class CustomerSheetTestPlaygroundController: ObservableObject {
@@ -147,6 +147,7 @@ class CustomerSheetTestPlaygroundController: ObservableObject {
147147
case .allowVisa:
148148
configuration.cardBrandAcceptance = .allowed(brands: [.visa])
149149
}
150+
configuration.alternateUpdatePaymentMethodNavigation = settings.alternateUpdatePaymentMethodNavigation == .on
150151
return configuration
151152
}
152153

Example/PaymentSheet Example/PaymentSheet Example/CustomerSheetTestPlaygroundSettings.swift

+10-2
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,12 @@ public struct CustomerSheetTestPlaygroundSettings: Codable, Equatable {
142142
case allowVisa
143143
}
144144

145+
enum AlternateUpdatePaymentMethodNavigation: String, PickerEnum {
146+
static let enumName: String = "alternateUpdatePaymentMethodNavigation"
147+
case on
148+
case off
149+
}
150+
145151
var customerMode: CustomerMode
146152
var customerId: String?
147153
var customerKeyType: CustomerKeyType
@@ -162,7 +168,8 @@ public struct CustomerSheetTestPlaygroundSettings: Codable, Equatable {
162168
var paymentMethodRemove: PaymentMethodRemove
163169
var paymentMethodAllowRedisplayFilters: PaymentMethodAllowRedisplayFilters
164170
var cardBrandAcceptance: CardBrandAcceptance
165-
171+
var alternateUpdatePaymentMethodNavigation: AlternateUpdatePaymentMethodNavigation
172+
166173
static func defaultValues() -> CustomerSheetTestPlaygroundSettings {
167174
return CustomerSheetTestPlaygroundSettings(customerMode: .new,
168175
customerId: nil,
@@ -182,7 +189,8 @@ public struct CustomerSheetTestPlaygroundSettings: Codable, Equatable {
182189
allowsRemovalOfLastSavedPaymentMethod: .on,
183190
paymentMethodRemove: .enabled,
184191
paymentMethodAllowRedisplayFilters: .always,
185-
cardBrandAcceptance: .all)
192+
cardBrandAcceptance: .all,
193+
alternateUpdatePaymentMethodNavigation: .off)
186194
}
187195

188196
var base64Data: String {

Example/PaymentSheet Example/PaymentSheet Example/PaymentSheetTestPlayground.swift

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ struct PaymentSheetTestPlayground: View {
4545
SettingView(setting: $playgroundController.settings.requireCVCRecollection)
4646
SettingView(setting: $playgroundController.settings.autoreload)
4747
SettingView(setting: $playgroundController.settings.shakeAmbiguousViews)
48+
SettingView(setting: $playgroundController.settings.alternateUpdatePaymentMethodNavigation)
4849
}
4950

5051
var body: some View {

Example/PaymentSheet Example/PaymentSheet Example/PaymentSheetTestPlaygroundSettings.swift

+9-1
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,12 @@ struct PaymentSheetTestPlaygroundSettings: Codable, Equatable {
432432
case allowVisa
433433
}
434434

435+
enum AlternateUpdatePaymentMethodNavigation: String, PickerEnum {
436+
static let enumName: String = "alternateUpdatePaymentMethodNavigation"
437+
case on
438+
case off
439+
}
440+
435441
var uiStyle: UIStyle
436442
var layout: Layout
437443
var mode: Mode
@@ -476,6 +482,7 @@ struct PaymentSheetTestPlaygroundSettings: Codable, Equatable {
476482
var formSheetAction: FormSheetAction
477483
var embeddedViewDisplaysMandateText: DisplaysMandateTextEnabled
478484
var cardBrandAcceptance: CardBrandAcceptance
485+
var alternateUpdatePaymentMethodNavigation: AlternateUpdatePaymentMethodNavigation
479486

480487
static func defaultValues() -> PaymentSheetTestPlaygroundSettings {
481488
return PaymentSheetTestPlaygroundSettings(
@@ -519,7 +526,8 @@ struct PaymentSheetTestPlaygroundSettings: Codable, Equatable {
519526
collectAddress: .automatic,
520527
formSheetAction: .confirm,
521528
embeddedViewDisplaysMandateText: .on,
522-
cardBrandAcceptance: .all)
529+
cardBrandAcceptance: .all,
530+
alternateUpdatePaymentMethodNavigation: .off)
523531
}
524532

525533
static let nsUserDefaultsKey = "PaymentSheetTestPlaygroundSettings"

Example/PaymentSheet Example/PaymentSheet Example/PlaygroundController.swift

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import Contacts
1414
import PassKit
1515
@_spi(STP) import StripeCore
1616
@_spi(STP) import StripePayments
17-
@_spi(CustomerSessionBetaAccess) @_spi(STP) @_spi(PaymentSheetSkipConfirmation) @_spi(ExperimentalAllowsRemovalOfLastSavedPaymentMethodAPI) @_spi(EmbeddedPaymentElementPrivateBeta) @_spi(CardBrandFilteringBeta) import StripePaymentSheet
17+
@_spi(CustomerSessionBetaAccess) @_spi(STP) @_spi(PaymentSheetSkipConfirmation) @_spi(ExperimentalAllowsRemovalOfLastSavedPaymentMethodAPI) @_spi(EmbeddedPaymentElementPrivateBeta) @_spi(CardBrandFilteringBeta) @_spi(AlternateUpdatePaymentMethodNavigation) import StripePaymentSheet
1818
import SwiftUI
1919
import UIKit
2020

@@ -184,6 +184,7 @@ class PlaygroundController: ObservableObject {
184184
case .allowVisa:
185185
configuration.cardBrandAcceptance = .allowed(brands: [.visa])
186186
}
187+
configuration.alternateUpdatePaymentMethodNavigation = settings.alternateUpdatePaymentMethodNavigation == .on
187188
return configuration
188189
}
189190

@@ -271,7 +272,7 @@ class PlaygroundController: ObservableObject {
271272
case .allowVisa:
272273
configuration.cardBrandAcceptance = .allowed(brands: [.visa])
273274
}
274-
275+
configuration.alternateUpdatePaymentMethodNavigation = settings.alternateUpdatePaymentMethodNavigation == .on
275276
return configuration
276277
}
277278

Example/PaymentSheet Example/PaymentSheetUITest/CustomerSheetUITest.swift

+30
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,36 @@ class CustomerSheetUITest: XCTestCase {
473473
XCTAssertTrue(successText.waitForExistence(timeout: timeout))
474474
}
475475

476+
func testCardBrandChoiceUpdateAndRemove() {
477+
var settings = CustomerSheetTestPlaygroundSettings.defaultValues()
478+
settings.alternateUpdatePaymentMethodNavigation = .on
479+
settings.merchantCountryCode = .FR
480+
settings.customerMode = .returning
481+
482+
loadPlayground(app, settings)
483+
484+
app.buttons["None"].waitForExistenceAndTap()
485+
app.buttons["Edit"].waitForExistenceAndTap()
486+
487+
// circularEditButton shows up in the view hierarchy, but it's not actually on the screen or tappable so we scroll a little
488+
let startCoordinate = app.collectionViews.firstMatch.coordinate(withNormalizedOffset: CGVector(dx: 0.9, dy: 0.99))
489+
startCoordinate.press(forDuration: 0.1, thenDragTo: app.collectionViews.firstMatch.coordinate(withNormalizedOffset: CGVector(dx: 0.1, dy: 0.99)))
490+
XCTAssertTrue(app.buttons.matching(identifier: "CircularButton.Edit").firstMatch.waitForExistenceAndTap())
491+
XCTAssertTrue(app.otherElements.matching(identifier: "Card Brand Dropdown").firstMatch.waitForExistenceAndTap())
492+
app.pickerWheels.firstMatch.selectNextOption()
493+
app.toolbars.buttons["Done"].tap()
494+
XCTAssertTrue(app.textFields["Visa"].waitForExistence(timeout: 3))
495+
app.buttons["Save"].waitForExistenceAndTap()
496+
XCTAssertTrue(app.buttons["Done"].waitForExistence(timeout: 3))
497+
XCTAssertEqual(app.images.matching(identifier: "carousel_card_visa").count, 2)
498+
499+
app.buttons.matching(identifier: "CircularButton.Edit").element(boundBy: 1).waitForExistenceAndTap()
500+
app.buttons["Remove"].waitForExistenceAndTap()
501+
app.alerts.buttons["Remove"].waitForExistenceAndTap()
502+
XCTAssertTrue(app.buttons["Done"].waitForExistence(timeout: 3))
503+
XCTAssertEqual(app.images.matching(identifier: "carousel_card_visa").count, 1)
504+
app.buttons["Done"].waitForExistenceAndTap()
505+
}
476506
// MARK: - allowsRemovalOfLastSavedPaymentMethod
477507
func testRemoveLastSavedPaymentMethod() throws {
478508
var settings = CustomerSheetTestPlaygroundSettings.defaultValues()

Example/PaymentSheet Example/PaymentSheetUITest/PaymentSheetLPMUITest.swift

+36
Original file line numberDiff line numberDiff line change
@@ -1024,6 +1024,42 @@ class PaymentSheetStandardLPMUICBCTests: PaymentSheetStandardLPMUICase {
10241024
// Card should be removed
10251025
XCTAssertFalse(app.staticTexts["•••• 1001"].waitForExistence(timeout: 5.0))
10261026
}
1027+
1028+
func testCardBrandChoiceUpdateAndRemove() {
1029+
var settings = PaymentSheetTestPlaygroundSettings.defaultValues()
1030+
settings.alternateUpdatePaymentMethodNavigation = .on
1031+
settings.merchantCountryCode = .FR
1032+
settings.currency = .eur
1033+
settings.customerMode = .returning
1034+
settings.layout = .horizontal
1035+
1036+
loadPlayground(app, settings)
1037+
1038+
app.buttons["Present PaymentSheet"].waitForExistenceAndTap()
1039+
1040+
app.buttons["Edit"].waitForExistenceAndTap()
1041+
1042+
XCTAssertEqual(app.images.matching(identifier: "carousel_card_cartes_bancaires").count, 1)
1043+
XCTAssertEqual(app.images.matching(identifier: "carousel_card_visa").count, 1)
1044+
1045+
XCTAssertEqual(app.buttons.matching(identifier: "CircularButton.Edit").count, 2)
1046+
1047+
app.buttons.matching(identifier: "CircularButton.Edit").firstMatch.waitForExistenceAndTap()
1048+
app.otherElements.matching(identifier: "Card Brand Dropdown").firstMatch.waitForExistenceAndTap()
1049+
app.pickerWheels.firstMatch.selectNextOption()
1050+
app.toolbars.buttons["Done"].tap()
1051+
XCTAssertTrue(app.textFields["Visa"].waitForExistence(timeout: 3))
1052+
app.buttons["Save"].waitForExistenceAndTap()
1053+
XCTAssertTrue(app.buttons["Done"].waitForExistence(timeout: 3))
1054+
XCTAssertEqual(app.images.matching(identifier: "carousel_card_visa").count, 2)
1055+
1056+
app.buttons.matching(identifier: "CircularButton.Edit").element(boundBy: 1).waitForExistenceAndTap()
1057+
app.buttons["Remove"].waitForExistenceAndTap()
1058+
app.alerts.buttons["Remove"].waitForExistenceAndTap()
1059+
XCTAssertTrue(app.buttons["Done"].waitForExistence(timeout: 3))
1060+
XCTAssertEqual(app.images.matching(identifier: "carousel_card_visa").count, 1)
1061+
app.buttons["Done"].waitForExistenceAndTap()
1062+
}
10271063
}
10281064

10291065
// MARK: - Helpers

Example/PaymentSheet Example/PaymentSheetUITest/PaymentSheetUITest.swift

+51
Original file line numberDiff line numberDiff line change
@@ -2439,6 +2439,57 @@ class PaymentSheetLinkUITests: PaymentSheetUITestCase {
24392439
// }
24402440
}
24412441

2442+
class PaymentSheetDefaultSPMUITests: PaymentSheetUITestCase {
2443+
func testDefaultSPMHorizontalNavigation() {
2444+
var settings = PaymentSheetTestPlaygroundSettings.defaultValues()
2445+
settings.alternateUpdatePaymentMethodNavigation = .on
2446+
settings.merchantCountryCode = .FR
2447+
settings.currency = .eur
2448+
settings.customerMode = .returning
2449+
settings.layout = .horizontal
2450+
2451+
loadPlayground(app, settings)
2452+
2453+
app.buttons["Present PaymentSheet"].waitForExistenceAndTap()
2454+
2455+
app.buttons["Edit"].waitForExistenceAndTap()
2456+
2457+
XCTAssertEqual(app.buttons.matching(identifier: "CircularButton.Edit").count, 2)
2458+
}
2459+
func testDefaultSPMVerticalNavigation() {
2460+
var settings = PaymentSheetTestPlaygroundSettings.defaultValues()
2461+
settings.alternateUpdatePaymentMethodNavigation = .on
2462+
settings.merchantCountryCode = .FR
2463+
settings.currency = .eur
2464+
settings.customerMode = .returning
2465+
settings.layout = .vertical
2466+
2467+
loadPlayground(app, settings)
2468+
2469+
app.buttons["Present PaymentSheet"].waitForExistenceAndTap()
2470+
app.buttons["View more"].waitForExistenceAndTap()
2471+
app.buttons["Edit"].waitForExistenceAndTap()
2472+
2473+
XCTAssertEqual(app.buttons.matching(identifier: "chevron").count, 2)
2474+
}
2475+
func testDefaultSPMNavigationFlagOff() {
2476+
var settings = PaymentSheetTestPlaygroundSettings.defaultValues()
2477+
settings.alternateUpdatePaymentMethodNavigation = .off
2478+
settings.merchantCountryCode = .FR
2479+
settings.currency = .eur
2480+
settings.customerMode = .returning
2481+
settings.layout = .horizontal
2482+
2483+
loadPlayground(app, settings)
2484+
2485+
app.buttons["Present PaymentSheet"].waitForExistenceAndTap()
2486+
2487+
app.buttons["Edit"].waitForExistenceAndTap()
2488+
2489+
XCTAssertEqual(app.buttons.matching(identifier: "CircularButton.Edit").count, 1)
2490+
}
2491+
}
2492+
24422493
// MARK: Helpers
24432494
extension PaymentSheetUITestCase {
24442495
func _testUSBankAccount(mode: PaymentSheetTestPlaygroundSettings.Mode, integrationType: PaymentSheetTestPlaygroundSettings.IntegrationType, vertical: Bool = false) {

StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSavedPaymentMethodsCollectionViewController.swift

+7-1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ class CustomerSavedPaymentMethodsCollectionViewController: UIViewController {
8282
let allowsRemovalOfLastSavedPaymentMethod: Bool
8383
let paymentMethodRemove: Bool
8484
let isTestMode: Bool
85+
let alternateUpdatePaymentMethodNavigation: Bool
8586
}
8687

8788
/// Whether or not you can edit save payment methods by removing or updating them.
@@ -386,7 +387,8 @@ extension CustomerSavedPaymentMethodsCollectionViewController: UICollectionViewD
386387

387388
cell.setViewModel(viewModel.toSavedPaymentOptionsViewControllerSelection(),
388389
cbcEligible: cbcEligible,
389-
allowsPaymentMethodRemoval: configuration.paymentMethodRemove)
390+
allowsPaymentMethodRemoval: configuration.paymentMethodRemove,
391+
alternateUpdatePaymentMethodNavigation: configuration.alternateUpdatePaymentMethodNavigation)
390392
cell.delegate = self
391393
cell.isRemovingPaymentMethods = self.collectionView.isRemovingPaymentMethods
392394
cell.appearance = appearance
@@ -537,6 +539,10 @@ extension CustomerSavedPaymentMethodsCollectionViewController: UpdateCardViewCon
537539

538540
let updatedViewModel: Selection = .saved(paymentMethod: updatedPaymentMethod)
539541
viewModels[row] = updatedViewModel
542+
// Update savedPaymentMethods
543+
if let row = self.savedPaymentMethods.firstIndex(where: { $0.stripeId == updatedPaymentMethod.stripeId }) {
544+
self.savedPaymentMethods[row] = updatedPaymentMethod
545+
}
540546
collectionView.reloadData()
541547
_ = viewController.bottomSheetController?.popContentViewController()
542548
}

StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSavedPaymentMethodsViewController.swift

+4-2
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ class CustomerSavedPaymentMethodsViewController: UIViewController {
103103
showApplePay: showApplePay,
104104
allowsRemovalOfLastSavedPaymentMethod: configuration.allowsRemovalOfLastSavedPaymentMethod,
105105
paymentMethodRemove: paymentMethodRemove,
106-
isTestMode: configuration.apiClient.isTestmode
106+
isTestMode: configuration.apiClient.isTestmode,
107+
alternateUpdatePaymentMethodNavigation: configuration.alternateUpdatePaymentMethodNavigation
107108
),
108109
appearance: configuration.appearance,
109110
cbcEligible: cbcEligible,
@@ -654,7 +655,8 @@ class CustomerSavedPaymentMethodsViewController: UIViewController {
654655
showApplePay: isApplePayEnabled,
655656
allowsRemovalOfLastSavedPaymentMethod: configuration.allowsRemovalOfLastSavedPaymentMethod,
656657
paymentMethodRemove: paymentMethodRemove,
657-
isTestMode: configuration.apiClient.isTestmode
658+
isTestMode: configuration.apiClient.isTestmode,
659+
alternateUpdatePaymentMethodNavigation: configuration.alternateUpdatePaymentMethodNavigation
658660
),
659661
appearance: configuration.appearance,
660662
cbcEligible: cbcEligible,

StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSheetConfiguration.swift

+5
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ extension CustomerSheet {
8181
/// Note: Card brand filtering is not currently supported by Link.
8282
@_spi(CardBrandFilteringBeta) public var cardBrandAcceptance: PaymentSheet.CardBrandAcceptance = .all
8383

84+
/// This is an experimental feature that may be removed at any time.
85+
/// If true, when editing, cards and us bank accounts will have the edit icon and users cannot remove them from the list screen.
86+
/// If false (default), only card brand choice eligible cards can be edited and users can remove payment methods from the list screen.
87+
@_spi(AlternateUpdatePaymentMethodNavigation) public var alternateUpdatePaymentMethodNavigation = false
88+
8489
public init () {
8590
}
8691
}

StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Embedded/EmbeddedPaymentElement+Internal.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,11 @@ extension EmbeddedPaymentElement: EmbeddedPaymentMethodsViewDelegate {
135135
self.formViewController = formViewController
136136
}
137137
func presentSavedPaymentMethods(selectedSavedPaymentMethod: STPPaymentMethod?) {
138-
// Special case, only 1 card remaining but is co-branded, skip showing the list and show update view controller
138+
// Special case, only 1 card remaining but is co-branded (or alternateUpdatePaymentMethodNavigation), skip showing the list and show update view controller
139139
if savedPaymentMethods.count == 1,
140140
let paymentMethod = savedPaymentMethods.first,
141141
paymentMethod.isCoBrandedCard,
142-
elementsSession.isCardBrandChoiceEligible {
142+
elementsSession.isCardBrandChoiceEligible || configuration.alternateUpdatePaymentMethodNavigation {
143143
let updateViewController = UpdateCardViewController(paymentMethod: paymentMethod,
144144
removeSavedPaymentMethodMessage: configuration.removeSavedPaymentMethodMessage,
145145
appearance: configuration.appearance,

0 commit comments

Comments
 (0)