Skip to content

Commit 1224267

Browse files
committed
Remove client side staging flag for updatePaymentMethod
1 parent 0460327 commit 1224267

20 files changed

+14
-51
lines changed

Example/PaymentSheet Example/PaymentSheet Example/CustomerSessionPlaygroundView.swift

-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ struct CustomerSessionPlaygroundView: View {
5454
}
5555
SettingPickerView(setting: $viewModel.paymentMethodRemove)
5656
SettingPickerView(setting: $viewModel.paymentMethodRemoveLast)
57-
SettingPickerView(setting: $viewModel.paymentMethodUpdate)
5857
SettingPickerView(setting: paymentMethodRedisplayBinding)
5958
if viewModel.paymentMethodRedisplay == .enabled {
6059
SettingPickerView(setting: $viewModel.paymentMethodAllowRedisplayFilters)

Example/PaymentSheet Example/PaymentSheet Example/CustomerSheetCustomerSessionPlaygroundView.swift

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ struct CustomerSheetCustomerSessionPlaygroundView: View {
2424
VStack {
2525
SettingPickerView(setting: $viewModel.paymentMethodRemove)
2626
SettingPickerView(setting: $viewModel.paymentMethodRemoveLast)
27-
SettingPickerView(setting: $viewModel.paymentMethodUpdate)
2827
SettingPickerView(setting: $viewModel.paymentMethodAllowRedisplayFilters)
2928
SettingPickerView(setting: $viewModel.paymentMethodSyncDefault)
3029
}

Example/PaymentSheet Example/PaymentSheet Example/CustomerSheetTestPlaygroundController.swift

-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ class CustomerSheetTestPlaygroundController: ObservableObject {
141141
case .allowVisa:
142142
configuration.cardBrandAcceptance = .allowed(brands: [.visa])
143143
}
144-
configuration.updatePaymentMethodEnabled = settings.paymentMethodUpdate == .enabled
145144
return configuration
146145
}
147146

Example/PaymentSheet Example/PaymentSheet Example/CustomerSheetTestPlaygroundSettings.swift

-8
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,6 @@ public struct CustomerSheetTestPlaygroundSettings: Codable, Equatable {
116116
case enabled
117117
case disabled
118118
}
119-
enum PaymentMethodUpdate: String, PickerEnum {
120-
static let enumName: String = "PaymentMethodUpdate"
121-
122-
case enabled
123-
case disabled
124-
}
125119
enum PaymentMethodAllowRedisplayFilters: String, PickerEnum {
126120
static var enumName: String { "PaymentMethodRedisplayFilters" }
127121

@@ -180,7 +174,6 @@ public struct CustomerSheetTestPlaygroundSettings: Codable, Equatable {
180174
var allowsRemovalOfLastSavedPaymentMethod: AllowsRemovalOfLastSavedPaymentMethod
181175
var paymentMethodRemove: PaymentMethodRemove
182176
var paymentMethodRemoveLast: PaymentMethodRemoveLast
183-
var paymentMethodUpdate: PaymentMethodUpdate
184177
var paymentMethodAllowRedisplayFilters: PaymentMethodAllowRedisplayFilters
185178
var paymentMethodSyncDefault: PaymentMethodSyncDefault
186179
var cardBrandAcceptance: CardBrandAcceptance
@@ -204,7 +197,6 @@ public struct CustomerSheetTestPlaygroundSettings: Codable, Equatable {
204197
allowsRemovalOfLastSavedPaymentMethod: .on,
205198
paymentMethodRemove: .enabled,
206199
paymentMethodRemoveLast: .enabled,
207-
paymentMethodUpdate: .disabled,
208200
paymentMethodAllowRedisplayFilters: .always,
209201
paymentMethodSyncDefault: .disabled,
210202
cardBrandAcceptance: .all)

Example/PaymentSheet Example/PaymentSheet Example/PaymentSheetTestPlaygroundSettings.swift

-8
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,6 @@ struct PaymentSheetTestPlaygroundSettings: Codable, Equatable {
198198
case enabled
199199
case disabled
200200
}
201-
enum PaymentMethodUpdate: String, PickerEnum {
202-
static var enumName: String { "PaymentMethodUpdate" }
203-
204-
case enabled
205-
case disabled
206-
}
207201
enum PaymentMethodRemoveLast: String, PickerEnum {
208202
static var enumName: String { "PaymentMethodRemoveLast" }
209203

@@ -492,7 +486,6 @@ struct PaymentSheetTestPlaygroundSettings: Codable, Equatable {
492486
var allowRedisplayOverride: AllowRedisplayOverride
493487
var paymentMethodRemove: PaymentMethodRemove
494488
var paymentMethodRemoveLast: PaymentMethodRemoveLast
495-
var paymentMethodUpdate: PaymentMethodUpdate
496489
var paymentMethodRedisplay: PaymentMethodRedisplay
497490
var paymentMethodAllowRedisplayFilters: PaymentMethodAllowRedisplayFilters
498491
var paymentMethodSetAsDefault: PaymentMethodSetAsDefault
@@ -543,7 +536,6 @@ struct PaymentSheetTestPlaygroundSettings: Codable, Equatable {
543536
allowRedisplayOverride: .notSet,
544537
paymentMethodRemove: .enabled,
545538
paymentMethodRemoveLast: .enabled,
546-
paymentMethodUpdate: .disabled,
547539
paymentMethodRedisplay: .enabled,
548540
paymentMethodAllowRedisplayFilters: .always,
549541
paymentMethodSetAsDefault: .disabled,

Example/PaymentSheet Example/PaymentSheet Example/PlaygroundController.swift

-4
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,6 @@ class PlaygroundController: ObservableObject {
185185
configuration.cardBrandAcceptance = .allowed(brands: [.visa])
186186
}
187187

188-
configuration.updatePaymentMethodEnabled = settings.paymentMethodUpdate == .enabled
189-
190188
switch settings.style {
191189
case .automatic:
192190
configuration.style = .automatic
@@ -285,8 +283,6 @@ class PlaygroundController: ObservableObject {
285283
configuration.cardBrandAcceptance = .allowed(brands: [.visa])
286284
}
287285

288-
configuration.updatePaymentMethodEnabled = settings.paymentMethodUpdate == .enabled
289-
290286
return configuration
291287
}
292288

Example/PaymentSheet Example/PaymentSheetUITest/CustomerSheetUITest.swift

-2
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,6 @@ class CustomerSheetUITest: XCTestCase {
768768
var settings = CustomerSheetTestPlaygroundSettings.defaultValues()
769769
settings.customerMode = .returning
770770
settings.customerKeyType = .customerSession
771-
settings.paymentMethodUpdate = .enabled
772771
settings.merchantCountryCode = .FR
773772
loadPlayground(
774773
app,
@@ -834,7 +833,6 @@ class CustomerSheetUITest: XCTestCase {
834833
var settings = CustomerSheetTestPlaygroundSettings.defaultValues()
835834
settings.customerMode = .returning
836835
settings.customerKeyType = .customerSession
837-
settings.paymentMethodUpdate = .enabled
838836
settings.merchantCountryCode = .FR
839837
settings.collectAddress = .full
840838
loadPlayground(

Example/PaymentSheet Example/PaymentSheetUITest/PaymentSheetUITest.swift

-2
Original file line numberDiff line numberDiff line change
@@ -1600,7 +1600,6 @@ class PaymentSheetCustomerSessionDedupeUITests: PaymentSheetUITestCase {
16001600
settings.linkEnabledMode = .off
16011601

16021602
settings.customerKeyType = .customerSession
1603-
settings.paymentMethodUpdate = .enabled
16041603
loadPlayground(app, settings)
16051604
app.buttons["Apple Pay, apple_pay"].waitForExistenceAndTap(timeout: 30) // Should default to Apple Pay
16061605
XCTAssertTrue(app.staticTexts["Edit"].waitForExistenceAndTap(timeout: 15))
@@ -1665,7 +1664,6 @@ class PaymentSheetCustomerSessionDedupeUITests: PaymentSheetUITestCase {
16651664
settings.collectAddress = .full
16661665

16671666
settings.customerKeyType = .customerSession
1668-
settings.paymentMethodUpdate = .enabled
16691667
loadPlayground(app, settings)
16701668
app.buttons["Apple Pay, apple_pay"].waitForExistenceAndTap(timeout: 30) // Should default to Apple Pay
16711669
XCTAssertTrue(app.staticTexts["Edit"].waitForExistenceAndTap(timeout: 15))

StripePaymentSheet/StripePaymentSheet/Source/Internal/API Bindings/v1-elements-sessions/STPElementsSession.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -246,12 +246,12 @@ extension STPElementsSession {
246246
return customer?.customerSession.mobilePaymentElementComponent.features?.paymentMethodSetAsDefault ?? false
247247
}
248248

249-
func paymentMethodUpdateForPaymentSheet(_ configuration: PaymentElementConfiguration) -> Bool {
250-
return configuration.updatePaymentMethodEnabled && customer?.customerSession.mobilePaymentElementComponent.enabled ?? false
249+
var paymentMethodUpdateForPaymentSheet: Bool {
250+
return customer?.customerSession.mobilePaymentElementComponent.enabled ?? false
251251
}
252252

253-
func paymentMethodUpdateForCustomerSheet(_ configuration: CustomerSheet.Configuration) -> Bool {
254-
return configuration.updatePaymentMethodEnabled && customer?.customerSession.customerSheetComponent.enabled ?? false
253+
var paymentMethodUpdateForCustomerSheet: Bool {
254+
return customer?.customerSession.customerSheetComponent.enabled ?? false
255255
}
256256

257257
func allowsRemovalOfPaymentMethodsForCustomerSheet() -> Bool {

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

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

84-
/// Flag used to stage the development of updating payment method
85-
@_spi(UpdatePaymentMethodBeta) public var updatePaymentMethodEnabled: Bool = false
86-
8784
public init () {
8885
}
8986
}

StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSheetDataSource.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ extension CustomerSheetDataSource {
213213
case .customerAdapter:
214214
return false
215215
case .customerSession:
216-
return elementsSession.paymentMethodUpdateForCustomerSheet(configuration)
216+
return elementsSession.paymentMethodUpdateForCustomerSheet
217217
}
218218
}
219219
func paymentMethodSyncDefault(elementsSession: STPElementsSession) -> Bool {

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ extension EmbeddedPaymentElement {
3333
isCBCEligible: loadResult.elementsSession.isCardBrandChoiceEligible,
3434
allowsRemovalOfLastSavedPaymentMethod: loadResult.elementsSession.paymentMethodRemoveLast(configuration: configuration),
3535
allowsPaymentMethodRemoval: loadResult.elementsSession.allowsRemovalOfPaymentMethodsForPaymentSheet(),
36-
allowsPaymentMethodUpdate: loadResult.elementsSession.paymentMethodUpdateForPaymentSheet(configuration),
36+
allowsPaymentMethodUpdate: loadResult.elementsSession.paymentMethodUpdateForPaymentSheet,
3737
isFlatCheckmarkStyle: configuration.appearance.embeddedPaymentElement.row.style == .flatWithCheckmark
3838
)
3939
let initialSelection: RowButtonType? = {
@@ -170,7 +170,7 @@ extension EmbeddedPaymentElement: EmbeddedPaymentMethodsViewDelegate {
170170
hostedSurface: .paymentSheet,
171171
cardBrandFilter: configuration.cardBrandFilter,
172172
canRemove: elementsSession.paymentMethodRemoveLast(configuration: configuration) && elementsSession.allowsRemovalOfPaymentMethodsForPaymentSheet(),
173-
canUpdate: elementsSession.paymentMethodUpdateForPaymentSheet(configuration),
173+
canUpdate: elementsSession.paymentMethodUpdateForPaymentSheet,
174174
isCBCEligible: paymentMethod.isCoBrandedCard && elementsSession.isCardBrandChoiceEligible,
175175
allowsSetAsDefaultPM: elementsSession.paymentMethodSetAsDefaultForPaymentSheet,
176176
isDefault: paymentMethod == defaultPaymentMethod)
@@ -311,7 +311,7 @@ extension EmbeddedPaymentElement: UpdatePaymentMethodViewControllerDelegate {
311311
isCBCEligible: elementsSession.isCardBrandChoiceEligible,
312312
allowsRemovalOfLastSavedPaymentMethod: elementsSession.paymentMethodRemoveLast(configuration: configuration),
313313
allowsPaymentMethodRemoval: elementsSession.allowsRemovalOfPaymentMethodsForPaymentSheet(),
314-
allowsPaymentMethodUpdate: elementsSession.paymentMethodUpdateForPaymentSheet(configuration),
314+
allowsPaymentMethodUpdate: elementsSession.paymentMethodUpdateForPaymentSheet,
315315
isFlatCheckmarkStyle: configuration.appearance.embeddedPaymentElement.row.style == .flatWithCheckmark
316316
)
317317
}

StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Embedded/EmbeddedPaymentElementConfiguration.swift

-3
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,6 @@ extension EmbeddedPaymentElement {
134134
/// Note: Card brand filtering is not currently supported by Link.
135135
public var cardBrandAcceptance: PaymentSheet.CardBrandAcceptance = .all
136136

137-
/// Flag used to stage the development of updating payment method
138-
@_spi(UpdatePaymentMethodBeta) public var updatePaymentMethodEnabled: Bool = false
139-
140137
/// The view can display payment methods like “Card” that, when tapped, open a form sheet where customers enter their payment method details. The sheet has a button at the bottom. `FormSheetAction` enumerates the actions the button can perform.
141138
public enum FormSheetAction {
142139
/// The button says “Pay” or “Setup”. When tapped, we confirm the payment or setup in the form sheet.

StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentElementConfiguration.swift

-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ protocol PaymentElementConfiguration: PaymentMethodRequirementProvider {
3939
var analyticPayload: [String: Any] { get }
4040
var disableWalletPaymentMethodFiltering: Bool { get set }
4141
var linkPaymentMethodsOnly: Bool { get set }
42-
var updatePaymentMethodEnabled: Bool { get }
4342
}
4443

4544
extension PaymentElementConfiguration {

StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetConfiguration.swift

-3
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,6 @@ extension PaymentSheet {
212212
/// Note: This is only a client-side solution.
213213
/// Note: Card brand filtering is not currently supported by Link.
214214
public var cardBrandAcceptance: PaymentSheet.CardBrandAcceptance = .all
215-
216-
/// Flag used to stage the development of updating payment method
217-
@_spi(UpdatePaymentMethodBeta) public var updatePaymentMethodEnabled: Bool = false
218215
}
219216

220217
/// Defines the layout orientations available for displaying payment methods in PaymentSheet.

StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Saved Payment Method Screen/SavedPaymentOptionsViewController.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ extension SavedPaymentOptionsViewController: PaymentOptionCellDelegate {
596596
hostedSurface: .paymentSheet,
597597
cardBrandFilter: paymentSheetConfiguration.cardBrandFilter,
598598
canRemove: configuration.allowsRemovalOfPaymentMethods && (savedPaymentMethods.count > 1 || configuration.allowsRemovalOfLastSavedPaymentMethod),
599-
canUpdate: elementsSession.paymentMethodUpdateForPaymentSheet(paymentSheetConfiguration),
599+
canUpdate: elementsSession.paymentMethodUpdateForPaymentSheet,
600600
isCBCEligible: paymentMethod.isCoBrandedCard && cbcEligible,
601601
allowsSetAsDefaultPM: configuration.allowsSetAsDefaultPM,
602602
isDefault: isDefaultPaymentMethod(savedPaymentMethodId: paymentMethod.stripeId))

StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Saved Payment Method Screen/Vertical Saved Payment Method Screen/VerticalSavedPaymentMethodsViewController.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ class VerticalSavedPaymentMethodsViewController: UIViewController {
183183
self.defaultPaymentMethod = defaultPaymentMethod
184184
self.paymentMethodRemove = elementsSession.allowsRemovalOfPaymentMethodsForPaymentSheet()
185185
self.paymentMethodRemoveLast = elementsSession.paymentMethodRemoveLast(configuration: configuration)
186-
self.paymentMethodUpdate = elementsSession.paymentMethodUpdateForPaymentSheet(configuration)
186+
self.paymentMethodUpdate = elementsSession.paymentMethodUpdateForPaymentSheet
187187
self.paymentMethodSetAsDefault = elementsSession.paymentMethodSetAsDefaultForPaymentSheet
188188
self.isCBCEligible = elementsSession.isCardBrandChoiceEligible
189189
self.analyticsHelper = analyticsHelper

StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/ViewControllers/PaymentSheetFlowControllerViewController.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ class PaymentSheetFlowControllerViewController: UIViewController, FlowController
208208
allowsRemovalOfLastSavedPaymentMethod: elementsSession.paymentMethodRemoveLast(configuration: configuration),
209209
allowsRemovalOfPaymentMethods: elementsSession.allowsRemovalOfPaymentMethodsForPaymentSheet(),
210210
allowsSetAsDefaultPM: elementsSession.paymentMethodSetAsDefaultForPaymentSheet,
211-
allowsUpdatePaymentMethod: elementsSession.paymentMethodUpdateForPaymentSheet(configuration)
211+
allowsUpdatePaymentMethod: elementsSession.paymentMethodUpdateForPaymentSheet
212212
),
213213
paymentSheetConfiguration: configuration,
214214
intent: intent,

StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/ViewControllers/PaymentSheetVerticalViewController.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ class PaymentSheetVerticalViewController: UIViewController, FlowControllerViewCo
382382
isCBCEligible: loadResult.elementsSession.isCardBrandChoiceEligible,
383383
allowsRemovalOfLastSavedPaymentMethod: loadResult.elementsSession.paymentMethodRemoveLast(configuration: configuration),
384384
allowsPaymentMethodRemoval: loadResult.elementsSession.allowsRemovalOfPaymentMethodsForPaymentSheet(),
385-
allowsPaymentMethodUpdate: loadResult.elementsSession.paymentMethodUpdateForPaymentSheet(configuration)
385+
allowsPaymentMethodUpdate: loadResult.elementsSession.paymentMethodUpdateForPaymentSheet
386386
)
387387
return VerticalPaymentMethodListViewController(
388388
initialSelection: initialSelection,
@@ -614,7 +614,7 @@ class PaymentSheetVerticalViewController: UIViewController, FlowControllerViewCo
614614
hostedSurface: .paymentSheet,
615615
cardBrandFilter: configuration.cardBrandFilter,
616616
canRemove: elementsSession.paymentMethodRemoveLast(configuration: configuration) && elementsSession.allowsRemovalOfPaymentMethodsForPaymentSheet(),
617-
canUpdate: elementsSession.paymentMethodUpdateForPaymentSheet(configuration),
617+
canUpdate: elementsSession.paymentMethodUpdateForPaymentSheet,
618618
isCBCEligible: paymentMethod.isCoBrandedCard && elementsSession.isCardBrandChoiceEligible,
619619
allowsSetAsDefaultPM: elementsSession.paymentMethodSetAsDefaultForPaymentSheet,
620620
isDefault: paymentMethod == defaultPaymentMethod)

StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/ViewControllers/PaymentSheetViewController.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ class PaymentSheetViewController: UIViewController, PaymentSheetViewControllerPr
176176
allowsRemovalOfLastSavedPaymentMethod: elementsSession.paymentMethodRemoveLast(configuration: configuration),
177177
allowsRemovalOfPaymentMethods: loadResult.elementsSession.allowsRemovalOfPaymentMethodsForPaymentSheet(),
178178
allowsSetAsDefaultPM: elementsSession.paymentMethodSetAsDefaultForPaymentSheet,
179-
allowsUpdatePaymentMethod: elementsSession.paymentMethodUpdateForPaymentSheet(configuration)
179+
allowsUpdatePaymentMethod: elementsSession.paymentMethodUpdateForPaymentSheet
180180
),
181181
paymentSheetConfiguration: configuration,
182182
intent: intent,

0 commit comments

Comments
 (0)