From a14958867e07efdebeb0c65d4d249dbcd44394dc Mon Sep 17 00:00:00 2001 From: Joyce Qin Date: Wed, 29 Jan 2025 16:18:16 -0800 Subject: [PATCH 01/14] read from customersession setting instead of config --- .../CustomerSessionPlaygroundView.swift | 4 +++- .../CustomerSheetTestPlayground.swift | 2 +- ...ustomerSheetTestPlaygroundController.swift | 2 +- .../CustomerSheetTestPlaygroundSettings.swift | 19 ++++++++-------- .../PaymentSheetTestPlaygroundSettings.swift | 14 ++++++------ .../PlaygroundController.swift | 3 +-- .../CustomerSession.swift | 11 +++++++--- .../STPElementsSession.swift | 8 +++++++ .../CustomerSessionAdapter.swift | 6 ++--- ...stomerAddPaymentMethodViewController.swift | 4 ++++ ...ymentMethodsCollectionViewController.swift | 4 ++-- ...merSavedPaymentMethodsViewController.swift | 19 ++++++++++------ .../CustomerSheet/CustomerSheet.swift | 6 ++++- .../CustomerSheetConfiguration.swift | 5 ----- .../CustomerSheetDataSource.swift | 11 +++++++++- .../EmbeddedPaymentElement+Internal.swift | 4 ++-- .../EmbeddedPaymentElementConfiguration.swift | 5 ----- .../PaymentElementConfiguration.swift | 1 - .../PaymentSheetConfiguration.swift | 4 ---- .../PaymentSheetFormFactory+Card.swift | 4 ++-- .../PaymentSheetFormFactory.swift | 12 ++++++---- .../PaymentSheetFormFactoryConfig.swift | 8 ------- .../PaymentSheet/PaymentSheetLoader.swift | 4 ++-- .../SavedPaymentOptionsViewController.swift | 2 +- ...calSavedPaymentMethodsViewController.swift | 10 +++++---- ...entSheetFlowControllerViewController.swift | 2 +- .../PaymentSheetVerticalViewController.swift | 4 ++-- .../PaymentSheetViewController.swift | 2 +- .../UpdatePaymentMethodViewModel.swift | 4 ++-- ...entMethodViewControllerSnapshotTests.swift | 2 +- ...MethodsCollectionViewControllerTests.swift | 4 ++-- .../CustomerSheet/CustomerSheetTests.swift | 4 ++-- .../IntentConfirmParamsTest.swift | 22 +++++++++---------- .../PaymentSheet/STPElementsSessionTest.swift | 19 ++++++++++++++++ ...entMethodViewControllerSnapshotTests.swift | 2 +- ...ntMethodsViewControllerSnapshotTests.swift | 2 +- 36 files changed, 139 insertions(+), 100 deletions(-) diff --git a/Example/PaymentSheet Example/PaymentSheet Example/CustomerSessionPlaygroundView.swift b/Example/PaymentSheet Example/PaymentSheet Example/CustomerSessionPlaygroundView.swift index 690b1935ce2..77d0471ac6f 100644 --- a/Example/PaymentSheet Example/PaymentSheet Example/CustomerSessionPlaygroundView.swift +++ b/Example/PaymentSheet Example/PaymentSheet Example/CustomerSessionPlaygroundView.swift @@ -50,13 +50,15 @@ struct CustomerSessionPlaygroundView: View { if viewModel.paymentMethodSave == .disabled { SettingPickerView(setting: $viewModel.allowRedisplayOverride) } + else { + SettingPickerView(setting: $viewModel.paymentMethodSetAsDefault) + } SettingPickerView(setting: $viewModel.paymentMethodRemove) SettingPickerView(setting: $viewModel.paymentMethodRemoveLast) SettingPickerView(setting: paymentMethodRedisplayBinding) if viewModel.paymentMethodRedisplay == .enabled { SettingPickerView(setting: $viewModel.paymentMethodAllowRedisplayFilters) } - SettingPickerView(setting: $viewModel.allowsSetAsDefaultPM) } }.padding() diff --git a/Example/PaymentSheet Example/PaymentSheet Example/CustomerSheetTestPlayground.swift b/Example/PaymentSheet Example/PaymentSheet Example/CustomerSheetTestPlayground.swift index 481c9161d0b..b275b1430d6 100644 --- a/Example/PaymentSheet Example/PaymentSheet Example/CustomerSheetTestPlayground.swift +++ b/Example/PaymentSheet Example/PaymentSheet Example/CustomerSheetTestPlayground.swift @@ -53,7 +53,7 @@ struct CustomerSheetTestPlayground: View { SettingPickerView(setting: $playgroundController.settings.paymentMethodRemove) SettingPickerView(setting: $playgroundController.settings.paymentMethodRemoveLast) SettingPickerView(setting: $playgroundController.settings.paymentMethodAllowRedisplayFilters) - SettingPickerView(setting: $playgroundController.settings.allowsSetAsDefaultPM) + SettingPickerView(setting: $playgroundController.settings.paymentMethodSetAsDefault) } } } diff --git a/Example/PaymentSheet Example/PaymentSheet Example/CustomerSheetTestPlaygroundController.swift b/Example/PaymentSheet Example/PaymentSheet Example/CustomerSheetTestPlaygroundController.swift index 519921e1063..32e7cd20b11 100644 --- a/Example/PaymentSheet Example/PaymentSheet Example/CustomerSheetTestPlaygroundController.swift +++ b/Example/PaymentSheet Example/PaymentSheet Example/CustomerSheetTestPlaygroundController.swift @@ -147,7 +147,6 @@ class CustomerSheetTestPlaygroundController: ObservableObject { case .allowVisa: configuration.cardBrandAcceptance = .allowed(brands: [.visa]) } - configuration.allowsSetAsDefaultPM = settings.allowsSetAsDefaultPM == .on return configuration } @@ -328,6 +327,7 @@ class CustomerSheetBackend { "merchant_country_code": settings.merchantCountryCode.rawValue, "customer_session_payment_method_remove": settings.paymentMethodRemove.rawValue, "customer_session_payment_method_remove_last": settings.paymentMethodRemoveLast.rawValue, + "customer_session_payment_method_set_as_default": settings.paymentMethodSetAsDefault.rawValue, ] as [String: Any] if let allowRedisplayValue = settings.paymentMethodAllowRedisplayFilters.arrayValue() { diff --git a/Example/PaymentSheet Example/PaymentSheet Example/CustomerSheetTestPlaygroundSettings.swift b/Example/PaymentSheet Example/PaymentSheet Example/CustomerSheetTestPlaygroundSettings.swift index 365140d361e..0ca96e2f2df 100644 --- a/Example/PaymentSheet Example/PaymentSheet Example/CustomerSheetTestPlaygroundSettings.swift +++ b/Example/PaymentSheet Example/PaymentSheet Example/CustomerSheetTestPlaygroundSettings.swift @@ -141,6 +141,13 @@ public struct CustomerSheetTestPlaygroundSettings: Codable, Equatable { } } + enum PaymentMethodSetAsDefault: String, PickerEnum { + static let enumName: String = "paymentMethodSetAsDefault" + + case enabled + case disabled + } + enum CardBrandAcceptance: String, PickerEnum { static let enumName: String = "cardBrandAcceptance" case all @@ -148,12 +155,6 @@ public struct CustomerSheetTestPlaygroundSettings: Codable, Equatable { case allowVisa } - enum AllowsSetAsDefaultPM: String, PickerEnum { - static let enumName: String = "allowsSetAsDefaultPM" - case on - case off - } - var customerMode: CustomerMode var customerId: String? var customerKeyType: CustomerKeyType @@ -174,8 +175,8 @@ public struct CustomerSheetTestPlaygroundSettings: Codable, Equatable { var paymentMethodRemove: PaymentMethodRemove var paymentMethodRemoveLast: PaymentMethodRemoveLast var paymentMethodAllowRedisplayFilters: PaymentMethodAllowRedisplayFilters + var paymentMethodSetAsDefault: PaymentMethodSetAsDefault var cardBrandAcceptance: CardBrandAcceptance - var allowsSetAsDefaultPM: AllowsSetAsDefaultPM static func defaultValues() -> CustomerSheetTestPlaygroundSettings { return CustomerSheetTestPlaygroundSettings(customerMode: .new, @@ -197,8 +198,8 @@ public struct CustomerSheetTestPlaygroundSettings: Codable, Equatable { paymentMethodRemove: .enabled, paymentMethodRemoveLast: .enabled, paymentMethodAllowRedisplayFilters: .always, - cardBrandAcceptance: .all, - allowsSetAsDefaultPM: .off) + paymentMethodSetAsDefault: .disabled, + cardBrandAcceptance: .all) } var base64Data: String { diff --git a/Example/PaymentSheet Example/PaymentSheet Example/PaymentSheetTestPlaygroundSettings.swift b/Example/PaymentSheet Example/PaymentSheet Example/PaymentSheetTestPlaygroundSettings.swift index 187ba60dc4a..b262ad8a890 100644 --- a/Example/PaymentSheet Example/PaymentSheet Example/PaymentSheetTestPlaygroundSettings.swift +++ b/Example/PaymentSheet Example/PaymentSheet Example/PaymentSheetTestPlaygroundSettings.swift @@ -446,10 +446,10 @@ struct PaymentSheetTestPlaygroundSettings: Codable, Equatable { case allowVisa } - enum AllowsSetAsDefaultPM: String, PickerEnum { - static let enumName: String = "allowsSetAsDefaultPM" - case on - case off + enum PaymentMethodSetAsDefault: String, PickerEnum { + static let enumName: String = "paymentMethodSetAsDefault" + case enabled + case disabled } var uiStyle: UIStyle @@ -474,6 +474,7 @@ struct PaymentSheetTestPlaygroundSettings: Codable, Equatable { var paymentMethodRemoveLast: PaymentMethodRemoveLast var paymentMethodRedisplay: PaymentMethodRedisplay var paymentMethodAllowRedisplayFilters: PaymentMethodAllowRedisplayFilters + var paymentMethodSetAsDefault: PaymentMethodSetAsDefault var defaultBillingAddress: DefaultBillingAddress var customEmail: String? var linkPassthroughMode: LinkPassthroughMode @@ -498,7 +499,6 @@ struct PaymentSheetTestPlaygroundSettings: Codable, Equatable { var formSheetAction: FormSheetAction var embeddedViewDisplaysMandateText: DisplaysMandateTextEnabled var cardBrandAcceptance: CardBrandAcceptance - var allowsSetAsDefaultPM: AllowsSetAsDefaultPM static func defaultValues() -> PaymentSheetTestPlaygroundSettings { return PaymentSheetTestPlaygroundSettings( @@ -522,6 +522,7 @@ struct PaymentSheetTestPlaygroundSettings: Codable, Equatable { paymentMethodRemoveLast: .enabled, paymentMethodRedisplay: .enabled, paymentMethodAllowRedisplayFilters: .always, + paymentMethodSetAsDefault: .disabled, defaultBillingAddress: .off, customEmail: nil, linkPassthroughMode: .passthrough, @@ -544,8 +545,7 @@ struct PaymentSheetTestPlaygroundSettings: Codable, Equatable { collectAddress: .automatic, formSheetAction: .continue, embeddedViewDisplaysMandateText: .on, - cardBrandAcceptance: .all, - allowsSetAsDefaultPM: .off) + cardBrandAcceptance: .all) } static let nsUserDefaultsKey = "PaymentSheetTestPlaygroundSettings" diff --git a/Example/PaymentSheet Example/PaymentSheet Example/PlaygroundController.swift b/Example/PaymentSheet Example/PaymentSheet Example/PlaygroundController.swift index 4f5d64ba40d..b177e909beb 100644 --- a/Example/PaymentSheet Example/PaymentSheet Example/PlaygroundController.swift +++ b/Example/PaymentSheet Example/PaymentSheet Example/PlaygroundController.swift @@ -183,7 +183,6 @@ class PlaygroundController: ObservableObject { case .allowVisa: configuration.cardBrandAcceptance = .allowed(brands: [.visa]) } - configuration.allowsSetAsDefaultPM = settings.allowsSetAsDefaultPM == .on return configuration } @@ -272,7 +271,6 @@ class PlaygroundController: ObservableObject { case .allowVisa: configuration.cardBrandAcceptance = .allowed(brands: [.visa]) } - configuration.allowsSetAsDefaultPM = settings.allowsSetAsDefaultPM == .on return configuration } @@ -630,6 +628,7 @@ extension PlaygroundController { "customer_session_payment_method_remove": settings.paymentMethodRemove.rawValue, "customer_session_payment_method_remove_last": settings.paymentMethodRemoveLast.rawValue, "customer_session_payment_method_redisplay": settings.paymentMethodRedisplay.rawValue, + "customer_session_payment_method_set_as_default": settings.paymentMethodSetAsDefault.rawValue, // "set_shipping_address": true // Uncomment to make server vend PI with shipping address populated ] as [String: Any] if settingsToLoad.apmsEnabled == .off, let supportedPaymentMethods = settingsToLoad.supportedPaymentMethods, !supportedPaymentMethods.isEmpty { diff --git a/StripePaymentSheet/StripePaymentSheet/Source/Internal/API Bindings/v1-elements-sessions/CustomerSession.swift b/StripePaymentSheet/StripePaymentSheet/Source/Internal/API Bindings/v1-elements-sessions/CustomerSession.swift index 3e806e3fac6..f366d045f8c 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/Internal/API Bindings/v1-elements-sessions/CustomerSession.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/Internal/API Bindings/v1-elements-sessions/CustomerSession.swift @@ -42,6 +42,7 @@ struct CustomerSession: Equatable, Hashable { return nil } let paymentMethodRemoveLast = mobilePaymentElementFeaturesDict["payment_method_remove_last"] as? String ?? "enabled" + let paymentMethodSetAsDefault = mobilePaymentElementFeaturesDict["payment_method_set_as_default"] as? String ?? "disabled" var allowRedisplayOverrideValue: STPPaymentMethodAllowRedisplay? if let allowRedisplayOverride = mobilePaymentElementFeaturesDict["payment_method_save_allow_redisplay_override"] as? String { @@ -52,7 +53,8 @@ struct CustomerSession: Equatable, Hashable { features: MobilePaymentElementComponentFeature(paymentMethodSave: paymentMethodSave == "enabled", paymentMethodRemove: paymentMethodRemove == "enabled", paymentMethodRemoveLast: paymentMethodRemoveLast == "enabled", - paymentMethodSaveAllowRedisplayOverride: allowRedisplayOverrideValue)) + paymentMethodSaveAllowRedisplayOverride: allowRedisplayOverrideValue, + paymentMethodSetAsDefault: paymentMethodSetAsDefault == "enabled")) } else { mobilePaymentElementComponent = MobilePaymentElementComponent(enabled: false, features: nil) } @@ -64,10 +66,11 @@ struct CustomerSession: Equatable, Hashable { return nil } let paymentMethodRemoveLast = customerSheetFeaturesDict["payment_method_remove_last"] as? String ?? "enabled" - + let paymentMethodSetAsDefault = customerSheetFeaturesDict["payment_method_set_as_default"] as? String ?? "enabled" customerSheetComponent = CustomerSheetComponent(enabled: true, features: CustomerSheetComponentFeature(paymentMethodRemove: paymentMethodRemove == "enabled", - paymentMethodRemoveLast: paymentMethodRemoveLast == "enabled")) + paymentMethodRemoveLast: paymentMethodRemoveLast == "enabled", + paymentMethodSetAsDefault: paymentMethodSetAsDefault == "enabled")) } else { customerSheetComponent = CustomerSheetComponent(enabled: false, features: nil) } @@ -94,6 +97,7 @@ struct MobilePaymentElementComponentFeature: Equatable, Hashable { let paymentMethodRemove: Bool let paymentMethodRemoveLast: Bool let paymentMethodSaveAllowRedisplayOverride: STPPaymentMethodAllowRedisplay? + let paymentMethodSetAsDefault: Bool } struct CustomerSheetComponent: Equatable, Hashable { @@ -104,4 +108,5 @@ struct CustomerSheetComponent: Equatable, Hashable { struct CustomerSheetComponentFeature: Equatable, Hashable { let paymentMethodRemove: Bool let paymentMethodRemoveLast: Bool + let paymentMethodSetAsDefault: Bool } diff --git a/StripePaymentSheet/StripePaymentSheet/Source/Internal/API Bindings/v1-elements-sessions/STPElementsSession.swift b/StripePaymentSheet/StripePaymentSheet/Source/Internal/API Bindings/v1-elements-sessions/STPElementsSession.swift index 96a57ebce77..eed4d5e40c6 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/Internal/API Bindings/v1-elements-sessions/STPElementsSession.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/Internal/API Bindings/v1-elements-sessions/STPElementsSession.swift @@ -211,6 +211,10 @@ extension STPElementsSession { return customer?.customerSession.mobilePaymentElementComponent.features?.paymentMethodRemoveLast ?? true } + var paymentMethodSetAsDefaultForPaymentSheet: Bool { + return customer?.customerSession.mobilePaymentElementComponent.features?.paymentMethodSetAsDefault ?? false + } + func allowsRemovalOfPaymentMethodsForCustomerSheet() -> Bool { var allowsRemovalOfPaymentMethods = false if let customerSession = customer?.customerSession { @@ -227,6 +231,10 @@ extension STPElementsSession { return customer?.customerSession.customerSheetComponent.features?.paymentMethodRemoveLast ?? true } + var paymentMethodSetAsDefaultForCustomerSheet: Bool { + return customer?.customerSession.customerSheetComponent.features?.paymentMethodSetAsDefault ?? false + } + var isLinkCardBrand: Bool { linkSettings?.linkMode == .linkCardBrand } diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSessionAdapter/CustomerSessionAdapter.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSessionAdapter/CustomerSessionAdapter.swift index 68b760d1da8..01707d5de97 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSessionAdapter/CustomerSessionAdapter.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSessionAdapter/CustomerSessionAdapter.swift @@ -107,10 +107,10 @@ extension CustomerSessionAdapter { return stripePaymentMethodId } - func fetchSelectedPaymentOption(for customerId: String, customer: ElementsCustomer? = nil) -> CustomerPaymentOption? { + func fetchSelectedPaymentOption(for customerId: String, elementsSession: STPElementsSession? = nil) -> CustomerPaymentOption? { // if opted in to the "set as default" feature, try to get default payment method from elements session - if configuration.allowsSetAsDefaultPM { - guard let customer = customer, + if let elementsSession = elementsSession, elementsSession.paymentMethodSetAsDefaultForCustomerSheet { + guard let customer = elementsSession.customer, let defaultPaymentMethod = customer.getDefaultOrFirstPaymentMethod() else { return nil } return CustomerPaymentOption.stripeId(defaultPaymentMethod.stripeId) } diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerAddPaymentMethodViewController.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerAddPaymentMethodViewController.swift index 0c3cef8dd21..b6953597a24 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerAddPaymentMethodViewController.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerAddPaymentMethodViewController.swift @@ -24,6 +24,7 @@ class CustomerAddPaymentMethodViewController: UIViewController { let paymentMethodTypes: [PaymentSheet.PaymentMethodType] let cbcEligible: Bool let savePaymentMethodConsentBehavior: PaymentSheetFormFactory.SavePaymentMethodConsentBehavior + let showSetAsDefaultCheckbox: Bool // MARK: - Read-only Properties weak var delegate: CustomerAddPaymentMethodViewControllerDelegate? @@ -127,6 +128,7 @@ class CustomerAddPaymentMethodViewController: UIViewController { paymentMethodTypes: [PaymentSheet.PaymentMethodType], cbcEligible: Bool, savePaymentMethodConsentBehavior: PaymentSheetFormFactory.SavePaymentMethodConsentBehavior, + showSetAsDefaultCheckbox: Bool, delegate: CustomerAddPaymentMethodViewControllerDelegate ) { self.configuration = configuration @@ -140,6 +142,7 @@ class CustomerAddPaymentMethodViewController: UIViewController { self.paymentMethodTypes = paymentMethodTypes self.cbcEligible = cbcEligible self.savePaymentMethodConsentBehavior = savePaymentMethodConsentBehavior + self.showSetAsDefaultCheckbox = showSetAsDefaultCheckbox super.init(nibName: nil, bundle: nil) self.view.backgroundColor = configuration.appearance.colors.background } @@ -249,6 +252,7 @@ class CustomerAddPaymentMethodViewController: UIViewController { isSettingUp: true, countryCode: nil, savePaymentMethodConsentBehavior: savePaymentMethodConsentBehavior, + showSetAsDefaultCheckbox: showSetAsDefaultCheckbox, analyticsHelper: nil, paymentMethodIncentive: nil ).make() diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSavedPaymentMethodsCollectionViewController.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSavedPaymentMethodsCollectionViewController.swift index fba4a6b6ac7..c6f2413f96d 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSavedPaymentMethodsCollectionViewController.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSavedPaymentMethodsCollectionViewController.swift @@ -81,8 +81,8 @@ class CustomerSavedPaymentMethodsCollectionViewController: UIViewController { let showApplePay: Bool let allowsRemovalOfLastSavedPaymentMethod: Bool let paymentMethodRemove: Bool + let paymentMethodSetAsDefault: Bool let isTestMode: Bool - let allowsSetAsDefaultPM: Bool } /// Whether or not you can edit save payment methods by removing or updating them. @@ -243,7 +243,7 @@ class CustomerSavedPaymentMethodsCollectionViewController: UIViewController { delegate: CustomerSavedPaymentMethodsCollectionViewControllerDelegate? = nil ) { // when opted into the set as default feature, only show payment methods that can be set as default (card, US bank account) - if configuration.allowsSetAsDefaultPM { + if configuration.paymentMethodSetAsDefault { self.savedPaymentMethods = savedPaymentMethods.filter{ savedPaymentMethod in CustomerSheet.supportedDefaultPaymentMethods.contains{paymentMethodType in savedPaymentMethod.type == paymentMethodType} } diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSavedPaymentMethodsViewController.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSavedPaymentMethodsViewController.swift index 637210c415d..6b309de7f30 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSavedPaymentMethodsViewController.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSavedPaymentMethodsViewController.swift @@ -34,6 +34,7 @@ class CustomerSavedPaymentMethodsViewController: UIViewController { let configuration: CustomerSheet.Configuration let customerSheetDataSource: CustomerSheetDataSource let paymentMethodRemove: Bool + let paymentMethodSetAsDefault: Bool let allowsRemovalOfLastSavedPaymentMethod: Bool let cbcEligible: Bool @@ -59,16 +60,17 @@ class CustomerSavedPaymentMethodsViewController: UIViewController { paymentMethodTypes: paymentMethodTypes, cbcEligible: cbcEligible, savePaymentMethodConsentBehavior: customerSheetDataSource.savePaymentMethodConsentBehavior(), + showSetAsDefaultCheckbox: paymentMethodSetAsDefault, delegate: self) }() private var cachedClientSecret: String? var showApplePay: Bool { - return isApplePayEnabled && !configuration.allowsSetAsDefaultPM + return isApplePayEnabled && !paymentMethodSetAsDefault } var paymentMethodTypes: [PaymentSheet.PaymentMethodType] { - let supportedPaymentMethods = configuration.allowsSetAsDefaultPM ? CustomerSheet.supportedDefaultPaymentMethods : CustomerSheet.supportedPaymentMethods + let supportedPaymentMethods = paymentMethodSetAsDefault ? CustomerSheet.supportedDefaultPaymentMethods : CustomerSheet.supportedPaymentMethods let paymentMethodTypes = merchantSupportedPaymentMethodTypes.customerSheetSupportedPaymentMethodTypesForAdd(canCreateSetupIntents: canCreateSetupIntents, supportedPaymentMethods: supportedPaymentMethods) return paymentMethodTypes.toPaymentSheetPaymentMethodTypes() } @@ -108,8 +110,8 @@ class CustomerSavedPaymentMethodsViewController: UIViewController { showApplePay: showApplePay, allowsRemovalOfLastSavedPaymentMethod: allowsRemovalOfLastSavedPaymentMethod, paymentMethodRemove: paymentMethodRemove, - isTestMode: configuration.apiClient.isTestmode, - allowsSetAsDefaultPM: configuration.allowsSetAsDefaultPM + paymentMethodSetAsDefault: paymentMethodSetAsDefault, + isTestMode: configuration.apiClient.isTestmode ), appearance: configuration.appearance, cbcEligible: cbcEligible, @@ -151,6 +153,7 @@ class CustomerSavedPaymentMethodsViewController: UIViewController { customerSheetDataSource: CustomerSheetDataSource, isApplePayEnabled: Bool, paymentMethodRemove: Bool, + paymentMethodSetAsDefault: Bool, allowsRemovalOfLastSavedPaymentMethod: Bool, cbcEligible: Bool, csCompletion: CustomerSheet.CustomerSheetCompletion?, @@ -163,12 +166,13 @@ class CustomerSavedPaymentMethodsViewController: UIViewController { self.customerSheetDataSource = customerSheetDataSource self.isApplePayEnabled = isApplePayEnabled self.paymentMethodRemove = paymentMethodRemove + self.paymentMethodSetAsDefault = paymentMethodSetAsDefault self.allowsRemovalOfLastSavedPaymentMethod = allowsRemovalOfLastSavedPaymentMethod self.cbcEligible = cbcEligible self.csCompletion = csCompletion self.delegate = delegate - if Self.shouldShowPaymentMethodCarousel(savedPaymentMethods: savedPaymentMethods, showApplePay: isApplePayEnabled && !configuration.allowsSetAsDefaultPM) { + if Self.shouldShowPaymentMethodCarousel(savedPaymentMethods: savedPaymentMethods, showApplePay: isApplePayEnabled && !paymentMethodSetAsDefault) { self.mode = .selectingSaved } else { switch customerSheetDataSource.dataSource { @@ -649,6 +653,7 @@ class CustomerSavedPaymentMethodsViewController: UIViewController { paymentMethodTypes: paymentMethodTypes, cbcEligible: cbcEligible, savePaymentMethodConsentBehavior: customerSheetDataSource.savePaymentMethodConsentBehavior(), + showSetAsDefaultCheckbox: paymentMethodSetAsDefault, delegate: self) cachedClientSecret = nil } @@ -662,8 +667,8 @@ class CustomerSavedPaymentMethodsViewController: UIViewController { showApplePay: isApplePayEnabled, allowsRemovalOfLastSavedPaymentMethod: allowsRemovalOfLastSavedPaymentMethod, paymentMethodRemove: paymentMethodRemove, - isTestMode: configuration.apiClient.isTestmode, - allowsSetAsDefaultPM: configuration.allowsSetAsDefaultPM + paymentMethodSetAsDefault: paymentMethodSetAsDefault, + isTestMode: configuration.apiClient.isTestmode ), appearance: configuration.appearance, cbcEligible: cbcEligible, diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSheet.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSheet.swift index 79e088e701c..a4a16e98296 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSheet.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSheet.swift @@ -167,6 +167,7 @@ public class CustomerSheet { case .success((let savedPaymentMethods, let selectedPaymentMethodOption, let elementsSession)): let merchantSupportedPaymentMethodTypes = customerSheetDataSource.merchantSupportedPaymentMethodTypes(elementsSession: elementsSession) let paymentMethodRemove = customerSheetDataSource.paymentMethodRemove(elementsSession: elementsSession) + let paymentMethodSetAsDefault = customerSheetDataSource.paymentMethodSetAsDefault(elementsSession: elementsSession) let allowsRemovalOfLastSavedPaymentMethod = CustomerSheet.allowsRemovalOfLastPaymentMethod(elementsSession: elementsSession, configuration: self.configuration) self.present(from: presentingViewController, savedPaymentMethods: savedPaymentMethods, @@ -174,6 +175,7 @@ public class CustomerSheet { merchantSupportedPaymentMethodTypes: merchantSupportedPaymentMethodTypes, customerSheetDataSource: customerSheetDataSource, paymentMethodRemove: paymentMethodRemove, + paymentMethodSetAsDefault: paymentMethodSetAsDefault, allowsRemovalOfLastSavedPaymentMethod: allowsRemovalOfLastSavedPaymentMethod, cbcEligible: elementsSession.cardBrandChoice?.eligible ?? false) STPAnalyticsClient.sharedClient.logPaymentSheetEvent(event: .customerSheetLoadSucceeded, @@ -198,6 +200,7 @@ public class CustomerSheet { merchantSupportedPaymentMethodTypes: [STPPaymentMethodType], customerSheetDataSource: CustomerSheetDataSource, paymentMethodRemove: Bool, + paymentMethodSetAsDefault: Bool, allowsRemovalOfLastSavedPaymentMethod: Bool, cbcEligible: Bool) { let loadSpecsPromise = Promise() @@ -214,6 +217,7 @@ public class CustomerSheet { customerSheetDataSource: customerSheetDataSource, isApplePayEnabled: isApplePayEnabled, paymentMethodRemove: paymentMethodRemove, + paymentMethodSetAsDefault: paymentMethodSetAsDefault, allowsRemovalOfLastSavedPaymentMethod: allowsRemovalOfLastSavedPaymentMethod, cbcEligible: cbcEligible, csCompletion: self.csCompletion, @@ -330,7 +334,7 @@ extension CustomerSheet { var selectedPaymentOption: CustomerPaymentOption? // if opted in to the "set as default" feature, try to get default payment method from elements session - if configuration.allowsSetAsDefaultPM { + if elementsSession.paymentMethodSetAsDefaultForCustomerSheet { guard let customer = elementsSession.customer, let defaultPaymentMethod = customer.getDefaultOrFirstPaymentMethod() else { return nil } selectedPaymentOption = CustomerPaymentOption.stripeId(defaultPaymentMethod.stripeId) diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSheetConfiguration.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSheetConfiguration.swift index c1f253c575c..67f6785c5df 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSheetConfiguration.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSheetConfiguration.swift @@ -81,11 +81,6 @@ extension CustomerSheet { /// Note: Card brand filtering is not currently supported by Link. @_spi(CardBrandFilteringBeta) public var cardBrandAcceptance: PaymentSheet.CardBrandAcceptance = .all - /// This is an experimental feature that may be removed at any time. - /// If true, users can set a payment method as default and sync their default payment method across web and mobile - /// If false (default), users cannot set default payment methods. - @_spi(AllowsSetAsDefaultPM) public var allowsSetAsDefaultPM = false - public init () { } } diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSheetDataSource.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSheetDataSource.swift index 311b1f79a29..8afee76cab5 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSheetDataSource.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSheetDataSource.swift @@ -42,7 +42,7 @@ class CustomerSheetDataSource { await loadFormSpecs() let customerId = try await customerSessionClientSecret.customerId let elementSession = try await elementsSessionResult - let paymentOption = customerSessionAdapter.fetchSelectedPaymentOption(for: customerId, customer: elementSession.customer) + let paymentOption = customerSessionAdapter.fetchSelectedPaymentOption(for: customerId, elementsSession: elementSession) // Override with specs from elementSession _ = FormSpecProvider.shared.loadFrom(elementSession.paymentMethodSpecs as Any) @@ -198,4 +198,13 @@ extension CustomerSheetDataSource { return elementsSession.allowsRemovalOfPaymentMethodsForCustomerSheet() } } + + func paymentMethodSetAsDefault(elementsSession: STPElementsSession) -> Bool { + switch dataSource { + case .customerAdapter: + return false + case .customerSession: + return elementsSession.paymentMethodSetAsDefaultForCustomerSheet + } + } } diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Embedded/EmbeddedPaymentElement+Internal.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Embedded/EmbeddedPaymentElement+Internal.swift index 4172954dad4..9d27685c33a 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Embedded/EmbeddedPaymentElement+Internal.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Embedded/EmbeddedPaymentElement+Internal.swift @@ -54,7 +54,7 @@ extension EmbeddedPaymentElement { // If there's no previous customer input, default to the customer's default or the first saved payment method, if any var customerDefault: CustomerPaymentOption? // if opted in to the "set as default" feature, try to get default payment method from elements session - if configuration.allowsSetAsDefaultPM { + if loadResult.elementsSession.paymentMethodSetAsDefaultForPaymentSheet { if let defaultPaymentMethod = loadResult.elementsSession.customer?.getDefaultOrFirstPaymentMethod() { customerDefault = CustomerPaymentOption.stripeId(defaultPaymentMethod.stripeId) } @@ -165,7 +165,7 @@ extension EmbeddedPaymentElement: EmbeddedPaymentMethodsViewDelegate { cardBrandFilter: configuration.cardBrandFilter, canRemove: configuration.allowsRemovalOfLastSavedPaymentMethod && elementsSession.allowsRemovalOfPaymentMethodsForPaymentSheet(), canUpdateCardBrand: paymentMethod.isCoBrandedCard && elementsSession.isCardBrandChoiceEligible, - allowsSetAsDefaultPM: configuration.allowsSetAsDefaultPM, + canSetAsDefaultPM: elementsSession.paymentMethodSetAsDefaultForPaymentSheet, isDefault: paymentMethod == elementsSession.customer?.getDefaultPaymentMethod() ) let updateViewController = UpdatePaymentMethodViewController( diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Embedded/EmbeddedPaymentElementConfiguration.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Embedded/EmbeddedPaymentElementConfiguration.swift index 9560558b933..92d980659f5 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Embedded/EmbeddedPaymentElementConfiguration.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Embedded/EmbeddedPaymentElementConfiguration.swift @@ -131,11 +131,6 @@ extension EmbeddedPaymentElement { /// Note: Card brand filtering is not currently supported by Link. @_spi(CardBrandFilteringBeta) public var cardBrandAcceptance: PaymentSheet.CardBrandAcceptance = .all - /// This is an experimental feature that may be removed at any time. - /// If true, users can set a payment method as default and sync their default payment method across web and mobile - /// If false (default), users cannot set default payment methods. - @_spi(AllowsSetAsDefaultPM) public var allowsSetAsDefaultPM = false - /// 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. public enum FormSheetAction { /// The button says “Pay” or “Setup”. When tapped, we confirm the payment or setup in the form sheet. diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentElementConfiguration.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentElementConfiguration.swift index f350973fa3f..462c0d663de 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentElementConfiguration.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentElementConfiguration.swift @@ -37,7 +37,6 @@ protocol PaymentElementConfiguration: PaymentMethodRequirementProvider { var cardBrandAcceptance: PaymentSheet.CardBrandAcceptance { get set } var analyticPayload: [String: Any] { get } var disableWalletPaymentMethodFiltering: Bool { get set } - var allowsSetAsDefaultPM: Bool { get set } var linkPaymentMethodsOnly: Bool { get set } } diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetConfiguration.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetConfiguration.swift index f8b9d83335f..0dae47f34aa 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetConfiguration.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetConfiguration.swift @@ -210,10 +210,6 @@ extension PaymentSheet { /// Note: Card brand filtering is not currently supported by Link. @_spi(CardBrandFilteringBeta) public var cardBrandAcceptance: PaymentSheet.CardBrandAcceptance = .all - /// This is an experimental feature that may be removed at any time. - /// If true, users can set a payment method as default and sync their default payment method across web and mobile - /// If false (default), users cannot set default payment methods. - @_spi(AllowsSetAsDefaultPM) public var allowsSetAsDefaultPM = false } /// Defines the layout orientations available for displaying payment methods in PaymentSheet. diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetFormFactory/PaymentSheetFormFactory+Card.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetFormFactory/PaymentSheetFormFactory+Card.swift index 92a13ae5b9d..02fc07d1f83 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetFormFactory/PaymentSheetFormFactory+Card.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetFormFactory/PaymentSheetFormFactory+Card.swift @@ -13,10 +13,10 @@ import StripePayments import UIKit extension PaymentSheetFormFactory { - func makeCard(cardBrandChoiceEligible: Bool = false) -> PaymentMethodElement { + func makeCard(cardBrandChoiceEligible: Bool = false, showSetAsDefaultCheckbox: Bool) -> PaymentMethodElement { let showLinkInlineSignup = showLinkInlineCardSignup var defaultCheckbox: PaymentMethodElementWrapper? - if configuration.allowsSetAsDefaultPM { + if showSetAsDefaultCheckbox { defaultCheckbox = makeDefaultCheckbox() } let saveCheckbox = makeSaveCheckbox( diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetFormFactory/PaymentSheetFormFactory.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetFormFactory/PaymentSheetFormFactory.swift index 95be2e29088..9fe101967bc 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetFormFactory/PaymentSheetFormFactory.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetFormFactory/PaymentSheetFormFactory.swift @@ -36,6 +36,7 @@ class PaymentSheetFormFactory { let countryCode: String? let cardBrandChoiceEligible: Bool let savePaymentMethodConsentBehavior: SavePaymentMethodConsentBehavior + let showSetAsDefaultCheckbox: Bool let analyticsHelper: PaymentSheetAnalyticsHelper? let paymentMethodIncentive: PaymentMethodIncentive? @@ -107,6 +108,7 @@ class PaymentSheetFormFactory { isSettingUp: intent.isSettingUp, countryCode: elementsSession.countryCode(overrideCountry: configuration.overrideCountry), savePaymentMethodConsentBehavior: elementsSession.savePaymentMethodConsentBehavior, + showSetAsDefaultCheckbox: elementsSession.paymentMethodSetAsDefaultForPaymentSheet, analyticsHelper: analyticsHelper, paymentMethodIncentive: elementsSession.incentive) } @@ -124,6 +126,7 @@ class PaymentSheetFormFactory { isSettingUp: Bool, countryCode: String?, savePaymentMethodConsentBehavior: SavePaymentMethodConsentBehavior, + showSetAsDefaultCheckbox: Bool, analyticsHelper: PaymentSheetAnalyticsHelper?, paymentMethodIncentive: PaymentMethodIncentive? ) { @@ -144,6 +147,7 @@ class PaymentSheetFormFactory { self.countryCode = countryCode self.cardBrandChoiceEligible = cardBrandChoiceEligible self.savePaymentMethodConsentBehavior = savePaymentMethodConsentBehavior + self.showSetAsDefaultCheckbox = showSetAsDefaultCheckbox self.analyticsHelper = analyticsHelper self.paymentMethodIncentive = paymentMethodIncentive } @@ -160,9 +164,9 @@ class PaymentSheetFormFactory { // We have two ways to create the form for a payment method // 1. Custom, one-off forms if paymentMethod == .card { - return makeCard(cardBrandChoiceEligible: cardBrandChoiceEligible) + return makeCard(cardBrandChoiceEligible: cardBrandChoiceEligible, showSetAsDefaultCheckbox: showSetAsDefaultCheckbox) } else if paymentMethod == .USBankAccount { - return makeUSBankAccount(merchantName: configuration.merchantDisplayName) + return makeUSBankAccount(merchantName: configuration.merchantDisplayName, showSetAsDefaultCheckbox: showSetAsDefaultCheckbox) } else if paymentMethod == .UPI { return makeUPI() } else if paymentMethod == .cashApp && isSettingUp { @@ -525,10 +529,10 @@ extension PaymentSheetFormFactory { ) } - func makeUSBankAccount(merchantName: String) -> PaymentMethodElement { + func makeUSBankAccount(merchantName: String, showSetAsDefaultCheckbox: Bool) -> PaymentMethodElement { let isSaving = BoolReference() var defaultCheckbox: PaymentMethodElementWrapper? - if configuration.allowsSetAsDefaultPM { + if showSetAsDefaultCheckbox { defaultCheckbox = makeDefaultCheckbox() } let saveCheckbox = makeSaveCheckbox( diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetFormFactory/PaymentSheetFormFactoryConfig.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetFormFactory/PaymentSheetFormFactoryConfig.swift index 7aa60671701..e3bd939c552 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetFormFactory/PaymentSheetFormFactoryConfig.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetFormFactory/PaymentSheetFormFactoryConfig.swift @@ -112,12 +112,4 @@ enum PaymentSheetFormFactoryConfig { } } - var allowsSetAsDefaultPM: Bool { - switch self { - case .paymentSheet(let config): - return config.allowsSetAsDefaultPM - case .customerSheet(let config): - return config.allowsSetAsDefaultPM - } - } } diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetLoader.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetLoader.swift index 90e6c0d1695..231093f0764 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetLoader.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetLoader.swift @@ -117,7 +117,7 @@ final class PaymentSheetLoader { customerID: configuration.customer?.id, showApplePay: integrationShape.canDefaultToLinkOrApplePay ? isApplePayEnabled : false, showLink: integrationShape.canDefaultToLinkOrApplePay ? isLinkEnabled : false, - allowsSetAsDefaultPM: configuration.allowsSetAsDefaultPM, + allowsSetAsDefaultPM: elementsSession.paymentMethodSetAsDefaultForPaymentSheet, customer: elementsSession.customer ) let paymentMethodTypes = PaymentSheet.PaymentMethodType.filteredPaymentMethodTypes(from: intent, elementsSession: elementsSession, configuration: configuration, logAvailability: true) @@ -319,7 +319,7 @@ final class PaymentSheetLoader { if let customerID = configuration.customer?.id { var defaultPaymentMethodOption: CustomerPaymentOption? // if opted in to the "set as default" feature, try to get default payment method from elements session - if configuration.allowsSetAsDefaultPM { + if elementsSession.paymentMethodSetAsDefaultForPaymentSheet { guard let customer = elementsSession.customer, let defaultPaymentMethod = customer.getDefaultOrFirstPaymentMethod() else { return [] } defaultPaymentMethodOption = CustomerPaymentOption.stripeId(defaultPaymentMethod.stripeId) diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Saved Payment Method Screen/SavedPaymentOptionsViewController.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Saved Payment Method Screen/SavedPaymentOptionsViewController.swift index 2f1d8637a31..33d9ee265f1 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Saved Payment Method Screen/SavedPaymentOptionsViewController.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Saved Payment Method Screen/SavedPaymentOptionsViewController.swift @@ -590,7 +590,7 @@ extension SavedPaymentOptionsViewController: PaymentOptionCellDelegate { cardBrandFilter: paymentSheetConfiguration.cardBrandFilter, canRemove: configuration.allowsRemovalOfPaymentMethods && (savedPaymentMethods.count > 1 || configuration.allowsRemovalOfLastSavedPaymentMethod), canUpdateCardBrand: paymentMethod.isCoBrandedCard && cbcEligible, - allowsSetAsDefaultPM: configuration.allowsSetAsDefaultPM, + canSetAsDefaultPM: configuration.allowsSetAsDefaultPM, isDefault: paymentMethod == elementsSession.customer?.getDefaultPaymentMethod() ) let editVc = UpdatePaymentMethodViewController( diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Saved Payment Method Screen/Vertical Saved Payment Method Screen/VerticalSavedPaymentMethodsViewController.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Saved Payment Method Screen/Vertical Saved Payment Method Screen/VerticalSavedPaymentMethodsViewController.swift index ddee6684bcc..129f4da5eb3 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Saved Payment Method Screen/Vertical Saved Payment Method Screen/VerticalSavedPaymentMethodsViewController.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Saved Payment Method Screen/Vertical Saved Payment Method Screen/VerticalSavedPaymentMethodsViewController.swift @@ -35,6 +35,7 @@ class VerticalSavedPaymentMethodsViewController: UIViewController { private let configuration: PaymentElementConfiguration private let elementsSession: STPElementsSession private let paymentMethodRemove: Bool + private let paymentMethodSetAsDefault: Bool private let isCBCEligible: Bool private let analyticsHelper: PaymentSheetAnalyticsHelper @@ -97,7 +98,7 @@ class VerticalSavedPaymentMethodsViewController: UIViewController { guard hasSupportedSavedPaymentMethods else { fatalError("Saved payment methods contain unsupported payment methods.") } - return configuration.allowsSetAsDefaultPM || canRemovePaymentMethods || canEditPaymentMethods + return paymentMethodSetAsDefault || canRemovePaymentMethods || canEditPaymentMethods } private var selectedPaymentMethod: STPPaymentMethod? { @@ -170,6 +171,7 @@ class VerticalSavedPaymentMethodsViewController: UIViewController { self.configuration = configuration self.elementsSession = elementsSession self.paymentMethodRemove = elementsSession.allowsRemovalOfPaymentMethodsForPaymentSheet() + self.paymentMethodSetAsDefault = elementsSession.paymentMethodSetAsDefaultForPaymentSheet self.isCBCEligible = elementsSession.isCardBrandChoiceEligible self.analyticsHelper = analyticsHelper super.init(nibName: nil, bundle: nil) @@ -178,8 +180,8 @@ class VerticalSavedPaymentMethodsViewController: UIViewController { } private func isDefaultPaymentMethod(paymentMethodId: String) -> Bool { - guard configuration.allowsSetAsDefaultPM, let defaultPaymentMethod = elementsSession.customer?.getDefaultPaymentMethod() else { return false } - return configuration.allowsSetAsDefaultPM && paymentMethodId == defaultPaymentMethod.stripeId + guard paymentMethodSetAsDefault, let defaultPaymentMethod = elementsSession.customer?.getDefaultPaymentMethod() else { return false } + return paymentMethodSetAsDefault && paymentMethodId == defaultPaymentMethod.stripeId } private func buildPaymentMethodRows(paymentMethods: [STPPaymentMethod]) -> [SavedPaymentMethodRowButton] { @@ -334,7 +336,7 @@ extension VerticalSavedPaymentMethodsViewController: SavedPaymentMethodRowButton cardBrandFilter: configuration.cardBrandFilter, canRemove: canRemovePaymentMethods, canUpdateCardBrand: paymentMethod.isCoBrandedCard && isCBCEligible, - allowsSetAsDefaultPM: configuration.allowsSetAsDefaultPM, + canSetAsDefaultPM: paymentMethodSetAsDefault, isDefault: paymentMethod == elementsSession.customer?.getDefaultPaymentMethod() ) let updateViewController = UpdatePaymentMethodViewController( diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/ViewControllers/PaymentSheetFlowControllerViewController.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/ViewControllers/PaymentSheetFlowControllerViewController.swift index 65aabb4c205..0f4bea5ce40 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/ViewControllers/PaymentSheetFlowControllerViewController.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/ViewControllers/PaymentSheetFlowControllerViewController.swift @@ -207,7 +207,7 @@ class PaymentSheetFlowControllerViewController: UIViewController, FlowController isTestMode: configuration.apiClient.isTestmode, allowsRemovalOfLastSavedPaymentMethod: PaymentSheetViewController.allowsRemovalOfLastPaymentMethod(elementsSession: elementsSession, configuration: configuration), allowsRemovalOfPaymentMethods: elementsSession.allowsRemovalOfPaymentMethodsForPaymentSheet(), - allowsSetAsDefaultPM: configuration.allowsSetAsDefaultPM + allowsSetAsDefaultPM: elementsSession.paymentMethodSetAsDefaultForPaymentSheet ), paymentSheetConfiguration: configuration, intent: intent, diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/ViewControllers/PaymentSheetVerticalViewController.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/ViewControllers/PaymentSheetVerticalViewController.swift index 7ebeaa9f3e7..1a8e5923da6 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/ViewControllers/PaymentSheetVerticalViewController.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/ViewControllers/PaymentSheetVerticalViewController.swift @@ -336,7 +336,7 @@ class PaymentSheetVerticalViewController: UIViewController, FlowControllerViewCo } var customerDefault: CustomerPaymentOption? - if configuration.allowsSetAsDefaultPM { + if elementsSession.paymentMethodSetAsDefaultForPaymentSheet { // if opted in to the "set as default" feature, try to get default payment method from elements session if let customer = elementsSession.customer, let defaultPaymentMethod = customer.getDefaultOrFirstPaymentMethod() { @@ -619,7 +619,7 @@ class PaymentSheetVerticalViewController: UIViewController, FlowControllerViewCo cardBrandFilter: configuration.cardBrandFilter, canRemove: configuration.allowsRemovalOfLastSavedPaymentMethod && elementsSession.allowsRemovalOfPaymentMethodsForPaymentSheet(), canUpdateCardBrand: paymentMethod.isCoBrandedCard && elementsSession.isCardBrandChoiceEligible, - allowsSetAsDefaultPM: configuration.allowsSetAsDefaultPM, + canSetAsDefaultPM: elementsSession.paymentMethodSetAsDefaultForPaymentSheet, isDefault: paymentMethod == elementsSession.customer?.getDefaultPaymentMethod() ) let updateViewController = UpdatePaymentMethodViewController( diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/ViewControllers/PaymentSheetViewController.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/ViewControllers/PaymentSheetViewController.swift index 9e91c30f020..2f730be0f8d 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/ViewControllers/PaymentSheetViewController.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/ViewControllers/PaymentSheetViewController.swift @@ -175,7 +175,7 @@ class PaymentSheetViewController: UIViewController, PaymentSheetViewControllerPr isTestMode: configuration.apiClient.isTestmode, allowsRemovalOfLastSavedPaymentMethod: PaymentSheetViewController.allowsRemovalOfLastPaymentMethod(elementsSession: elementsSession, configuration: configuration), allowsRemovalOfPaymentMethods: loadResult.elementsSession.allowsRemovalOfPaymentMethodsForPaymentSheet(), - allowsSetAsDefaultPM: configuration.allowsSetAsDefaultPM + allowsSetAsDefaultPM: elementsSession.paymentMethodSetAsDefaultForPaymentSheet ), paymentSheetConfiguration: configuration, intent: intent, diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/ViewControllers/UpdatePaymentMethodViewModel.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/ViewControllers/UpdatePaymentMethodViewModel.swift index 2a984dd462f..c73e5ff4ada 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/ViewControllers/UpdatePaymentMethodViewModel.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/ViewControllers/UpdatePaymentMethodViewModel.swift @@ -59,7 +59,7 @@ class UpdatePaymentMethodViewModel { } }() - init(paymentMethod: STPPaymentMethod, appearance: PaymentSheet.Appearance, hostedSurface: HostedSurface, cardBrandFilter: CardBrandFilter = .default, canRemove: Bool, canUpdateCardBrand: Bool, allowsSetAsDefaultPM: Bool = false, isDefault: Bool = false) { + init(paymentMethod: STPPaymentMethod, appearance: PaymentSheet.Appearance, hostedSurface: HostedSurface, cardBrandFilter: CardBrandFilter = .default, canRemove: Bool, canUpdateCardBrand: Bool, canSetAsDefaultPM: Bool = false, isDefault: Bool = false) { guard PaymentSheet.supportedSavedPaymentMethods.contains(paymentMethod.type) else { fatalError("Unsupported payment type \(paymentMethod.type) in UpdatePaymentMethodViewModel") } @@ -69,7 +69,7 @@ class UpdatePaymentMethodViewModel { self.cardBrandFilter = cardBrandFilter self.canRemove = canRemove self.canUpdateCardBrand = canUpdateCardBrand - self.allowsSetAsDefaultPM = allowsSetAsDefaultPM + self.allowsSetAsDefaultPM = canSetAsDefaultPM self.isDefault = isDefault } } diff --git a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/AddPaymentMethodViewControllerSnapshotTests.swift b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/AddPaymentMethodViewControllerSnapshotTests.swift index 4a8d5ebd27b..eee1c93bf46 100644 --- a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/AddPaymentMethodViewControllerSnapshotTests.swift +++ b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/AddPaymentMethodViewControllerSnapshotTests.swift @@ -63,7 +63,7 @@ final class AddPaymentMethodViewControllerSnapshotTests: STPSnapshotTestCase { // ...and a "Save this card" checkbox... config.customer = .init(id: "id", ephemeralKeySecret: "ek") // allows set as default so that the set as default checkbox renders - config.allowsSetAsDefaultPM = true + config.paymentMethodSetAsDefault = true // ...the AddPMVC should show the card type selected with the form pre-filled with the previous input let sut = AddPaymentMethodViewController( intent: intent, diff --git a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/CustomerSheet/CustomerSavedPaymentMethodsCollectionViewControllerTests.swift b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/CustomerSheet/CustomerSavedPaymentMethodsCollectionViewControllerTests.swift index 89b0c3b9aee..f24a43c014f 100644 --- a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/CustomerSheet/CustomerSavedPaymentMethodsCollectionViewControllerTests.swift +++ b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/CustomerSheet/CustomerSavedPaymentMethodsCollectionViewControllerTests.swift @@ -308,8 +308,8 @@ class CustomerSavedPaymentMethodsCollectionViewControllerTests: XCTestCase { return CustomerSavedPaymentMethodsCollectionViewController.Configuration(showApplePay: showApplePay, allowsRemovalOfLastSavedPaymentMethod: allowsRemovalOfLastSavedPaymentMethod, paymentMethodRemove: paymentMethodRemove, - isTestMode: true, - allowsSetAsDefaultPM: allowsSetAsDefaultPM) + paymentMethodSetAsDefault: allowsSetAsDefaultPM, + isTestMode: true) } func customerSavedPaymentMethods(_ configuration: CustomerSavedPaymentMethodsCollectionViewController.Configuration, savedPaymentMethods: [STPPaymentMethod], diff --git a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/CustomerSheet/CustomerSheetTests.swift b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/CustomerSheet/CustomerSheetTests.swift index 8059ad4999b..4bf7a28d721 100644 --- a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/CustomerSheet/CustomerSheetTests.swift +++ b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/CustomerSheet/CustomerSheetTests.swift @@ -333,7 +333,7 @@ class CustomerSheetTests: APIStubbedTestCase { StubbedBackend.stubSessions(fileMock: .elementsSessions_customerSessionsCustomerSheetWithSavedPM_200) var configuration = CustomerSheet.Configuration() configuration.apiClient = stubbedAPIClient - configuration.allowsSetAsDefaultPM = true + configuration.paymentMethodSetAsDefault = true let loadPaymentMethodInfo = expectation(description: "loadPaymentMethodInfo completed") let customerSheet = CustomerSheet(configuration: configuration, @@ -357,7 +357,7 @@ class CustomerSheetTests: APIStubbedTestCase { StubbedBackend.stubSessions(fileMock: .elementsSessions_customerSessionsCustomerSheet_200) var configuration = CustomerSheet.Configuration() configuration.apiClient = stubbedAPIClient - configuration.allowsSetAsDefaultPM = true + configuration.paymentMethodSetAsDefault = true let loadPaymentMethodInfo = expectation(description: "loadPaymentMethodInfo completed") let customerSheet = CustomerSheet(configuration: configuration, diff --git a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/IntentConfirmParamsTest.swift b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/IntentConfirmParamsTest.swift index 7df8bf644a8..5c0dc47e900 100644 --- a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/IntentConfirmParamsTest.swift +++ b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/IntentConfirmParamsTest.swift @@ -41,7 +41,7 @@ class IntentConfirmParamsTest: XCTestCase { let intentConfirmParams = IntentConfirmParams(type: .stripe(.card)) intentConfirmParams.saveForFutureUseCheckboxState = .selected - intentConfirmParams.setAllowRedisplay(mobilePaymentElementFeatures: .init(paymentMethodSave: true, paymentMethodRemove: false, paymentMethodRemoveLast: true, paymentMethodSaveAllowRedisplayOverride: nil), + intentConfirmParams.setAllowRedisplay(mobilePaymentElementFeatures: .init(paymentMethodSave: true, paymentMethodRemove: false, paymentMethodRemoveLast: true, paymentMethodSaveAllowRedisplayOverride: nil, paymentMethodSetAsDefault: false), isSettingUp: true) XCTAssertEqual(.always, intentConfirmParams.paymentMethodParams.allowRedisplay) @@ -50,7 +50,7 @@ class IntentConfirmParamsTest: XCTestCase { let intentConfirmParams = IntentConfirmParams(type: .stripe(.card)) intentConfirmParams.saveForFutureUseCheckboxState = .deselected - intentConfirmParams.setAllowRedisplay(mobilePaymentElementFeatures: .init(paymentMethodSave: true, paymentMethodRemove: false, paymentMethodRemoveLast: true, paymentMethodSaveAllowRedisplayOverride: nil), + intentConfirmParams.setAllowRedisplay(mobilePaymentElementFeatures: .init(paymentMethodSave: true, paymentMethodRemove: false, paymentMethodRemoveLast: true, paymentMethodSaveAllowRedisplayOverride: nil, paymentMethodSetAsDefault: false), isSettingUp: true) XCTAssertEqual(.limited, intentConfirmParams.paymentMethodParams.allowRedisplay) @@ -62,7 +62,7 @@ class IntentConfirmParamsTest: XCTestCase { // The backend will prevent allowRedisplayValue from being set, when paymentMethodSave is set to enabled // but our code should be defensive enough to ensure allowRedisplayOverride does not override the value - intentConfirmParams.setAllowRedisplay(mobilePaymentElementFeatures: .init(paymentMethodSave: true, paymentMethodRemove: false, paymentMethodRemoveLast: true, paymentMethodSaveAllowRedisplayOverride: .always), + intentConfirmParams.setAllowRedisplay(mobilePaymentElementFeatures: .init(paymentMethodSave: true, paymentMethodRemove: false, paymentMethodRemoveLast: true, paymentMethodSaveAllowRedisplayOverride: .always, paymentMethodSetAsDefault: false), isSettingUp: true) XCTAssertEqual(.limited, intentConfirmParams.paymentMethodParams.allowRedisplay) @@ -72,7 +72,7 @@ class IntentConfirmParamsTest: XCTestCase { let intentConfirmParams = IntentConfirmParams(type: .stripe(.card)) intentConfirmParams.saveForFutureUseCheckboxState = .hidden - intentConfirmParams.setAllowRedisplay(mobilePaymentElementFeatures: .init(paymentMethodSave: false, paymentMethodRemove: false, paymentMethodRemoveLast: true, paymentMethodSaveAllowRedisplayOverride: nil), + intentConfirmParams.setAllowRedisplay(mobilePaymentElementFeatures: .init(paymentMethodSave: false, paymentMethodRemove: false, paymentMethodRemoveLast: true, paymentMethodSaveAllowRedisplayOverride: nil, paymentMethodSetAsDefault: false), isSettingUp: true) XCTAssertEqual(.limited, intentConfirmParams.paymentMethodParams.allowRedisplay) @@ -82,7 +82,7 @@ class IntentConfirmParamsTest: XCTestCase { let intentConfirmParams = IntentConfirmParams(type: .stripe(.card)) intentConfirmParams.saveForFutureUseCheckboxState = .hidden - intentConfirmParams.setAllowRedisplay(mobilePaymentElementFeatures: .init(paymentMethodSave: false, paymentMethodRemove: false, paymentMethodRemoveLast: true, paymentMethodSaveAllowRedisplayOverride: .always), + intentConfirmParams.setAllowRedisplay(mobilePaymentElementFeatures: .init(paymentMethodSave: false, paymentMethodRemove: false, paymentMethodRemoveLast: true, paymentMethodSaveAllowRedisplayOverride: .always, paymentMethodSetAsDefault: false), isSettingUp: true) XCTAssertEqual(.always, intentConfirmParams.paymentMethodParams.allowRedisplay) @@ -91,7 +91,7 @@ class IntentConfirmParamsTest: XCTestCase { let intentConfirmParams = IntentConfirmParams(type: .stripe(.card)) intentConfirmParams.saveForFutureUseCheckboxState = .hidden - intentConfirmParams.setAllowRedisplay(mobilePaymentElementFeatures: .init(paymentMethodSave: false, paymentMethodRemove: false, paymentMethodRemoveLast: true, paymentMethodSaveAllowRedisplayOverride: .limited), + intentConfirmParams.setAllowRedisplay(mobilePaymentElementFeatures: .init(paymentMethodSave: false, paymentMethodRemove: false, paymentMethodRemoveLast: true, paymentMethodSaveAllowRedisplayOverride: .limited, paymentMethodSetAsDefault: false), isSettingUp: true) XCTAssertEqual(.limited, intentConfirmParams.paymentMethodParams.allowRedisplay) @@ -100,7 +100,7 @@ class IntentConfirmParamsTest: XCTestCase { let intentConfirmParams = IntentConfirmParams(type: .stripe(.card)) intentConfirmParams.saveForFutureUseCheckboxState = .hidden - intentConfirmParams.setAllowRedisplay(mobilePaymentElementFeatures: .init(paymentMethodSave: false, paymentMethodRemove: false, paymentMethodRemoveLast: true, paymentMethodSaveAllowRedisplayOverride: .unspecified), + intentConfirmParams.setAllowRedisplay(mobilePaymentElementFeatures: .init(paymentMethodSave: false, paymentMethodRemove: false, paymentMethodRemoveLast: true, paymentMethodSaveAllowRedisplayOverride: .unspecified, paymentMethodSetAsDefault: false), isSettingUp: true) XCTAssertEqual(.unspecified, intentConfirmParams.paymentMethodParams.allowRedisplay) @@ -110,7 +110,7 @@ class IntentConfirmParamsTest: XCTestCase { let intentConfirmParams = IntentConfirmParams(type: .stripe(.card)) intentConfirmParams.saveForFutureUseCheckboxState = .deselected - intentConfirmParams.setAllowRedisplay(mobilePaymentElementFeatures: .init(paymentMethodSave: true, paymentMethodRemove: false, paymentMethodRemoveLast: true, paymentMethodSaveAllowRedisplayOverride: nil), + intentConfirmParams.setAllowRedisplay(mobilePaymentElementFeatures: .init(paymentMethodSave: true, paymentMethodRemove: false, paymentMethodRemoveLast: true, paymentMethodSaveAllowRedisplayOverride: nil, paymentMethodSetAsDefault: false), isSettingUp: false) XCTAssertEqual(.unspecified, intentConfirmParams.paymentMethodParams.allowRedisplay) @@ -119,7 +119,7 @@ class IntentConfirmParamsTest: XCTestCase { let intentConfirmParams = IntentConfirmParams(type: .stripe(.card)) intentConfirmParams.saveForFutureUseCheckboxState = .selected - intentConfirmParams.setAllowRedisplay(mobilePaymentElementFeatures: .init(paymentMethodSave: true, paymentMethodRemove: false, paymentMethodRemoveLast: true, paymentMethodSaveAllowRedisplayOverride: nil), + intentConfirmParams.setAllowRedisplay(mobilePaymentElementFeatures: .init(paymentMethodSave: true, paymentMethodRemove: false, paymentMethodRemoveLast: true, paymentMethodSaveAllowRedisplayOverride: nil, paymentMethodSetAsDefault: false), isSettingUp: false) XCTAssertEqual(.always, intentConfirmParams.paymentMethodParams.allowRedisplay) @@ -127,7 +127,7 @@ class IntentConfirmParamsTest: XCTestCase { func testSetAllowRedisplay_PI_saveDisabled_hidden() { let intentConfirmParams = IntentConfirmParams(type: .stripe(.card)) - intentConfirmParams.setAllowRedisplay(mobilePaymentElementFeatures: .init(paymentMethodSave: false, paymentMethodRemove: false, paymentMethodRemoveLast: true, paymentMethodSaveAllowRedisplayOverride: nil), + intentConfirmParams.setAllowRedisplay(mobilePaymentElementFeatures: .init(paymentMethodSave: false, paymentMethodRemove: false, paymentMethodRemoveLast: true, paymentMethodSaveAllowRedisplayOverride: nil, paymentMethodSetAsDefault: false), isSettingUp: false) XCTAssertEqual(.unspecified, intentConfirmParams.paymentMethodParams.allowRedisplay) @@ -136,7 +136,7 @@ class IntentConfirmParamsTest: XCTestCase { func testSetAllowRedisplay_PI_saveDisabled_hidden_doesNotOverride() { let intentConfirmParams = IntentConfirmParams(type: .stripe(.card)) - intentConfirmParams.setAllowRedisplay(mobilePaymentElementFeatures: .init(paymentMethodSave: false, paymentMethodRemove: false, paymentMethodRemoveLast: true, paymentMethodSaveAllowRedisplayOverride: .limited), + intentConfirmParams.setAllowRedisplay(mobilePaymentElementFeatures: .init(paymentMethodSave: false, paymentMethodRemove: false, paymentMethodRemoveLast: true, paymentMethodSaveAllowRedisplayOverride: .limited, paymentMethodSetAsDefault: false), isSettingUp: false) // Ensure that allowRedisplayOverride doesn't override: (hidden checkbox and not attached to customer) diff --git a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/STPElementsSessionTest.swift b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/STPElementsSessionTest.swift index 15b1d4fca76..ceae2d450e8 100644 --- a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/STPElementsSessionTest.swift +++ b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/STPElementsSessionTest.swift @@ -342,6 +342,25 @@ class STPElementsSessionTest: XCTestCase { XCTAssertTrue(allowsRemoval) XCTAssertFalse(elementsSession.paymentMethodRemoveLastForCustomerSheet) } + func testAllowsRemovalOfPaymentMethodsForCustomerSheet_setAsDefault_enabled() { + let elementsSession = STPElementsSession._testValue(paymentMethodTypes: ["card"], + customerSessionData: [ + "mobile_payment_element": [ + "enabled": false + ], + "customer_sheet": [ + "enabled": true, + "features": ["payment_method_remove": "enabled", + "payment_method_set_as_default": "enabled", + ], + ], + ]) + + let allowsRemoval = elementsSession.allowsRemovalOfPaymentMethodsForCustomerSheet() + let allowsSetAsDefault = elementsSession.paymentMethodSetAsDefaultForCustomerSheet + XCTAssertTrue(allowsRemoval) + XCTAssertTrue(allowsSetAsDefault) + } private let testCardJSON = [ "id": "pm_123card", "type": "card", diff --git a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/UpdatePaymentMethodViewControllerSnapshotTests.swift b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/UpdatePaymentMethodViewControllerSnapshotTests.swift index 97c9b449e3d..577fc5a4e65 100644 --- a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/UpdatePaymentMethodViewControllerSnapshotTests.swift +++ b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/UpdatePaymentMethodViewControllerSnapshotTests.swift @@ -140,7 +140,7 @@ final class UpdatePaymentMethodViewControllerSnapshotTests: STPSnapshotTestCase hostedSurface: .paymentSheet, canRemove: canRemove, canUpdateCardBrand: canUpdateCardBrand, - allowsSetAsDefaultPM: allowsSetAsDefaultPM, + canSetAsDefaultPM: allowsSetAsDefaultPM, isDefault: isDefault ) let sut = UpdatePaymentMethodViewController( diff --git a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/VerticalSavedPaymentMethodsViewControllerSnapshotTests.swift b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/VerticalSavedPaymentMethodsViewControllerSnapshotTests.swift index 4d2d835134a..b9a8b0aa180 100644 --- a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/VerticalSavedPaymentMethodsViewControllerSnapshotTests.swift +++ b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/VerticalSavedPaymentMethodsViewControllerSnapshotTests.swift @@ -45,7 +45,7 @@ final class VerticalSavedPaymentMethodsViewControllerSnapshotTests: STPSnapshotT configuration.appearance = appearance var paymentMethods = generatePaymentMethods() if showDefaultPMBadge { - configuration.allowsSetAsDefaultPM = true + configuration.paymentMethodSetAsDefault = true let card = STPPaymentMethod._testCard() paymentMethods.insert(card, at: 0) } From 4660d4fae4c0815d8fac2e64583513bb2bd7afa6 Mon Sep 17 00:00:00 2001 From: Joyce Qin Date: Thu, 30 Jan 2025 13:18:02 -0800 Subject: [PATCH 02/14] changed naming to better match others --- .../PaymentSheetTestPlaygroundSettings.swift | 13 +++++++------ .../CustomerAddPaymentMethodViewController.swift | 4 ---- ...CustomerSavedPaymentMethodsViewController.swift | 2 -- .../PaymentSheetFormFactory+Card.swift | 2 +- .../PaymentSheetFormFactory.swift | 4 ++-- .../Source/PaymentSheet/PaymentSheetLoader.swift | 2 +- .../SavedPaymentOptionsViewController.swift | 6 +++--- .../UpdatePaymentMethodViewController.swift | 2 +- .../UpdatePaymentMethodViewModel.swift | 8 ++++---- ...ymentMethodsCollectionViewControllerTests.swift | 8 ++++---- .../PaymentSheet/STPFixtures+PaymentSheet.swift | 6 +++--- ...ePaymentMethodViewControllerSnapshotTests.swift | 14 +++++++------- ...PaymentMethodsViewControllerSnapshotTests.swift | 1 - 13 files changed, 33 insertions(+), 39 deletions(-) diff --git a/Example/PaymentSheet Example/PaymentSheet Example/PaymentSheetTestPlaygroundSettings.swift b/Example/PaymentSheet Example/PaymentSheet Example/PaymentSheetTestPlaygroundSettings.swift index b262ad8a890..c4e2fc4c73d 100644 --- a/Example/PaymentSheet Example/PaymentSheet Example/PaymentSheetTestPlaygroundSettings.swift +++ b/Example/PaymentSheet Example/PaymentSheet Example/PaymentSheetTestPlaygroundSettings.swift @@ -235,6 +235,13 @@ struct PaymentSheetTestPlaygroundSettings: Codable, Equatable { } } + + enum PaymentMethodSetAsDefault: String, PickerEnum { + static let enumName: String = "paymentMethodSetAsDefault" + case enabled + case disabled + } + enum DefaultBillingAddress: String, PickerEnum { static var enumName: String { "Default billing address" } @@ -446,12 +453,6 @@ struct PaymentSheetTestPlaygroundSettings: Codable, Equatable { case allowVisa } - enum PaymentMethodSetAsDefault: String, PickerEnum { - static let enumName: String = "paymentMethodSetAsDefault" - case enabled - case disabled - } - var uiStyle: UIStyle var layout: Layout var mode: Mode diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerAddPaymentMethodViewController.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerAddPaymentMethodViewController.swift index b6953597a24..0c3cef8dd21 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerAddPaymentMethodViewController.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerAddPaymentMethodViewController.swift @@ -24,7 +24,6 @@ class CustomerAddPaymentMethodViewController: UIViewController { let paymentMethodTypes: [PaymentSheet.PaymentMethodType] let cbcEligible: Bool let savePaymentMethodConsentBehavior: PaymentSheetFormFactory.SavePaymentMethodConsentBehavior - let showSetAsDefaultCheckbox: Bool // MARK: - Read-only Properties weak var delegate: CustomerAddPaymentMethodViewControllerDelegate? @@ -128,7 +127,6 @@ class CustomerAddPaymentMethodViewController: UIViewController { paymentMethodTypes: [PaymentSheet.PaymentMethodType], cbcEligible: Bool, savePaymentMethodConsentBehavior: PaymentSheetFormFactory.SavePaymentMethodConsentBehavior, - showSetAsDefaultCheckbox: Bool, delegate: CustomerAddPaymentMethodViewControllerDelegate ) { self.configuration = configuration @@ -142,7 +140,6 @@ class CustomerAddPaymentMethodViewController: UIViewController { self.paymentMethodTypes = paymentMethodTypes self.cbcEligible = cbcEligible self.savePaymentMethodConsentBehavior = savePaymentMethodConsentBehavior - self.showSetAsDefaultCheckbox = showSetAsDefaultCheckbox super.init(nibName: nil, bundle: nil) self.view.backgroundColor = configuration.appearance.colors.background } @@ -252,7 +249,6 @@ class CustomerAddPaymentMethodViewController: UIViewController { isSettingUp: true, countryCode: nil, savePaymentMethodConsentBehavior: savePaymentMethodConsentBehavior, - showSetAsDefaultCheckbox: showSetAsDefaultCheckbox, analyticsHelper: nil, paymentMethodIncentive: nil ).make() diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSavedPaymentMethodsViewController.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSavedPaymentMethodsViewController.swift index 6b309de7f30..fef810c5cde 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSavedPaymentMethodsViewController.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSavedPaymentMethodsViewController.swift @@ -60,7 +60,6 @@ class CustomerSavedPaymentMethodsViewController: UIViewController { paymentMethodTypes: paymentMethodTypes, cbcEligible: cbcEligible, savePaymentMethodConsentBehavior: customerSheetDataSource.savePaymentMethodConsentBehavior(), - showSetAsDefaultCheckbox: paymentMethodSetAsDefault, delegate: self) }() private var cachedClientSecret: String? @@ -653,7 +652,6 @@ class CustomerSavedPaymentMethodsViewController: UIViewController { paymentMethodTypes: paymentMethodTypes, cbcEligible: cbcEligible, savePaymentMethodConsentBehavior: customerSheetDataSource.savePaymentMethodConsentBehavior(), - showSetAsDefaultCheckbox: paymentMethodSetAsDefault, delegate: self) cachedClientSecret = nil } diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetFormFactory/PaymentSheetFormFactory+Card.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetFormFactory/PaymentSheetFormFactory+Card.swift index 02fc07d1f83..113d680bb72 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetFormFactory/PaymentSheetFormFactory+Card.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetFormFactory/PaymentSheetFormFactory+Card.swift @@ -13,7 +13,7 @@ import StripePayments import UIKit extension PaymentSheetFormFactory { - func makeCard(cardBrandChoiceEligible: Bool = false, showSetAsDefaultCheckbox: Bool) -> PaymentMethodElement { + func makeCard(cardBrandChoiceEligible: Bool = false, showSetAsDefaultCheckbox: Bool = false) -> PaymentMethodElement { let showLinkInlineSignup = showLinkInlineCardSignup var defaultCheckbox: PaymentMethodElementWrapper? if showSetAsDefaultCheckbox { diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetFormFactory/PaymentSheetFormFactory.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetFormFactory/PaymentSheetFormFactory.swift index 9fe101967bc..030af75d09d 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetFormFactory/PaymentSheetFormFactory.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetFormFactory/PaymentSheetFormFactory.swift @@ -126,7 +126,7 @@ class PaymentSheetFormFactory { isSettingUp: Bool, countryCode: String?, savePaymentMethodConsentBehavior: SavePaymentMethodConsentBehavior, - showSetAsDefaultCheckbox: Bool, + showSetAsDefaultCheckbox: Bool = false, analyticsHelper: PaymentSheetAnalyticsHelper?, paymentMethodIncentive: PaymentMethodIncentive? ) { @@ -529,7 +529,7 @@ extension PaymentSheetFormFactory { ) } - func makeUSBankAccount(merchantName: String, showSetAsDefaultCheckbox: Bool) -> PaymentMethodElement { + func makeUSBankAccount(merchantName: String, showSetAsDefaultCheckbox: Bool = false) -> PaymentMethodElement { let isSaving = BoolReference() var defaultCheckbox: PaymentMethodElementWrapper? if showSetAsDefaultCheckbox { diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetLoader.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetLoader.swift index 231093f0764..b4f161b962d 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetLoader.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetLoader.swift @@ -117,7 +117,7 @@ final class PaymentSheetLoader { customerID: configuration.customer?.id, showApplePay: integrationShape.canDefaultToLinkOrApplePay ? isApplePayEnabled : false, showLink: integrationShape.canDefaultToLinkOrApplePay ? isLinkEnabled : false, - allowsSetAsDefaultPM: elementsSession.paymentMethodSetAsDefaultForPaymentSheet, + paymentMethodSetAsDefault: elementsSession.paymentMethodSetAsDefaultForPaymentSheet, customer: elementsSession.customer ) let paymentMethodTypes = PaymentSheet.PaymentMethodType.filteredPaymentMethodTypes(from: intent, elementsSession: elementsSession, configuration: configuration, logAvailability: true) diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Saved Payment Method Screen/SavedPaymentOptionsViewController.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Saved Payment Method Screen/SavedPaymentOptionsViewController.swift index 33d9ee265f1..bc88396055e 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Saved Payment Method Screen/SavedPaymentOptionsViewController.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Saved Payment Method Screen/SavedPaymentOptionsViewController.swift @@ -457,11 +457,11 @@ class SavedPaymentOptionsViewController: UIViewController { /// Creates the list of viewmodels to display in the "saved payment methods" carousel e.g. `["+ Add", "Apple Pay", "Link", "Visa 4242"]` /// - Returns defaultSelectedIndex: The index of the view model that is the default e.g. in the above list, if "Visa 4242" is the default, the index is 3. - static func makeViewModels(savedPaymentMethods: [STPPaymentMethod], customerID: String?, showApplePay: Bool, showLink: Bool, allowsSetAsDefaultPM: Bool, customer: ElementsCustomer?) -> (defaultSelectedIndex: Int, viewModels: [Selection]) { + static func makeViewModels(savedPaymentMethods: [STPPaymentMethod], customerID: String?, showApplePay: Bool, showLink: Bool, paymentMethodSetAsDefault: Bool, customer: ElementsCustomer?) -> (defaultSelectedIndex: Int, viewModels: [Selection]) { // Get the default var defaultPaymentMethodOption: CustomerPaymentOption? // if opted in to the "set as default" feature, try to get default payment method from elements session - if allowsSetAsDefaultPM { + if paymentMethodSetAsDefault { if let customer = customer, let defaultPaymentMethod = customer.getDefaultOrFirstPaymentMethod() { defaultPaymentMethodOption = CustomerPaymentOption.stripeId(defaultPaymentMethod.stripeId) @@ -590,7 +590,7 @@ extension SavedPaymentOptionsViewController: PaymentOptionCellDelegate { cardBrandFilter: paymentSheetConfiguration.cardBrandFilter, canRemove: configuration.allowsRemovalOfPaymentMethods && (savedPaymentMethods.count > 1 || configuration.allowsRemovalOfLastSavedPaymentMethod), canUpdateCardBrand: paymentMethod.isCoBrandedCard && cbcEligible, - canSetAsDefaultPM: configuration.allowsSetAsDefaultPM, + canSetAsDefaultPM: configuration.allowsSetAsDefaultPM, isDefault: paymentMethod == elementsSession.customer?.getDefaultPaymentMethod() ) let editVc = UpdatePaymentMethodViewController( diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/ViewControllers/UpdatePaymentMethodViewController.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/ViewControllers/UpdatePaymentMethodViewController.swift index dd14052a3a4..7d97c04c120 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/ViewControllers/UpdatePaymentMethodViewController.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/ViewControllers/UpdatePaymentMethodViewController.swift @@ -104,7 +104,7 @@ final class UpdatePaymentMethodViewController: UIViewController { }() private lazy var setAsDefaultCheckbox: CheckboxElement? = { - guard viewModel.allowsSetAsDefaultPM && PaymentSheet.supportedDefaultPaymentMethods.contains(where: { + guard viewModel.canSetAsDefaultPM && PaymentSheet.supportedDefaultPaymentMethods.contains(where: { viewModel.paymentMethod.type == $0 }) else { return nil } return CheckboxElement(theme: viewModel.appearance.asElementsTheme, label: String.Localized.set_as_default_payment_method, isSelectedByDefault: viewModel.isDefault) { [weak self] isSelected in diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/ViewControllers/UpdatePaymentMethodViewModel.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/ViewControllers/UpdatePaymentMethodViewModel.swift index c73e5ff4ada..9b9ff220d3a 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/ViewControllers/UpdatePaymentMethodViewModel.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/ViewControllers/UpdatePaymentMethodViewModel.swift @@ -19,7 +19,7 @@ class UpdatePaymentMethodViewModel { let cardBrandFilter: CardBrandFilter let canRemove: Bool let canUpdateCardBrand: Bool - let allowsSetAsDefaultPM: Bool + let canSetAsDefaultPM: Bool let isDefault: Bool var selectedCardBrand: STPCardBrand? @@ -27,7 +27,7 @@ class UpdatePaymentMethodViewModel { var hasChangedCardBrand: Bool = false var hasChangedDefaultPaymentMethodCheckbox: Bool = false var canEdit: Bool { - return canUpdateCardBrand || allowsSetAsDefaultPM + return canUpdateCardBrand || canSetAsDefaultPM } var hasUpdates: Bool { return hasChangedCardBrand || hasChangedDefaultPaymentMethodCheckbox @@ -59,7 +59,7 @@ class UpdatePaymentMethodViewModel { } }() - init(paymentMethod: STPPaymentMethod, appearance: PaymentSheet.Appearance, hostedSurface: HostedSurface, cardBrandFilter: CardBrandFilter = .default, canRemove: Bool, canUpdateCardBrand: Bool, canSetAsDefaultPM: Bool = false, isDefault: Bool = false) { + init(paymentMethod: STPPaymentMethod, appearance: PaymentSheet.Appearance, hostedSurface: HostedSurface, cardBrandFilter: CardBrandFilter = .default, canRemove: Bool, canUpdateCardBrand: Bool, canSetAsDefaultPM: Bool = false, isDefault: Bool = false) { guard PaymentSheet.supportedSavedPaymentMethods.contains(paymentMethod.type) else { fatalError("Unsupported payment type \(paymentMethod.type) in UpdatePaymentMethodViewModel") } @@ -69,7 +69,7 @@ class UpdatePaymentMethodViewModel { self.cardBrandFilter = cardBrandFilter self.canRemove = canRemove self.canUpdateCardBrand = canUpdateCardBrand - self.allowsSetAsDefaultPM = canSetAsDefaultPM + self.canSetAsDefaultPM = canSetAsDefaultPM self.isDefault = isDefault } } diff --git a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/CustomerSheet/CustomerSavedPaymentMethodsCollectionViewControllerTests.swift b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/CustomerSheet/CustomerSavedPaymentMethodsCollectionViewControllerTests.swift index f24a43c014f..29d10f7f7aa 100644 --- a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/CustomerSheet/CustomerSavedPaymentMethodsCollectionViewControllerTests.swift +++ b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/CustomerSheet/CustomerSavedPaymentMethodsCollectionViewControllerTests.swift @@ -294,7 +294,7 @@ class CustomerSavedPaymentMethodsCollectionViewControllerTests: XCTestCase { func testHideNonCardUSBank_SetAsDefault() { let configuration = configuration(allowsRemovalOfLastSavedPaymentMethod: true, paymentMethodRemove: true, - allowsSetAsDefaultPM: true) + paymentMethodSetAsDefault: true) let controller = customerSavedPaymentMethods(configuration, savedPaymentMethods: [STPPaymentMethod._testCard(), STPPaymentMethod._testUSBankAccount(), STPPaymentMethod._testSEPA()], cbcEligible: false) @@ -303,12 +303,12 @@ class CustomerSavedPaymentMethodsCollectionViewControllerTests: XCTestCase { func configuration(allowsRemovalOfLastSavedPaymentMethod: Bool, paymentMethodRemove: Bool, - showApplePay: Bool = false, - allowsSetAsDefaultPM: Bool = false) -> CustomerSavedPaymentMethodsCollectionViewController.Configuration { + paymentMethodSetAsDefault: Bool = false, + showApplePay: Bool = false) -> CustomerSavedPaymentMethodsCollectionViewController.Configuration { return CustomerSavedPaymentMethodsCollectionViewController.Configuration(showApplePay: showApplePay, allowsRemovalOfLastSavedPaymentMethod: allowsRemovalOfLastSavedPaymentMethod, paymentMethodRemove: paymentMethodRemove, - paymentMethodSetAsDefault: allowsSetAsDefaultPM, + paymentMethodSetAsDefault: paymentMethodSetAsDefault, isTestMode: true) } func customerSavedPaymentMethods(_ configuration: CustomerSavedPaymentMethodsCollectionViewController.Configuration, diff --git a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/STPFixtures+PaymentSheet.swift b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/STPFixtures+PaymentSheet.swift index 615dbb3cbd5..86c50fb5d2c 100644 --- a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/STPFixtures+PaymentSheet.swift +++ b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/STPFixtures+PaymentSheet.swift @@ -51,11 +51,12 @@ extension STPElementsSession { "enabled": true, "features": ["payment_method_save": "enabled", "payment_method_remove": "enabled", + "payment_method_set_as_default": "enabled" ], ], "customer_sheet": [ "enabled": false, - ], ], allowsSetAsDefaultPM: true, defaultPaymentMethod: defaultPaymentMethod, paymentMethods: paymentMethods) + ], ], defaultPaymentMethod: defaultPaymentMethod, paymentMethods: paymentMethods) } static func _testValue( @@ -67,7 +68,6 @@ extension STPElementsSession { linkMode: LinkMode? = nil, linkFundingSources: Set = [], disableLinkSignup: Bool? = nil, - allowsSetAsDefaultPM: Bool = false, defaultPaymentMethod: String? = nil, paymentMethods: [[AnyHashable: Any]]? = nil, linkUseAttestation: Bool? = nil, @@ -95,7 +95,7 @@ extension STPElementsSession { "components": customerSessionData, ], ] - if allowsSetAsDefaultPM, let defaultPaymentMethod { + if let defaultPaymentMethod { json[jsonDict: "customer"]?["default_payment_method"] = defaultPaymentMethod } if let paymentMethods { diff --git a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/UpdatePaymentMethodViewControllerSnapshotTests.swift b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/UpdatePaymentMethodViewControllerSnapshotTests.swift index 577fc5a4e65..9defbffb29c 100644 --- a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/UpdatePaymentMethodViewControllerSnapshotTests.swift +++ b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/UpdatePaymentMethodViewControllerSnapshotTests.swift @@ -41,11 +41,11 @@ final class UpdatePaymentMethodViewControllerSnapshotTests: STPSnapshotTestCase } func test_UpdatePaymentMethodViewControllerSetAsDefaultCard() { - _test_UpdatePaymentMethodViewController(paymentMethodType: .card, darkMode: false, canUpdateCardBrand: true, allowsSetAsDefaultPM: true) + _test_UpdatePaymentMethodViewController(paymentMethodType: .card, darkMode: false, canUpdateCardBrand: true, canSetAsDefaultPM: true) } func test_UpdatePaymentMethodViewControllerDefaultCard() { - _test_UpdatePaymentMethodViewController(paymentMethodType: .card, darkMode: false, canUpdateCardBrand: true, allowsSetAsDefaultPM: true, isDefault: true) + _test_UpdatePaymentMethodViewController(paymentMethodType: .card, darkMode: false, canUpdateCardBrand: true, canSetAsDefaultPM: true, isDefault: true) } func test_UpdatePaymentMethodViewControllerRemoveOnlyCard() { @@ -65,11 +65,11 @@ final class UpdatePaymentMethodViewControllerSnapshotTests: STPSnapshotTestCase } func test_UpdatePaymentMethodViewControllerSetAsDefaultUSBankAccount() { - _test_UpdatePaymentMethodViewController(paymentMethodType: .USBankAccount, darkMode: false, allowsSetAsDefaultPM: true) + _test_UpdatePaymentMethodViewController(paymentMethodType: .USBankAccount, darkMode: false, canSetAsDefaultPM: true) } func test_UpdatePaymentMethodViewControllerDefaultUSBankAccount() { - _test_UpdatePaymentMethodViewController(paymentMethodType: .USBankAccount, darkMode: false, allowsSetAsDefaultPM: true, isDefault: true) + _test_UpdatePaymentMethodViewController(paymentMethodType: .USBankAccount, darkMode: false, canSetAsDefaultPM: true, isDefault: true) } func test_EmbeddedSingleUSBankAccount_UpdatePaymentMethodViewControllerDarkMode() { @@ -97,7 +97,7 @@ final class UpdatePaymentMethodViewControllerSnapshotTests: STPSnapshotTestCase } func test_UpdatePaymentMethodViewControllerSetAsDefaultSEPADebit() { - _test_UpdatePaymentMethodViewController(paymentMethodType: .SEPADebit, darkMode: false, allowsSetAsDefaultPM: true) + _test_UpdatePaymentMethodViewController(paymentMethodType: .SEPADebit, darkMode: false, canSetAsDefaultPM: true) } func test_EmbeddedSingleSEPADebit_UpdatePaymentMethodViewControllerDarkMode() { @@ -112,7 +112,7 @@ final class UpdatePaymentMethodViewControllerSnapshotTests: STPSnapshotTestCase _test_UpdatePaymentMethodViewController(paymentMethodType: .SEPADebit, darkMode: false, isEmbeddedSingle: true, appearance: ._testMSPaintTheme) } - func _test_UpdatePaymentMethodViewController(paymentMethodType: STPPaymentMethodType, darkMode: Bool, isEmbeddedSingle: Bool = false, appearance: PaymentSheet.Appearance = .default, canRemove: Bool = true, canUpdateCardBrand: Bool = false, expired: Bool = false, allowsSetAsDefaultPM: Bool = false, isDefault: Bool = false) { + func _test_UpdatePaymentMethodViewController(paymentMethodType: STPPaymentMethodType, darkMode: Bool, isEmbeddedSingle: Bool = false, appearance: PaymentSheet.Appearance = .default, canRemove: Bool = true, canUpdateCardBrand: Bool = false, expired: Bool = false, canSetAsDefaultPM: Bool = false, isDefault: Bool = false) { let paymentMethod: STPPaymentMethod = { switch paymentMethodType { case .card: @@ -140,7 +140,7 @@ final class UpdatePaymentMethodViewControllerSnapshotTests: STPSnapshotTestCase hostedSurface: .paymentSheet, canRemove: canRemove, canUpdateCardBrand: canUpdateCardBrand, - canSetAsDefaultPM: allowsSetAsDefaultPM, + canSetAsDefaultPM: canSetAsDefaultPM, isDefault: isDefault ) let sut = UpdatePaymentMethodViewController( diff --git a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/VerticalSavedPaymentMethodsViewControllerSnapshotTests.swift b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/VerticalSavedPaymentMethodsViewControllerSnapshotTests.swift index b9a8b0aa180..419430f9668 100644 --- a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/VerticalSavedPaymentMethodsViewControllerSnapshotTests.swift +++ b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/VerticalSavedPaymentMethodsViewControllerSnapshotTests.swift @@ -45,7 +45,6 @@ final class VerticalSavedPaymentMethodsViewControllerSnapshotTests: STPSnapshotT configuration.appearance = appearance var paymentMethods = generatePaymentMethods() if showDefaultPMBadge { - configuration.paymentMethodSetAsDefault = true let card = STPPaymentMethod._testCard() paymentMethods.insert(card, at: 0) } From cf5fd54cb82f8f9ba8da3d1ff9d85ed834bca9a2 Mon Sep 17 00:00:00 2001 From: Joyce Qin Date: Thu, 30 Jan 2025 13:47:47 -0800 Subject: [PATCH 03/14] elementssession test --- .../PaymentSheet/STPElementsSessionTest.swift | 54 ++++++++++++++++--- 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/STPElementsSessionTest.swift b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/STPElementsSessionTest.swift index ceae2d450e8..9a46b38dc0c 100644 --- a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/STPElementsSessionTest.swift +++ b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/STPElementsSessionTest.swift @@ -262,6 +262,37 @@ class STPElementsSessionTest: XCTestCase { XCTAssertEqual(.legacy, savePaymentMethodConsentBehavior) } + func testSetAsDefault_enabled() { + let elementsSession = STPElementsSession._testValue(paymentMethodTypes: ["card"], + customerSessionData: [ + "mobile_payment_element": [ + "enabled": true, + "features": ["payment_method_set_as_default": "enabled"], + ], + "customer_sheet": [ + "enabled": false, + + ], + ]) + + let allowsSetAsDefault = elementsSession.paymentMethodSetAsDefaultForPaymentSheet + XCTAssertTrue(allowsSetAsDefault) + } + func testSetAsDefault_disabled() { + let elementsSession = STPElementsSession._testValue(paymentMethodTypes: ["card"], + customerSessionData: [ + "mobile_payment_element": [ + "enabled": true, + "features": ["payment_method_set_as_default": "disabled"] + ], + "customer_sheet": [ + "enabled": false, + ], + ]) + + let allowsSetAsDefault = elementsSession.paymentMethodSetAsDefaultForPaymentSheet + XCTAssertFalse(allowsSetAsDefault) + } func testAllowsRemovalOfPaymentMethodsForCustomerSheet_legacy() { let elementsSession = STPElementsSession._testValue(paymentMethodTypes: ["card"], @@ -342,7 +373,7 @@ class STPElementsSessionTest: XCTestCase { XCTAssertTrue(allowsRemoval) XCTAssertFalse(elementsSession.paymentMethodRemoveLastForCustomerSheet) } - func testAllowsRemovalOfPaymentMethodsForCustomerSheet_setAsDefault_enabled() { + func testSetAsDefaultForCustomerSheet_enabled() { let elementsSession = STPElementsSession._testValue(paymentMethodTypes: ["card"], customerSessionData: [ "mobile_payment_element": [ @@ -350,17 +381,28 @@ class STPElementsSessionTest: XCTestCase { ], "customer_sheet": [ "enabled": true, - "features": ["payment_method_remove": "enabled", - "payment_method_set_as_default": "enabled", - ], + "features": ["payment_method_set_as_default": "enabled"], ], ]) - let allowsRemoval = elementsSession.allowsRemovalOfPaymentMethodsForCustomerSheet() let allowsSetAsDefault = elementsSession.paymentMethodSetAsDefaultForCustomerSheet - XCTAssertTrue(allowsRemoval) XCTAssertTrue(allowsSetAsDefault) } + func testSetAsDefaultForCustomerSheet_disabled() { + let elementsSession = STPElementsSession._testValue(paymentMethodTypes: ["card"], + customerSessionData: [ + "mobile_payment_element": [ + "enabled": false + ], + "customer_sheet": [ + "enabled": true, + "features": ["payment_method_set_as_default": "disabled"], + ], + ]) + + let allowsSetAsDefault = elementsSession.paymentMethodSetAsDefaultForCustomerSheet + XCTAssertFalse(allowsSetAsDefault) + } private let testCardJSON = [ "id": "pm_123card", "type": "card", From b6cfbe99f48d4200c6e9d7dd570339a11558a204 Mon Sep 17 00:00:00 2001 From: Joyce Qin Date: Thu, 30 Jan 2025 14:01:53 -0800 Subject: [PATCH 04/14] remove canUpdateCardBrand (removed in master) --- .../PaymentSheet/Embedded/EmbeddedPaymentElement+Internal.swift | 1 - .../SavedPaymentOptionsViewController.swift | 1 - .../VerticalSavedPaymentMethodsViewController.swift | 1 - .../ViewControllers/PaymentSheetVerticalViewController.swift | 1 - 4 files changed, 4 deletions(-) diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Embedded/EmbeddedPaymentElement+Internal.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Embedded/EmbeddedPaymentElement+Internal.swift index 9091420df18..937ef0afc7c 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Embedded/EmbeddedPaymentElement+Internal.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Embedded/EmbeddedPaymentElement+Internal.swift @@ -164,7 +164,6 @@ extension EmbeddedPaymentElement: EmbeddedPaymentMethodsViewDelegate { hostedSurface: .paymentSheet, cardBrandFilter: configuration.cardBrandFilter, canRemove: configuration.allowsRemovalOfLastSavedPaymentMethod && elementsSession.allowsRemovalOfPaymentMethodsForPaymentSheet(), - canUpdateCardBrand: paymentMethod.isCoBrandedCard && elementsSession.isCardBrandChoiceEligible, isCBCEligible: paymentMethod.isCoBrandedCard && elementsSession.isCardBrandChoiceEligible, canSetAsDefaultPM: elementsSession.paymentMethodSetAsDefaultForPaymentSheet, isDefault: paymentMethod == elementsSession.customer?.getDefaultPaymentMethod() diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Saved Payment Method Screen/SavedPaymentOptionsViewController.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Saved Payment Method Screen/SavedPaymentOptionsViewController.swift index 71300bf58e4..de9726f138f 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Saved Payment Method Screen/SavedPaymentOptionsViewController.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Saved Payment Method Screen/SavedPaymentOptionsViewController.swift @@ -589,7 +589,6 @@ extension SavedPaymentOptionsViewController: PaymentOptionCellDelegate { hostedSurface: .paymentSheet, cardBrandFilter: paymentSheetConfiguration.cardBrandFilter, canRemove: configuration.allowsRemovalOfPaymentMethods && (savedPaymentMethods.count > 1 || configuration.allowsRemovalOfLastSavedPaymentMethod), - canUpdateCardBrand: paymentMethod.isCoBrandedCard && cbcEligible, isCBCEligible: paymentMethod.isCoBrandedCard && cbcEligible, canSetAsDefaultPM: configuration.allowsSetAsDefaultPM, isDefault: paymentMethod == elementsSession.customer?.getDefaultPaymentMethod() diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Saved Payment Method Screen/Vertical Saved Payment Method Screen/VerticalSavedPaymentMethodsViewController.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Saved Payment Method Screen/Vertical Saved Payment Method Screen/VerticalSavedPaymentMethodsViewController.swift index cf33ab1b4dd..9c1aa8c7b9e 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Saved Payment Method Screen/Vertical Saved Payment Method Screen/VerticalSavedPaymentMethodsViewController.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Saved Payment Method Screen/Vertical Saved Payment Method Screen/VerticalSavedPaymentMethodsViewController.swift @@ -335,7 +335,6 @@ extension VerticalSavedPaymentMethodsViewController: SavedPaymentMethodRowButton hostedSurface: .paymentSheet, cardBrandFilter: configuration.cardBrandFilter, canRemove: canRemovePaymentMethods, - canUpdateCardBrand: paymentMethod.isCoBrandedCard && isCBCEligible, isCBCEligible: paymentMethod.isCoBrandedCard && isCBCEligible, canSetAsDefaultPM: paymentMethodSetAsDefault, isDefault: paymentMethod == elementsSession.customer?.getDefaultPaymentMethod() diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/ViewControllers/PaymentSheetVerticalViewController.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/ViewControllers/PaymentSheetVerticalViewController.swift index 2824c3a76d7..5ee57d26c3f 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/ViewControllers/PaymentSheetVerticalViewController.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/ViewControllers/PaymentSheetVerticalViewController.swift @@ -618,7 +618,6 @@ class PaymentSheetVerticalViewController: UIViewController, FlowControllerViewCo hostedSurface: .paymentSheet, cardBrandFilter: configuration.cardBrandFilter, canRemove: configuration.allowsRemovalOfLastSavedPaymentMethod && elementsSession.allowsRemovalOfPaymentMethodsForPaymentSheet(), - canUpdateCardBrand: paymentMethod.isCoBrandedCard && elementsSession.isCardBrandChoiceEligible, isCBCEligible: paymentMethod.isCoBrandedCard && elementsSession.isCardBrandChoiceEligible, canSetAsDefaultPM: elementsSession.paymentMethodSetAsDefaultForPaymentSheet, isDefault: paymentMethod == elementsSession.customer?.getDefaultPaymentMethod() From cb9d01dc2a1153da3d690c4fdadd08475ebcd752 Mon Sep 17 00:00:00 2001 From: Joyce Qin Date: Thu, 30 Jan 2025 14:15:01 -0800 Subject: [PATCH 05/14] fix build --- .../SavedPaymentOptionsViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Saved Payment Method Screen/SavedPaymentOptionsViewController.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Saved Payment Method Screen/SavedPaymentOptionsViewController.swift index de9726f138f..c47a49ee1fe 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Saved Payment Method Screen/SavedPaymentOptionsViewController.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Saved Payment Method Screen/SavedPaymentOptionsViewController.swift @@ -377,7 +377,7 @@ class SavedPaymentOptionsViewController: UIViewController { customerID: configuration.customerID, showApplePay: configuration.showApplePay, showLink: configuration.showLink, - allowsSetAsDefaultPM: configuration.allowsSetAsDefaultPM, + paymentMethodSetAsDefault: configuration.allowsSetAsDefaultPM, customer: elementsSession.customer ) From 907a3639ffe29bf3e83b1d2184f82d66311f64ae Mon Sep 17 00:00:00 2001 From: Joyce Qin Date: Thu, 30 Jan 2025 14:49:08 -0800 Subject: [PATCH 06/14] fix test --- ...mentMethodViewControllerSnapshotTests.swift | 8 +++----- .../CustomerSheet/CustomerSheetTests.swift | 2 -- .../STPFixtures+PaymentSheet.swift | 18 +++++++++++++++++- ...merSessionCustomerSheetWithSavedPM_200.json | 3 ++- ...sions_customerSessionCustomerSheet_200.json | 3 ++- 5 files changed, 24 insertions(+), 10 deletions(-) diff --git a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/AddPaymentMethodViewControllerSnapshotTests.swift b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/AddPaymentMethodViewControllerSnapshotTests.swift index eee1c93bf46..29a7834c656 100644 --- a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/AddPaymentMethodViewControllerSnapshotTests.swift +++ b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/AddPaymentMethodViewControllerSnapshotTests.swift @@ -8,7 +8,7 @@ #if !canImport(CompositorServices) import iOSSnapshotTestCase import StripeCoreTestUtils -@_spi(STP) @testable import StripePaymentSheet +@_spi(STP) @_spi(CustomerSessionBetaAccess) @testable import StripePaymentSheet @testable import StripePaymentsTestUtils @_spi(STP) @testable import StripeUICore import XCTest @@ -36,11 +36,11 @@ final class AddPaymentMethodViewControllerSnapshotTests: STPSnapshotTestCase { let intent = Intent._testPaymentIntent(paymentMethodTypes: [.payPal, .card, .cashApp]) var config = PaymentSheet.Configuration._testValue_MostPermissive() // ...and a "Save this card" checkbox... - config.customer = .init(id: "id", ephemeralKeySecret: "ek") + config.customer = .init(id: "id", customerSessionClientSecret: "cuss_123") // ...the AddPMVC should show the card type selected with the form pre-filled with the previous input let sut = AddPaymentMethodViewController( intent: intent, - elementsSession: ._testValue(intent: intent), + elementsSession: ._testValue(intent: intent, paymentMethodSetAsDefault: true), configuration: config, previousCustomerInput: previousCustomerInput, paymentMethodTypes: [.stripe(.payPal), .stripe(.card), .stripe(.cashApp)], @@ -62,8 +62,6 @@ final class AddPaymentMethodViewControllerSnapshotTests: STPSnapshotTestCase { var config = PaymentSheet.Configuration._testValue_MostPermissive() // ...and a "Save this card" checkbox... config.customer = .init(id: "id", ephemeralKeySecret: "ek") - // allows set as default so that the set as default checkbox renders - config.paymentMethodSetAsDefault = true // ...the AddPMVC should show the card type selected with the form pre-filled with the previous input let sut = AddPaymentMethodViewController( intent: intent, diff --git a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/CustomerSheet/CustomerSheetTests.swift b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/CustomerSheet/CustomerSheetTests.swift index 4bf7a28d721..6f9c9cd9d50 100644 --- a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/CustomerSheet/CustomerSheetTests.swift +++ b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/CustomerSheet/CustomerSheetTests.swift @@ -333,7 +333,6 @@ class CustomerSheetTests: APIStubbedTestCase { StubbedBackend.stubSessions(fileMock: .elementsSessions_customerSessionsCustomerSheetWithSavedPM_200) var configuration = CustomerSheet.Configuration() configuration.apiClient = stubbedAPIClient - configuration.paymentMethodSetAsDefault = true let loadPaymentMethodInfo = expectation(description: "loadPaymentMethodInfo completed") let customerSheet = CustomerSheet(configuration: configuration, @@ -357,7 +356,6 @@ class CustomerSheetTests: APIStubbedTestCase { StubbedBackend.stubSessions(fileMock: .elementsSessions_customerSessionsCustomerSheet_200) var configuration = CustomerSheet.Configuration() configuration.apiClient = stubbedAPIClient - configuration.paymentMethodSetAsDefault = true let loadPaymentMethodInfo = expectation(description: "loadPaymentMethodInfo completed") let customerSheet = CustomerSheet(configuration: configuration, diff --git a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/STPFixtures+PaymentSheet.swift b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/STPFixtures+PaymentSheet.swift index 86c50fb5d2c..a389487e916 100644 --- a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/STPFixtures+PaymentSheet.swift +++ b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/STPFixtures+PaymentSheet.swift @@ -148,7 +148,8 @@ extension STPElementsSession { static func _testValue( intent: Intent, linkMode: LinkMode? = nil, - linkFundingSources: Set = [] + linkFundingSources: Set = [], + paymentMethodSetAsDefault: Bool = false ) -> STPElementsSession { let paymentMethodTypes: [String] = { switch intent { @@ -160,8 +161,23 @@ extension STPElementsSession { return intentConfig.paymentMethodTypes ?? [] } }() + var customerSessionData: [String : Any]? + if paymentMethodSetAsDefault { + customerSessionData = [ + "mobile_payment_element": [ + "enabled": true, + "features": ["payment_method_save": "enabled", + "payment_method_remove": "enabled", + "payment_method_set_as_default": "enabled" + ], + ], + "customer_sheet": [ + "enabled": false, + ], ] + } return STPElementsSession._testValue( paymentMethodTypes: paymentMethodTypes, + customerSessionData: customerSessionData, linkMode: linkMode, linkFundingSources: linkFundingSources ) diff --git a/StripePaymentSheet/StripePaymentSheetTests/Resources/MockFiles/elements_sessions_customerSessionCustomerSheetWithSavedPM_200.json b/StripePaymentSheet/StripePaymentSheetTests/Resources/MockFiles/elements_sessions_customerSessionCustomerSheetWithSavedPM_200.json index dcca6f1ef45..8384590f710 100644 --- a/StripePaymentSheet/StripePaymentSheetTests/Resources/MockFiles/elements_sessions_customerSessionCustomerSheetWithSavedPM_200.json +++ b/StripePaymentSheet/StripePaymentSheetTests/Resources/MockFiles/elements_sessions_customerSessionCustomerSheetWithSavedPM_200.json @@ -23,7 +23,8 @@ "customer_sheet": { "enabled": true, "features": { - "payment_method_remove": "enabled" + "payment_method_remove": "enabled", + "payment_method_set_as_default": "enabled" } }, "pricing_table": { diff --git a/StripePaymentSheet/StripePaymentSheetTests/Resources/MockFiles/elements_sessions_customerSessionCustomerSheet_200.json b/StripePaymentSheet/StripePaymentSheetTests/Resources/MockFiles/elements_sessions_customerSessionCustomerSheet_200.json index 0dfd8f96f21..7686577f8e2 100644 --- a/StripePaymentSheet/StripePaymentSheetTests/Resources/MockFiles/elements_sessions_customerSessionCustomerSheet_200.json +++ b/StripePaymentSheet/StripePaymentSheetTests/Resources/MockFiles/elements_sessions_customerSessionCustomerSheet_200.json @@ -23,7 +23,8 @@ "customer_sheet": { "enabled": true, "features": { - "payment_method_remove": "enabled" + "payment_method_remove": "enabled", + "payment_method_set_as_default": "enabled" } }, "pricing_table": { From 9aa630784f9de49262cfefa642a184ceab76bc6a Mon Sep 17 00:00:00 2001 From: Joyce Qin Date: Thu, 30 Jan 2025 16:17:10 -0800 Subject: [PATCH 07/14] fixing build --- .../v1-elements-sessions/CustomerSession.swift | 2 +- .../Source/PaymentSheet/PaymentSheet+API.swift | 9 ++++----- .../Source/PaymentSheet/PaymentSheet+DeferredAPI.swift | 3 ++- .../AddPaymentMethodViewControllerSnapshotTests.swift | 2 +- .../PaymentSheet/PaymentSheet+APITest.swift | 6 +----- .../PaymentSheet/PaymentSheetLPMConfirmFlowTests.swift | 9 ++++++--- 6 files changed, 15 insertions(+), 16 deletions(-) diff --git a/StripePaymentSheet/StripePaymentSheet/Source/Internal/API Bindings/v1-elements-sessions/CustomerSession.swift b/StripePaymentSheet/StripePaymentSheet/Source/Internal/API Bindings/v1-elements-sessions/CustomerSession.swift index f366d045f8c..0002ee413ec 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/Internal/API Bindings/v1-elements-sessions/CustomerSession.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/Internal/API Bindings/v1-elements-sessions/CustomerSession.swift @@ -42,7 +42,7 @@ struct CustomerSession: Equatable, Hashable { return nil } let paymentMethodRemoveLast = mobilePaymentElementFeaturesDict["payment_method_remove_last"] as? String ?? "enabled" - let paymentMethodSetAsDefault = mobilePaymentElementFeaturesDict["payment_method_set_as_default"] as? String ?? "disabled" + let paymentMethodSetAsDefault = mobilePaymentElementFeaturesDict["payment_method_set_as_default"] as? String ?? "enabled" var allowRedisplayOverrideValue: STPPaymentMethodAllowRedisplay? if let allowRedisplayOverride = mobilePaymentElementFeaturesDict["payment_method_save_allow_redisplay_override"] as? String { diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheet+API.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheet+API.swift index d966e4807d7..38d96871ca8 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheet+API.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheet+API.swift @@ -200,7 +200,7 @@ extension PaymentSheet { params, with: authenticationContext, completion: { actionStatus, paymentIntent, error in - if let paymentIntent { + if let paymentIntent, !elementsSession.paymentMethodSetAsDefaultForPaymentSheet { setDefaultPaymentMethodIfNecessary(actionStatus: actionStatus, intent: .paymentIntent(paymentIntent), configuration: configuration) } paymentHandlerCompletion(actionStatus, error) @@ -222,7 +222,7 @@ extension PaymentSheet { setupIntentParams, with: authenticationContext, completion: { actionStatus, setupIntent, error in - if let setupIntent { + if let setupIntent, !elementsSession.paymentMethodSetAsDefaultForPaymentSheet { setDefaultPaymentMethodIfNecessary(actionStatus: actionStatus, intent: .setupIntent(setupIntent), configuration: configuration) } paymentHandlerCompletion(actionStatus, error) @@ -242,6 +242,7 @@ extension PaymentSheet { authenticationContext: authenticationContext, paymentHandler: paymentHandler, isFlowController: isFlowController, + allowsSetAsDefaultPM: elementsSession.paymentMethodSetAsDefaultForPaymentSheet, completion: completion ) } @@ -573,9 +574,7 @@ extension PaymentSheet { intent.isSetupFutureUsageSet, let paymentMethod = intent.paymentMethod, // Can it appear in the list of saved PMs? - PaymentSheet.supportedSavedPaymentMethods.contains(paymentMethod.type), - // Should we be writing to local storage? - !configuration.allowsSetAsDefaultPM + PaymentSheet.supportedSavedPaymentMethods.contains(paymentMethod.type) else { return } diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheet+DeferredAPI.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheet+DeferredAPI.swift index ca3d163d6e9..81e1c3058ee 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheet+DeferredAPI.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheet+DeferredAPI.swift @@ -17,6 +17,7 @@ extension PaymentSheet { authenticationContext: STPAuthenticationContext, paymentHandler: STPPaymentHandler, isFlowController: Bool, + allowsSetAsDefaultPM: Bool = false, mandateData: STPMandateDataParams? = nil, completion: @escaping (PaymentSheetResult, STPAnalyticsClient.DeferredIntentConfirmationType?) -> Void ) { @@ -52,7 +53,7 @@ extension PaymentSheet { // Overwrite `completion` to ensure we set the default if necessary before completing. let completion = { (status: STPPaymentHandlerActionStatus, paymentOrSetupIntent: PaymentOrSetupIntent?, error: NSError?, deferredIntentConfirmationType: STPAnalyticsClient.DeferredIntentConfirmationType) in - if let paymentOrSetupIntent { + if let paymentOrSetupIntent, !allowsSetAsDefaultPM { setDefaultPaymentMethodIfNecessary(actionStatus: status, intent: paymentOrSetupIntent, configuration: configuration) } completion(makePaymentSheetResult(for: status, error: error), deferredIntentConfirmationType) diff --git a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/AddPaymentMethodViewControllerSnapshotTests.swift b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/AddPaymentMethodViewControllerSnapshotTests.swift index 29a7834c656..416414055ed 100644 --- a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/AddPaymentMethodViewControllerSnapshotTests.swift +++ b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/AddPaymentMethodViewControllerSnapshotTests.swift @@ -40,7 +40,7 @@ final class AddPaymentMethodViewControllerSnapshotTests: STPSnapshotTestCase { // ...the AddPMVC should show the card type selected with the form pre-filled with the previous input let sut = AddPaymentMethodViewController( intent: intent, - elementsSession: ._testValue(intent: intent, paymentMethodSetAsDefault: true), + elementsSession: ._testValue(intent: intent, allowsSetAsDefaultPM: true), configuration: config, previousCustomerInput: previousCustomerInput, paymentMethodTypes: [.stripe(.payPal), .stripe(.card), .stripe(.cashApp)], diff --git a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/PaymentSheet+APITest.swift b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/PaymentSheet+APITest.swift index ce741e0af53..b2d1488899b 100644 --- a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/PaymentSheet+APITest.swift +++ b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/PaymentSheet+APITest.swift @@ -365,7 +365,6 @@ class PaymentSheetAPITest: STPNetworkStubbingTestCase { let cscs = try await STPTestingAPIClient.shared().fetchCustomerAndCustomerSessionClientSecret(customerID: customerAndEphemeralKey.customer, merchantCountry: nil) var configuration = self.configuration configuration.customer = PaymentSheet.CustomerConfiguration(id: cscs.customer, customerSessionClientSecret: cscs.customerSessionClientSecret) - configuration.allowsSetAsDefaultPM = true // 0. Create a PI on our test backend STPTestingAPIClient.shared.fetchPaymentIntent(types: types, shouldSavePM: true, customerID: configuration.customer?.id) { result in @@ -436,7 +435,7 @@ class PaymentSheetAPITest: STPNetworkStubbingTestCase { print(error) } } - await fulfillment(of: [expectation], timeout: STPTestingNetworkRequestTimeout) + await fulfillment(of: [expectation], timeout: 10000) } func testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault() async throws { @@ -447,7 +446,6 @@ class PaymentSheetAPITest: STPNetworkStubbingTestCase { let cscs = try await STPTestingAPIClient.shared().fetchCustomerAndCustomerSessionClientSecret(customerID: customerAndEphemeralKey.customer, merchantCountry: nil) var configuration = self.configuration configuration.customer = PaymentSheet.CustomerConfiguration(id: cscs.customer, customerSessionClientSecret: cscs.customerSessionClientSecret) - configuration.allowsSetAsDefaultPM = true // 0. Create a SI on our test backend let clientSecret = try await STPTestingAPIClient.shared.fetchSetupIntent(types: types, customerID: configuration.customer?.id) // 1. Load the SI @@ -519,7 +517,6 @@ class PaymentSheetAPITest: STPNetworkStubbingTestCase { let cscs = try await STPTestingAPIClient.shared().fetchCustomerAndCustomerSessionClientSecret(customerID: customerAndEphemeralKey.customer, merchantCountry: nil) var configuration = self.configuration configuration.customer = PaymentSheet.CustomerConfiguration(id: cscs.customer, customerSessionClientSecret: cscs.customerSessionClientSecret) - configuration.allowsSetAsDefaultPM = true let types = ["card"] let confirmHandler: PaymentSheet.IntentConfiguration.ConfirmHandler = {_, _, intentCreationCallback in Task { [configuration] in @@ -589,7 +586,6 @@ class PaymentSheetAPITest: STPNetworkStubbingTestCase { let cscs = try await STPTestingAPIClient.shared().fetchCustomerAndCustomerSessionClientSecret(customerID: customerAndEphemeralKey.customer, merchantCountry: nil) var configuration = self.configuration configuration.customer = PaymentSheet.CustomerConfiguration(id: cscs.customer, customerSessionClientSecret: cscs.customerSessionClientSecret) - configuration.allowsSetAsDefaultPM = true let types = ["card"] let confirmHandler: PaymentSheet.IntentConfiguration.ConfirmHandler = {_, _, intentCreationCallback in Task { [configuration] in diff --git a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/PaymentSheetLPMConfirmFlowTests.swift b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/PaymentSheetLPMConfirmFlowTests.swift index 74289bad778..52b6825d445 100644 --- a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/PaymentSheetLPMConfirmFlowTests.swift +++ b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/PaymentSheetLPMConfirmFlowTests.swift @@ -460,13 +460,13 @@ final class PaymentSheet_LPM_ConfirmFlowTests: STPNetworkStubbingTestCase { configuration.returnURL = "https://foo.com" configuration.allowsPaymentMethodsRequiringShippingAddress = true configuration.customer = customerConfig - configuration.allowsSetAsDefaultPM = true try await _testConfirm( intentKinds: [.paymentIntentWithSetupFutureUsage, .setupIntent], currency: "USD", paymentMethodType: .card, merchantCountry: .US, - configuration: configuration + configuration: configuration, + allowsSetAsDefaultPM: true ) { form in form.getCardSection().panElement.setText("4242424242424242") form.getCardSection().expiryElement.setText("1228") @@ -586,6 +586,7 @@ extension PaymentSheet_LPM_ConfirmFlowTests { merchantCountry: MerchantCountry = .US, configuration: PaymentSheet.Configuration? = nil, defaultCountry: String = "US", + allowsSetAsDefaultPM: Bool = false, formCompleter: (PaymentMethodElement) -> Void ) async throws { for intentKind in intentKinds { @@ -597,6 +598,7 @@ extension PaymentSheet_LPM_ConfirmFlowTests { merchantCountry: merchantCountry, configuration: configuration, defaultCountry: defaultCountry, + allowsSetAsDefaultPM: allowsSetAsDefaultPM, formCompleter: formCompleter ) } @@ -620,6 +622,7 @@ extension PaymentSheet_LPM_ConfirmFlowTests { merchantCountry: MerchantCountry = .US, configuration: PaymentSheet.Configuration? = nil, defaultCountry: String, + allowsSetAsDefaultPM: Bool = false, formCompleter: (PaymentMethodElement) -> Void ) async throws { // Initialize PaymentSheet at least once to set the correct payment_user_agent for this process: @@ -650,7 +653,7 @@ extension PaymentSheet_LPM_ConfirmFlowTests { for (description, intent) in intents { func makeFormVC(previousCustomerInput: IntentConfirmParams?) -> PaymentMethodFormViewController { - return PaymentMethodFormViewController(type: .stripe(paymentMethodType), intent: intent, elementsSession: ._testValue(intent: intent, allowsSetAsDefaultPM: configuration.allowsSetAsDefaultPM), previousCustomerInput: previousCustomerInput, formCache: .init(), configuration: configuration, headerView: nil, analyticsHelper: ._testValue(), delegate: self) + return PaymentMethodFormViewController(type: .stripe(paymentMethodType), intent: intent, elementsSession: ._testValue(intent: intent, allowsSetAsDefaultPM: allowsSetAsDefaultPM), previousCustomerInput: previousCustomerInput, formCache: .init(), configuration: configuration, headerView: nil, analyticsHelper: ._testValue(), delegate: self) } // Make the form let formVC = makeFormVC(previousCustomerInput: nil) From 23358dd3dcc91b5cfc9e95db5637dcdcb5358e49 Mon Sep 17 00:00:00 2001 From: Joyce Qin Date: Tue, 4 Feb 2025 13:17:11 -0800 Subject: [PATCH 08/14] replace payment_method_set_as_default with payment_method_sync_default for customersheet, fix some tests --- .../CustomerSheetTestPlayground.swift | 2 +- ...ustomerSheetTestPlaygroundController.swift | 2 +- .../CustomerSheetTestPlaygroundSettings.swift | 8 +- .../CustomerSession.swift | 8 +- .../STPElementsSession.swift | 4 +- .../CustomerSessionAdapter.swift | 2 +- ...ymentMethodsCollectionViewController.swift | 4 +- ...merSavedPaymentMethodsViewController.swift | 16 +- .../CustomerSheet/CustomerSheet.swift | 10 +- .../CustomerSheetDataSource.swift | 4 +- ...entMethodViewControllerSnapshotTests.swift | 5 +- ...MethodsCollectionViewControllerTests.swift | 6 +- .../CustomerSheet/CustomerSheetTests.swift | 6 +- .../PaymentSheet/PaymentSheet+APITest.swift | 9 +- .../PaymentSheet/STPElementsSessionTest.swift | 17 +- .../PaymentSheet/Stubbed/StubbedBackend.swift | 2 + ...erSessionCustomerSheetWithSavedPM_200.json | 3 +- ...erSheetWithSavedPM_DefaultEnabled_200.json | 167 ++++++++++++++++++ ...ions_customerSessionCustomerSheet_200.json | 3 +- ...ssionCustomerSheet_DefaultEnabled_200.json | 119 +++++++++++++ .../STPTestingAPIClient+Swift.swift | 14 +- 21 files changed, 356 insertions(+), 55 deletions(-) create mode 100644 StripePaymentSheet/StripePaymentSheetTests/Resources/MockFiles/elements_sessions_customerSessionCustomerSheetWithSavedPM_DefaultEnabled_200.json create mode 100644 StripePaymentSheet/StripePaymentSheetTests/Resources/MockFiles/elements_sessions_customerSessionCustomerSheet_DefaultEnabled_200.json diff --git a/Example/PaymentSheet Example/PaymentSheet Example/CustomerSheetTestPlayground.swift b/Example/PaymentSheet Example/PaymentSheet Example/CustomerSheetTestPlayground.swift index b275b1430d6..70f9c95269c 100644 --- a/Example/PaymentSheet Example/PaymentSheet Example/CustomerSheetTestPlayground.swift +++ b/Example/PaymentSheet Example/PaymentSheet Example/CustomerSheetTestPlayground.swift @@ -53,7 +53,7 @@ struct CustomerSheetTestPlayground: View { SettingPickerView(setting: $playgroundController.settings.paymentMethodRemove) SettingPickerView(setting: $playgroundController.settings.paymentMethodRemoveLast) SettingPickerView(setting: $playgroundController.settings.paymentMethodAllowRedisplayFilters) - SettingPickerView(setting: $playgroundController.settings.paymentMethodSetAsDefault) + SettingPickerView(setting: $playgroundController.settings.paymentMethodSyncDefault) } } } diff --git a/Example/PaymentSheet Example/PaymentSheet Example/CustomerSheetTestPlaygroundController.swift b/Example/PaymentSheet Example/PaymentSheet Example/CustomerSheetTestPlaygroundController.swift index 32e7cd20b11..3ecb0c7c22f 100644 --- a/Example/PaymentSheet Example/PaymentSheet Example/CustomerSheetTestPlaygroundController.swift +++ b/Example/PaymentSheet Example/PaymentSheet Example/CustomerSheetTestPlaygroundController.swift @@ -327,7 +327,7 @@ class CustomerSheetBackend { "merchant_country_code": settings.merchantCountryCode.rawValue, "customer_session_payment_method_remove": settings.paymentMethodRemove.rawValue, "customer_session_payment_method_remove_last": settings.paymentMethodRemoveLast.rawValue, - "customer_session_payment_method_set_as_default": settings.paymentMethodSetAsDefault.rawValue, + "customer_session_payment_method_sync_default": settings.paymentMethodSyncDefault.rawValue, ] as [String: Any] if let allowRedisplayValue = settings.paymentMethodAllowRedisplayFilters.arrayValue() { diff --git a/Example/PaymentSheet Example/PaymentSheet Example/CustomerSheetTestPlaygroundSettings.swift b/Example/PaymentSheet Example/PaymentSheet Example/CustomerSheetTestPlaygroundSettings.swift index 0ca96e2f2df..3e040528639 100644 --- a/Example/PaymentSheet Example/PaymentSheet Example/CustomerSheetTestPlaygroundSettings.swift +++ b/Example/PaymentSheet Example/PaymentSheet Example/CustomerSheetTestPlaygroundSettings.swift @@ -141,8 +141,8 @@ public struct CustomerSheetTestPlaygroundSettings: Codable, Equatable { } } - enum PaymentMethodSetAsDefault: String, PickerEnum { - static let enumName: String = "paymentMethodSetAsDefault" + enum PaymentMethodSyncDefault: String, PickerEnum { + static let enumName: String = "PaymentMethodSyncDefault" case enabled case disabled @@ -175,7 +175,7 @@ public struct CustomerSheetTestPlaygroundSettings: Codable, Equatable { var paymentMethodRemove: PaymentMethodRemove var paymentMethodRemoveLast: PaymentMethodRemoveLast var paymentMethodAllowRedisplayFilters: PaymentMethodAllowRedisplayFilters - var paymentMethodSetAsDefault: PaymentMethodSetAsDefault + var paymentMethodSyncDefault: PaymentMethodSyncDefault var cardBrandAcceptance: CardBrandAcceptance static func defaultValues() -> CustomerSheetTestPlaygroundSettings { @@ -198,7 +198,7 @@ public struct CustomerSheetTestPlaygroundSettings: Codable, Equatable { paymentMethodRemove: .enabled, paymentMethodRemoveLast: .enabled, paymentMethodAllowRedisplayFilters: .always, - paymentMethodSetAsDefault: .disabled, + paymentMethodSyncDefault: .disabled, cardBrandAcceptance: .all) } diff --git a/StripePaymentSheet/StripePaymentSheet/Source/Internal/API Bindings/v1-elements-sessions/CustomerSession.swift b/StripePaymentSheet/StripePaymentSheet/Source/Internal/API Bindings/v1-elements-sessions/CustomerSession.swift index 0002ee413ec..88d65957f2e 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/Internal/API Bindings/v1-elements-sessions/CustomerSession.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/Internal/API Bindings/v1-elements-sessions/CustomerSession.swift @@ -42,7 +42,7 @@ struct CustomerSession: Equatable, Hashable { return nil } let paymentMethodRemoveLast = mobilePaymentElementFeaturesDict["payment_method_remove_last"] as? String ?? "enabled" - let paymentMethodSetAsDefault = mobilePaymentElementFeaturesDict["payment_method_set_as_default"] as? String ?? "enabled" + let paymentMethodSetAsDefault = mobilePaymentElementFeaturesDict["payment_method_set_as_default"] as? String ?? "disabled" var allowRedisplayOverrideValue: STPPaymentMethodAllowRedisplay? if let allowRedisplayOverride = mobilePaymentElementFeaturesDict["payment_method_save_allow_redisplay_override"] as? String { @@ -66,11 +66,11 @@ struct CustomerSession: Equatable, Hashable { return nil } let paymentMethodRemoveLast = customerSheetFeaturesDict["payment_method_remove_last"] as? String ?? "enabled" - let paymentMethodSetAsDefault = customerSheetFeaturesDict["payment_method_set_as_default"] as? String ?? "enabled" + let paymentMethodSyncDefault = customerSheetFeaturesDict["payment_method_sync_default"] as? String ?? "disabled" customerSheetComponent = CustomerSheetComponent(enabled: true, features: CustomerSheetComponentFeature(paymentMethodRemove: paymentMethodRemove == "enabled", paymentMethodRemoveLast: paymentMethodRemoveLast == "enabled", - paymentMethodSetAsDefault: paymentMethodSetAsDefault == "enabled")) + paymentMethodSyncDefault: paymentMethodSyncDefault == "enabled")) } else { customerSheetComponent = CustomerSheetComponent(enabled: false, features: nil) } @@ -108,5 +108,5 @@ struct CustomerSheetComponent: Equatable, Hashable { struct CustomerSheetComponentFeature: Equatable, Hashable { let paymentMethodRemove: Bool let paymentMethodRemoveLast: Bool - let paymentMethodSetAsDefault: Bool + let paymentMethodSyncDefault: Bool } diff --git a/StripePaymentSheet/StripePaymentSheet/Source/Internal/API Bindings/v1-elements-sessions/STPElementsSession.swift b/StripePaymentSheet/StripePaymentSheet/Source/Internal/API Bindings/v1-elements-sessions/STPElementsSession.swift index eed4d5e40c6..f001629b5fa 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/Internal/API Bindings/v1-elements-sessions/STPElementsSession.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/Internal/API Bindings/v1-elements-sessions/STPElementsSession.swift @@ -231,8 +231,8 @@ extension STPElementsSession { return customer?.customerSession.customerSheetComponent.features?.paymentMethodRemoveLast ?? true } - var paymentMethodSetAsDefaultForCustomerSheet: Bool { - return customer?.customerSession.customerSheetComponent.features?.paymentMethodSetAsDefault ?? false + var paymentMethodSyncDefaultForCustomerSheet: Bool { + return customer?.customerSession.customerSheetComponent.features?.paymentMethodSyncDefault ?? false } var isLinkCardBrand: Bool { diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSessionAdapter/CustomerSessionAdapter.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSessionAdapter/CustomerSessionAdapter.swift index 01707d5de97..a211642a6af 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSessionAdapter/CustomerSessionAdapter.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSessionAdapter/CustomerSessionAdapter.swift @@ -109,7 +109,7 @@ extension CustomerSessionAdapter { func fetchSelectedPaymentOption(for customerId: String, elementsSession: STPElementsSession? = nil) -> CustomerPaymentOption? { // if opted in to the "set as default" feature, try to get default payment method from elements session - if let elementsSession = elementsSession, elementsSession.paymentMethodSetAsDefaultForCustomerSheet { + if let elementsSession = elementsSession, elementsSession.paymentMethodSyncDefaultForCustomerSheet { guard let customer = elementsSession.customer, let defaultPaymentMethod = customer.getDefaultOrFirstPaymentMethod() else { return nil } return CustomerPaymentOption.stripeId(defaultPaymentMethod.stripeId) diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSavedPaymentMethodsCollectionViewController.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSavedPaymentMethodsCollectionViewController.swift index 3e6653f3264..82e56a65b25 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSavedPaymentMethodsCollectionViewController.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSavedPaymentMethodsCollectionViewController.swift @@ -81,7 +81,7 @@ class CustomerSavedPaymentMethodsCollectionViewController: UIViewController { let showApplePay: Bool let allowsRemovalOfLastSavedPaymentMethod: Bool let paymentMethodRemove: Bool - let paymentMethodSetAsDefault: Bool + let paymentMethodSyncDefault: Bool let isTestMode: Bool } @@ -243,7 +243,7 @@ class CustomerSavedPaymentMethodsCollectionViewController: UIViewController { delegate: CustomerSavedPaymentMethodsCollectionViewControllerDelegate? = nil ) { // when opted into the set as default feature, only show payment methods that can be set as default (card, US bank account) - if configuration.paymentMethodSetAsDefault { + if configuration.paymentMethodSyncDefault { self.savedPaymentMethods = savedPaymentMethods.filter{ savedPaymentMethod in CustomerSheet.supportedDefaultPaymentMethods.contains{paymentMethodType in savedPaymentMethod.type == paymentMethodType} } diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSavedPaymentMethodsViewController.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSavedPaymentMethodsViewController.swift index fef810c5cde..289b538b1b8 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSavedPaymentMethodsViewController.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSavedPaymentMethodsViewController.swift @@ -34,7 +34,7 @@ class CustomerSavedPaymentMethodsViewController: UIViewController { let configuration: CustomerSheet.Configuration let customerSheetDataSource: CustomerSheetDataSource let paymentMethodRemove: Bool - let paymentMethodSetAsDefault: Bool + let paymentMethodSyncDefault: Bool let allowsRemovalOfLastSavedPaymentMethod: Bool let cbcEligible: Bool @@ -65,11 +65,11 @@ class CustomerSavedPaymentMethodsViewController: UIViewController { private var cachedClientSecret: String? var showApplePay: Bool { - return isApplePayEnabled && !paymentMethodSetAsDefault + return isApplePayEnabled && !paymentMethodSyncDefault } var paymentMethodTypes: [PaymentSheet.PaymentMethodType] { - let supportedPaymentMethods = paymentMethodSetAsDefault ? CustomerSheet.supportedDefaultPaymentMethods : CustomerSheet.supportedPaymentMethods + let supportedPaymentMethods = paymentMethodSyncDefault ? CustomerSheet.supportedDefaultPaymentMethods : CustomerSheet.supportedPaymentMethods let paymentMethodTypes = merchantSupportedPaymentMethodTypes.customerSheetSupportedPaymentMethodTypesForAdd(canCreateSetupIntents: canCreateSetupIntents, supportedPaymentMethods: supportedPaymentMethods) return paymentMethodTypes.toPaymentSheetPaymentMethodTypes() } @@ -109,7 +109,7 @@ class CustomerSavedPaymentMethodsViewController: UIViewController { showApplePay: showApplePay, allowsRemovalOfLastSavedPaymentMethod: allowsRemovalOfLastSavedPaymentMethod, paymentMethodRemove: paymentMethodRemove, - paymentMethodSetAsDefault: paymentMethodSetAsDefault, + paymentMethodSyncDefault: paymentMethodSyncDefault, isTestMode: configuration.apiClient.isTestmode ), appearance: configuration.appearance, @@ -152,7 +152,7 @@ class CustomerSavedPaymentMethodsViewController: UIViewController { customerSheetDataSource: CustomerSheetDataSource, isApplePayEnabled: Bool, paymentMethodRemove: Bool, - paymentMethodSetAsDefault: Bool, + paymentMethodSyncDefault: Bool, allowsRemovalOfLastSavedPaymentMethod: Bool, cbcEligible: Bool, csCompletion: CustomerSheet.CustomerSheetCompletion?, @@ -165,13 +165,13 @@ class CustomerSavedPaymentMethodsViewController: UIViewController { self.customerSheetDataSource = customerSheetDataSource self.isApplePayEnabled = isApplePayEnabled self.paymentMethodRemove = paymentMethodRemove - self.paymentMethodSetAsDefault = paymentMethodSetAsDefault + self.paymentMethodSyncDefault = paymentMethodSyncDefault self.allowsRemovalOfLastSavedPaymentMethod = allowsRemovalOfLastSavedPaymentMethod self.cbcEligible = cbcEligible self.csCompletion = csCompletion self.delegate = delegate - if Self.shouldShowPaymentMethodCarousel(savedPaymentMethods: savedPaymentMethods, showApplePay: isApplePayEnabled && !paymentMethodSetAsDefault) { + if Self.shouldShowPaymentMethodCarousel(savedPaymentMethods: savedPaymentMethods, showApplePay: isApplePayEnabled && !paymentMethodSyncDefault) { self.mode = .selectingSaved } else { switch customerSheetDataSource.dataSource { @@ -665,7 +665,7 @@ class CustomerSavedPaymentMethodsViewController: UIViewController { showApplePay: isApplePayEnabled, allowsRemovalOfLastSavedPaymentMethod: allowsRemovalOfLastSavedPaymentMethod, paymentMethodRemove: paymentMethodRemove, - paymentMethodSetAsDefault: paymentMethodSetAsDefault, + paymentMethodSyncDefault: paymentMethodSyncDefault, isTestMode: configuration.apiClient.isTestmode ), appearance: configuration.appearance, diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSheet.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSheet.swift index a4a16e98296..9127b3cee9a 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSheet.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSheet.swift @@ -167,7 +167,7 @@ public class CustomerSheet { case .success((let savedPaymentMethods, let selectedPaymentMethodOption, let elementsSession)): let merchantSupportedPaymentMethodTypes = customerSheetDataSource.merchantSupportedPaymentMethodTypes(elementsSession: elementsSession) let paymentMethodRemove = customerSheetDataSource.paymentMethodRemove(elementsSession: elementsSession) - let paymentMethodSetAsDefault = customerSheetDataSource.paymentMethodSetAsDefault(elementsSession: elementsSession) + let paymentMethodSyncDefault = customerSheetDataSource.paymentMethodSyncDefault(elementsSession: elementsSession) let allowsRemovalOfLastSavedPaymentMethod = CustomerSheet.allowsRemovalOfLastPaymentMethod(elementsSession: elementsSession, configuration: self.configuration) self.present(from: presentingViewController, savedPaymentMethods: savedPaymentMethods, @@ -175,7 +175,7 @@ public class CustomerSheet { merchantSupportedPaymentMethodTypes: merchantSupportedPaymentMethodTypes, customerSheetDataSource: customerSheetDataSource, paymentMethodRemove: paymentMethodRemove, - paymentMethodSetAsDefault: paymentMethodSetAsDefault, + paymentMethodSyncDefault: paymentMethodSyncDefault, allowsRemovalOfLastSavedPaymentMethod: allowsRemovalOfLastSavedPaymentMethod, cbcEligible: elementsSession.cardBrandChoice?.eligible ?? false) STPAnalyticsClient.sharedClient.logPaymentSheetEvent(event: .customerSheetLoadSucceeded, @@ -200,7 +200,7 @@ public class CustomerSheet { merchantSupportedPaymentMethodTypes: [STPPaymentMethodType], customerSheetDataSource: CustomerSheetDataSource, paymentMethodRemove: Bool, - paymentMethodSetAsDefault: Bool, + paymentMethodSyncDefault: Bool, allowsRemovalOfLastSavedPaymentMethod: Bool, cbcEligible: Bool) { let loadSpecsPromise = Promise() @@ -217,7 +217,7 @@ public class CustomerSheet { customerSheetDataSource: customerSheetDataSource, isApplePayEnabled: isApplePayEnabled, paymentMethodRemove: paymentMethodRemove, - paymentMethodSetAsDefault: paymentMethodSetAsDefault, + paymentMethodSyncDefault: paymentMethodSyncDefault, allowsRemovalOfLastSavedPaymentMethod: allowsRemovalOfLastSavedPaymentMethod, cbcEligible: cbcEligible, csCompletion: self.csCompletion, @@ -334,7 +334,7 @@ extension CustomerSheet { var selectedPaymentOption: CustomerPaymentOption? // if opted in to the "set as default" feature, try to get default payment method from elements session - if elementsSession.paymentMethodSetAsDefaultForCustomerSheet { + if elementsSession.paymentMethodSyncDefaultForCustomerSheet { guard let customer = elementsSession.customer, let defaultPaymentMethod = customer.getDefaultOrFirstPaymentMethod() else { return nil } selectedPaymentOption = CustomerPaymentOption.stripeId(defaultPaymentMethod.stripeId) diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSheetDataSource.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSheetDataSource.swift index 8afee76cab5..ca43ea4fbb9 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSheetDataSource.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSheetDataSource.swift @@ -199,12 +199,12 @@ extension CustomerSheetDataSource { } } - func paymentMethodSetAsDefault(elementsSession: STPElementsSession) -> Bool { + func paymentMethodSyncDefault(elementsSession: STPElementsSession) -> Bool { switch dataSource { case .customerAdapter: return false case .customerSession: - return elementsSession.paymentMethodSetAsDefaultForCustomerSheet + return elementsSession.paymentMethodSyncDefaultForCustomerSheet } } } diff --git a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/AddPaymentMethodViewControllerSnapshotTests.swift b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/AddPaymentMethodViewControllerSnapshotTests.swift index 416414055ed..9cca68d7f96 100644 --- a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/AddPaymentMethodViewControllerSnapshotTests.swift +++ b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/AddPaymentMethodViewControllerSnapshotTests.swift @@ -40,7 +40,7 @@ final class AddPaymentMethodViewControllerSnapshotTests: STPSnapshotTestCase { // ...the AddPMVC should show the card type selected with the form pre-filled with the previous input let sut = AddPaymentMethodViewController( intent: intent, - elementsSession: ._testValue(intent: intent, allowsSetAsDefaultPM: true), + elementsSession: ._testValue(intent: intent), configuration: config, previousCustomerInput: previousCustomerInput, paymentMethodTypes: [.stripe(.payPal), .stripe(.card), .stripe(.cashApp)], @@ -65,7 +65,8 @@ final class AddPaymentMethodViewControllerSnapshotTests: STPSnapshotTestCase { // ...the AddPMVC should show the card type selected with the form pre-filled with the previous input let sut = AddPaymentMethodViewController( intent: intent, - elementsSession: ._testValue(intent: intent), + // ...and a "Set as default" checkbox... + elementsSession: ._testValue(intent: intent, allowsSetAsDefaultPM: true), configuration: config, previousCustomerInput: previousCustomerInput, paymentMethodTypes: [.stripe(.payPal), .stripe(.card), .stripe(.cashApp)], diff --git a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/CustomerSheet/CustomerSavedPaymentMethodsCollectionViewControllerTests.swift b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/CustomerSheet/CustomerSavedPaymentMethodsCollectionViewControllerTests.swift index 29d10f7f7aa..c7d3d85bf13 100644 --- a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/CustomerSheet/CustomerSavedPaymentMethodsCollectionViewControllerTests.swift +++ b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/CustomerSheet/CustomerSavedPaymentMethodsCollectionViewControllerTests.swift @@ -294,7 +294,7 @@ class CustomerSavedPaymentMethodsCollectionViewControllerTests: XCTestCase { func testHideNonCardUSBank_SetAsDefault() { let configuration = configuration(allowsRemovalOfLastSavedPaymentMethod: true, paymentMethodRemove: true, - paymentMethodSetAsDefault: true) + paymentMethodSyncDefault: true) let controller = customerSavedPaymentMethods(configuration, savedPaymentMethods: [STPPaymentMethod._testCard(), STPPaymentMethod._testUSBankAccount(), STPPaymentMethod._testSEPA()], cbcEligible: false) @@ -303,12 +303,12 @@ class CustomerSavedPaymentMethodsCollectionViewControllerTests: XCTestCase { func configuration(allowsRemovalOfLastSavedPaymentMethod: Bool, paymentMethodRemove: Bool, - paymentMethodSetAsDefault: Bool = false, + paymentMethodSyncDefault: Bool = false, showApplePay: Bool = false) -> CustomerSavedPaymentMethodsCollectionViewController.Configuration { return CustomerSavedPaymentMethodsCollectionViewController.Configuration(showApplePay: showApplePay, allowsRemovalOfLastSavedPaymentMethod: allowsRemovalOfLastSavedPaymentMethod, paymentMethodRemove: paymentMethodRemove, - paymentMethodSetAsDefault: paymentMethodSetAsDefault, + paymentMethodSyncDefault: paymentMethodSyncDefault, isTestMode: true) } func customerSavedPaymentMethods(_ configuration: CustomerSavedPaymentMethodsCollectionViewController.Configuration, diff --git a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/CustomerSheet/CustomerSheetTests.swift b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/CustomerSheet/CustomerSheetTests.swift index 6f9c9cd9d50..51044ae7302 100644 --- a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/CustomerSheet/CustomerSheetTests.swift +++ b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/CustomerSheet/CustomerSheetTests.swift @@ -7,7 +7,7 @@ import Foundation @_spi(STP) @testable import StripeCore @_spi(STP) @testable import StripePayments -@_spi(CustomerSessionBetaAccess) @_spi(CardBrandFilteringBeta) @_spi(AllowsSetAsDefaultPM) @testable import StripePaymentSheet +@_spi(STP) @_spi(CustomerSessionBetaAccess) @_spi(CardBrandFilteringBeta) @_spi(AllowsSetAsDefaultPM) @testable import StripePaymentSheet import OHHTTPStubs import OHHTTPStubsSwift @@ -330,7 +330,7 @@ class CustomerSheetTests: APIStubbedTestCase { func testLoadPaymentMethodInfo_CustomerSession_NoDefaultPMHasSavedPaymentMethod() throws { let stubbedAPIClient = stubbedAPIClient() - StubbedBackend.stubSessions(fileMock: .elementsSessions_customerSessionsCustomerSheetWithSavedPM_200) + StubbedBackend.stubSessions(fileMock: .elementsSessions_customerSessionsCustomerSheetWithSavedPM_DefaultEnabled_200) var configuration = CustomerSheet.Configuration() configuration.apiClient = stubbedAPIClient @@ -353,7 +353,7 @@ class CustomerSheetTests: APIStubbedTestCase { func testLoadPaymentMethodInfo_CustomerSession_NoDefaultPMNoSavedPaymentMethod() throws { let stubbedAPIClient = stubbedAPIClient() - StubbedBackend.stubSessions(fileMock: .elementsSessions_customerSessionsCustomerSheet_200) + StubbedBackend.stubSessions(fileMock: .elementsSessions_customerSessionsCustomerSheet_DefaultEnabled_200) var configuration = CustomerSheet.Configuration() configuration.apiClient = stubbedAPIClient diff --git a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/PaymentSheet+APITest.swift b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/PaymentSheet+APITest.swift index b2d1488899b..67205621491 100644 --- a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/PaymentSheet+APITest.swift +++ b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/PaymentSheet+APITest.swift @@ -362,7 +362,7 @@ class PaymentSheetAPITest: STPNetworkStubbingTestCase { let expectation = XCTestExpectation(description: "Check default payment method set") // Create a new customer and new key let customerAndEphemeralKey = try await STPTestingAPIClient.shared().fetchCustomerAndEphemeralKey(customerID: nil, merchantCountry: nil) - let cscs = try await STPTestingAPIClient.shared().fetchCustomerAndCustomerSessionClientSecret(customerID: customerAndEphemeralKey.customer, merchantCountry: nil) + let cscs = try await STPTestingAPIClient.shared().fetchCustomerAndCustomerSessionClientSecret(customerID: customerAndEphemeralKey.customer, merchantCountry: nil, features: .init(paymentMethodSave: true, paymentMethodRemove: true, paymentMethodRemoveLast: true, paymentMethodSaveAllowRedisplayOverride: .always, paymentMethodSetAsDefault: true)) var configuration = self.configuration configuration.customer = PaymentSheet.CustomerConfiguration(id: cscs.customer, customerSessionClientSecret: cscs.customerSessionClientSecret) // 0. Create a PI on our test backend @@ -443,7 +443,7 @@ class PaymentSheetAPITest: STPNetworkStubbingTestCase { let expectation = XCTestExpectation(description: "Check default payment method set") // Create a new customer and new key let customerAndEphemeralKey = try await STPTestingAPIClient.shared().fetchCustomerAndEphemeralKey(customerID: nil, merchantCountry: nil) - let cscs = try await STPTestingAPIClient.shared().fetchCustomerAndCustomerSessionClientSecret(customerID: customerAndEphemeralKey.customer, merchantCountry: nil) + let cscs = try await STPTestingAPIClient.shared().fetchCustomerAndCustomerSessionClientSecret(customerID: customerAndEphemeralKey.customer, merchantCountry: nil, features: .init(paymentMethodSave: true, paymentMethodRemove: true, paymentMethodRemoveLast: true, paymentMethodSaveAllowRedisplayOverride: .always, paymentMethodSetAsDefault: true)) var configuration = self.configuration configuration.customer = PaymentSheet.CustomerConfiguration(id: cscs.customer, customerSessionClientSecret: cscs.customerSessionClientSecret) // 0. Create a SI on our test backend @@ -514,7 +514,7 @@ class PaymentSheetAPITest: STPNetworkStubbingTestCase { let expectation = XCTestExpectation(description: "Check default payment method set") // Create a new customer and new key let customerAndEphemeralKey = try await STPTestingAPIClient.shared().fetchCustomerAndEphemeralKey(customerID: nil, merchantCountry: nil) - let cscs = try await STPTestingAPIClient.shared().fetchCustomerAndCustomerSessionClientSecret(customerID: customerAndEphemeralKey.customer, merchantCountry: nil) + let cscs = try await STPTestingAPIClient.shared().fetchCustomerAndCustomerSessionClientSecret(customerID: customerAndEphemeralKey.customer, merchantCountry: nil, features: .init(paymentMethodSave: true, paymentMethodRemove: true, paymentMethodRemoveLast: true, paymentMethodSaveAllowRedisplayOverride: .always, paymentMethodSetAsDefault: true)) var configuration = self.configuration configuration.customer = PaymentSheet.CustomerConfiguration(id: cscs.customer, customerSessionClientSecret: cscs.customerSessionClientSecret) let types = ["card"] @@ -583,7 +583,7 @@ class PaymentSheetAPITest: STPNetworkStubbingTestCase { let expectation = XCTestExpectation(description: "Check default payment method set") // Create a new customer and new key let customerAndEphemeralKey = try await STPTestingAPIClient.shared().fetchCustomerAndEphemeralKey(customerID: nil, merchantCountry: nil) - let cscs = try await STPTestingAPIClient.shared().fetchCustomerAndCustomerSessionClientSecret(customerID: customerAndEphemeralKey.customer, merchantCountry: nil) + let cscs = try await STPTestingAPIClient.shared().fetchCustomerAndCustomerSessionClientSecret(customerID: customerAndEphemeralKey.customer, merchantCountry: nil, features: .init(paymentMethodSave: true, paymentMethodRemove: true, paymentMethodRemoveLast: true, paymentMethodSaveAllowRedisplayOverride: .always, paymentMethodSetAsDefault: true)) var configuration = self.configuration configuration.customer = PaymentSheet.CustomerConfiguration(id: cscs.customer, customerSessionClientSecret: cscs.customerSessionClientSecret) let types = ["card"] @@ -618,6 +618,7 @@ class PaymentSheetAPITest: STPNetworkStubbingTestCase { ) { result, _ in switch result { case .completed: + sleep(3) PaymentSheetLoader.load( mode: .deferredIntent(intentConfig), configuration: configuration, diff --git a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/STPElementsSessionTest.swift b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/STPElementsSessionTest.swift index 9a46b38dc0c..369afe97712 100644 --- a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/STPElementsSessionTest.swift +++ b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/STPElementsSessionTest.swift @@ -267,7 +267,9 @@ class STPElementsSessionTest: XCTestCase { customerSessionData: [ "mobile_payment_element": [ "enabled": true, - "features": ["payment_method_set_as_default": "enabled"], + "features": ["payment_method_save": "enabled", + "payment_method_remove": "enabled", + "payment_method_set_as_default": "enabled"], ], "customer_sheet": [ "enabled": false, @@ -283,7 +285,9 @@ class STPElementsSessionTest: XCTestCase { customerSessionData: [ "mobile_payment_element": [ "enabled": true, - "features": ["payment_method_set_as_default": "disabled"] + "features": ["payment_method_save": "enabled", + "payment_method_remove": "enabled", + "payment_method_set_as_default": "disabled"] ], "customer_sheet": [ "enabled": false, @@ -381,11 +385,12 @@ class STPElementsSessionTest: XCTestCase { ], "customer_sheet": [ "enabled": true, - "features": ["payment_method_set_as_default": "enabled"], + "features": ["payment_method_remove": "enabled", + "payment_method_sync_default": "enabled"], ], ]) - let allowsSetAsDefault = elementsSession.paymentMethodSetAsDefaultForCustomerSheet + let allowsSetAsDefault = elementsSession.paymentMethodSyncDefaultForCustomerSheet XCTAssertTrue(allowsSetAsDefault) } func testSetAsDefaultForCustomerSheet_disabled() { @@ -396,11 +401,11 @@ class STPElementsSessionTest: XCTestCase { ], "customer_sheet": [ "enabled": true, - "features": ["payment_method_set_as_default": "disabled"], + "features": ["payment_method_sync_default": "disabled"], ], ]) - let allowsSetAsDefault = elementsSession.paymentMethodSetAsDefaultForCustomerSheet + let allowsSetAsDefault = elementsSession.paymentMethodSyncDefaultForCustomerSheet XCTAssertFalse(allowsSetAsDefault) } private let testCardJSON = [ diff --git a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/Stubbed/StubbedBackend.swift b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/Stubbed/StubbedBackend.swift index f8216993788..f573414f8b4 100644 --- a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/Stubbed/StubbedBackend.swift +++ b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/Stubbed/StubbedBackend.swift @@ -73,6 +73,8 @@ public class ClassForBundle {} case elementsSessionsPaymentMethod_200 = "MockFiles/elements_sessions_paymentMethod_200" case elementsSessions_customerSessionsCustomerSheet_200 = "MockFiles/elements_sessions_customerSessionCustomerSheet_200" case elementsSessions_customerSessionsCustomerSheetWithSavedPM_200 = "MockFiles/elements_sessions_customerSessionCustomerSheetWithSavedPM_200" + case elementsSessions_customerSessionsCustomerSheet_DefaultEnabled_200 = "MockFiles/elements_sessions_customerSessionCustomerSheet_DefaultEnabled_200" + case elementsSessions_customerSessionsCustomerSheetWithSavedPM_DefaultEnabled_200 = "MockFiles/elements_sessions_customerSessionCustomerSheetWithSavedPM_DefaultEnabled_200" case elementsSessionsPaymentMethod_savedPM_200 = "MockFiles/elements_sessions_paymentMethod_savedPM_200" case elementsSessionsPaymentMethod_link_200 = "MockFiles/elements_sessions_paymentMethod_link_200" diff --git a/StripePaymentSheet/StripePaymentSheetTests/Resources/MockFiles/elements_sessions_customerSessionCustomerSheetWithSavedPM_200.json b/StripePaymentSheet/StripePaymentSheetTests/Resources/MockFiles/elements_sessions_customerSessionCustomerSheetWithSavedPM_200.json index 8384590f710..dcca6f1ef45 100644 --- a/StripePaymentSheet/StripePaymentSheetTests/Resources/MockFiles/elements_sessions_customerSessionCustomerSheetWithSavedPM_200.json +++ b/StripePaymentSheet/StripePaymentSheetTests/Resources/MockFiles/elements_sessions_customerSessionCustomerSheetWithSavedPM_200.json @@ -23,8 +23,7 @@ "customer_sheet": { "enabled": true, "features": { - "payment_method_remove": "enabled", - "payment_method_set_as_default": "enabled" + "payment_method_remove": "enabled" } }, "pricing_table": { diff --git a/StripePaymentSheet/StripePaymentSheetTests/Resources/MockFiles/elements_sessions_customerSessionCustomerSheetWithSavedPM_DefaultEnabled_200.json b/StripePaymentSheet/StripePaymentSheetTests/Resources/MockFiles/elements_sessions_customerSessionCustomerSheetWithSavedPM_DefaultEnabled_200.json new file mode 100644 index 00000000000..4367b3c06ef --- /dev/null +++ b/StripePaymentSheet/StripePaymentSheetTests/Resources/MockFiles/elements_sessions_customerSessionCustomerSheetWithSavedPM_DefaultEnabled_200.json @@ -0,0 +1,167 @@ +{ + "apple_pay_preference": "enabled", + "business_name": "Mobile Example Account", + "customer": { + "customer_session": { + "id": "cuss_1PK3MvL654321654", + "object": "customer_session", + "api_key": "ek_test_YWNjdF8xSHZUSTdMdT", + "api_key_expiry": 1716580929, + "components": { + "buy_button": { + "enabled": false + }, + "payment_element": { + "enabled": false + }, + "payment_sheet": { + "enabled": false + }, + "mobile_payment_element": { + "enabled": false + }, + "customer_sheet": { + "enabled": true, + "features": { + "payment_method_remove": "enabled", + "payment_method_sync_default": "enabled" + } + }, + "pricing_table": { + "enabled": false + } + }, + "customer": "cus_123456", + "livemode": false + }, + "default_payment_method": null, + "payment_methods": [ + { + "id": "pm_1PK61111111", + "object": "payment_method", + "allow_redisplay": "unspecified", + "billing_details": { + "address": { + "city": null, + "country": "US", + "line1": null, + "line2": null, + "postal_code": "24242", + "state": null + }, + "email": null, + "name": null, + "phone": null + }, + "card": { + "brand": "visa", + "checks": { + "address_line1_check": null, + "address_postal_code_check": null, + "cvc_check": null + }, + "country": "US", + "display_brand": "visa", + "exp_month": 4, + "exp_year": 2025, + "funding": "credit", + "generated_from": null, + "last4": "4242", + "networks": { + "available": [ + "visa" + ], + "preferred": null + }, + "three_d_secure_usage": { + "supported": true + }, + "wallet": null + }, + "created": 1716588986, + "customer": "cus_QAO9BBR6lFUSRq", + "livemode": false, + "type": "card" + } + ], + "payment_methods_with_link_details": [] + }, + "experiments": { + "miui_payment_element_aa_experiment": "control" + }, + "flags": { + "elements_include_payment_intent_id_in_analytics_events": true, + "elements_enable_mx_card_installments": false, + "elements_enable_br_card_installments": false + }, + "google_pay_preference": "disabled", + "link_consumer_info": null, + "link_settings": { + "instant_debits_inline_institution": true, + "link_bank_onboarding_enabled": false, + "link_financial_incentives_experiment_enabled": false, + "link_local_storage_login_enabled": true + }, + "merchant_country": "US", + "merchant_currency": "usd", + "merchant_id": "acct_1", + "order": null, + "ordered_payment_method_types_and_wallets": [ + "card" + ], + "payment_method_preference": { + "object": "payment_method_preference", + "country_code": "US", + "ordered_payment_method_types": [ + "card" + ], + "payment_intent": { + "id": "pi_3Kth", + "object": "payment_intent", + "amount": 5099, + "automatic_payment_methods": null, + "canceled_at": null, + "cancellation_reason": null, + "capture_method": "automatic", + "client_secret": "pi_3Kth_secret_EAG4KQ6JmW", + "confirmation_method": "automatic", + "created": 1651191113, + "currency": "usd", + "description": null, + "last_payment_error": null, + "livemode": false, + "next_action": null, + "payment_method": null, + "payment_method_types": [ + "card" + ], + "processing": null, + "receipt_email": null, + "setup_future_usage": null, + "shipping": { + "address": { + "city": "San Francisco", + "country": "US", + "line1": "510 Townsend St", + "line2": null, + "postal_code": "94102", + "state": "California" + }, + "carrier": null, + "name": "John Doe", + "phone": null, + "tracking_number": null + }, + "source": null, + "status": "requires_payment_method" + }, + "type": "payment_intent" + }, + "session_id": "123", + "shipping_address_settings": { + "autocomplete_allowed": false + }, + "unactivated_payment_method_types": [ + + ] +} diff --git a/StripePaymentSheet/StripePaymentSheetTests/Resources/MockFiles/elements_sessions_customerSessionCustomerSheet_200.json b/StripePaymentSheet/StripePaymentSheetTests/Resources/MockFiles/elements_sessions_customerSessionCustomerSheet_200.json index 7686577f8e2..0dfd8f96f21 100644 --- a/StripePaymentSheet/StripePaymentSheetTests/Resources/MockFiles/elements_sessions_customerSessionCustomerSheet_200.json +++ b/StripePaymentSheet/StripePaymentSheetTests/Resources/MockFiles/elements_sessions_customerSessionCustomerSheet_200.json @@ -23,8 +23,7 @@ "customer_sheet": { "enabled": true, "features": { - "payment_method_remove": "enabled", - "payment_method_set_as_default": "enabled" + "payment_method_remove": "enabled" } }, "pricing_table": { diff --git a/StripePaymentSheet/StripePaymentSheetTests/Resources/MockFiles/elements_sessions_customerSessionCustomerSheet_DefaultEnabled_200.json b/StripePaymentSheet/StripePaymentSheetTests/Resources/MockFiles/elements_sessions_customerSessionCustomerSheet_DefaultEnabled_200.json new file mode 100644 index 00000000000..2c14159aad0 --- /dev/null +++ b/StripePaymentSheet/StripePaymentSheetTests/Resources/MockFiles/elements_sessions_customerSessionCustomerSheet_DefaultEnabled_200.json @@ -0,0 +1,119 @@ +{ + "apple_pay_preference": "enabled", + "business_name": "Mobile Example Account", + "customer": { + "customer_session": { + "id": "cuss_1PK3MvL654321654", + "object": "customer_session", + "api_key": "ek_test_YWNjdF8xSHZUSTdMdT", + "api_key_expiry": 1716580929, + "components": { + "buy_button": { + "enabled": false + }, + "payment_element": { + "enabled": false + }, + "payment_sheet": { + "enabled": false + }, + "mobile_payment_element": { + "enabled": false + }, + "customer_sheet": { + "enabled": true, + "features": { + "payment_method_remove": "enabled", + "payment_method_sync_default": "enabled" + } + }, + "pricing_table": { + "enabled": false + } + }, + "customer": "cus_123456", + "livemode": false + }, + "default_payment_method": null, + "payment_methods": [], + "payment_methods_with_link_details": [] + }, + "experiments": { + "miui_payment_element_aa_experiment": "control" + }, + "flags": { + "elements_include_payment_intent_id_in_analytics_events": true, + "elements_enable_mx_card_installments": false, + "elements_enable_br_card_installments": false + }, + "google_pay_preference": "disabled", + "link_consumer_info": null, + "link_settings": { + "instant_debits_inline_institution": true, + "link_bank_onboarding_enabled": false, + "link_financial_incentives_experiment_enabled": false, + "link_local_storage_login_enabled": true + }, + "merchant_country": "US", + "merchant_currency": "usd", + "merchant_id": "acct_1", + "order": null, + "ordered_payment_method_types_and_wallets": [ + "card" + ], + "payment_method_preference": { + "object": "payment_method_preference", + "country_code": "US", + "ordered_payment_method_types": [ + "card" + ], + "payment_intent": { + "id": "pi_3Kth", + "object": "payment_intent", + "amount": 5099, + "automatic_payment_methods": null, + "canceled_at": null, + "cancellation_reason": null, + "capture_method": "automatic", + "client_secret": "pi_3Kth_secret_EAG4KQ6JmW", + "confirmation_method": "automatic", + "created": 1651191113, + "currency": "usd", + "description": null, + "last_payment_error": null, + "livemode": false, + "next_action": null, + "payment_method": null, + "payment_method_types": [ + "card" + ], + "processing": null, + "receipt_email": null, + "setup_future_usage": null, + "shipping": { + "address": { + "city": "San Francisco", + "country": "US", + "line1": "510 Townsend St", + "line2": null, + "postal_code": "94102", + "state": "California" + }, + "carrier": null, + "name": "John Doe", + "phone": null, + "tracking_number": null + }, + "source": null, + "status": "requires_payment_method" + }, + "type": "payment_intent" + }, + "session_id": "123", + "shipping_address_settings": { + "autocomplete_allowed": false + }, + "unactivated_payment_method_types": [ + + ] +} diff --git a/StripePayments/StripePaymentsTestUtils/STPTestingAPIClient+Swift.swift b/StripePayments/StripePaymentsTestUtils/STPTestingAPIClient+Swift.swift index d40131893bb..2a418d271aa 100644 --- a/StripePayments/StripePaymentsTestUtils/STPTestingAPIClient+Swift.swift +++ b/StripePayments/StripePaymentsTestUtils/STPTestingAPIClient+Swift.swift @@ -6,10 +6,12 @@ // import Foundation +@testable import StripePaymentSheet @_exported import StripePaymentsObjcTestUtils extension STPTestingAPIClient { static let STPTestingBackendURL = "https://stp-mobile-ci-test-backend-e1b3.stripedemos.com/" + public static var shared: STPTestingAPIClient { return .shared() } @@ -142,12 +144,18 @@ extension STPTestingAPIClient { func fetchCustomerAndCustomerSessionClientSecret( customerID: String? = nil, - merchantCountry: String? = "us" + merchantCountry: String? = "us", + features: MobilePaymentElementComponentFeature = .init(paymentMethodSave: true, paymentMethodRemove: true, paymentMethodRemoveLast: false, paymentMethodSaveAllowRedisplayOverride: nil, paymentMethodSetAsDefault: false) ) async throws -> CreateCustomerSessionResponse { - let params = [ + let params: [String: Any?] = [ "component_name": "mobile_payment_element", "customer_id": customerID, "account": merchantCountry, + "features": [ + "payment_method_save": features.paymentMethodSave ? "enabled" : "disabled", + "payment_method_remove": features.paymentMethodRemove ? "enabled" : "disabled", + "payment_method_set_as_default": features.paymentMethodSetAsDefault ? "enabled" : "disabled" + ] ] return try await makeRequest(endpoint: "create_customer_session_cs", params: params) } @@ -156,7 +164,7 @@ extension STPTestingAPIClient { fileprivate func makeRequest( endpoint: String, - params: [String: String?] + params: [String: Any?] ) async throws -> ResponseType { let session = URLSession(configuration: sessionConfig) let url = URL(string: STPTestingAPIClient.STPTestingBackendURL + endpoint)! From 68ae80e0d3db46ecb0b92d8ff34a2119454a2446 Mon Sep 17 00:00:00 2001 From: Joyce Qin Date: Tue, 4 Feb 2025 14:25:18 -0800 Subject: [PATCH 09/14] remove @testable import from STPTestingAPIClient --- .../PaymentSheet/PaymentSheet+APITest.swift | 9 +++++---- .../STPTestingAPIClient+Swift.swift | 12 ++++++------ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/PaymentSheet+APITest.swift b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/PaymentSheet+APITest.swift index 9e66e4cbb36..4b7ef56bf0e 100644 --- a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/PaymentSheet+APITest.swift +++ b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/PaymentSheet+APITest.swift @@ -366,7 +366,7 @@ class PaymentSheetAPITest: STPNetworkStubbingTestCase { let expectation = XCTestExpectation(description: "Check default payment method set") // Create a new customer and new key let customerAndEphemeralKey = try await STPTestingAPIClient.shared().fetchCustomerAndEphemeralKey(customerID: nil, merchantCountry: nil) - let cscs = try await STPTestingAPIClient.shared().fetchCustomerAndCustomerSessionClientSecret(customerID: customerAndEphemeralKey.customer, merchantCountry: nil, features: .init(paymentMethodSave: true, paymentMethodRemove: true, paymentMethodRemoveLast: true, paymentMethodSaveAllowRedisplayOverride: .always, paymentMethodSetAsDefault: true)) + let cscs = try await STPTestingAPIClient.shared().fetchCustomerAndCustomerSessionClientSecret(customerID: customerAndEphemeralKey.customer, merchantCountry: nil, paymentMethodSave: true, paymentMethodRemove: true, paymentMethodSetAsDefault: true) var configuration = self.configuration configuration.customer = PaymentSheet.CustomerConfiguration(id: cscs.customer, customerSessionClientSecret: cscs.customerSessionClientSecret) // 0. Create a PI on our test backend @@ -447,7 +447,7 @@ class PaymentSheetAPITest: STPNetworkStubbingTestCase { let expectation = XCTestExpectation(description: "Check default payment method set") // Create a new customer and new key let customerAndEphemeralKey = try await STPTestingAPIClient.shared().fetchCustomerAndEphemeralKey(customerID: nil, merchantCountry: nil) - let cscs = try await STPTestingAPIClient.shared().fetchCustomerAndCustomerSessionClientSecret(customerID: customerAndEphemeralKey.customer, merchantCountry: nil, features: .init(paymentMethodSave: true, paymentMethodRemove: true, paymentMethodRemoveLast: true, paymentMethodSaveAllowRedisplayOverride: .always, paymentMethodSetAsDefault: true)) + let cscs = try await STPTestingAPIClient.shared().fetchCustomerAndCustomerSessionClientSecret(customerID: customerAndEphemeralKey.customer, merchantCountry: nil, paymentMethodSave: true, paymentMethodRemove: true, paymentMethodSetAsDefault: true) var configuration = self.configuration configuration.customer = PaymentSheet.CustomerConfiguration(id: cscs.customer, customerSessionClientSecret: cscs.customerSessionClientSecret) // 0. Create a SI on our test backend @@ -518,7 +518,7 @@ class PaymentSheetAPITest: STPNetworkStubbingTestCase { let expectation = XCTestExpectation(description: "Check default payment method set") // Create a new customer and new key let customerAndEphemeralKey = try await STPTestingAPIClient.shared().fetchCustomerAndEphemeralKey(customerID: nil, merchantCountry: nil) - let cscs = try await STPTestingAPIClient.shared().fetchCustomerAndCustomerSessionClientSecret(customerID: customerAndEphemeralKey.customer, merchantCountry: nil, features: .init(paymentMethodSave: true, paymentMethodRemove: true, paymentMethodRemoveLast: true, paymentMethodSaveAllowRedisplayOverride: .always, paymentMethodSetAsDefault: true)) + let cscs = try await STPTestingAPIClient.shared().fetchCustomerAndCustomerSessionClientSecret(customerID: customerAndEphemeralKey.customer, merchantCountry: nil, paymentMethodSave: true, paymentMethodRemove: true, paymentMethodSetAsDefault: true) var configuration = self.configuration configuration.customer = PaymentSheet.CustomerConfiguration(id: cscs.customer, customerSessionClientSecret: cscs.customerSessionClientSecret) let types = ["card"] @@ -586,7 +586,8 @@ class PaymentSheetAPITest: STPNetworkStubbingTestCase { let callbackExpectation = XCTestExpectation(description: "Confirm callback invoked") let expectation = XCTestExpectation(description: "Check default payment method set") // Create a new customer and new key - let cscs = try await STPTestingAPIClient.shared().fetchCustomerAndCustomerSessionClientSecret() + let customerAndEphemeralKey = try await STPTestingAPIClient.shared().fetchCustomerAndEphemeralKey(customerID: nil, merchantCountry: nil) + let cscs = try await STPTestingAPIClient.shared().fetchCustomerAndCustomerSessionClientSecret(customerID: customerAndEphemeralKey.customer, merchantCountry: nil, paymentMethodSave: true, paymentMethodRemove: true, paymentMethodSetAsDefault: true) var configuration = self.configuration configuration.customer = PaymentSheet.CustomerConfiguration(id: cscs.customer, customerSessionClientSecret: cscs.customerSessionClientSecret) let types = ["card"] diff --git a/StripePayments/StripePaymentsTestUtils/STPTestingAPIClient+Swift.swift b/StripePayments/StripePaymentsTestUtils/STPTestingAPIClient+Swift.swift index 2a418d271aa..a08b565b2aa 100644 --- a/StripePayments/StripePaymentsTestUtils/STPTestingAPIClient+Swift.swift +++ b/StripePayments/StripePaymentsTestUtils/STPTestingAPIClient+Swift.swift @@ -6,12 +6,10 @@ // import Foundation -@testable import StripePaymentSheet @_exported import StripePaymentsObjcTestUtils extension STPTestingAPIClient { static let STPTestingBackendURL = "https://stp-mobile-ci-test-backend-e1b3.stripedemos.com/" - public static var shared: STPTestingAPIClient { return .shared() } @@ -145,16 +143,18 @@ extension STPTestingAPIClient { func fetchCustomerAndCustomerSessionClientSecret( customerID: String? = nil, merchantCountry: String? = "us", - features: MobilePaymentElementComponentFeature = .init(paymentMethodSave: true, paymentMethodRemove: true, paymentMethodRemoveLast: false, paymentMethodSaveAllowRedisplayOverride: nil, paymentMethodSetAsDefault: false) + paymentMethodSave: Bool = true, + paymentMethodRemove: Bool = true, + paymentMethodSetAsDefault: Bool = false ) async throws -> CreateCustomerSessionResponse { let params: [String: Any?] = [ "component_name": "mobile_payment_element", "customer_id": customerID, "account": merchantCountry, "features": [ - "payment_method_save": features.paymentMethodSave ? "enabled" : "disabled", - "payment_method_remove": features.paymentMethodRemove ? "enabled" : "disabled", - "payment_method_set_as_default": features.paymentMethodSetAsDefault ? "enabled" : "disabled" + "payment_method_save": paymentMethodSave ? "enabled" : "disabled", + "payment_method_remove": paymentMethodRemove ? "enabled" : "disabled", + "payment_method_set_as_default": paymentMethodSetAsDefault ? "enabled" : "disabled" ] ] return try await makeRequest(endpoint: "create_customer_session_cs", params: params) From 9c268e71863f1964bcb4c21075e59c9ed19c924c Mon Sep 17 00:00:00 2001 From: Joyce Qin Date: Tue, 4 Feb 2025 16:12:51 -0800 Subject: [PATCH 10/14] read from elementsSession in makeViewModels instead of passing it in --- .../Source/PaymentSheet/PaymentSheetLoader.swift | 3 +-- .../SavedPaymentOptionsViewController.swift | 14 +++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetLoader.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetLoader.swift index b4f161b962d..e42b54a918f 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetLoader.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetLoader.swift @@ -117,8 +117,7 @@ final class PaymentSheetLoader { customerID: configuration.customer?.id, showApplePay: integrationShape.canDefaultToLinkOrApplePay ? isApplePayEnabled : false, showLink: integrationShape.canDefaultToLinkOrApplePay ? isLinkEnabled : false, - paymentMethodSetAsDefault: elementsSession.paymentMethodSetAsDefaultForPaymentSheet, - customer: elementsSession.customer + elementsSession: elementsSession ) let paymentMethodTypes = PaymentSheet.PaymentMethodType.filteredPaymentMethodTypes(from: intent, elementsSession: elementsSession, configuration: configuration, logAvailability: true) diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Saved Payment Method Screen/SavedPaymentOptionsViewController.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Saved Payment Method Screen/SavedPaymentOptionsViewController.swift index c47a49ee1fe..97ce923e645 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Saved Payment Method Screen/SavedPaymentOptionsViewController.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Saved Payment Method Screen/SavedPaymentOptionsViewController.swift @@ -377,8 +377,7 @@ class SavedPaymentOptionsViewController: UIViewController { customerID: configuration.customerID, showApplePay: configuration.showApplePay, showLink: configuration.showLink, - paymentMethodSetAsDefault: configuration.allowsSetAsDefaultPM, - customer: elementsSession.customer + elementsSession: elementsSession ) collectionView.reloadData() @@ -457,15 +456,16 @@ class SavedPaymentOptionsViewController: UIViewController { /// Creates the list of viewmodels to display in the "saved payment methods" carousel e.g. `["+ Add", "Apple Pay", "Link", "Visa 4242"]` /// - Returns defaultSelectedIndex: The index of the view model that is the default e.g. in the above list, if "Visa 4242" is the default, the index is 3. - static func makeViewModels(savedPaymentMethods: [STPPaymentMethod], customerID: String?, showApplePay: Bool, showLink: Bool, paymentMethodSetAsDefault: Bool, customer: ElementsCustomer?) -> (defaultSelectedIndex: Int, viewModels: [Selection]) { + static func makeViewModels(savedPaymentMethods: [STPPaymentMethod], customerID: String?, showApplePay: Bool, showLink: Bool, elementsSession: STPElementsSession?) -> (defaultSelectedIndex: Int, viewModels: [Selection]) { // Get the default var defaultPaymentMethodOption: CustomerPaymentOption? // if opted in to the "set as default" feature, try to get default payment method from elements session - if paymentMethodSetAsDefault { - if let customer = customer, - let defaultPaymentMethod = customer.getDefaultOrFirstPaymentMethod() { + if let elementsSession = elementsSession, + let customer = elementsSession.customer, + let features = customer.customerSession.mobilePaymentElementComponent.features, + features.paymentMethodSetAsDefault, + let defaultPaymentMethod = customer.getDefaultOrFirstPaymentMethod() { defaultPaymentMethodOption = CustomerPaymentOption.stripeId(defaultPaymentMethod.stripeId) - } } else { defaultPaymentMethodOption = CustomerPaymentOption.defaultPaymentMethod(for: customerID) From 3aef64e45a47e70182180b335d0e7622e708b970 Mon Sep 17 00:00:00 2001 From: Joyce Qin Date: Wed, 5 Feb 2025 14:15:47 -0800 Subject: [PATCH 11/14] mock network for tests with updated ci test backend --- .../0000_post_create_ephemeral_key.tail | 8 +-- .../0001_post_create_customer_session_cs.tail | 8 +-- .../0002_get_v1_elements_sessions.tail | 38 ++++++------ .../0003_post_v1_payment_methods.tail | 15 +++-- .../0004_post_create_payment_intent.tail | 8 +-- ..._intents_pi_3QpGr3FY0qyl6XeW0cvmFFgp.tail} | 15 +++-- ..._pi_3QpGr3FY0qyl6XeW0cvmFFgp_confirm.tail} | 27 ++++---- .../0007_get_v1_elements_sessions.tail | 52 ++++++++-------- .../0000_post_create_customer_session_cs.tail | 18 ------ .../0000_post_create_ephemeral_key.tail | 18 ++++++ .../0001_post_create_customer_session_cs.tail | 18 ++++++ ...ail => 0002_get_v1_elements_sessions.tail} | 36 +++++------ .../0003_post_create_setup_intent.tail | 18 ------ ...tail => 0003_post_v1_payment_methods.tail} | 15 +++-- .../0004_post_create_setup_intent.tail | 18 ++++++ ...ntents_seti_1QpGrRFY0qyl6XeWYojpxx9P.tail} | 15 +++-- ...eti_1QpGrRFY0qyl6XeWYojpxx9P_confirm.tail} | 27 ++++---- ...ail => 0007_get_v1_elements_sessions.tail} | 50 +++++++-------- .../0000_post_create_ephemeral_key.tail | 8 +-- .../0001_post_create_customer_session_cs.tail | 8 +-- .../0002_post_create_payment_intent.tail | 8 +-- .../0003_get_v1_elements_sessions.tail | 47 +++++++------- ..._pi_3QpGpjFY0qyl6XeW0qNtmYXp_confirm.tail} | 27 ++++---- ..._intents_pi_3QpGpjFY0qyl6XeW0qNtmYXp.tail} | 17 +++--- .../0006_post_create_payment_intent.tail | 8 +-- .../0007_get_v1_elements_sessions.tail | 61 ++++++++++--------- .../0000_post_create_ephemeral_key.tail | 8 +-- .../0001_post_create_customer_session_cs.tail | 8 +-- .../0002_post_create_setup_intent.tail | 8 +-- .../0003_get_v1_elements_sessions.tail | 44 ++++++------- ...eti_1QpGqGFY0qyl6XeWy8yvLefV_confirm.tail} | 27 ++++---- ...ntents_seti_1QpGqGFY0qyl6XeWy8yvLefV.tail} | 17 +++--- .../0006_post_create_setup_intent.tail | 8 +-- .../0007_get_v1_elements_sessions.tail | 58 +++++++++--------- 34 files changed, 394 insertions(+), 372 deletions(-) rename StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredPaymentIntentSetAsDefault/{0005_get_v1_payment_intents_pi_3QmOHHFY0qyl6XeW18F0I80J.tail => 0005_get_v1_payment_intents_pi_3QpGr3FY0qyl6XeW0cvmFFgp.tail} (77%) rename StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredPaymentIntentSetAsDefault/{0006_post_v1_payment_intents_pi_3QmOHHFY0qyl6XeW18F0I80J_confirm.tail => 0006_post_v1_payment_intents_pi_3QpGr3FY0qyl6XeW0cvmFFgp_confirm.tail} (80%) delete mode 100644 StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0000_post_create_customer_session_cs.tail create mode 100644 StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0000_post_create_ephemeral_key.tail create mode 100644 StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0001_post_create_customer_session_cs.tail rename StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/{0001_get_v1_elements_sessions.tail => 0002_get_v1_elements_sessions.tail} (94%) delete mode 100644 StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0003_post_create_setup_intent.tail rename StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/{0002_post_v1_payment_methods.tail => 0003_post_v1_payment_methods.tail} (85%) create mode 100644 StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0004_post_create_setup_intent.tail rename StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/{0004_get_v1_setup_intents_seti_1QnNXoFY0qyl6XeW0DXCjJaZ.tail => 0005_get_v1_setup_intents_seti_1QpGrRFY0qyl6XeWYojpxx9P.tail} (71%) rename StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/{0005_post_v1_setup_intents_seti_1QnNXoFY0qyl6XeW0DXCjJaZ_confirm.tail => 0006_post_v1_setup_intents_seti_1QpGrRFY0qyl6XeWYojpxx9P_confirm.tail} (74%) rename StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/{0006_get_v1_elements_sessions.tail => 0007_get_v1_elements_sessions.tail} (93%) rename StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithPaymentIntentSetAsDefault/{0004_post_v1_payment_intents_pi_3QmKgzFY0qyl6XeW1AAWRXRU_confirm.tail => 0004_post_v1_payment_intents_pi_3QpGpjFY0qyl6XeW0qNtmYXp_confirm.tail} (82%) rename StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithPaymentIntentSetAsDefault/{0005_get_v1_payment_intents_pi_3QmKgzFY0qyl6XeW1AAWRXRU.tail => 0005_get_v1_payment_intents_pi_3QpGpjFY0qyl6XeW0qNtmYXp.tail} (78%) rename StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault/{0004_post_v1_setup_intents_seti_1QmPRrFY0qyl6XeW2rhGoo6G_confirm.tail => 0004_post_v1_setup_intents_seti_1QpGqGFY0qyl6XeWy8yvLefV_confirm.tail} (77%) rename StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault/{0005_get_v1_setup_intents_seti_1QmPRrFY0qyl6XeW2rhGoo6G.tail => 0005_get_v1_setup_intents_seti_1QpGqGFY0qyl6XeWy8yvLefV.tail} (70%) diff --git a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredPaymentIntentSetAsDefault/0000_post_create_ephemeral_key.tail b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredPaymentIntentSetAsDefault/0000_post_create_ephemeral_key.tail index fd824967193..4dba8135e58 100644 --- a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredPaymentIntentSetAsDefault/0000_post_create_ephemeral_key.tail +++ b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredPaymentIntentSetAsDefault/0000_post_create_ephemeral_key.tail @@ -4,15 +4,15 @@ https:\/\/stp-mobile-ci-test-backend-e1b3\.stripedemos\.com\/create_ephemeral_ke text/html Content-Type: text/html;charset=utf-8 Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 -Set-Cookie: rack.session=dsZ5IhboQll3Ey5eBOxP4M72uJVEBRzG0JEk6rO%2FZ0D6xVcBDm5Df41CmiHO65Z%2BxfHqcIa0Ko%2FZrCnn1B8i%2BR%2FzOxC9zlk%2FKBBmgJh8m2ecKhdP%2FVuCC2PLXCfnMTyzABsMwQIBlDYfGUGyucS00CaImB1%2BW1Q4Bl%2FPz1YgZbRWeMGc0OYzakRfTgBpkzqD4Yv8%2BGUGuuuXS7j1AEHlz0GFV8AAToY%2Fvy79I7cJ6lw%3D; path=/ +Set-Cookie: rack.session=ajpcrXEV07%2FccAHhJwPc7ucRdk9tAJ4B%2F4YGhbtgPQKJGBxXhasBFC%2FMKfvOpKqacqVEvqK8cnLXM2Ch%2Bmh5lfmVkeLgBcfNryNa99QAQGxo36KbmHrAtyaOqmze3Bb%2BJK%2BnmmZL5UR551PjMxCw4nbcd55ULUGrbK3gC%2FP3oezGWj4YBYVZhAm9RjC2vkMH%2F4XU8EtToD3DsQgJM4dThF6ujyyyKxz8fs%2FKi5ieD0U%3D; path=/ Server: Google Frontend -x-cloud-trace-context: 7083efa535a052bcfccbadc061a9690f +x-cloud-trace-context: b34a3238355b6be5037b476dbd80f1a2;o=1 Via: 1.1 google x-xss-protection: 1; mode=block -Date: Tue, 28 Jan 2025 23:33:05 GMT +Date: Wed, 05 Feb 2025 22:13:56 GMT x-robots-tag: noindex, nofollow Content-Length: 149 x-content-type-options: nosniff x-frame-options: SAMEORIGIN -{"ephemeral_key_secret":"ek_test_YWNjdF8xRzZtMXBGWTBxeWw2WGVXLFVWeEg0ZGl6eEp2SllwSVh4T2tvVHloZ21MN2ZQVGs_00MbJbSnAW","customer":"cus_Rfjkh79eDM6ppC"} \ No newline at end of file +{"ephemeral_key_secret":"ek_test_YWNjdF8xRzZtMXBGWTBxeWw2WGVXLEVNYWc1T3k1TkcyZHZ3WFdRYUl1em5aeE9qMXR6dDE_00LgdsxBGW","customer":"cus_RiiHwZyWbhU6pL"} \ No newline at end of file diff --git a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredPaymentIntentSetAsDefault/0001_post_create_customer_session_cs.tail b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredPaymentIntentSetAsDefault/0001_post_create_customer_session_cs.tail index 223faf9f76a..70424d4f8b6 100644 --- a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredPaymentIntentSetAsDefault/0001_post_create_customer_session_cs.tail +++ b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredPaymentIntentSetAsDefault/0001_post_create_customer_session_cs.tail @@ -4,15 +4,15 @@ https:\/\/stp-mobile-ci-test-backend-e1b3\.stripedemos\.com\/create_customer_ses text/html Content-Type: text/html;charset=utf-8 Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 -Set-Cookie: rack.session=W3hKgl%2FLk54tHYxCC3iRP8YyZP2KZW6W67Yc2x8eYp7dwTdZ2g0p75XzKO75Ck6LXrQu4JJxRjfamBxZ3Thzi9BwMx%2FARrdeDHXnrs1qrXk1ElNdCljFFBRiBSddZTd%2BHL6aTA00UCGdtGlSuJYm74ddk8wbURODr3gZBN4dfjz%2FERvY5pGVH0n2hUqdAvNrDY8ZL87lC1PU4SDOcyElLDrsKRZe0Y9rzYgb3YHnIAg%3D; path=/ +Set-Cookie: rack.session=Ojlg7MUiPEjxmtRpC8GXOePcSkgtzLs5HtVOq0FfwaWgjRGmfQLRqnEQqERg%2BzO3PQYMbLtJJ378u5LytrJ%2FlLaue%2FfbYArGTQ0T%2BImITVvLZA8OhlUU7QzCj9jN81%2BJNTBLTdRPKmhaRhFe8YMxvPrkP8bzw%2BEBQC4QlNsq8M%2BpBTQF2almePVxxjjDQvq%2F6qx%2Fi67tLvgKwOLAVeD2HreRLISyV2XPe7IX%2BYfe%2F2A%3D; path=/ Server: Google Frontend -x-cloud-trace-context: e20c8fce438fa9d9dc003cdea4f772aa +x-cloud-trace-context: 9d75a17eafeb5192de4dc183e67f0d9a Via: 1.1 google x-xss-protection: 1; mode=block -Date: Tue, 28 Jan 2025 23:33:06 GMT +Date: Wed, 05 Feb 2025 22:13:56 GMT x-robots-tag: noindex, nofollow Content-Length: 128 x-content-type-options: nosniff x-frame-options: SAMEORIGIN -{"customer_session_client_secret":"cuss_secret_RfjkOWUZFmwaQRgmctzAwqBA4nYaC1m2Tf5DWpEBEph71UP","customer":"cus_Rfjkh79eDM6ppC"} \ No newline at end of file +{"customer_session_client_secret":"cuss_secret_RiiHqgxxAECjfemcN0SUYsa0Yvzv9XIlTmRHcePZp368i0w","customer":"cus_RiiHwZyWbhU6pL"} \ No newline at end of file diff --git a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredPaymentIntentSetAsDefault/0002_get_v1_elements_sessions.tail b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredPaymentIntentSetAsDefault/0002_get_v1_elements_sessions.tail index 8ec54731ca3..8469a500dc3 100644 --- a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredPaymentIntentSetAsDefault/0002_get_v1_elements_sessions.tail +++ b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredPaymentIntentSetAsDefault/0002_get_v1_elements_sessions.tail @@ -1,9 +1,9 @@ GET -https:\/\/api\.stripe\.com\/v1\/elements\/sessions\?customer_session_client_secret=cuss_secret_RfjkOWUZFmwaQRgmctzAwqBA4nYaC1m2Tf5DWpEBEph71UP&deferred_intent%5Bamount%5D=100&deferred_intent%5Bcapture_method%5D=automatic&deferred_intent%5Bcurrency%5D=USD&deferred_intent%5Bmode%5D=payment&deferred_intent%5Bpayment_method_types%5D%5B0%5D=card&key=pk_test_ErsyMEOTudSjQR8hh0VrQr5X008sBXGOu6&locale=en-US&mobile_app_id=com\.stripe\.StripeiOSTestHostApp&type=deferred_intent$ +https:\/\/api\.stripe\.com\/v1\/elements\/sessions\?customer_session_client_secret=cuss_secret_RiiHqgxxAECjfemcN0SUYsa0Yvzv9XIlTmRHcePZp368i0w&deferred_intent%5Bamount%5D=100&deferred_intent%5Bcapture_method%5D=automatic&deferred_intent%5Bcurrency%5D=USD&deferred_intent%5Bmode%5D=payment&deferred_intent%5Bpayment_method_types%5D%5B0%5D=card&key=pk_test_ErsyMEOTudSjQR8hh0VrQr5X008sBXGOu6&locale=en-US&mobile_app_id=com\.stripe\.StripeiOSTestHostApp&type=deferred_intent$ 200 application/json access-control-allow-methods: GET, HEAD, PUT, PATCH, POST, DELETE -content-security-policy: base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=DXTHRs1V37GUQGKqEJlaOeufQsY1bGogVKbGnKFyntjshmLznXhyBFA5yJ7KTkfcz5TDnrsOmu32-pWw +content-security-policy: base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=qKU8BstCJI9xztfOZ9GqzmtJmP371lIDZpNTFoaPJWirDHM6eA2fXarvgGLcAOnLTGNbCNBPMkPxH2zC Server: nginx Cache-Control: no-cache, no-store reporting-endpoints: coop="https://q.stripe.com/coop-report" @@ -14,16 +14,15 @@ Access-Control-Allow-Origin: * x-stripe-routing-context-priority-tier: api-testmode x-stripe-priority-routing-enabled: true report-to: {"group":"coop","max_age":8640,"endpoints":[{"url":"https://q.stripe.com/coop-report"}],"include_subdomains":true} -request-id: req_oorffrf71ir4aJ -Content-Length: 15451 +request-id: req_khNcFSRcwJwIom +Content-Length: 15601 Vary: Origin -Date: Tue, 28 Jan 2025 23:33:06 GMT +Date: Wed, 05 Feb 2025 22:13:57 GMT stripe-version: 2020-08-27 access-control-expose-headers: Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required access-control-max-age: 300 access-control-allow-credentials: true Content-Type: application/json -x-content-type-options: nosniff { "payment_method_preference" : { @@ -168,7 +167,7 @@ x-content-type-options: nosniff "elements_spm_max_visible_payment_methods" : false, "elements_disable_link_email_otp" : false, "cbc_in_link_popup" : true, - "elements_disable_progressive_cursor" : true, + "elements_disable_progressive_cursor" : false, "elements_enable_external_payment_method_picpay" : false, "elements_enable_external_payment_method_planpay" : false, "elements_enable_external_payment_method_samsung_pay" : false, @@ -193,7 +192,7 @@ x-content-type-options: nosniff "elements_enable_external_payment_method_mybank" : false }, "merchant_logo_url" : null, - "session_id" : "elements_session_1ARa4TFah7s", + "session_id" : "elements_session_13rmdkK5xby", "card_installments_enabled" : false, "account_id" : "acct_1G6m1pFY0qyl6XeW", "merchant_id" : "acct_1G6m1pFY0qyl6XeW", @@ -222,9 +221,9 @@ x-content-type-options: nosniff "paypal_merchant_id" : null }, "experiments_data" : { - "arb_id" : "3cfd1f55-47d5-410b-92ec-b396001fcf8f", + "arb_id" : "70b49175-c5a3-4b8f-8f21-bac2c70fdcf8", "experiment_metadata" : { - "seed" : "32aab725f5832a8b5ac9bbb12bb786037925b1847713f2c16070a71cdb2b6f45", + "seed" : "9b0424a6c822c9d049e1245c834c1658932b02d87684324ca862d43e128332e4", "semi_dominant_payment_methods" : [ ] @@ -278,6 +277,7 @@ x-content-type-options: nosniff "link_bank_onboarding_enabled" : false, "link_hcaptcha_rqdata" : null, "link_user_session_id_accuracy_test" : false, + "link_lookup_hcaptcha_enabled" : false, "link_financial_incentives_experiment_enabled" : false, "link_passthrough_mode_enabled" : false, "link_no_code_default_values_identification" : true, @@ -289,6 +289,7 @@ x-content-type-options: nosniff "link_popup_smart_defaults_enabled" : false, "link_hcaptcha_site_key" : "20000000-ffff-ffff-ffff-000000000002", "link_crypto_onramp_force_cvc_reverification" : false, + "link_wanderlust_in_elements_enabled" : false, "link_email_verification_login_enabled" : false, "link_only_for_payment_method_types_enabled" : false, "link_bank_incentives_enabled" : false, @@ -338,8 +339,8 @@ x-content-type-options: nosniff "default_payment_method" : null, "customer_session" : { "object" : "customer_session", - "api_key_expiry" : 1738108986, - "id" : "cuss_1QmOHGFY0qyl6XeWWMDBo8k5", + "api_key_expiry" : 1738795437, + "id" : "cuss_1QpGr2FY0qyl6XeWQLumThJ4", "livemode" : false, "components" : { "customer_sheet" : { @@ -352,16 +353,17 @@ x-content-type-options: nosniff "mobile_payment_element" : { "enabled" : true, "features" : { - "payment_method_remove" : "enabled", + "payment_method_save_allow_redisplay_override" : null, + "payment_method_redisplay" : "enabled", "payment_method_save" : "enabled", + "payment_method_set_as_default" : "enabled", "payment_method_allow_redisplay_filters" : [ "unspecified", "limited", "always" ], - "payment_method_save_allow_redisplay_override" : null, - "payment_method_remove_last" : "enabled", - "payment_method_redisplay" : "enabled" + "payment_method_remove" : "enabled", + "payment_method_remove_last" : "enabled" } }, "payment_element" : { @@ -372,8 +374,8 @@ x-content-type-options: nosniff "enabled" : false } }, - "customer" : "cus_Rfjkh79eDM6ppC", - "api_key" : "ek_test_YWNjdF8xRzZtMXBGWTBxeWw2WGVXLER2RlY0YkpNR3ZIYW9IMktQRE5hREdFTmlLQTkxVkg_00p5D2iEMO" + "customer" : "cus_RiiHwZyWbhU6pL", + "api_key" : "ek_test_YWNjdF8xRzZtMXBGWTBxeWw2WGVXLFhjUlhta1A2YXNDaGR5ZmgxRHRYZlY5REs1NTVRZ00_00QyeyQFpq" } }, "klarna_express_config" : { diff --git a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredPaymentIntentSetAsDefault/0003_post_v1_payment_methods.tail b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredPaymentIntentSetAsDefault/0003_post_v1_payment_methods.tail index 7db59c0742e..a3ad6accc09 100644 --- a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredPaymentIntentSetAsDefault/0003_post_v1_payment_methods.tail +++ b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredPaymentIntentSetAsDefault/0003_post_v1_payment_methods.tail @@ -3,7 +3,7 @@ https:\/\/api\.stripe\.com\/v1\/payment_methods$ 200 application/json access-control-allow-methods: GET, HEAD, PUT, PATCH, POST, DELETE -content-security-policy: base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=UbpD8beeN6qfHYLXysVeUdVsn60rSv8CMuz-dlm-ryFT4Xl5Prsm6uzY668SP9lEkJ6Bug32nyE6Zlf2 +content-security-policy: base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=LBLtEKlxH6XSr04jG6MQLjN1nDT28a3_G9hFbW4CGJ9quOpaX32PceNJ1HtNxTFvt0TFWQcXUPYQ5en4 Server: nginx Cache-Control: no-cache, no-store reporting-endpoints: coop="https://q.stripe.com/coop-report" @@ -14,24 +14,23 @@ Access-Control-Allow-Origin: * stripe-should-retry: false x-stripe-priority-routing-enabled: true report-to: {"group":"coop","max_age":8640,"endpoints":[{"url":"https://q.stripe.com/coop-report"}],"include_subdomains":true} -request-id: req_4h0L6sl2sRa03D +request-id: req_3dMH7hz5rF93Ae x-stripe-routing-context-priority-tier: api-testmode Content-Length: 966 Vary: Origin -Date: Tue, 28 Jan 2025 23:33:06 GMT -original-request: req_4h0L6sl2sRa03D +Date: Wed, 05 Feb 2025 22:13:57 GMT +original-request: req_3dMH7hz5rF93Ae stripe-version: 2020-08-27 -idempotency-key: 83c0673a-617d-4d73-b4cf-744ea3f79847 +idempotency-key: 1524e97c-bf59-46dd-af07-d2dfd0bcac0f access-control-expose-headers: Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required access-control-max-age: 300 access-control-allow-credentials: true Content-Type: application/json -x-content-type-options: nosniff X-Stripe-Mock-Request: allow_redisplay=always&card\[cvc]=123&card\[exp_month]=12&card\[exp_year]=32&card\[number]=4242424242424242&payment_user_agent=.*&type=card { "object" : "payment_method", - "id" : "pm_1QmOHGFY0qyl6XeW8hTo1ZlO", + "id" : "pm_1QpGr3FY0qyl6XeWdWwED8Dd", "billing_details" : { "email" : null, "phone" : null, @@ -72,7 +71,7 @@ X-Stripe-Mock-Request: allow_redisplay=always&card\[cvc]=123&card\[exp_month]=12 "country" : "US" }, "livemode" : false, - "created" : 1738107186, + "created" : 1738793637, "allow_redisplay" : "always", "type" : "card", "customer" : null diff --git a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredPaymentIntentSetAsDefault/0004_post_create_payment_intent.tail b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredPaymentIntentSetAsDefault/0004_post_create_payment_intent.tail index 9e1c14ab39d..27743d55049 100644 --- a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredPaymentIntentSetAsDefault/0004_post_create_payment_intent.tail +++ b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredPaymentIntentSetAsDefault/0004_post_create_payment_intent.tail @@ -4,15 +4,15 @@ https:\/\/stp-mobile-ci-test-backend-e1b3\.stripedemos\.com\/create_payment_inte text/html Content-Type: text/html;charset=utf-8 Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 -Set-Cookie: rack.session=sS4Lo8ECeYPl8rNeba22Vf6uHBim5KGqsD31BBjAMX%2BVJzprgnyur3Bnawe9zB8L6nNt%2B8aLdAf2PYNNix01dKPSRjg%2FShtOm%2B4V10Tu4wDY1pOQtupB4x9s8Sq%2FLbgFCaCXv49cZwppdJOCRGGrpCYURtizjkwbrn8FEFnMFFjbMaR955yOs0C4gjcc6%2FS1FZUfa84yXyzqo6hLIQBi9GMk7Irr%2F6fC9jsNhhgTaqw%3D; path=/ +Set-Cookie: rack.session=lRVWqx1VyZAjtRMzZNaJM4M6MJ0Q%2BTgl5r6yvs9U7%2FFUGbL%2Bnu1GkuyRFuKqk4x6qvU7O2vZKyWz%2F8V9js7YI4zNl1htoOIOZ3BLhQM3n8j6vC%2BKJrKVOXcSB3zOU8xDXp64BmYaQbXYWVQ%2FRmbBT044ePK6%2FGR%2FodqLYkN8Sa%2BNUKv0RejKrMkH0bgTQJddmsfEP1OAL12Ohf2L4NSQk8vGP%2BP5EO75XpZ%2F%2B4f0%2BkY%3D; path=/ Server: Google Frontend -x-cloud-trace-context: a3488eea75efecb5300729480164fb5a;o=1 +x-cloud-trace-context: 290d8277a230b3e8944d0c6fb13fc67d Via: 1.1 google x-xss-protection: 1; mode=block -Date: Tue, 28 Jan 2025 23:33:07 GMT +Date: Wed, 05 Feb 2025 22:13:58 GMT x-robots-tag: noindex, nofollow Content-Length: 147 x-content-type-options: nosniff x-frame-options: SAMEORIGIN -{"intent":"pi_3QmOHHFY0qyl6XeW18F0I80J","secret":"pi_3QmOHHFY0qyl6XeW18F0I80J_secret_KQuaDW84T8wCpOyrFjnixyjTb","status":"requires_payment_method"} \ No newline at end of file +{"intent":"pi_3QpGr3FY0qyl6XeW0cvmFFgp","secret":"pi_3QpGr3FY0qyl6XeW0cvmFFgp_secret_h4wkIHUN4epXqIcIVjyoSt3jt","status":"requires_payment_method"} \ No newline at end of file diff --git a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredPaymentIntentSetAsDefault/0005_get_v1_payment_intents_pi_3QmOHHFY0qyl6XeW18F0I80J.tail b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredPaymentIntentSetAsDefault/0005_get_v1_payment_intents_pi_3QpGr3FY0qyl6XeW0cvmFFgp.tail similarity index 77% rename from StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredPaymentIntentSetAsDefault/0005_get_v1_payment_intents_pi_3QmOHHFY0qyl6XeW18F0I80J.tail rename to StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredPaymentIntentSetAsDefault/0005_get_v1_payment_intents_pi_3QpGr3FY0qyl6XeW0cvmFFgp.tail index 9a74849179e..c68a0c3d7ce 100644 --- a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredPaymentIntentSetAsDefault/0005_get_v1_payment_intents_pi_3QmOHHFY0qyl6XeW18F0I80J.tail +++ b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredPaymentIntentSetAsDefault/0005_get_v1_payment_intents_pi_3QpGr3FY0qyl6XeW0cvmFFgp.tail @@ -1,9 +1,9 @@ GET -https:\/\/api\.stripe\.com\/v1\/payment_intents\/pi_3QmOHHFY0qyl6XeW18F0I80J\?client_secret=pi_3QmOHHFY0qyl6XeW18F0I80J_secret_KQuaDW84T8wCpOyrFjnixyjTb&expand%5B0%5D=payment_method$ +https:\/\/api\.stripe\.com\/v1\/payment_intents\/pi_3QpGr3FY0qyl6XeW0cvmFFgp\?client_secret=pi_3QpGr3FY0qyl6XeW0cvmFFgp_secret_h4wkIHUN4epXqIcIVjyoSt3jt&expand%5B0%5D=payment_method$ 200 application/json access-control-allow-methods: GET, HEAD, PUT, PATCH, POST, DELETE -content-security-policy: base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=dzDu1TCZhx4ZPj4zrsCQ8Vn_6MWtsjzCNgCxA4LRY7e6TFjbcSy1v4rEpOnJnjEnnd6Feox11SroOsNY +content-security-policy: base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=OgoqtogUGG4mB4SpiQXzdPFOePKl_GlznKNkDqtrp8Z78wFU0EpXtsoHBMY1Ttzqnorx-ZCuTCMOi-hD Server: nginx Cache-Control: no-cache, no-store reporting-endpoints: coop="https://q.stripe.com/coop-report" @@ -14,16 +14,15 @@ Access-Control-Allow-Origin: * x-stripe-routing-context-priority-tier: api-testmode x-stripe-priority-routing-enabled: true report-to: {"group":"coop","max_age":8640,"endpoints":[{"url":"https://q.stripe.com/coop-report"}],"include_subdomains":true} -request-id: req_WYyP8rk8Q6g1jP +request-id: req_AfHj2AR1vocZJn Content-Length: 984 Vary: Origin -Date: Tue, 28 Jan 2025 23:33:07 GMT +Date: Wed, 05 Feb 2025 22:13:58 GMT stripe-version: 2020-08-27 access-control-expose-headers: Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required access-control-max-age: 300 access-control-allow-credentials: true Content-Type: application/json -x-content-type-options: nosniff { "payment_method_configuration_details" : null, @@ -47,12 +46,12 @@ x-content-type-options: nosniff "next_action" : null, "status" : "requires_payment_method", "payment_method" : null, - "client_secret" : "pi_3QmOHHFY0qyl6XeW18F0I80J_secret_KQuaDW84T8wCpOyrFjnixyjTb", + "client_secret" : "pi_3QpGr3FY0qyl6XeW0cvmFFgp_secret_h4wkIHUN4epXqIcIVjyoSt3jt", "total_details" : { "amount_discount" : 0, "amount_tax" : 0 }, - "id" : "pi_3QmOHHFY0qyl6XeW18F0I80J", + "id" : "pi_3QpGr3FY0qyl6XeW0cvmFFgp", "confirmation_method" : "automatic", "amount_details" : { "tip" : { @@ -65,6 +64,6 @@ x-content-type-options: nosniff "card" ], "setup_future_usage" : null, - "created" : 1738107187, + "created" : 1738793637, "description" : null } \ No newline at end of file diff --git a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredPaymentIntentSetAsDefault/0006_post_v1_payment_intents_pi_3QmOHHFY0qyl6XeW18F0I80J_confirm.tail b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredPaymentIntentSetAsDefault/0006_post_v1_payment_intents_pi_3QpGr3FY0qyl6XeW0cvmFFgp_confirm.tail similarity index 80% rename from StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredPaymentIntentSetAsDefault/0006_post_v1_payment_intents_pi_3QmOHHFY0qyl6XeW18F0I80J_confirm.tail rename to StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredPaymentIntentSetAsDefault/0006_post_v1_payment_intents_pi_3QpGr3FY0qyl6XeW0cvmFFgp_confirm.tail index 6296cd38966..bb6e2873b10 100644 --- a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredPaymentIntentSetAsDefault/0006_post_v1_payment_intents_pi_3QmOHHFY0qyl6XeW18F0I80J_confirm.tail +++ b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredPaymentIntentSetAsDefault/0006_post_v1_payment_intents_pi_3QpGr3FY0qyl6XeW0cvmFFgp_confirm.tail @@ -1,9 +1,9 @@ POST -https:\/\/api\.stripe\.com\/v1\/payment_intents\/pi_3QmOHHFY0qyl6XeW18F0I80J\/confirm$ +https:\/\/api\.stripe\.com\/v1\/payment_intents\/pi_3QpGr3FY0qyl6XeW0cvmFFgp\/confirm$ 200 application/json access-control-allow-methods: GET, HEAD, PUT, PATCH, POST, DELETE -content-security-policy: base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=y8o819v0Hlo0ctIGVX9RV40hwxiKvBQDjHWHLihq6lA3oTdfUgwBkK4QvxBcwuS1SAo1YuAyH4B81Tmy +content-security-policy: base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=sOO_QdgmaFqBQHlOUAF8weJJfFtcFs7eAUXCeryUAohLvOKJpluu8N1T4m4AcWXg9WnH0Q-XG1tvUpn8 Server: nginx Cache-Control: no-cache, no-store reporting-endpoints: coop="https://q.stripe.com/coop-report" @@ -14,20 +14,19 @@ Access-Control-Allow-Origin: * stripe-should-retry: false x-stripe-priority-routing-enabled: true report-to: {"group":"coop","max_age":8640,"endpoints":[{"url":"https://q.stripe.com/coop-report"}],"include_subdomains":true} -request-id: req_YjjqIvwhjHTEgv +request-id: req_PgXThgixEyxFSR x-stripe-routing-context-priority-tier: api-testmode Content-Length: 2303 Vary: Origin -Date: Tue, 28 Jan 2025 23:33:08 GMT -original-request: req_YjjqIvwhjHTEgv +Date: Wed, 05 Feb 2025 22:13:59 GMT +original-request: req_PgXThgixEyxFSR stripe-version: 2020-08-27 -idempotency-key: 041088e3-09c1-46dd-914e-da3edbe1ba07 +idempotency-key: 296a31db-f21e-4bb5-87e9-8a8f06d6b049 access-control-expose-headers: Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required access-control-max-age: 300 access-control-allow-credentials: true Content-Type: application/json -x-content-type-options: nosniff -X-Stripe-Mock-Request: client_secret=pi_3QmOHHFY0qyl6XeW18F0I80J_secret_KQuaDW84T8wCpOyrFjnixyjTb&expand\[0]=payment_method&payment_method=pm_1QmOHGFY0qyl6XeW8hTo1ZlO&payment_method_options\[card]\[setup_future_usage]=off_session&set_as_default_payment_method=true&shipping\[address]\[country]=US&shipping\[address]\[line1]=Line%201&shipping\[name]=Jane%20Doe&shipping\[phone]=5551234567&use_stripe_sdk=true +X-Stripe-Mock-Request: client_secret=pi_3QpGr3FY0qyl6XeW0cvmFFgp_secret_h4wkIHUN4epXqIcIVjyoSt3jt&expand\[0]=payment_method&payment_method=pm_1QpGr3FY0qyl6XeWdWwED8Dd&payment_method_options\[card]\[setup_future_usage]=off_session&set_as_default_payment_method=true&shipping\[address]\[country]=US&shipping\[address]\[line1]=Line%201&shipping\[name]=Jane%20Doe&shipping\[phone]=5551234567&use_stripe_sdk=true { "payment_method_configuration_details" : null, @@ -65,7 +64,7 @@ X-Stripe-Mock-Request: client_secret=pi_3QmOHHFY0qyl6XeW18F0I80J_secret_KQuaDW84 "status" : "succeeded", "payment_method" : { "object" : "payment_method", - "id" : "pm_1QmOHGFY0qyl6XeW8hTo1ZlO", + "id" : "pm_1QpGr3FY0qyl6XeWdWwED8Dd", "billing_details" : { "email" : null, "phone" : null, @@ -106,17 +105,17 @@ X-Stripe-Mock-Request: client_secret=pi_3QmOHHFY0qyl6XeW18F0I80J_secret_KQuaDW84 "country" : "US" }, "livemode" : false, - "created" : 1738107186, + "created" : 1738793637, "allow_redisplay" : "always", "type" : "card", - "customer" : "cus_Rfjkh79eDM6ppC" + "customer" : "cus_RiiHwZyWbhU6pL" }, - "client_secret" : "pi_3QmOHHFY0qyl6XeW18F0I80J_secret_KQuaDW84T8wCpOyrFjnixyjTb", + "client_secret" : "pi_3QpGr3FY0qyl6XeW0cvmFFgp_secret_h4wkIHUN4epXqIcIVjyoSt3jt", "total_details" : { "amount_discount" : 0, "amount_tax" : 0 }, - "id" : "pi_3QmOHHFY0qyl6XeW18F0I80J", + "id" : "pi_3QpGr3FY0qyl6XeW0cvmFFgp", "confirmation_method" : "automatic", "amount_details" : { "tip" : { @@ -129,6 +128,6 @@ X-Stripe-Mock-Request: client_secret=pi_3QmOHHFY0qyl6XeW18F0I80J_secret_KQuaDW84 "card" ], "setup_future_usage" : null, - "created" : 1738107187, + "created" : 1738793637, "description" : null } \ No newline at end of file diff --git a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredPaymentIntentSetAsDefault/0007_get_v1_elements_sessions.tail b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredPaymentIntentSetAsDefault/0007_get_v1_elements_sessions.tail index 3bda206b7a1..87e67b50656 100644 --- a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredPaymentIntentSetAsDefault/0007_get_v1_elements_sessions.tail +++ b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredPaymentIntentSetAsDefault/0007_get_v1_elements_sessions.tail @@ -1,9 +1,9 @@ GET -https:\/\/api\.stripe\.com\/v1\/elements\/sessions\?customer_session_client_secret=cuss_secret_RfjkOWUZFmwaQRgmctzAwqBA4nYaC1m2Tf5DWpEBEph71UP&deferred_intent%5Bamount%5D=100&deferred_intent%5Bcapture_method%5D=automatic&deferred_intent%5Bcurrency%5D=USD&deferred_intent%5Bmode%5D=payment&deferred_intent%5Bpayment_method_types%5D%5B0%5D=card&key=pk_test_ErsyMEOTudSjQR8hh0VrQr5X008sBXGOu6&locale=en-US&mobile_app_id=com\.stripe\.StripeiOSTestHostApp&type=deferred_intent$ +https:\/\/api\.stripe\.com\/v1\/elements\/sessions\?customer_session_client_secret=cuss_secret_RiiHqgxxAECjfemcN0SUYsa0Yvzv9XIlTmRHcePZp368i0w&deferred_intent%5Bamount%5D=100&deferred_intent%5Bcapture_method%5D=automatic&deferred_intent%5Bcurrency%5D=USD&deferred_intent%5Bmode%5D=payment&deferred_intent%5Bpayment_method_types%5D%5B0%5D=card&key=pk_test_ErsyMEOTudSjQR8hh0VrQr5X008sBXGOu6&locale=en-US&mobile_app_id=com\.stripe\.StripeiOSTestHostApp&type=deferred_intent$ 200 application/json access-control-allow-methods: GET, HEAD, PUT, PATCH, POST, DELETE -content-security-policy: base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=EfwiZdrpDfapkhDTKr9bAloFX9jSdE53cns7kYEQkVSISc0jv-mVutvjSVz7POFls18wm-oPrpYK2CFb +content-security-policy: base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=xx2m5RF5OKUa3IuxVuwR7Tk7wvjeyPAVtZgb19ko-7lrMrCuKZjfNmp11FlRV-Gggp2IgqaI_eAMZSRD Server: nginx Cache-Control: no-cache, no-store reporting-endpoints: coop="https://q.stripe.com/coop-report" @@ -14,16 +14,15 @@ Access-Control-Allow-Origin: * x-stripe-routing-context-priority-tier: api-testmode x-stripe-priority-routing-enabled: true report-to: {"group":"coop","max_age":8640,"endpoints":[{"url":"https://q.stripe.com/coop-report"}],"include_subdomains":true} -request-id: req_wKZbEbRJg57PiB -Content-Length: 18196 +request-id: req_9olixojl22o4N0 +Content-Length: 18346 Vary: Origin -Date: Tue, 28 Jan 2025 23:33:19 GMT +Date: Wed, 05 Feb 2025 22:14:02 GMT stripe-version: 2020-08-27 access-control-expose-headers: Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required access-control-max-age: 300 access-control-allow-credentials: true Content-Type: application/json -x-content-type-options: nosniff { "payment_method_preference" : { @@ -168,7 +167,7 @@ x-content-type-options: nosniff "elements_spm_max_visible_payment_methods" : false, "elements_disable_link_email_otp" : false, "cbc_in_link_popup" : true, - "elements_disable_progressive_cursor" : true, + "elements_disable_progressive_cursor" : false, "elements_enable_external_payment_method_picpay" : false, "elements_enable_external_payment_method_planpay" : false, "elements_enable_external_payment_method_samsung_pay" : false, @@ -193,7 +192,7 @@ x-content-type-options: nosniff "elements_enable_external_payment_method_mybank" : false }, "merchant_logo_url" : null, - "session_id" : "elements_session_18HTTVz5Vlw", + "session_id" : "elements_session_1gVeIYiHlCm", "card_installments_enabled" : false, "account_id" : "acct_1G6m1pFY0qyl6XeW", "merchant_id" : "acct_1G6m1pFY0qyl6XeW", @@ -222,9 +221,9 @@ x-content-type-options: nosniff "paypal_merchant_id" : null }, "experiments_data" : { - "arb_id" : "2b6615a3-ad0f-4818-b4b0-fa93fbfabaa8", + "arb_id" : "3ed7d9c5-08c9-4f83-89f7-76bfec448fe5", "experiment_metadata" : { - "seed" : "32aab725f5832a8b5ac9bbb12bb786037925b1847713f2c16070a71cdb2b6f45", + "seed" : "9b0424a6c822c9d049e1245c834c1658932b02d87684324ca862d43e128332e4", "semi_dominant_payment_methods" : [ ] @@ -278,6 +277,7 @@ x-content-type-options: nosniff "link_bank_onboarding_enabled" : false, "link_hcaptcha_rqdata" : null, "link_user_session_id_accuracy_test" : false, + "link_lookup_hcaptcha_enabled" : false, "link_financial_incentives_experiment_enabled" : false, "link_passthrough_mode_enabled" : false, "link_no_code_default_values_identification" : true, @@ -289,6 +289,7 @@ x-content-type-options: nosniff "link_popup_smart_defaults_enabled" : false, "link_hcaptcha_site_key" : "20000000-ffff-ffff-ffff-000000000002", "link_crypto_onramp_force_cvc_reverification" : false, + "link_wanderlust_in_elements_enabled" : false, "link_email_verification_login_enabled" : false, "link_only_for_payment_method_types_enabled" : false, "link_bank_incentives_enabled" : false, @@ -332,7 +333,7 @@ x-content-type-options: nosniff "payment_methods" : [ { "object" : "payment_method", - "id" : "pm_1QmOHGFY0qyl6XeW8hTo1ZlO", + "id" : "pm_1QpGr3FY0qyl6XeWdWwED8Dd", "billing_details" : { "email" : null, "phone" : null, @@ -373,17 +374,17 @@ x-content-type-options: nosniff "country" : "US" }, "livemode" : false, - "created" : 1738107186, + "created" : 1738793637, "allow_redisplay" : "always", "type" : "card", - "customer" : "cus_Rfjkh79eDM6ppC" + "customer" : "cus_RiiHwZyWbhU6pL" } ], "payment_methods_with_link_details" : [ { "payment_method" : { "object" : "payment_method", - "id" : "pm_1QmOHGFY0qyl6XeW8hTo1ZlO", + "id" : "pm_1QpGr3FY0qyl6XeWdWwED8Dd", "billing_details" : { "email" : null, "phone" : null, @@ -424,19 +425,19 @@ x-content-type-options: nosniff "country" : "US" }, "livemode" : false, - "created" : 1738107186, + "created" : 1738793637, "allow_redisplay" : "always", "type" : "card", - "customer" : "cus_Rfjkh79eDM6ppC" + "customer" : "cus_RiiHwZyWbhU6pL" }, "link_payment_details" : null } ], - "default_payment_method" : "pm_1QmOHGFY0qyl6XeW8hTo1ZlO", + "default_payment_method" : "pm_1QpGr3FY0qyl6XeWdWwED8Dd", "customer_session" : { "object" : "customer_session", - "api_key_expiry" : 1738108986, - "id" : "cuss_1QmOHGFY0qyl6XeWWMDBo8k5", + "api_key_expiry" : 1738795437, + "id" : "cuss_1QpGr2FY0qyl6XeWQLumThJ4", "livemode" : false, "components" : { "customer_sheet" : { @@ -449,16 +450,17 @@ x-content-type-options: nosniff "mobile_payment_element" : { "enabled" : true, "features" : { - "payment_method_remove" : "enabled", + "payment_method_save_allow_redisplay_override" : null, + "payment_method_redisplay" : "enabled", "payment_method_save" : "enabled", + "payment_method_set_as_default" : "enabled", "payment_method_allow_redisplay_filters" : [ "unspecified", "limited", "always" ], - "payment_method_save_allow_redisplay_override" : null, - "payment_method_remove_last" : "enabled", - "payment_method_redisplay" : "enabled" + "payment_method_remove" : "enabled", + "payment_method_remove_last" : "enabled" } }, "payment_element" : { @@ -469,8 +471,8 @@ x-content-type-options: nosniff "enabled" : false } }, - "customer" : "cus_Rfjkh79eDM6ppC", - "api_key" : "ek_test_YWNjdF8xRzZtMXBGWTBxeWw2WGVXLER2RlY0YkpNR3ZIYW9IMktQRE5hREdFTmlLQTkxVkg_00p5D2iEMO" + "customer" : "cus_RiiHwZyWbhU6pL", + "api_key" : "ek_test_YWNjdF8xRzZtMXBGWTBxeWw2WGVXLFhjUlhta1A2YXNDaGR5ZmgxRHRYZlY5REs1NTVRZ00_00QyeyQFpq" } }, "klarna_express_config" : { diff --git a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0000_post_create_customer_session_cs.tail b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0000_post_create_customer_session_cs.tail deleted file mode 100644 index d7e0b3d3dfe..00000000000 --- a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0000_post_create_customer_session_cs.tail +++ /dev/null @@ -1,18 +0,0 @@ -POST -https:\/\/stp-mobile-ci-test-backend-e1b3\.stripedemos\.com\/create_customer_session_cs$ -200 -text/html -Content-Type: text/html;charset=utf-8 -Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 -Set-Cookie: rack.session=6m%2FIFE1b0l5NGzUdyixfwCaiVIpRhGQAMC8tOweZpPEWkzSnWh4PgPVkzTLYytNHPl%2F%2BK%2FzKKwMdIK3Mt%2FuuqxgBdPh74eO85V4AQgGgLAFMyEtlqH34kGGykls8Kr3Qj6s9TcTw1DCRo%2B4ZZBRcAYNgGWbzuBGXKsZ7sMCURgyqB04j9KQcSqeWSzWO2aKjfomZ4ns%2B1ZE5u9nY4NxtCSlVC%2FH%2BOigQaQu40BC2iZU%3D; path=/ -Server: Google Frontend -x-cloud-trace-context: 900623d4fa4cc93473d2e2ce45cda0d2;o=1 -Via: 1.1 google -x-xss-protection: 1; mode=block -Date: Fri, 31 Jan 2025 16:58:15 GMT -x-robots-tag: noindex, nofollow -Content-Length: 128 -x-content-type-options: nosniff -x-frame-options: SAMEORIGIN - -{"customer_session_client_secret":"cuss_secret_Rgl3dt57WDTrNH2pQbCGSFIIFFz2IrpIW0T12vnNLU10Xxc","customer":"cus_Rgl30fpuXslWZx"} \ No newline at end of file diff --git a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0000_post_create_ephemeral_key.tail b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0000_post_create_ephemeral_key.tail new file mode 100644 index 00000000000..65e73866cb5 --- /dev/null +++ b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0000_post_create_ephemeral_key.tail @@ -0,0 +1,18 @@ +POST +https:\/\/stp-mobile-ci-test-backend-e1b3\.stripedemos\.com\/create_ephemeral_key$ +200 +text/html +Content-Type: text/html;charset=utf-8 +Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 +Set-Cookie: rack.session=WE8w2oar91mzsJgOkgUlSA3du8kB4AFAqmgsho9zlxp82jkpSkmyduz8zPtuVJTJo9bWN5fbsPj%2FLm5%2FSol1a1MaKx3gjXELpDnrq%2Bk%2BUVkui1WxG2BfNMuAj1yu1cmPBWJj8btmubrnyqqNy3zRVA8k5CF3dYsgadEJTficjleE%2FtE2jWBrzHfjIPeaj%2FJUr1xBkqktAEKSetIc%2BP%2FQJf2qb48Bz%2BOt3l%2FIFc7%2FK48%3D; path=/ +Server: Google Frontend +x-cloud-trace-context: 7772a7ac04467fd8f16943dea07cb4e1;o=1 +Via: 1.1 google +x-xss-protection: 1; mode=block +Date: Wed, 05 Feb 2025 22:14:20 GMT +x-robots-tag: noindex, nofollow +Content-Length: 149 +x-content-type-options: nosniff +x-frame-options: SAMEORIGIN + +{"ephemeral_key_secret":"ek_test_YWNjdF8xRzZtMXBGWTBxeWw2WGVXLGtySE5PcHJ2bWVNQ3JaeWJnTnFiUXBpQ05QZnhHM1o_00ycddUf24","customer":"cus_RiiHdYYP9mXQTY"} \ No newline at end of file diff --git a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0001_post_create_customer_session_cs.tail b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0001_post_create_customer_session_cs.tail new file mode 100644 index 00000000000..39ff8ecb89e --- /dev/null +++ b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0001_post_create_customer_session_cs.tail @@ -0,0 +1,18 @@ +POST +https:\/\/stp-mobile-ci-test-backend-e1b3\.stripedemos\.com\/create_customer_session_cs$ +200 +text/html +Content-Type: text/html;charset=utf-8 +Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 +Set-Cookie: rack.session=0MQsUjWl1TqGwZ3c9Wt88uZg5AsFHRaeUNtt1BDFBFMHsJhkDUE8Ov2umsHL%2FYs9r1nYNjPjVs1uWtjOw0GgMUiy%2FdL9XV69M1Shd5G18IXC5KFikmAOWcznOXFJ6OWZo8KtNUI2ELU6NuioI9RpjImesSR6lHh2PPIpBp9HaRpjeOMBqmgbPV1aRdvucl1kJT1%2Fs5TH1q8rJyb1bct8WFBorFjxxRRl96BjwbFrOYE%3D; path=/ +Server: Google Frontend +x-cloud-trace-context: c3d2e246cf84d8cd48a04fdda60a87f8 +Via: 1.1 google +x-xss-protection: 1; mode=block +Date: Wed, 05 Feb 2025 22:14:20 GMT +x-robots-tag: noindex, nofollow +Content-Length: 128 +x-content-type-options: nosniff +x-frame-options: SAMEORIGIN + +{"customer_session_client_secret":"cuss_secret_RiiI8f5KB2RNxUTyyuUmS6yEPi3yxTtHhYWdm5zEEe5AKSx","customer":"cus_RiiHdYYP9mXQTY"} \ No newline at end of file diff --git a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0001_get_v1_elements_sessions.tail b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0002_get_v1_elements_sessions.tail similarity index 94% rename from StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0001_get_v1_elements_sessions.tail rename to StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0002_get_v1_elements_sessions.tail index 17c05c9bb08..0c62e4f5506 100644 --- a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0001_get_v1_elements_sessions.tail +++ b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0002_get_v1_elements_sessions.tail @@ -1,9 +1,9 @@ GET -https:\/\/api\.stripe\.com\/v1\/elements\/sessions\?customer_session_client_secret=cuss_secret_Rgl3dt57WDTrNH2pQbCGSFIIFFz2IrpIW0T12vnNLU10Xxc&deferred_intent%5Bmode%5D=setup&deferred_intent%5Bpayment_method_types%5D%5B0%5D=card&deferred_intent%5Bsetup_future_usage%5D=off_session&key=pk_test_ErsyMEOTudSjQR8hh0VrQr5X008sBXGOu6&locale=en-US&mobile_app_id=com\.stripe\.StripeiOSTestHostApp&type=deferred_intent$ +https:\/\/api\.stripe\.com\/v1\/elements\/sessions\?customer_session_client_secret=cuss_secret_RiiI8f5KB2RNxUTyyuUmS6yEPi3yxTtHhYWdm5zEEe5AKSx&deferred_intent%5Bmode%5D=setup&deferred_intent%5Bpayment_method_types%5D%5B0%5D=card&deferred_intent%5Bsetup_future_usage%5D=off_session&key=pk_test_ErsyMEOTudSjQR8hh0VrQr5X008sBXGOu6&locale=en-US&mobile_app_id=com\.stripe\.StripeiOSTestHostApp&type=deferred_intent$ 200 application/json access-control-allow-methods: GET, HEAD, PUT, PATCH, POST, DELETE -content-security-policy: base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=DKNHlZXkCi-Yz4ytFYfJmqjJdoDsfVDucopRIVf8JPNwMN_pq6vVDkhp_5p_Y7uQyC4Xk_5v31SVohEi +content-security-policy: base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=ZxZeF4FQA_9naN76HjPbGb65iHHjoiOt2R5iCgH1mpEoFspTP8NadtJbHuHBsnT_Koa3x6ogoI1c5zyj Server: nginx Cache-Control: no-cache, no-store reporting-endpoints: coop="https://q.stripe.com/coop-report" @@ -14,10 +14,10 @@ Access-Control-Allow-Origin: * x-stripe-routing-context-priority-tier: api-testmode x-stripe-priority-routing-enabled: true report-to: {"group":"coop","max_age":8640,"endpoints":[{"url":"https://q.stripe.com/coop-report"}],"include_subdomains":true} -request-id: req_AccvILWmeE8SGf -Content-Length: 15500 +request-id: req_HxfNS0iWwhV1jE +Content-Length: 15600 Vary: Origin -Date: Fri, 31 Jan 2025 16:58:16 GMT +Date: Wed, 05 Feb 2025 22:14:20 GMT stripe-version: 2020-08-27 access-control-expose-headers: Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required access-control-max-age: 300 @@ -167,7 +167,7 @@ Content-Type: application/json "elements_spm_max_visible_payment_methods" : false, "elements_disable_link_email_otp" : false, "cbc_in_link_popup" : true, - "elements_disable_progressive_cursor" : true, + "elements_disable_progressive_cursor" : false, "elements_enable_external_payment_method_picpay" : false, "elements_enable_external_payment_method_planpay" : false, "elements_enable_external_payment_method_samsung_pay" : false, @@ -192,7 +192,7 @@ Content-Type: application/json "elements_enable_external_payment_method_mybank" : false }, "merchant_logo_url" : null, - "session_id" : "elements_session_1qy2chfTyFa", + "session_id" : "elements_session_1vKxNHxLkIE", "card_installments_enabled" : false, "account_id" : "acct_1G6m1pFY0qyl6XeW", "merchant_id" : "acct_1G6m1pFY0qyl6XeW", @@ -221,9 +221,9 @@ Content-Type: application/json "paypal_merchant_id" : null }, "experiments_data" : { - "arb_id" : "b57db218-1d47-4e4b-94f8-a2c7ba271436", + "arb_id" : "07aa2bfb-2106-4321-ac42-7b769532d53f", "experiment_metadata" : { - "seed" : "b0163e9cf440b89cf81077daeea505b888c2d2c769df3dd770fa36728ed2d1e8", + "seed" : "9b0424a6c822c9d049e1245c834c1658932b02d87684324ca862d43e128332e4", "semi_dominant_payment_methods" : [ ] @@ -277,6 +277,7 @@ Content-Type: application/json "link_bank_onboarding_enabled" : false, "link_hcaptcha_rqdata" : null, "link_user_session_id_accuracy_test" : false, + "link_lookup_hcaptcha_enabled" : false, "link_financial_incentives_experiment_enabled" : false, "link_passthrough_mode_enabled" : false, "link_no_code_default_values_identification" : true, @@ -338,8 +339,8 @@ Content-Type: application/json "default_payment_method" : null, "customer_session" : { "object" : "customer_session", - "api_key_expiry" : 1738344496, - "id" : "cuss_1QnNXnFY0qyl6XeWQmAQad6r", + "api_key_expiry" : 1738795460, + "id" : "cuss_1QpGrQFY0qyl6XeWlsgca3TN", "livemode" : false, "components" : { "customer_sheet" : { @@ -352,16 +353,17 @@ Content-Type: application/json "mobile_payment_element" : { "enabled" : true, "features" : { - "payment_method_remove" : "enabled", + "payment_method_save_allow_redisplay_override" : null, + "payment_method_redisplay" : "enabled", "payment_method_save" : "enabled", + "payment_method_set_as_default" : "enabled", "payment_method_allow_redisplay_filters" : [ "unspecified", "limited", "always" ], - "payment_method_save_allow_redisplay_override" : null, - "payment_method_remove_last" : "enabled", - "payment_method_redisplay" : "enabled" + "payment_method_remove" : "enabled", + "payment_method_remove_last" : "enabled" } }, "payment_element" : { @@ -372,8 +374,8 @@ Content-Type: application/json "enabled" : false } }, - "customer" : "cus_Rgl30fpuXslWZx", - "api_key" : "ek_test_YWNjdF8xRzZtMXBGWTBxeWw2WGVXLGlJN0pRanI5S2p5UXRIQTdwaUdjOWNmeUtvNWtrT2w_00qUKnCYDv" + "customer" : "cus_RiiHdYYP9mXQTY", + "api_key" : "ek_test_YWNjdF8xRzZtMXBGWTBxeWw2WGVXLE1hazlZaG1ncGVOOUtJWFVtQWpZSVhVcFNNb05wdk0_00mFSaJV8O" } }, "klarna_express_config" : { diff --git a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0003_post_create_setup_intent.tail b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0003_post_create_setup_intent.tail deleted file mode 100644 index 5faa57a2a28..00000000000 --- a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0003_post_create_setup_intent.tail +++ /dev/null @@ -1,18 +0,0 @@ -POST -https:\/\/stp-mobile-ci-test-backend-e1b3\.stripedemos\.com\/create_setup_intent$ -200 -text/html -Content-Type: text/html;charset=utf-8 -Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 -Set-Cookie: rack.session=1cDqBr48kUOe%2BYjMcjjnYkVyf%2By%2B6OHmyCHzQ9O24Sy9Wbc%2Fg7j6UalTh8J3u7gMeAbb2zLg2HQbXeQfvkvP8%2BSRgcKJnmLY3RKzCdWmBTA4V%2FkwpVtYXC9wCfJGAoH9T4fA7nDCkJQMsy391abVv8ts3esEhR%2FMe3aJQnCFCaS0GLjJlm7MsSth4P5uVwK7T5cdqIAipmGLaCr7wmwxu%2F80rT%2FZrHStUcMohbOaJls%3D; path=/ -Server: Google Frontend -x-cloud-trace-context: d8bfd7a4989cd372931164e817fd1bca -Via: 1.1 google -x-xss-protection: 1; mode=block -Date: Fri, 31 Jan 2025 16:58:17 GMT -x-robots-tag: noindex, nofollow -Content-Length: 157 -x-content-type-options: nosniff -x-frame-options: SAMEORIGIN - -{"intent":"seti_1QnNXoFY0qyl6XeW0DXCjJaZ","secret":"seti_1QnNXoFY0qyl6XeW0DXCjJaZ_secret_Rgl3vKlXRmPaUSrSqerfjdm6BhLfLHc","status":"requires_payment_method"} \ No newline at end of file diff --git a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0002_post_v1_payment_methods.tail b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0003_post_v1_payment_methods.tail similarity index 85% rename from StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0002_post_v1_payment_methods.tail rename to StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0003_post_v1_payment_methods.tail index 12e93d4d30b..869506f7652 100644 --- a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0002_post_v1_payment_methods.tail +++ b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0003_post_v1_payment_methods.tail @@ -3,7 +3,7 @@ https:\/\/api\.stripe\.com\/v1\/payment_methods$ 200 application/json access-control-allow-methods: GET, HEAD, PUT, PATCH, POST, DELETE -content-security-policy: base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=8wljLiUpODt2gA9P1vVi6ruZdmOoanDkynFjsUeFgXKoD9HK5Z_tbkCism1B993s-xSOrgTJSiwr7IXq +content-security-policy: base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=LBLtEKlxH6XSr04jG6MQLjN1nDT28a3_G9hFbW4CGJ9quOpaX32PceNJ1HtNxTFvt0TFWQcXUPYQ5en4 Server: nginx Cache-Control: no-cache, no-store reporting-endpoints: coop="https://q.stripe.com/coop-report" @@ -14,24 +14,23 @@ Access-Control-Allow-Origin: * stripe-should-retry: false x-stripe-priority-routing-enabled: true report-to: {"group":"coop","max_age":8640,"endpoints":[{"url":"https://q.stripe.com/coop-report"}],"include_subdomains":true} -request-id: req_oPPqJOPiEH9IDW +request-id: req_dCdWphF2QaH2jV x-stripe-routing-context-priority-tier: api-testmode Content-Length: 966 Vary: Origin -Date: Fri, 31 Jan 2025 16:58:16 GMT -original-request: req_oPPqJOPiEH9IDW +Date: Wed, 05 Feb 2025 22:14:21 GMT +original-request: req_dCdWphF2QaH2jV stripe-version: 2020-08-27 -idempotency-key: e06fdedc-108a-492c-8142-65c407e6fdf8 +idempotency-key: 9d22627a-00cb-4e98-9458-bc9e75e71999 access-control-expose-headers: Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required access-control-max-age: 300 access-control-allow-credentials: true Content-Type: application/json -x-content-type-options: nosniff X-Stripe-Mock-Request: allow_redisplay=always&card\[cvc]=123&card\[exp_month]=12&card\[exp_year]=32&card\[number]=4242424242424242&payment_user_agent=.*&type=card { "object" : "payment_method", - "id" : "pm_1QnNXoFY0qyl6XeWThTF3i2m", + "id" : "pm_1QpGrRFY0qyl6XeWiyJ0VE2P", "billing_details" : { "email" : null, "phone" : null, @@ -72,7 +71,7 @@ X-Stripe-Mock-Request: allow_redisplay=always&card\[cvc]=123&card\[exp_month]=12 "country" : "US" }, "livemode" : false, - "created" : 1738342696, + "created" : 1738793661, "allow_redisplay" : "always", "type" : "card", "customer" : null diff --git a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0004_post_create_setup_intent.tail b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0004_post_create_setup_intent.tail new file mode 100644 index 00000000000..778bae39923 --- /dev/null +++ b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0004_post_create_setup_intent.tail @@ -0,0 +1,18 @@ +POST +https:\/\/stp-mobile-ci-test-backend-e1b3\.stripedemos\.com\/create_setup_intent$ +200 +text/html +Content-Type: text/html;charset=utf-8 +Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 +Set-Cookie: rack.session=eOVdNDnbDJXfem%2FxOczOaAvW%2BimK5JTVSnhKnhecTixNr6f6w532r%2BUFtVQMIzRzJcKeYx9CVXh8ehQ2r2K8yHbuhto%2FG9ChnfHmQoksE%2FQodi3ue%2FiWsAaiohjVrIWLSofco2fooC6wYJpfJOpBggHd7UVYycCgBUTCG71NKuaFlDwn%2Fqp%2B%2F7TeyTzNoHp7ULMz3MnxFiRiee2ZZC35hrTaPNChj6bJjeECHM7JHDI%3D; path=/ +Server: Google Frontend +x-cloud-trace-context: 0c11bc1a6732753dc465d3abceab3dd1 +Via: 1.1 google +x-xss-protection: 1; mode=block +Date: Wed, 05 Feb 2025 22:14:21 GMT +x-robots-tag: noindex, nofollow +Content-Length: 157 +x-content-type-options: nosniff +x-frame-options: SAMEORIGIN + +{"intent":"seti_1QpGrRFY0qyl6XeWYojpxx9P","secret":"seti_1QpGrRFY0qyl6XeWYojpxx9P_secret_RiiIYAAU76sETakPQWnNF56o2TcnhkH","status":"requires_payment_method"} \ No newline at end of file diff --git a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0004_get_v1_setup_intents_seti_1QnNXoFY0qyl6XeW0DXCjJaZ.tail b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0005_get_v1_setup_intents_seti_1QpGrRFY0qyl6XeWYojpxx9P.tail similarity index 71% rename from StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0004_get_v1_setup_intents_seti_1QnNXoFY0qyl6XeW0DXCjJaZ.tail rename to StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0005_get_v1_setup_intents_seti_1QpGrRFY0qyl6XeWYojpxx9P.tail index a5089d10f8c..f3647786e9d 100644 --- a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0004_get_v1_setup_intents_seti_1QnNXoFY0qyl6XeW0DXCjJaZ.tail +++ b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0005_get_v1_setup_intents_seti_1QpGrRFY0qyl6XeWYojpxx9P.tail @@ -1,9 +1,9 @@ GET -https:\/\/api\.stripe\.com\/v1\/setup_intents\/seti_1QnNXoFY0qyl6XeW0DXCjJaZ\?client_secret=seti_1QnNXoFY0qyl6XeW0DXCjJaZ_secret_Rgl3vKlXRmPaUSrSqerfjdm6BhLfLHc&expand%5B0%5D=payment_method$ +https:\/\/api\.stripe\.com\/v1\/setup_intents\/seti_1QpGrRFY0qyl6XeWYojpxx9P\?client_secret=seti_1QpGrRFY0qyl6XeWYojpxx9P_secret_RiiIYAAU76sETakPQWnNF56o2TcnhkH&expand%5B0%5D=payment_method$ 200 application/json access-control-allow-methods: GET, HEAD, PUT, PATCH, POST, DELETE -content-security-policy: base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=VZMvVxw5RGeWwSxHGUMHiEoU9ou2-cOfFW_abF1PLvPO8viL2NuGq7p5WGiJG7R-PuqUtBeVWEczBEuu +content-security-policy: base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=MFLWjtWT9mFWXpoBQ5xYCv8ZCXdCh0gFsTFoPy-YAIzxhKI1x8ktQyIQnM2TP247wX7MZd4sBlkpCpAS Server: nginx Cache-Control: no-cache, no-store reporting-endpoints: coop="https://q.stripe.com/coop-report" @@ -14,19 +14,18 @@ Access-Control-Allow-Origin: * x-stripe-routing-context-priority-tier: api-testmode x-stripe-priority-routing-enabled: true report-to: {"group":"coop","max_age":8640,"endpoints":[{"url":"https://q.stripe.com/coop-report"}],"include_subdomains":true} -request-id: req_1HCVk9gGEadOae +request-id: req_QNPI6TC1YwdFHP Content-Length: 533 Vary: Origin -Date: Fri, 31 Jan 2025 16:58:17 GMT +Date: Wed, 05 Feb 2025 22:14:22 GMT stripe-version: 2020-08-27 access-control-expose-headers: Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required access-control-max-age: 300 access-control-allow-credentials: true Content-Type: application/json -x-content-type-options: nosniff { - "id" : "seti_1QnNXoFY0qyl6XeW0DXCjJaZ", + "id" : "seti_1QpGrRFY0qyl6XeWYojpxx9P", "description" : null, "next_action" : null, "livemode" : false, @@ -38,8 +37,8 @@ x-content-type-options: nosniff ], "object" : "setup_intent", "last_setup_error" : null, - "created" : 1738342696, - "client_secret" : "seti_1QnNXoFY0qyl6XeW0DXCjJaZ_secret_Rgl3vKlXRmPaUSrSqerfjdm6BhLfLHc", + "created" : 1738793661, + "client_secret" : "seti_1QpGrRFY0qyl6XeWYojpxx9P_secret_RiiIYAAU76sETakPQWnNF56o2TcnhkH", "automatic_payment_methods" : null, "cancellation_reason" : null, "status" : "requires_payment_method" diff --git a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0005_post_v1_setup_intents_seti_1QnNXoFY0qyl6XeW0DXCjJaZ_confirm.tail b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0006_post_v1_setup_intents_seti_1QpGrRFY0qyl6XeWYojpxx9P_confirm.tail similarity index 74% rename from StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0005_post_v1_setup_intents_seti_1QnNXoFY0qyl6XeW0DXCjJaZ_confirm.tail rename to StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0006_post_v1_setup_intents_seti_1QpGrRFY0qyl6XeWYojpxx9P_confirm.tail index 54d6efeaf45..30c3e25f55c 100644 --- a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0005_post_v1_setup_intents_seti_1QnNXoFY0qyl6XeW0DXCjJaZ_confirm.tail +++ b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0006_post_v1_setup_intents_seti_1QpGrRFY0qyl6XeWYojpxx9P_confirm.tail @@ -1,9 +1,9 @@ POST -https:\/\/api\.stripe\.com\/v1\/setup_intents\/seti_1QnNXoFY0qyl6XeW0DXCjJaZ\/confirm$ +https:\/\/api\.stripe\.com\/v1\/setup_intents\/seti_1QpGrRFY0qyl6XeWYojpxx9P\/confirm$ 200 application/json access-control-allow-methods: GET, HEAD, PUT, PATCH, POST, DELETE -content-security-policy: base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=VZMvVxw5RGeWwSxHGUMHiEoU9ou2-cOfFW_abF1PLvPO8viL2NuGq7p5WGiJG7R-PuqUtBeVWEczBEuu +content-security-policy: base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=LBLtEKlxH6XSr04jG6MQLjN1nDT28a3_G9hFbW4CGJ9quOpaX32PceNJ1HtNxTFvt0TFWQcXUPYQ5en4 Server: nginx Cache-Control: no-cache, no-store reporting-endpoints: coop="https://q.stripe.com/coop-report" @@ -14,29 +14,28 @@ Access-Control-Allow-Origin: * stripe-should-retry: false x-stripe-priority-routing-enabled: true report-to: {"group":"coop","max_age":8640,"endpoints":[{"url":"https://q.stripe.com/coop-report"}],"include_subdomains":true} -request-id: req_G71hsOU2ANPi0I +request-id: req_X1DZX0UMuTV8rK x-stripe-routing-context-priority-tier: api-testmode Content-Length: 1591 Vary: Origin -Date: Fri, 31 Jan 2025 16:58:18 GMT -original-request: req_G71hsOU2ANPi0I +Date: Wed, 05 Feb 2025 22:14:23 GMT +original-request: req_X1DZX0UMuTV8rK stripe-version: 2020-08-27 -idempotency-key: 10d21cb9-12bd-4561-8b2f-ec08db38d644 +idempotency-key: d5d167cb-a553-43ed-ada9-1d53bb31ad32 access-control-expose-headers: Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required access-control-max-age: 300 access-control-allow-credentials: true Content-Type: application/json -x-content-type-options: nosniff -X-Stripe-Mock-Request: client_secret=seti_1QnNXoFY0qyl6XeW0DXCjJaZ_secret_Rgl3vKlXRmPaUSrSqerfjdm6BhLfLHc&expand\[0]=payment_method&payment_method=pm_1QnNXoFY0qyl6XeWThTF3i2m&set_as_default_payment_method=true&use_stripe_sdk=true +X-Stripe-Mock-Request: client_secret=seti_1QpGrRFY0qyl6XeWYojpxx9P_secret_RiiIYAAU76sETakPQWnNF56o2TcnhkH&expand\[0]=payment_method&payment_method=pm_1QpGrRFY0qyl6XeWiyJ0VE2P&set_as_default_payment_method=true&use_stripe_sdk=true { - "id" : "seti_1QnNXoFY0qyl6XeW0DXCjJaZ", + "id" : "seti_1QpGrRFY0qyl6XeWYojpxx9P", "description" : null, "next_action" : null, "livemode" : false, "payment_method" : { "object" : "payment_method", - "id" : "pm_1QnNXoFY0qyl6XeWThTF3i2m", + "id" : "pm_1QpGrRFY0qyl6XeWiyJ0VE2P", "billing_details" : { "email" : null, "phone" : null, @@ -77,10 +76,10 @@ X-Stripe-Mock-Request: client_secret=seti_1QnNXoFY0qyl6XeW0DXCjJaZ_secret_Rgl3vK "country" : "US" }, "livemode" : false, - "created" : 1738342696, + "created" : 1738793661, "allow_redisplay" : "always", "type" : "card", - "customer" : "cus_Rgl30fpuXslWZx" + "customer" : "cus_RiiHdYYP9mXQTY" }, "payment_method_configuration_details" : null, "usage" : "off_session", @@ -89,8 +88,8 @@ X-Stripe-Mock-Request: client_secret=seti_1QnNXoFY0qyl6XeW0DXCjJaZ_secret_Rgl3vK ], "object" : "setup_intent", "last_setup_error" : null, - "created" : 1738342696, - "client_secret" : "seti_1QnNXoFY0qyl6XeW0DXCjJaZ_secret_Rgl3vKlXRmPaUSrSqerfjdm6BhLfLHc", + "created" : 1738793661, + "client_secret" : "seti_1QpGrRFY0qyl6XeWYojpxx9P_secret_RiiIYAAU76sETakPQWnNF56o2TcnhkH", "automatic_payment_methods" : null, "cancellation_reason" : null, "status" : "succeeded" diff --git a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0006_get_v1_elements_sessions.tail b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0007_get_v1_elements_sessions.tail similarity index 93% rename from StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0006_get_v1_elements_sessions.tail rename to StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0007_get_v1_elements_sessions.tail index 840907210a1..ab057ff1247 100644 --- a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0006_get_v1_elements_sessions.tail +++ b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithDeferredSetupIntentSetAsDefault/0007_get_v1_elements_sessions.tail @@ -1,9 +1,9 @@ GET -https:\/\/api\.stripe\.com\/v1\/elements\/sessions\?customer_session_client_secret=cuss_secret_Rgl3dt57WDTrNH2pQbCGSFIIFFz2IrpIW0T12vnNLU10Xxc&deferred_intent%5Bmode%5D=setup&deferred_intent%5Bpayment_method_types%5D%5B0%5D=card&deferred_intent%5Bsetup_future_usage%5D=off_session&key=pk_test_ErsyMEOTudSjQR8hh0VrQr5X008sBXGOu6&locale=en-US&mobile_app_id=com\.stripe\.StripeiOSTestHostApp&type=deferred_intent$ +https:\/\/api\.stripe\.com\/v1\/elements\/sessions\?customer_session_client_secret=cuss_secret_RiiI8f5KB2RNxUTyyuUmS6yEPi3yxTtHhYWdm5zEEe5AKSx&deferred_intent%5Bmode%5D=setup&deferred_intent%5Bpayment_method_types%5D%5B0%5D=card&deferred_intent%5Bsetup_future_usage%5D=off_session&key=pk_test_ErsyMEOTudSjQR8hh0VrQr5X008sBXGOu6&locale=en-US&mobile_app_id=com\.stripe\.StripeiOSTestHostApp&type=deferred_intent$ 200 application/json access-control-allow-methods: GET, HEAD, PUT, PATCH, POST, DELETE -content-security-policy: base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=8wljLiUpODt2gA9P1vVi6ruZdmOoanDkynFjsUeFgXKoD9HK5Z_tbkCism1B993s-xSOrgTJSiwr7IXq +content-security-policy: base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=ZxZeF4FQA_9naN76HjPbGb65iHHjoiOt2R5iCgH1mpEoFspTP8NadtJbHuHBsnT_Koa3x6ogoI1c5zyj Server: nginx Cache-Control: no-cache, no-store reporting-endpoints: coop="https://q.stripe.com/coop-report" @@ -14,10 +14,10 @@ Access-Control-Allow-Origin: * x-stripe-routing-context-priority-tier: api-testmode x-stripe-priority-routing-enabled: true report-to: {"group":"coop","max_age":8640,"endpoints":[{"url":"https://q.stripe.com/coop-report"}],"include_subdomains":true} -request-id: req_xpGPUAbbHkaEUG -Content-Length: 18245 +request-id: req_tiarhizImtgA1W +Content-Length: 18345 Vary: Origin -Date: Fri, 31 Jan 2025 16:58:22 GMT +Date: Wed, 05 Feb 2025 22:14:26 GMT stripe-version: 2020-08-27 access-control-expose-headers: Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required access-control-max-age: 300 @@ -167,7 +167,7 @@ Content-Type: application/json "elements_spm_max_visible_payment_methods" : false, "elements_disable_link_email_otp" : false, "cbc_in_link_popup" : true, - "elements_disable_progressive_cursor" : true, + "elements_disable_progressive_cursor" : false, "elements_enable_external_payment_method_picpay" : false, "elements_enable_external_payment_method_planpay" : false, "elements_enable_external_payment_method_samsung_pay" : false, @@ -192,7 +192,7 @@ Content-Type: application/json "elements_enable_external_payment_method_mybank" : false }, "merchant_logo_url" : null, - "session_id" : "elements_session_1NMfoyHbRGz", + "session_id" : "elements_session_1rg2YJmGEKE", "card_installments_enabled" : false, "account_id" : "acct_1G6m1pFY0qyl6XeW", "merchant_id" : "acct_1G6m1pFY0qyl6XeW", @@ -221,9 +221,9 @@ Content-Type: application/json "paypal_merchant_id" : null }, "experiments_data" : { - "arb_id" : "72cbe332-422b-4e86-9d50-46f37b8e2e0e", + "arb_id" : "6ba312ce-8aa2-4f6c-8db0-b77d23958d5f", "experiment_metadata" : { - "seed" : "b0163e9cf440b89cf81077daeea505b888c2d2c769df3dd770fa36728ed2d1e8", + "seed" : "9b0424a6c822c9d049e1245c834c1658932b02d87684324ca862d43e128332e4", "semi_dominant_payment_methods" : [ ] @@ -277,6 +277,7 @@ Content-Type: application/json "link_bank_onboarding_enabled" : false, "link_hcaptcha_rqdata" : null, "link_user_session_id_accuracy_test" : false, + "link_lookup_hcaptcha_enabled" : false, "link_financial_incentives_experiment_enabled" : false, "link_passthrough_mode_enabled" : false, "link_no_code_default_values_identification" : true, @@ -332,7 +333,7 @@ Content-Type: application/json "payment_methods" : [ { "object" : "payment_method", - "id" : "pm_1QnNXoFY0qyl6XeWThTF3i2m", + "id" : "pm_1QpGrRFY0qyl6XeWiyJ0VE2P", "billing_details" : { "email" : null, "phone" : null, @@ -373,17 +374,17 @@ Content-Type: application/json "country" : "US" }, "livemode" : false, - "created" : 1738342696, + "created" : 1738793661, "allow_redisplay" : "always", "type" : "card", - "customer" : "cus_Rgl30fpuXslWZx" + "customer" : "cus_RiiHdYYP9mXQTY" } ], "payment_methods_with_link_details" : [ { "payment_method" : { "object" : "payment_method", - "id" : "pm_1QnNXoFY0qyl6XeWThTF3i2m", + "id" : "pm_1QpGrRFY0qyl6XeWiyJ0VE2P", "billing_details" : { "email" : null, "phone" : null, @@ -424,19 +425,19 @@ Content-Type: application/json "country" : "US" }, "livemode" : false, - "created" : 1738342696, + "created" : 1738793661, "allow_redisplay" : "always", "type" : "card", - "customer" : "cus_Rgl30fpuXslWZx" + "customer" : "cus_RiiHdYYP9mXQTY" }, "link_payment_details" : null } ], - "default_payment_method" : "pm_1QnNXoFY0qyl6XeWThTF3i2m", + "default_payment_method" : "pm_1QpGrRFY0qyl6XeWiyJ0VE2P", "customer_session" : { "object" : "customer_session", - "api_key_expiry" : 1738344496, - "id" : "cuss_1QnNXnFY0qyl6XeWQmAQad6r", + "api_key_expiry" : 1738795460, + "id" : "cuss_1QpGrQFY0qyl6XeWlsgca3TN", "livemode" : false, "components" : { "customer_sheet" : { @@ -449,16 +450,17 @@ Content-Type: application/json "mobile_payment_element" : { "enabled" : true, "features" : { - "payment_method_remove" : "enabled", + "payment_method_save_allow_redisplay_override" : null, + "payment_method_redisplay" : "enabled", "payment_method_save" : "enabled", + "payment_method_set_as_default" : "enabled", "payment_method_allow_redisplay_filters" : [ "unspecified", "limited", "always" ], - "payment_method_save_allow_redisplay_override" : null, - "payment_method_remove_last" : "enabled", - "payment_method_redisplay" : "enabled" + "payment_method_remove" : "enabled", + "payment_method_remove_last" : "enabled" } }, "payment_element" : { @@ -469,8 +471,8 @@ Content-Type: application/json "enabled" : false } }, - "customer" : "cus_Rgl30fpuXslWZx", - "api_key" : "ek_test_YWNjdF8xRzZtMXBGWTBxeWw2WGVXLGlJN0pRanI5S2p5UXRIQTdwaUdjOWNmeUtvNWtrT2w_00qUKnCYDv" + "customer" : "cus_RiiHdYYP9mXQTY", + "api_key" : "ek_test_YWNjdF8xRzZtMXBGWTBxeWw2WGVXLE1hazlZaG1ncGVOOUtJWFVtQWpZSVhVcFNNb05wdk0_00mFSaJV8O" } }, "klarna_express_config" : { diff --git a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithPaymentIntentSetAsDefault/0000_post_create_ephemeral_key.tail b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithPaymentIntentSetAsDefault/0000_post_create_ephemeral_key.tail index 2126ea21885..535888ccde3 100644 --- a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithPaymentIntentSetAsDefault/0000_post_create_ephemeral_key.tail +++ b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithPaymentIntentSetAsDefault/0000_post_create_ephemeral_key.tail @@ -4,15 +4,15 @@ https:\/\/stp-mobile-ci-test-backend-e1b3\.stripedemos\.com\/create_ephemeral_ke text/html Content-Type: text/html;charset=utf-8 Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 -Set-Cookie: rack.session=qSiwBiaC8gzTDXC5rK1oZEmATRZrXLUuobKT%2FlbiJ65O7a7HaiG95eN35TO0Y%2Beif3IdiDmLYiHEhnMZmu5vIreKujfZdaeLKec1WAOhkf5gsoayM%2BSJvOgQFRfef72ZdIfJeVIoRsqLrHHQxx0L3LnHRN8FZDs8AuRgTcf3KFNJTwBYvrKoLKIYgvjNRNgpuSMu5Gnd3l51hluEuB8uxKtccE45SU%2FD9oaRSGYi4ps%3D; path=/ +Set-Cookie: rack.session=C3es1Bgxy7%2BRJB9S%2BwCy8g1WSVodOsEedCaz%2F%2FUGyLaUdyDB0rpwG1UAcEaXpJiZw44VqrAt4mF%2FmxkW3s7mdVTgglfsN%2F8hN7ojwl2zwgJZ%2Bm9ResStbWRHKxl09yNnKju1JUH8khgGEacsCOQOPuH1ReNs2jfWgod7oWmatoQwGLddXgx2EkIzruRM7fKLy3Iws7epOjkx6hSb0XgIilGzt8hoe2Hx7nE5ypK9n%2BY%3D; path=/ Server: Google Frontend -x-cloud-trace-context: db1fdb94a0320a3c13d9b8f53ba9a6bb;o=1 +x-cloud-trace-context: c045d1f842e35e53afa6b46ddf7af415;o=1 Via: 1.1 google x-xss-protection: 1; mode=block -Date: Tue, 28 Jan 2025 19:43:25 GMT +Date: Wed, 05 Feb 2025 22:12:34 GMT x-robots-tag: noindex, nofollow Content-Length: 149 x-content-type-options: nosniff x-frame-options: SAMEORIGIN -{"ephemeral_key_secret":"ek_test_YWNjdF8xRzZtMXBGWTBxeWw2WGVXLFByR2ZaaldWZUxLS0xPTTU4QlRDQlJWdlhiaTdScVU_00UPifaFnz","customer":"cus_Rfg38S8M5wgitm"} \ No newline at end of file +{"ephemeral_key_secret":"ek_test_YWNjdF8xRzZtMXBGWTBxeWw2WGVXLHkxQUdlM3Y4TTgweGpxOFhIdXV0TUxyUEZmT093Y0M_001fiunI8Z","customer":"cus_RiiGhVe1tvdrla"} \ No newline at end of file diff --git a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithPaymentIntentSetAsDefault/0001_post_create_customer_session_cs.tail b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithPaymentIntentSetAsDefault/0001_post_create_customer_session_cs.tail index cfb97312fb3..f2ff548e0b8 100644 --- a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithPaymentIntentSetAsDefault/0001_post_create_customer_session_cs.tail +++ b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithPaymentIntentSetAsDefault/0001_post_create_customer_session_cs.tail @@ -4,15 +4,15 @@ https:\/\/stp-mobile-ci-test-backend-e1b3\.stripedemos\.com\/create_customer_ses text/html Content-Type: text/html;charset=utf-8 Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 -Set-Cookie: rack.session=uk%2BCHmQwIxbJAxqWaXgRFItqHAB1R8JLYynRIvR7HYX1EVZRvQBUN%2BwLoHD56mEVQud9TqMp7PnXN%2FAnS7LxvhtCXW1FDwzKNdtb6ApZUDZKpJWwqd%2FpRiW2Cu6GIZbYWVV3waDQ5oE8cXCde6olHFAJazsXTorwVcXvNSohu6JK0hcZcpD2W2SkwCj89lzt0W7ioGTdnzfJqW5S6aISrptSRDo2STNFBNVFlE8S4w0%3D; path=/ +Set-Cookie: rack.session=8qgg6QxsEIQada1VdVOIvErQD%2B7ReKbwBKB9L%2FKOA1fOuKLvYBg7UBEcYuvsvSsEjEHdfSj4Of54JJ%2F7pNBk5yvVWh8WHvof9WPK4HKGIPpiYZHoj3zSDflVD1O4jXXCDG8W6kAfknCg2CcKIM%2FsaMHZt8WiDMhxKRhEHMcPkeMBsviyLAmUKnqdZP7DgraYqVmLdJC28DGY5tYZOb0bW5nIcIf0jWKkqIOk5m7fUA8%3D; path=/ Server: Google Frontend -x-cloud-trace-context: 8759097d7a904fba697d406e865b37c3 +x-cloud-trace-context: 9f74a9f8d70a3a53beea79748654d557 Via: 1.1 google x-xss-protection: 1; mode=block -Date: Tue, 28 Jan 2025 19:43:25 GMT +Date: Wed, 05 Feb 2025 22:12:35 GMT x-robots-tag: noindex, nofollow Content-Length: 128 x-content-type-options: nosniff x-frame-options: SAMEORIGIN -{"customer_session_client_secret":"cuss_secret_Rfg3WUL7wDK0fLd2281Q68unrVV47BQZGpXo0yk9jAEaHKn","customer":"cus_Rfg38S8M5wgitm"} \ No newline at end of file +{"customer_session_client_secret":"cuss_secret_RiiGSz6JpKuguZqlei0hzEnVqvB0Ir9lFfKrdnIuDCE2BXc","customer":"cus_RiiGhVe1tvdrla"} \ No newline at end of file diff --git a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithPaymentIntentSetAsDefault/0002_post_create_payment_intent.tail b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithPaymentIntentSetAsDefault/0002_post_create_payment_intent.tail index dd8560edaee..d7f53e2ffe2 100644 --- a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithPaymentIntentSetAsDefault/0002_post_create_payment_intent.tail +++ b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithPaymentIntentSetAsDefault/0002_post_create_payment_intent.tail @@ -4,15 +4,15 @@ https:\/\/stp-mobile-ci-test-backend-e1b3\.stripedemos\.com\/create_payment_inte text/html Content-Type: text/html;charset=utf-8 Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 -Set-Cookie: rack.session=mpOIQJ2kSs%2BI6VcLP%2BGk%2BvqpJA4xcDB7FX%2BbhGMaPtlWbPswKflNaf3qWQce3BSA5JNUJZ6oP9OBFBQLDuwe09edjN7YaI%2Fa3tzMHwU00xWf3T3rAjHtsb%2BEo5RPZIT9iXJvMQG6dQ5CKAWRFigKCyRgxjXiY3RPPC0jmJOXVLMqdVwtM2xdoHQcGyNXhhwI%2B73LLwmQo0oLeDjPnomKNTB3ZDfd1fRU1EBhI9%2FgouA%3D; path=/ +Set-Cookie: rack.session=O4yzqTHQn16h2lPGW0%2FW0HdWpM3OMOfIAwKASax2VxfDt%2FChsefu6jDP1pGXsW%2BM5FUJV%2BufU%2FuNJuJXfILqZNgYSKMRIKV%2BOCzJayZuU%2BhHCn0W62577o2Nhtj9NlTWNasNLNY6p1AkkWYN6eFiau5ffpc1SybpZ1aW3uT3HUTWMDN5J%2FcZVQywHEPQ8crB4U02egr%2F6es%2Bvf67YvfmAXBbaXWT6ATL7aeWt%2BxK97U%3D; path=/ Server: Google Frontend -x-cloud-trace-context: c7e2d4ff61fcba216ace051929c1468b +x-cloud-trace-context: 034e20efc5294fba1d7474da8a26c1ca Via: 1.1 google x-xss-protection: 1; mode=block -Date: Tue, 28 Jan 2025 19:43:25 GMT +Date: Wed, 05 Feb 2025 22:12:35 GMT x-robots-tag: noindex, nofollow Content-Length: 147 x-content-type-options: nosniff x-frame-options: SAMEORIGIN -{"intent":"pi_3QmKgzFY0qyl6XeW1AAWRXRU","secret":"pi_3QmKgzFY0qyl6XeW1AAWRXRU_secret_TyeVzichB09mH7s3sRTltB6zO","status":"requires_payment_method"} \ No newline at end of file +{"intent":"pi_3QpGpjFY0qyl6XeW0qNtmYXp","secret":"pi_3QpGpjFY0qyl6XeW0qNtmYXp_secret_1ExpC4Hb1OdQADOwgzfg7tHt4","status":"requires_payment_method"} \ No newline at end of file diff --git a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithPaymentIntentSetAsDefault/0003_get_v1_elements_sessions.tail b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithPaymentIntentSetAsDefault/0003_get_v1_elements_sessions.tail index 402575b0827..5a66df93a97 100644 --- a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithPaymentIntentSetAsDefault/0003_get_v1_elements_sessions.tail +++ b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithPaymentIntentSetAsDefault/0003_get_v1_elements_sessions.tail @@ -1,9 +1,9 @@ GET -https:\/\/api\.stripe\.com\/v1\/elements\/sessions\?client_secret=pi_3QmKgzFY0qyl6XeW1AAWRXRU_secret_TyeVzichB09mH7s3sRTltB6zO&customer_session_client_secret=cuss_secret_Rfg3WUL7wDK0fLd2281Q68unrVV47BQZGpXo0yk9jAEaHKn&expand%5B0%5D=payment_method_preference\.payment_intent\.payment_method&locale=en-US&mobile_app_id=com\.stripe\.StripeiOSTestHostApp&type=payment_intent$ +https:\/\/api\.stripe\.com\/v1\/elements\/sessions\?client_secret=pi_3QpGpjFY0qyl6XeW0qNtmYXp_secret_1ExpC4Hb1OdQADOwgzfg7tHt4&customer_session_client_secret=cuss_secret_RiiGSz6JpKuguZqlei0hzEnVqvB0Ir9lFfKrdnIuDCE2BXc&expand%5B0%5D=payment_method_preference\.payment_intent\.payment_method&locale=en-US&mobile_app_id=com\.stripe\.StripeiOSTestHostApp&type=payment_intent$ 200 application/json access-control-allow-methods: GET, HEAD, PUT, PATCH, POST, DELETE -content-security-policy: base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=72jS9lsHcgY4wQ6817dxj-kxQdUEetuTiXYQfBDgSTx1CfWDNngQhTZLjOjYMWA5Pq0oM0DqelH-6Xz_ +content-security-policy: base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=cFdVR4NSpO4G9YuVMNkoNxooGw8Ihsq69e78yHE1mWLIGdLBmvtIh2P6fDkh_Og3mtcwc0oIekgFvowj Server: nginx Cache-Control: no-cache, no-store reporting-endpoints: coop="https://q.stripe.com/coop-report" @@ -14,16 +14,15 @@ Access-Control-Allow-Origin: * x-stripe-routing-context-priority-tier: api-testmode x-stripe-priority-routing-enabled: true report-to: {"group":"coop","max_age":8640,"endpoints":[{"url":"https://q.stripe.com/coop-report"}],"include_subdomains":true} -request-id: req_w53r1sq5HqSHLM -Content-Length: 16683 +request-id: req_J6Izyvwj9dasig +Content-Length: 16769 Vary: Origin -Date: Tue, 28 Jan 2025 19:43:26 GMT +Date: Wed, 05 Feb 2025 22:12:35 GMT stripe-version: 2020-08-27 access-control-expose-headers: Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required access-control-max-age: 300 access-control-allow-credentials: true Content-Type: application/json -x-content-type-options: nosniff { "payment_method_preference" : { @@ -51,12 +50,12 @@ x-content-type-options: nosniff "next_action" : null, "status" : "requires_payment_method", "payment_method" : null, - "client_secret" : "pi_3QmKgzFY0qyl6XeW1AAWRXRU_secret_TyeVzichB09mH7s3sRTltB6zO", + "client_secret" : "pi_3QpGpjFY0qyl6XeW0qNtmYXp_secret_1ExpC4Hb1OdQADOwgzfg7tHt4", "total_details" : { "amount_discount" : 0, "amount_tax" : 0 }, - "id" : "pi_3QmKgzFY0qyl6XeW1AAWRXRU", + "id" : "pi_3QpGpjFY0qyl6XeW0qNtmYXp", "confirmation_method" : "automatic", "amount_details" : { "tip" : { @@ -69,7 +68,7 @@ x-content-type-options: nosniff "card" ], "setup_future_usage" : null, - "created" : 1738093405, + "created" : 1738793555, "description" : null }, "ordered_payment_method_types" : [ @@ -211,7 +210,7 @@ x-content-type-options: nosniff "elements_spm_max_visible_payment_methods" : false, "elements_disable_link_email_otp" : false, "cbc_in_link_popup" : true, - "elements_disable_progressive_cursor" : true, + "elements_disable_progressive_cursor" : false, "elements_enable_external_payment_method_picpay" : false, "elements_enable_external_payment_method_planpay" : false, "elements_enable_external_payment_method_samsung_pay" : false, @@ -236,7 +235,7 @@ x-content-type-options: nosniff "elements_enable_external_payment_method_mybank" : false }, "merchant_logo_url" : null, - "session_id" : "elements_session_0bmjniyQD4Y", + "session_id" : "elements_session_05AJsGO3bu3", "card_installments_enabled" : false, "account_id" : "acct_1G6m1pFY0qyl6XeW", "merchant_id" : "acct_1G6m1pFY0qyl6XeW", @@ -265,9 +264,9 @@ x-content-type-options: nosniff "paypal_merchant_id" : null }, "experiments_data" : { - "arb_id" : "f1e14392-1ddf-43e3-b39b-ec5fe716d71e", + "arb_id" : "3ac9007e-2d4f-421e-b003-36e818040907", "experiment_metadata" : { - "seed" : "d5c3834c45b4c146f026511c88653a3f02d6f2192904d31b0f78d9c1207964cd", + "seed" : "9b0424a6c822c9d049e1245c834c1658932b02d87684324ca862d43e128332e4", "semi_dominant_payment_methods" : [ ] @@ -321,6 +320,7 @@ x-content-type-options: nosniff "link_bank_onboarding_enabled" : false, "link_hcaptcha_rqdata" : null, "link_user_session_id_accuracy_test" : false, + "link_lookup_hcaptcha_enabled" : false, "link_financial_incentives_experiment_enabled" : false, "link_passthrough_mode_enabled" : false, "link_no_code_default_values_identification" : true, @@ -329,10 +329,10 @@ x-content-type-options: nosniff "link_crypto_onramp_elements_logout_disabled" : false, "link_mode" : null, "link_no_code_default_values_usage" : true, - "link_instant_debits_new_incentive_display_enabled" : false, + "link_popup_smart_defaults_enabled" : false, "link_hcaptcha_site_key" : "20000000-ffff-ffff-ffff-000000000002", "link_crypto_onramp_force_cvc_reverification" : false, - "link_popup_smart_defaults_enabled" : false, + "link_wanderlust_in_elements_enabled" : false, "link_email_verification_login_enabled" : false, "link_only_for_payment_method_types_enabled" : false, "link_bank_incentives_enabled" : false, @@ -382,8 +382,8 @@ x-content-type-options: nosniff "default_payment_method" : null, "customer_session" : { "object" : "customer_session", - "api_key_expiry" : 1738095206, - "id" : "cuss_1QmKgzFY0qyl6XeWDRnTI848", + "api_key_expiry" : 1738795355, + "id" : "cuss_1QpGpjFY0qyl6XeW4XBKJiZw", "livemode" : false, "components" : { "customer_sheet" : { @@ -396,16 +396,17 @@ x-content-type-options: nosniff "mobile_payment_element" : { "enabled" : true, "features" : { - "payment_method_remove" : "enabled", + "payment_method_save_allow_redisplay_override" : null, + "payment_method_redisplay" : "enabled", "payment_method_save" : "enabled", + "payment_method_set_as_default" : "enabled", "payment_method_allow_redisplay_filters" : [ "unspecified", "limited", "always" ], - "payment_method_save_allow_redisplay_override" : null, - "payment_method_remove_last" : "enabled", - "payment_method_redisplay" : "enabled" + "payment_method_remove" : "enabled", + "payment_method_remove_last" : "enabled" } }, "payment_element" : { @@ -416,8 +417,8 @@ x-content-type-options: nosniff "enabled" : false } }, - "customer" : "cus_Rfg38S8M5wgitm", - "api_key" : "ek_test_YWNjdF8xRzZtMXBGWTBxeWw2WGVXLEhTeElpWjdUYlBKd0N3TERCWkR4dW1NT1U5bHRGeHU_00fc86KCsK" + "customer" : "cus_RiiGhVe1tvdrla", + "api_key" : "ek_test_YWNjdF8xRzZtMXBGWTBxeWw2WGVXLExONGM2MGkydjZGcldMbEZNWGNCVkttdTJSQUp3TTA_00fFSJ6r68" } }, "klarna_express_config" : { diff --git a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithPaymentIntentSetAsDefault/0004_post_v1_payment_intents_pi_3QmKgzFY0qyl6XeW1AAWRXRU_confirm.tail b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithPaymentIntentSetAsDefault/0004_post_v1_payment_intents_pi_3QpGpjFY0qyl6XeW0qNtmYXp_confirm.tail similarity index 82% rename from StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithPaymentIntentSetAsDefault/0004_post_v1_payment_intents_pi_3QmKgzFY0qyl6XeW1AAWRXRU_confirm.tail rename to StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithPaymentIntentSetAsDefault/0004_post_v1_payment_intents_pi_3QpGpjFY0qyl6XeW0qNtmYXp_confirm.tail index 54fcdc3660f..a26e7ea02e7 100644 --- a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithPaymentIntentSetAsDefault/0004_post_v1_payment_intents_pi_3QmKgzFY0qyl6XeW1AAWRXRU_confirm.tail +++ b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithPaymentIntentSetAsDefault/0004_post_v1_payment_intents_pi_3QpGpjFY0qyl6XeW0qNtmYXp_confirm.tail @@ -1,9 +1,9 @@ POST -https:\/\/api\.stripe\.com\/v1\/payment_intents\/pi_3QmKgzFY0qyl6XeW1AAWRXRU\/confirm$ +https:\/\/api\.stripe\.com\/v1\/payment_intents\/pi_3QpGpjFY0qyl6XeW0qNtmYXp\/confirm$ 200 application/json access-control-allow-methods: GET, HEAD, PUT, PATCH, POST, DELETE -content-security-policy: base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=aPAALdWLf0r1r1E9Kc1yTT6PpMBesLQMHHmd5dnuJ9_AltcmYcNBkFTRzCuh1sTONe2_Hy3tOMh4-P7o +content-security-policy: base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=YeltoBDzMDMAKqZ9lo0JR1z0x0H7TBa0XM-PJyuVYP-4AsJfLyrHZmuTp70a_NAPa-oOkT93luTu91vC Server: nginx Cache-Control: no-cache, no-store reporting-endpoints: coop="https://q.stripe.com/coop-report" @@ -14,20 +14,19 @@ Access-Control-Allow-Origin: * stripe-should-retry: false x-stripe-priority-routing-enabled: true report-to: {"group":"coop","max_age":8640,"endpoints":[{"url":"https://q.stripe.com/coop-report"}],"include_subdomains":true} -request-id: req_UbR39gPYnLT3pk +request-id: req_Q0bDfkTGIccPUT x-stripe-routing-context-priority-tier: api-testmode Content-Length: 2305 Vary: Origin -Date: Tue, 28 Jan 2025 19:43:27 GMT -original-request: req_UbR39gPYnLT3pk +Date: Wed, 05 Feb 2025 22:12:37 GMT +original-request: req_Q0bDfkTGIccPUT stripe-version: 2020-08-27 -idempotency-key: 7f70de30-fc7e-4eae-9978-237f2e63a108 +idempotency-key: bfaad305-315a-4a6a-8cd4-3934bc5a9634 access-control-expose-headers: Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required access-control-max-age: 300 access-control-allow-credentials: true Content-Type: application/json -x-content-type-options: nosniff -X-Stripe-Mock-Request: client_secret=pi_3QmKgzFY0qyl6XeW1AAWRXRU_secret_TyeVzichB09mH7s3sRTltB6zO&expand\[0]=payment_method&payment_method_data\[allow_redisplay]=always&payment_method_data\[card]\[cvc]=123&payment_method_data\[card]\[exp_month]=12&payment_method_data\[card]\[exp_year]=32&payment_method_data\[card]\[number]=4242424242424242&payment_method_data\[payment_user_agent]=.*&payment_method_data\[type]=card&payment_method_options\[card]\[setup_future_usage]=off_session&set_as_default_payment_method=true&shipping\[address]\[country]=US&shipping\[address]\[line1]=Line%201&shipping\[name]=Jane%20Doe&shipping\[phone]=5551234567&use_stripe_sdk=true +X-Stripe-Mock-Request: client_secret=pi_3QpGpjFY0qyl6XeW0qNtmYXp_secret_1ExpC4Hb1OdQADOwgzfg7tHt4&expand\[0]=payment_method&payment_method_data\[allow_redisplay]=always&payment_method_data\[card]\[cvc]=123&payment_method_data\[card]\[exp_month]=12&payment_method_data\[card]\[exp_year]=32&payment_method_data\[card]\[number]=4242424242424242&payment_method_data\[payment_user_agent]=.*&payment_method_data\[type]=card&payment_method_options\[card]\[setup_future_usage]=off_session&set_as_default_payment_method=true&shipping\[address]\[country]=US&shipping\[address]\[line1]=Line%201&shipping\[name]=Jane%20Doe&shipping\[phone]=5551234567&use_stripe_sdk=true { "payment_method_configuration_details" : null, @@ -65,7 +64,7 @@ X-Stripe-Mock-Request: client_secret=pi_3QmKgzFY0qyl6XeW1AAWRXRU_secret_TyeVzich "status" : "succeeded", "payment_method" : { "object" : "payment_method", - "id" : "pm_1QmKh0FY0qyl6XeWjHUFjRgd", + "id" : "pm_1QpGpkFY0qyl6XeWRwvYhpxA", "billing_details" : { "email" : null, "phone" : null, @@ -106,17 +105,17 @@ X-Stripe-Mock-Request: client_secret=pi_3QmKgzFY0qyl6XeW1AAWRXRU_secret_TyeVzich "country" : "US" }, "livemode" : false, - "created" : 1738093406, + "created" : 1738793556, "allow_redisplay" : "always", "type" : "card", - "customer" : "cus_Rfg38S8M5wgitm" + "customer" : "cus_RiiGhVe1tvdrla" }, - "client_secret" : "pi_3QmKgzFY0qyl6XeW1AAWRXRU_secret_TyeVzichB09mH7s3sRTltB6zO", + "client_secret" : "pi_3QpGpjFY0qyl6XeW0qNtmYXp_secret_1ExpC4Hb1OdQADOwgzfg7tHt4", "total_details" : { "amount_discount" : 0, "amount_tax" : 0 }, - "id" : "pi_3QmKgzFY0qyl6XeW1AAWRXRU", + "id" : "pi_3QpGpjFY0qyl6XeW0qNtmYXp", "confirmation_method" : "automatic", "amount_details" : { "tip" : { @@ -129,6 +128,6 @@ X-Stripe-Mock-Request: client_secret=pi_3QmKgzFY0qyl6XeW1AAWRXRU_secret_TyeVzich "card" ], "setup_future_usage" : null, - "created" : 1738093405, + "created" : 1738793555, "description" : null } \ No newline at end of file diff --git a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithPaymentIntentSetAsDefault/0005_get_v1_payment_intents_pi_3QmKgzFY0qyl6XeW1AAWRXRU.tail b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithPaymentIntentSetAsDefault/0005_get_v1_payment_intents_pi_3QpGpjFY0qyl6XeW0qNtmYXp.tail similarity index 78% rename from StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithPaymentIntentSetAsDefault/0005_get_v1_payment_intents_pi_3QmKgzFY0qyl6XeW1AAWRXRU.tail rename to StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithPaymentIntentSetAsDefault/0005_get_v1_payment_intents_pi_3QpGpjFY0qyl6XeW0qNtmYXp.tail index 390a642f328..5dd612a1750 100644 --- a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithPaymentIntentSetAsDefault/0005_get_v1_payment_intents_pi_3QmKgzFY0qyl6XeW1AAWRXRU.tail +++ b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithPaymentIntentSetAsDefault/0005_get_v1_payment_intents_pi_3QpGpjFY0qyl6XeW0qNtmYXp.tail @@ -1,9 +1,9 @@ GET -https:\/\/api\.stripe\.com\/v1\/payment_intents\/pi_3QmKgzFY0qyl6XeW1AAWRXRU\?client_secret=pi_3QmKgzFY0qyl6XeW1AAWRXRU_secret_TyeVzichB09mH7s3sRTltB6zO$ +https:\/\/api\.stripe\.com\/v1\/payment_intents\/pi_3QpGpjFY0qyl6XeW0qNtmYXp\?client_secret=pi_3QpGpjFY0qyl6XeW0qNtmYXp_secret_1ExpC4Hb1OdQADOwgzfg7tHt4$ 200 application/json access-control-allow-methods: GET, HEAD, PUT, PATCH, POST, DELETE -content-security-policy: base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=NOwwzK-UjAEmOSy0w-fo5BEwxb9qSJ8NHWxP3E6K-DzEh8Xfy6IOaBq74_1xSgh9f9zBaD_2K07qh6LR +content-security-policy: base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=h3xbEdK9depv58xVFuZvP5Okn-NklOjh7Hog2rjp88f_HKDFyKey7T1dcPuAFZnoVcUgtWBCzcog9cSy Server: nginx Cache-Control: no-cache, no-store reporting-endpoints: coop="https://q.stripe.com/coop-report" @@ -14,16 +14,15 @@ Access-Control-Allow-Origin: * x-stripe-routing-context-priority-tier: api-testmode x-stripe-priority-routing-enabled: true report-to: {"group":"coop","max_age":8640,"endpoints":[{"url":"https://q.stripe.com/coop-report"}],"include_subdomains":true} -request-id: req_TjZKomYmMK47tX +request-id: req_HJafMVOqQEJtGO Content-Length: 1258 Vary: Origin -Date: Tue, 28 Jan 2025 19:43:27 GMT +Date: Wed, 05 Feb 2025 22:12:37 GMT stripe-version: 2020-08-27 access-control-expose-headers: Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required access-control-max-age: 300 access-control-allow-credentials: true Content-Type: application/json -x-content-type-options: nosniff { "payment_method_configuration_details" : null, @@ -59,13 +58,13 @@ x-content-type-options: nosniff "cancellation_reason" : null, "next_action" : null, "status" : "succeeded", - "payment_method" : "pm_1QmKh0FY0qyl6XeWjHUFjRgd", - "client_secret" : "pi_3QmKgzFY0qyl6XeW1AAWRXRU_secret_TyeVzichB09mH7s3sRTltB6zO", + "payment_method" : "pm_1QpGpkFY0qyl6XeWRwvYhpxA", + "client_secret" : "pi_3QpGpjFY0qyl6XeW0qNtmYXp_secret_1ExpC4Hb1OdQADOwgzfg7tHt4", "total_details" : { "amount_discount" : 0, "amount_tax" : 0 }, - "id" : "pi_3QmKgzFY0qyl6XeW1AAWRXRU", + "id" : "pi_3QpGpjFY0qyl6XeW0qNtmYXp", "confirmation_method" : "automatic", "amount_details" : { "tip" : { @@ -78,6 +77,6 @@ x-content-type-options: nosniff "card" ], "setup_future_usage" : null, - "created" : 1738093405, + "created" : 1738793555, "description" : null } \ No newline at end of file diff --git a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithPaymentIntentSetAsDefault/0006_post_create_payment_intent.tail b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithPaymentIntentSetAsDefault/0006_post_create_payment_intent.tail index 53184c9cbf4..4a28214d935 100644 --- a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithPaymentIntentSetAsDefault/0006_post_create_payment_intent.tail +++ b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithPaymentIntentSetAsDefault/0006_post_create_payment_intent.tail @@ -4,15 +4,15 @@ https:\/\/stp-mobile-ci-test-backend-e1b3\.stripedemos\.com\/create_payment_inte text/html Content-Type: text/html;charset=utf-8 Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 -Set-Cookie: rack.session=Ar6ZfPuLObqOpqjFBlfjI7vCH48KbbKgJr5YeCUft5tnNTR2II5yE7n1y9XX8He5Yd4n815hdN8PkDCKT8Wwo%2FRGNUAGBpEj6bzGMqukjC%2FrFnEgm4HH8T%2FeN4aFTJGvgtcTSaZDY8ZMAtcz%2BPHYb7ZFNIrnITWLn9VwK21l74A27wAH3RpQk2xnu2covoYJvOYS339wB02ma%2BFTMwStwsWbf9EuBJdUtGW1DSOTwRk%3D; path=/ +Set-Cookie: rack.session=3zMi6usZDHZiLnA%2BTmirh%2FcneMoAnPXdLr8ZAvsT%2BcGax2Pd5ClA6d6KdY0CaY0r5ub7c9L3Fkbou5zthDVxFPazF6MOsXP2jICidcBJUAe6E%2Fr3O1RLnTDgWhO4jY%2BWCmNDhVntgxGfI8wWxNYOQ%2B4uSF7R62h46G9xenqu0YTv%2FXDwvCM%2B9SGxSiCjGOq3NIO3rSzsArUeDtfte0Xc6QOj%2Fs4kVhqEZLI98Nf8X0g%3D; path=/ Server: Google Frontend -x-cloud-trace-context: 5a1ca5b405b5ca2dab171aa59881f464 +x-cloud-trace-context: 1fd5a2fa609e80c9be77578467b315cc Via: 1.1 google x-xss-protection: 1; mode=block -Date: Tue, 28 Jan 2025 19:43:28 GMT +Date: Wed, 05 Feb 2025 22:12:38 GMT x-robots-tag: noindex, nofollow Content-Length: 147 x-content-type-options: nosniff x-frame-options: SAMEORIGIN -{"intent":"pi_3QmKh2FY0qyl6XeW1zYxxIpP","secret":"pi_3QmKh2FY0qyl6XeW1zYxxIpP_secret_XDh3vf7vu0EG57qpQvoZb0PAi","status":"requires_payment_method"} \ No newline at end of file +{"intent":"pi_3QpGplFY0qyl6XeW1fWYjfpQ","secret":"pi_3QpGplFY0qyl6XeW1fWYjfpQ_secret_ab5VVHeEBN0k5oj1rNpdzuh8r","status":"requires_payment_method"} \ No newline at end of file diff --git a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithPaymentIntentSetAsDefault/0007_get_v1_elements_sessions.tail b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithPaymentIntentSetAsDefault/0007_get_v1_elements_sessions.tail index 6c236b58b68..e1cb1796907 100644 --- a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithPaymentIntentSetAsDefault/0007_get_v1_elements_sessions.tail +++ b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithPaymentIntentSetAsDefault/0007_get_v1_elements_sessions.tail @@ -1,9 +1,9 @@ GET -https:\/\/api\.stripe\.com\/v1\/elements\/sessions\?client_secret=pi_3QmKh2FY0qyl6XeW1zYxxIpP_secret_XDh3vf7vu0EG57qpQvoZb0PAi&customer_session_client_secret=cuss_secret_Rfg3WUL7wDK0fLd2281Q68unrVV47BQZGpXo0yk9jAEaHKn&expand%5B0%5D=payment_method_preference\.payment_intent\.payment_method&locale=en-US&mobile_app_id=com\.stripe\.StripeiOSTestHostApp&type=payment_intent$ +https:\/\/api\.stripe\.com\/v1\/elements\/sessions\?client_secret=pi_3QpGplFY0qyl6XeW1fWYjfpQ_secret_ab5VVHeEBN0k5oj1rNpdzuh8r&customer_session_client_secret=cuss_secret_RiiGSz6JpKuguZqlei0hzEnVqvB0Ir9lFfKrdnIuDCE2BXc&expand%5B0%5D=payment_method_preference\.payment_intent\.payment_method&locale=en-US&mobile_app_id=com\.stripe\.StripeiOSTestHostApp&type=payment_intent$ 200 application/json access-control-allow-methods: GET, HEAD, PUT, PATCH, POST, DELETE -content-security-policy: base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=HA8NE0kfffTAiYEi9vFkLwWt9LnaDit9XQ6fL0cdBLxz0nTYXP8PcsDbyH_HYXbAs9hZV1gkZ-qAUBrl +content-security-policy: base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=YeltoBDzMDMAKqZ9lo0JR1z0x0H7TBa0XM-PJyuVYP-4AsJfLyrHZmuTp70a_NAPa-oOkT93luTu91vC Server: nginx Cache-Control: no-cache, no-store reporting-endpoints: coop="https://q.stripe.com/coop-report" @@ -14,16 +14,15 @@ Access-Control-Allow-Origin: * x-stripe-routing-context-priority-tier: api-testmode x-stripe-priority-routing-enabled: true report-to: {"group":"coop","max_age":8640,"endpoints":[{"url":"https://q.stripe.com/coop-report"}],"include_subdomains":true} -request-id: req_0iILqKJc6iifBt -Content-Length: 19428 +request-id: req_tkPHdd35AC1zsO +Content-Length: 19514 Vary: Origin -Date: Tue, 28 Jan 2025 19:43:28 GMT +Date: Wed, 05 Feb 2025 22:12:38 GMT stripe-version: 2020-08-27 access-control-expose-headers: Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required access-control-max-age: 300 access-control-allow-credentials: true Content-Type: application/json -x-content-type-options: nosniff { "payment_method_preference" : { @@ -51,12 +50,12 @@ x-content-type-options: nosniff "next_action" : null, "status" : "requires_payment_method", "payment_method" : null, - "client_secret" : "pi_3QmKh2FY0qyl6XeW1zYxxIpP_secret_XDh3vf7vu0EG57qpQvoZb0PAi", + "client_secret" : "pi_3QpGplFY0qyl6XeW1fWYjfpQ_secret_ab5VVHeEBN0k5oj1rNpdzuh8r", "total_details" : { "amount_discount" : 0, "amount_tax" : 0 }, - "id" : "pi_3QmKh2FY0qyl6XeW1zYxxIpP", + "id" : "pi_3QpGplFY0qyl6XeW1fWYjfpQ", "confirmation_method" : "automatic", "amount_details" : { "tip" : { @@ -69,7 +68,7 @@ x-content-type-options: nosniff "card" ], "setup_future_usage" : null, - "created" : 1738093408, + "created" : 1738793557, "description" : null }, "ordered_payment_method_types" : [ @@ -211,7 +210,7 @@ x-content-type-options: nosniff "elements_spm_max_visible_payment_methods" : false, "elements_disable_link_email_otp" : false, "cbc_in_link_popup" : true, - "elements_disable_progressive_cursor" : true, + "elements_disable_progressive_cursor" : false, "elements_enable_external_payment_method_picpay" : false, "elements_enable_external_payment_method_planpay" : false, "elements_enable_external_payment_method_samsung_pay" : false, @@ -236,7 +235,7 @@ x-content-type-options: nosniff "elements_enable_external_payment_method_mybank" : false }, "merchant_logo_url" : null, - "session_id" : "elements_session_0oktJeAmJQN", + "session_id" : "elements_session_0tXkv7cuIEV", "card_installments_enabled" : false, "account_id" : "acct_1G6m1pFY0qyl6XeW", "merchant_id" : "acct_1G6m1pFY0qyl6XeW", @@ -265,9 +264,9 @@ x-content-type-options: nosniff "paypal_merchant_id" : null }, "experiments_data" : { - "arb_id" : "fa297948-3eea-4968-99fa-ad845d574a48", + "arb_id" : "63719907-5e33-40be-8fc0-2683af105a9b", "experiment_metadata" : { - "seed" : "d5c3834c45b4c146f026511c88653a3f02d6f2192904d31b0f78d9c1207964cd", + "seed" : "9b0424a6c822c9d049e1245c834c1658932b02d87684324ca862d43e128332e4", "semi_dominant_payment_methods" : [ ] @@ -321,6 +320,7 @@ x-content-type-options: nosniff "link_bank_onboarding_enabled" : false, "link_hcaptcha_rqdata" : null, "link_user_session_id_accuracy_test" : false, + "link_lookup_hcaptcha_enabled" : false, "link_financial_incentives_experiment_enabled" : false, "link_passthrough_mode_enabled" : false, "link_no_code_default_values_identification" : true, @@ -329,10 +329,10 @@ x-content-type-options: nosniff "link_crypto_onramp_elements_logout_disabled" : false, "link_mode" : null, "link_no_code_default_values_usage" : true, - "link_instant_debits_new_incentive_display_enabled" : false, + "link_popup_smart_defaults_enabled" : false, "link_hcaptcha_site_key" : "20000000-ffff-ffff-ffff-000000000002", "link_crypto_onramp_force_cvc_reverification" : false, - "link_popup_smart_defaults_enabled" : false, + "link_wanderlust_in_elements_enabled" : false, "link_email_verification_login_enabled" : false, "link_only_for_payment_method_types_enabled" : false, "link_bank_incentives_enabled" : false, @@ -376,7 +376,7 @@ x-content-type-options: nosniff "payment_methods" : [ { "object" : "payment_method", - "id" : "pm_1QmKh0FY0qyl6XeWjHUFjRgd", + "id" : "pm_1QpGpkFY0qyl6XeWRwvYhpxA", "billing_details" : { "email" : null, "phone" : null, @@ -417,17 +417,17 @@ x-content-type-options: nosniff "country" : "US" }, "livemode" : false, - "created" : 1738093406, + "created" : 1738793556, "allow_redisplay" : "always", "type" : "card", - "customer" : "cus_Rfg38S8M5wgitm" + "customer" : "cus_RiiGhVe1tvdrla" } ], "payment_methods_with_link_details" : [ { "payment_method" : { "object" : "payment_method", - "id" : "pm_1QmKh0FY0qyl6XeWjHUFjRgd", + "id" : "pm_1QpGpkFY0qyl6XeWRwvYhpxA", "billing_details" : { "email" : null, "phone" : null, @@ -468,19 +468,19 @@ x-content-type-options: nosniff "country" : "US" }, "livemode" : false, - "created" : 1738093406, + "created" : 1738793556, "allow_redisplay" : "always", "type" : "card", - "customer" : "cus_Rfg38S8M5wgitm" + "customer" : "cus_RiiGhVe1tvdrla" }, "link_payment_details" : null } ], - "default_payment_method" : "pm_1QmKh0FY0qyl6XeWjHUFjRgd", + "default_payment_method" : "pm_1QpGpkFY0qyl6XeWRwvYhpxA", "customer_session" : { "object" : "customer_session", - "api_key_expiry" : 1738095206, - "id" : "cuss_1QmKgzFY0qyl6XeWDRnTI848", + "api_key_expiry" : 1738795355, + "id" : "cuss_1QpGpjFY0qyl6XeW4XBKJiZw", "livemode" : false, "components" : { "customer_sheet" : { @@ -493,16 +493,17 @@ x-content-type-options: nosniff "mobile_payment_element" : { "enabled" : true, "features" : { - "payment_method_remove" : "enabled", + "payment_method_save_allow_redisplay_override" : null, + "payment_method_redisplay" : "enabled", "payment_method_save" : "enabled", + "payment_method_set_as_default" : "enabled", "payment_method_allow_redisplay_filters" : [ "unspecified", "limited", "always" ], - "payment_method_save_allow_redisplay_override" : null, - "payment_method_remove_last" : "enabled", - "payment_method_redisplay" : "enabled" + "payment_method_remove" : "enabled", + "payment_method_remove_last" : "enabled" } }, "payment_element" : { @@ -513,8 +514,8 @@ x-content-type-options: nosniff "enabled" : false } }, - "customer" : "cus_Rfg38S8M5wgitm", - "api_key" : "ek_test_YWNjdF8xRzZtMXBGWTBxeWw2WGVXLEhTeElpWjdUYlBKd0N3TERCWkR4dW1NT1U5bHRGeHU_00fc86KCsK" + "customer" : "cus_RiiGhVe1tvdrla", + "api_key" : "ek_test_YWNjdF8xRzZtMXBGWTBxeWw2WGVXLExONGM2MGkydjZGcldMbEZNWGNCVkttdTJSQUp3TTA_00fFSJ6r68" } }, "klarna_express_config" : { diff --git a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault/0000_post_create_ephemeral_key.tail b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault/0000_post_create_ephemeral_key.tail index 1f24822eeef..a635b83e8ec 100644 --- a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault/0000_post_create_ephemeral_key.tail +++ b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault/0000_post_create_ephemeral_key.tail @@ -4,15 +4,15 @@ https:\/\/stp-mobile-ci-test-backend-e1b3\.stripedemos\.com\/create_ephemeral_ke text/html Content-Type: text/html;charset=utf-8 Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 -Set-Cookie: rack.session=0u5jsFalPOe3lFPj9k4Zx4pQvvlt%2BJ9of0ynT9ZuMLXixbRDsts1W225N%2FoHBxIkuPuezs0XvwX6u5PKyi6gSofrAYsf1%2FYjfdkzifmVthmdOh6T2NmH2fm8Al0hkJ7rZfOBrnS1Ed3rrxLA2cz%2F7bVNQe49YPHsDf3sw6mjuPi34NLvIlHCv808LMOU0vH7K6%2Fnly96hlHjUV8s3YtvqV6fVTJc52OGWcvLBKxJvkM%3D; path=/ +Set-Cookie: rack.session=uE5TbEvV2dbSkqI19ZF2areik24T%2Bz19rgEt1Ab2kB%2BSMIM5aXpUB7knI08795E4HdqXlP0S899EYCl%2Bz0%2FJ1aLg82C2vDv1kjl5CorF5XVbA0Lo0zh2l1NY7YZ1zWJh2a11%2F%2BIVbNrhzybiINJ5jemwod4LlhRKWcr8cAgqX68SPENxZherGXlmI%2FtV3ckwlzNaIZTLO77cSaEoIiSt61YjfDS35mvIZCrLZjCm%2BqA%3D; path=/ Server: Google Frontend -x-cloud-trace-context: a0171b72a8f6f680190f656880be7301;o=1 +x-cloud-trace-context: c9f4fbebd70c7babe3e2bc42c0f4ecc6;o=1 Via: 1.1 google x-xss-protection: 1; mode=block -Date: Wed, 29 Jan 2025 00:48:06 GMT +Date: Wed, 05 Feb 2025 22:13:08 GMT x-robots-tag: noindex, nofollow Content-Length: 149 x-content-type-options: nosniff x-frame-options: SAMEORIGIN -{"ephemeral_key_secret":"ek_test_YWNjdF8xRzZtMXBGWTBxeWw2WGVXLGtQVEVBN3hLUHFKWDJMOWJ3eUZ4R2RHUmlZTEt3NGk_00qRZePY4t","customer":"cus_RfkxGqn2f6j6vt"} \ No newline at end of file +{"ephemeral_key_secret":"ek_test_YWNjdF8xRzZtMXBGWTBxeWw2WGVXLFVnUHBvVzVYYlJXMzZRcHVpRWpTTnNLZlpmd2t1cEo_00bQSu5cIT","customer":"cus_RiiGxsbYWSEeFg"} \ No newline at end of file diff --git a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault/0001_post_create_customer_session_cs.tail b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault/0001_post_create_customer_session_cs.tail index 5c270970001..ddd47d82924 100644 --- a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault/0001_post_create_customer_session_cs.tail +++ b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault/0001_post_create_customer_session_cs.tail @@ -4,15 +4,15 @@ https:\/\/stp-mobile-ci-test-backend-e1b3\.stripedemos\.com\/create_customer_ses text/html Content-Type: text/html;charset=utf-8 Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 -Set-Cookie: rack.session=22%2BEogeJALvAgIi%2FlwU4HVFHQsJUcni91pIpG1ltGwUz%2F5g0y%2FACXUvhAg64By32rTFy%2FwXMHAYFIbM1c0V9TiNvjeMX7N9NEWaf%2FBKE%2Fu30xDz1ukyX6AKJFwJ%2FXt4aQYvHHXp7gVJUtZGMXV%2Fnrb7EMLDEsFkLpl53TXxHXjmt6P66nSqlwSbw8H1h7LQ4N0DKJKIM882rzxtSDJvT8OWXOEKbVXsi0NfL9%2BQpnqM%3D; path=/ +Set-Cookie: rack.session=RMhaQR0vWOuOT%2BR7pYG4v3JE5HpjzDGdybySEx7xUl9w8asE284hupm5rr1jQvoZLPPnCuwEP4%2FeeIBOxi%2Bnw8QIkIQmCNCiL48m%2FZPsF2At%2BkjJCZgDdk6sczkd0AueQiMzC%2BPRM%2FPfU6jbfRqGMZK2%2FzN9RWSnVHN%2FwN3rqmglY1SXbc9cZhzVVZgNeS2XQ3Dx8scabR1FXbf%2Fy9M5u12WUCR3LyyaiE9Vb4i5avY%3D; path=/ Server: Google Frontend -x-cloud-trace-context: 50664c9402acadec6a69a0c26cbead72 +x-cloud-trace-context: 8ddb128511c1f30a3df77170d6f0af4a Via: 1.1 google x-xss-protection: 1; mode=block -Date: Wed, 29 Jan 2025 00:48:07 GMT +Date: Wed, 05 Feb 2025 22:13:08 GMT x-robots-tag: noindex, nofollow Content-Length: 128 x-content-type-options: nosniff x-frame-options: SAMEORIGIN -{"customer_session_client_secret":"cuss_secret_RfkxQ8QbjaJwenOlNY6lwOxAhuqEL9RuCl0qmGjbP93jxY7","customer":"cus_RfkxGqn2f6j6vt"} \ No newline at end of file +{"customer_session_client_secret":"cuss_secret_RiiGTZxzpCkczhmF2fOdBQ7hiGAVaACu416Rfqd9DmarTkv","customer":"cus_RiiGxsbYWSEeFg"} \ No newline at end of file diff --git a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault/0002_post_create_setup_intent.tail b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault/0002_post_create_setup_intent.tail index 3f49cf59b49..b85b1cfa4c8 100644 --- a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault/0002_post_create_setup_intent.tail +++ b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault/0002_post_create_setup_intent.tail @@ -4,15 +4,15 @@ https:\/\/stp-mobile-ci-test-backend-e1b3\.stripedemos\.com\/create_setup_intent text/html Content-Type: text/html;charset=utf-8 Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 -Set-Cookie: rack.session=uKquU8dLzfVZaoEK0Mgj1sK4DGO2Qu6lw7dUxWzmpIs%2FXFzEGJZqjWH6uIsKRIuOhopI1S%2BZBN%2ByOQjZsazjEdOUKDxwNbkYzDKBgm8OubVs5EXxo4iDgC%2FBa6pyhZg%2B0xZXYmw7mBnqt7DAtK3F0gIU46V9TTx%2BIfqXLzIkuk72%2BiuefkUzTyrtquF1gVwNvvWPgPsoyh42ukTKoin5o8mEuyJ8kUrsRESuyN5hyAg%3D; path=/ +Set-Cookie: rack.session=aWhxYMYHnsF7oBHjQCbRPZUEzIvhKNaYzbvWpSGsqjH6Jo3fIzoPs9SWjAdVafY7pWIvf1pJG2gs9iuxamv2meYPwv%2Fd8VJEtZcT91GP7PdbkgGUrZAsHM68XlcRijzrTU%2FGKL72VfrkOxXigtvqUEcAv1bbYWjsM8pAY4DxHd6zsYO2OgoNESDsLFR3iwEFQ9J1HIA7LmlErx83qSMW35lJV9GKc4VWtBJ3eNftWF8%3D; path=/ Server: Google Frontend -x-cloud-trace-context: 88aed1296aa416f703d61fd7caec6d77 +x-cloud-trace-context: de09d978f87fdedfac73b88a5774f244 Via: 1.1 google x-xss-protection: 1; mode=block -Date: Wed, 29 Jan 2025 00:48:07 GMT +Date: Wed, 05 Feb 2025 22:13:08 GMT x-robots-tag: noindex, nofollow Content-Length: 157 x-content-type-options: nosniff x-frame-options: SAMEORIGIN -{"intent":"seti_1QmPRrFY0qyl6XeW2rhGoo6G","secret":"seti_1QmPRrFY0qyl6XeW2rhGoo6G_secret_RfkxhFE1QaxZpslZJ7gjop5hpLeMYrm","status":"requires_payment_method"} \ No newline at end of file +{"intent":"seti_1QpGqGFY0qyl6XeWy8yvLefV","secret":"seti_1QpGqGFY0qyl6XeWy8yvLefV_secret_RiiGgYK3oqvaSMwRKxJp6ygk7JSiZXK","status":"requires_payment_method"} \ No newline at end of file diff --git a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault/0003_get_v1_elements_sessions.tail b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault/0003_get_v1_elements_sessions.tail index ed5e018b24d..607831a3b78 100644 --- a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault/0003_get_v1_elements_sessions.tail +++ b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault/0003_get_v1_elements_sessions.tail @@ -1,9 +1,9 @@ GET -https:\/\/api\.stripe\.com\/v1\/elements\/sessions\?client_secret=seti_1QmPRrFY0qyl6XeW2rhGoo6G_secret_RfkxhFE1QaxZpslZJ7gjop5hpLeMYrm&customer_session_client_secret=cuss_secret_RfkxQ8QbjaJwenOlNY6lwOxAhuqEL9RuCl0qmGjbP93jxY7&expand%5B0%5D=payment_method_preference\.setup_intent\.payment_method&locale=en-US&mobile_app_id=com\.stripe\.StripeiOSTestHostApp&type=setup_intent$ +https:\/\/api\.stripe\.com\/v1\/elements\/sessions\?client_secret=seti_1QpGqGFY0qyl6XeWy8yvLefV_secret_RiiGgYK3oqvaSMwRKxJp6ygk7JSiZXK&customer_session_client_secret=cuss_secret_RiiGTZxzpCkczhmF2fOdBQ7hiGAVaACu416Rfqd9DmarTkv&expand%5B0%5D=payment_method_preference\.setup_intent\.payment_method&locale=en-US&mobile_app_id=com\.stripe\.StripeiOSTestHostApp&type=setup_intent$ 200 application/json access-control-allow-methods: GET, HEAD, PUT, PATCH, POST, DELETE -content-security-policy: base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=pXt4SIgEVFedVCh1GYXgxK6UYwyACt43efZhWNK1Ro_vB_d_3zno2JFi9tWLW5HBZj6KHhBtQZcQEwYp +content-security-policy: base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=cFdVR4NSpO4G9YuVMNkoNxooGw8Ihsq69e78yHE1mWLIGdLBmvtIh2P6fDkh_Og3mtcwc0oIekgFvowj Server: nginx Cache-Control: no-cache, no-store reporting-endpoints: coop="https://q.stripe.com/coop-report" @@ -14,23 +14,22 @@ Access-Control-Allow-Origin: * x-stripe-routing-context-priority-tier: api-testmode x-stripe-priority-routing-enabled: true report-to: {"group":"coop","max_age":8640,"endpoints":[{"url":"https://q.stripe.com/coop-report"}],"include_subdomains":true} -request-id: req_ODASoDOb57Vs87 -Content-Length: 16074 +request-id: req_sdCragHD4fo5NR +Content-Length: 16224 Vary: Origin -Date: Wed, 29 Jan 2025 00:48:07 GMT +Date: Wed, 05 Feb 2025 22:13:09 GMT stripe-version: 2020-08-27 access-control-expose-headers: Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required access-control-max-age: 300 access-control-allow-credentials: true Content-Type: application/json -x-content-type-options: nosniff { "payment_method_preference" : { "country_code" : "US", "object" : "payment_method_preference", "setup_intent" : { - "id" : "seti_1QmPRrFY0qyl6XeW2rhGoo6G", + "id" : "seti_1QpGqGFY0qyl6XeWy8yvLefV", "description" : null, "next_action" : null, "livemode" : false, @@ -42,8 +41,8 @@ x-content-type-options: nosniff ], "object" : "setup_intent", "last_setup_error" : null, - "created" : 1738111687, - "client_secret" : "seti_1QmPRrFY0qyl6XeW2rhGoo6G_secret_RfkxhFE1QaxZpslZJ7gjop5hpLeMYrm", + "created" : 1738793588, + "client_secret" : "seti_1QpGqGFY0qyl6XeWy8yvLefV_secret_RiiGgYK3oqvaSMwRKxJp6ygk7JSiZXK", "automatic_payment_methods" : null, "cancellation_reason" : null, "status" : "requires_payment_method" @@ -187,7 +186,7 @@ x-content-type-options: nosniff "elements_spm_max_visible_payment_methods" : false, "elements_disable_link_email_otp" : false, "cbc_in_link_popup" : true, - "elements_disable_progressive_cursor" : true, + "elements_disable_progressive_cursor" : false, "elements_enable_external_payment_method_picpay" : false, "elements_enable_external_payment_method_planpay" : false, "elements_enable_external_payment_method_samsung_pay" : false, @@ -212,7 +211,7 @@ x-content-type-options: nosniff "elements_enable_external_payment_method_mybank" : false }, "merchant_logo_url" : null, - "session_id" : "elements_session_0hEz6lxZEyH", + "session_id" : "elements_session_0llI5TVoiXM", "card_installments_enabled" : false, "account_id" : "acct_1G6m1pFY0qyl6XeW", "merchant_id" : "acct_1G6m1pFY0qyl6XeW", @@ -241,9 +240,9 @@ x-content-type-options: nosniff "paypal_merchant_id" : null }, "experiments_data" : { - "arb_id" : "60102912-317b-4960-9a2c-2464477b1c74", + "arb_id" : "ecda9711-c58e-4897-987e-ab404d3b5512", "experiment_metadata" : { - "seed" : "d6d51d6ceb22a2d4d0cb03447c0e71b2775297fa576d40ae2bc4f926fdc36ecb", + "seed" : "9b0424a6c822c9d049e1245c834c1658932b02d87684324ca862d43e128332e4", "semi_dominant_payment_methods" : [ ] @@ -297,6 +296,7 @@ x-content-type-options: nosniff "link_bank_onboarding_enabled" : false, "link_hcaptcha_rqdata" : null, "link_user_session_id_accuracy_test" : false, + "link_lookup_hcaptcha_enabled" : false, "link_financial_incentives_experiment_enabled" : false, "link_passthrough_mode_enabled" : false, "link_no_code_default_values_identification" : true, @@ -308,6 +308,7 @@ x-content-type-options: nosniff "link_popup_smart_defaults_enabled" : false, "link_hcaptcha_site_key" : "20000000-ffff-ffff-ffff-000000000002", "link_crypto_onramp_force_cvc_reverification" : false, + "link_wanderlust_in_elements_enabled" : false, "link_email_verification_login_enabled" : false, "link_only_for_payment_method_types_enabled" : false, "link_bank_incentives_enabled" : false, @@ -357,8 +358,8 @@ x-content-type-options: nosniff "default_payment_method" : null, "customer_session" : { "object" : "customer_session", - "api_key_expiry" : 1738113487, - "id" : "cuss_1QmPRrFY0qyl6XeWsjATJ8oY", + "api_key_expiry" : 1738795389, + "id" : "cuss_1QpGqGFY0qyl6XeWG43JpqnI", "livemode" : false, "components" : { "customer_sheet" : { @@ -371,16 +372,17 @@ x-content-type-options: nosniff "mobile_payment_element" : { "enabled" : true, "features" : { - "payment_method_remove" : "enabled", + "payment_method_save_allow_redisplay_override" : null, + "payment_method_redisplay" : "enabled", "payment_method_save" : "enabled", + "payment_method_set_as_default" : "enabled", "payment_method_allow_redisplay_filters" : [ "unspecified", "limited", "always" ], - "payment_method_save_allow_redisplay_override" : null, - "payment_method_remove_last" : "enabled", - "payment_method_redisplay" : "enabled" + "payment_method_remove" : "enabled", + "payment_method_remove_last" : "enabled" } }, "payment_element" : { @@ -391,8 +393,8 @@ x-content-type-options: nosniff "enabled" : false } }, - "customer" : "cus_RfkxGqn2f6j6vt", - "api_key" : "ek_test_YWNjdF8xRzZtMXBGWTBxeWw2WGVXLEFGeWtOVFo4TThiM3RVOGoxVkpvb09MWTNsZm4xcGc_00FlQ0TO0X" + "customer" : "cus_RiiGxsbYWSEeFg", + "api_key" : "ek_test_YWNjdF8xRzZtMXBGWTBxeWw2WGVXLEN3bnN5WEZEY3d3NEFtdWJsRmEyODJxZGNsN0paMGY_00Q4BCUOFR" } }, "klarna_express_config" : { diff --git a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault/0004_post_v1_setup_intents_seti_1QmPRrFY0qyl6XeW2rhGoo6G_confirm.tail b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault/0004_post_v1_setup_intents_seti_1QpGqGFY0qyl6XeWy8yvLefV_confirm.tail similarity index 77% rename from StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault/0004_post_v1_setup_intents_seti_1QmPRrFY0qyl6XeW2rhGoo6G_confirm.tail rename to StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault/0004_post_v1_setup_intents_seti_1QpGqGFY0qyl6XeWy8yvLefV_confirm.tail index bc7d832807a..b9829dfeed9 100644 --- a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault/0004_post_v1_setup_intents_seti_1QmPRrFY0qyl6XeW2rhGoo6G_confirm.tail +++ b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault/0004_post_v1_setup_intents_seti_1QpGqGFY0qyl6XeWy8yvLefV_confirm.tail @@ -1,9 +1,9 @@ POST -https:\/\/api\.stripe\.com\/v1\/setup_intents\/seti_1QmPRrFY0qyl6XeW2rhGoo6G\/confirm$ +https:\/\/api\.stripe\.com\/v1\/setup_intents\/seti_1QpGqGFY0qyl6XeWy8yvLefV\/confirm$ 200 application/json access-control-allow-methods: GET, HEAD, PUT, PATCH, POST, DELETE -content-security-policy: base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=35Z6vt17es6VQT6ekT9nWILYsqAjeIAx6KbODpXs7sT6K0bkEH8OYqmwg33lfUX2EsDevqfWw95visit +content-security-policy: base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=rGYv4qnCNDwGi1O4g6ttfwOeBKG04FcfIcnIVHvGzN-XNVb8h0ILw_jXPMUJgjmppFNrLRpjBtMjUab6 Server: nginx Cache-Control: no-cache, no-store reporting-endpoints: coop="https://q.stripe.com/coop-report" @@ -14,29 +14,28 @@ Access-Control-Allow-Origin: * stripe-should-retry: false x-stripe-priority-routing-enabled: true report-to: {"group":"coop","max_age":8640,"endpoints":[{"url":"https://q.stripe.com/coop-report"}],"include_subdomains":true} -request-id: req_pwH8tXSoyzEVET +request-id: req_PJtnCvuopi6KeI x-stripe-routing-context-priority-tier: api-testmode Content-Length: 1591 Vary: Origin -Date: Wed, 29 Jan 2025 00:48:08 GMT -original-request: req_pwH8tXSoyzEVET +Date: Wed, 05 Feb 2025 22:13:10 GMT +original-request: req_PJtnCvuopi6KeI stripe-version: 2020-08-27 -idempotency-key: c29e3a85-95fc-4e46-9444-e26b9779d082 +idempotency-key: 9be71e46-80a1-4721-8007-62d89d4d9bca access-control-expose-headers: Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required access-control-max-age: 300 access-control-allow-credentials: true Content-Type: application/json -x-content-type-options: nosniff -X-Stripe-Mock-Request: client_secret=seti_1QmPRrFY0qyl6XeW2rhGoo6G_secret_RfkxhFE1QaxZpslZJ7gjop5hpLeMYrm&expand\[0]=payment_method&payment_method_data\[allow_redisplay]=always&payment_method_data\[card]\[cvc]=123&payment_method_data\[card]\[exp_month]=12&payment_method_data\[card]\[exp_year]=32&payment_method_data\[card]\[number]=4242424242424242&payment_method_data\[payment_user_agent]=.*&payment_method_data\[type]=card&set_as_default_payment_method=true&use_stripe_sdk=true +X-Stripe-Mock-Request: client_secret=seti_1QpGqGFY0qyl6XeWy8yvLefV_secret_RiiGgYK3oqvaSMwRKxJp6ygk7JSiZXK&expand\[0]=payment_method&payment_method_data\[allow_redisplay]=always&payment_method_data\[card]\[cvc]=123&payment_method_data\[card]\[exp_month]=12&payment_method_data\[card]\[exp_year]=32&payment_method_data\[card]\[number]=4242424242424242&payment_method_data\[payment_user_agent]=.*&payment_method_data\[type]=card&set_as_default_payment_method=true&use_stripe_sdk=true { - "id" : "seti_1QmPRrFY0qyl6XeW2rhGoo6G", + "id" : "seti_1QpGqGFY0qyl6XeWy8yvLefV", "description" : null, "next_action" : null, "livemode" : false, "payment_method" : { "object" : "payment_method", - "id" : "pm_1QmPRrFY0qyl6XeW4TKGyB2p", + "id" : "pm_1QpGqHFY0qyl6XeW0UDbaJ26", "billing_details" : { "email" : null, "phone" : null, @@ -77,10 +76,10 @@ X-Stripe-Mock-Request: client_secret=seti_1QmPRrFY0qyl6XeW2rhGoo6G_secret_RfkxhF "country" : "US" }, "livemode" : false, - "created" : 1738111688, + "created" : 1738793589, "allow_redisplay" : "always", "type" : "card", - "customer" : "cus_RfkxGqn2f6j6vt" + "customer" : "cus_RiiGxsbYWSEeFg" }, "payment_method_configuration_details" : null, "usage" : "off_session", @@ -89,8 +88,8 @@ X-Stripe-Mock-Request: client_secret=seti_1QmPRrFY0qyl6XeW2rhGoo6G_secret_RfkxhF ], "object" : "setup_intent", "last_setup_error" : null, - "created" : 1738111687, - "client_secret" : "seti_1QmPRrFY0qyl6XeW2rhGoo6G_secret_RfkxhFE1QaxZpslZJ7gjop5hpLeMYrm", + "created" : 1738793588, + "client_secret" : "seti_1QpGqGFY0qyl6XeWy8yvLefV_secret_RiiGgYK3oqvaSMwRKxJp6ygk7JSiZXK", "automatic_payment_methods" : null, "cancellation_reason" : null, "status" : "succeeded" diff --git a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault/0005_get_v1_setup_intents_seti_1QmPRrFY0qyl6XeW2rhGoo6G.tail b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault/0005_get_v1_setup_intents_seti_1QpGqGFY0qyl6XeWy8yvLefV.tail similarity index 70% rename from StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault/0005_get_v1_setup_intents_seti_1QmPRrFY0qyl6XeW2rhGoo6G.tail rename to StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault/0005_get_v1_setup_intents_seti_1QpGqGFY0qyl6XeWy8yvLefV.tail index 5b1f7891e7d..feb8952644b 100644 --- a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault/0005_get_v1_setup_intents_seti_1QmPRrFY0qyl6XeW2rhGoo6G.tail +++ b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault/0005_get_v1_setup_intents_seti_1QpGqGFY0qyl6XeWy8yvLefV.tail @@ -1,9 +1,9 @@ GET -https:\/\/api\.stripe\.com\/v1\/setup_intents\/seti_1QmPRrFY0qyl6XeW2rhGoo6G\?client_secret=seti_1QmPRrFY0qyl6XeW2rhGoo6G_secret_RfkxhFE1QaxZpslZJ7gjop5hpLeMYrm$ +https:\/\/api\.stripe\.com\/v1\/setup_intents\/seti_1QpGqGFY0qyl6XeWy8yvLefV\?client_secret=seti_1QpGqGFY0qyl6XeWy8yvLefV_secret_RiiGgYK3oqvaSMwRKxJp6ygk7JSiZXK$ 200 application/json access-control-allow-methods: GET, HEAD, PUT, PATCH, POST, DELETE -content-security-policy: base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=CHAOYFwlc47KzUuH5v0Dl2YUJypcc48y8axxygFZdPZ2KolhlmkW8Z1ud31GjvB29txJ7KV37KZQIU1U +content-security-policy: base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=cFdVR4NSpO4G9YuVMNkoNxooGw8Ihsq69e78yHE1mWLIGdLBmvtIh2P6fDkh_Og3mtcwc0oIekgFvowj Server: nginx Cache-Control: no-cache, no-store reporting-endpoints: coop="https://q.stripe.com/coop-report" @@ -14,23 +14,22 @@ Access-Control-Allow-Origin: * x-stripe-routing-context-priority-tier: api-testmode x-stripe-priority-routing-enabled: true report-to: {"group":"coop","max_age":8640,"endpoints":[{"url":"https://q.stripe.com/coop-report"}],"include_subdomains":true} -request-id: req_sdX59q0pdH2pKZ +request-id: req_uORZlRTP5lsJH0 Content-Length: 544 Vary: Origin -Date: Wed, 29 Jan 2025 00:48:09 GMT +Date: Wed, 05 Feb 2025 22:13:10 GMT stripe-version: 2020-08-27 access-control-expose-headers: Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required access-control-max-age: 300 access-control-allow-credentials: true Content-Type: application/json -x-content-type-options: nosniff { - "id" : "seti_1QmPRrFY0qyl6XeW2rhGoo6G", + "id" : "seti_1QpGqGFY0qyl6XeWy8yvLefV", "description" : null, "next_action" : null, "livemode" : false, - "payment_method" : "pm_1QmPRrFY0qyl6XeW4TKGyB2p", + "payment_method" : "pm_1QpGqHFY0qyl6XeW0UDbaJ26", "payment_method_configuration_details" : null, "usage" : "off_session", "payment_method_types" : [ @@ -38,8 +37,8 @@ x-content-type-options: nosniff ], "object" : "setup_intent", "last_setup_error" : null, - "created" : 1738111687, - "client_secret" : "seti_1QmPRrFY0qyl6XeW2rhGoo6G_secret_RfkxhFE1QaxZpslZJ7gjop5hpLeMYrm", + "created" : 1738793588, + "client_secret" : "seti_1QpGqGFY0qyl6XeWy8yvLefV_secret_RiiGgYK3oqvaSMwRKxJp6ygk7JSiZXK", "automatic_payment_methods" : null, "cancellation_reason" : null, "status" : "succeeded" diff --git a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault/0006_post_create_setup_intent.tail b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault/0006_post_create_setup_intent.tail index 2295f5fb8c6..3777dd7b038 100644 --- a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault/0006_post_create_setup_intent.tail +++ b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault/0006_post_create_setup_intent.tail @@ -4,15 +4,15 @@ https:\/\/stp-mobile-ci-test-backend-e1b3\.stripedemos\.com\/create_setup_intent text/html Content-Type: text/html;charset=utf-8 Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 -Set-Cookie: rack.session=dIyhoZaJAAPTbw7n65p314dsYRX%2Fb5YvrsMGN4yrtZx1Tg9XBzJE7GozypEwsCIgSHl9jY15tbSWGRUAegVNNdXwjAcSEq%2B%2BESUaKW2ZuDT3DhU%2FxKgFOfxNvsumQKBAPCbGfJV%2FvOhK%2FqDjsL6vZuqIzTLbS6DhyxQiFI9ySitAro3R3fQJMAXmAAcWqhYclv8n%2BCrnJMTPPULpWNj5KTb5c5cEylfAP%2FcI3cWzRx0%3D; path=/ +Set-Cookie: rack.session=200Ip0EWCN2ldzueuHB7ghgJn8qEsC3JtoWYmhuN681kh2iJnUK5KeZvTaa6qyCHm6f2rMSlZNEcKJE2puNEFpLR1M0spl8PlVlZQJcPJd8XXMbk86xJ4b3GI5dJO3wnxELcldpsVAcOeY6JyajOcGOUkzkOYEcs104Kezj%2Bh5Sp0dJwVcR3WrEuxFrG5sGx%2BZGQ8oSsAnPWNJpA8nzTRaWWSd%2BoJ4Rq8a8ZF1RZZow%3D; path=/ Server: Google Frontend -x-cloud-trace-context: d775a87a774a2ce618ea8272ac11aebb +x-cloud-trace-context: fd1ab480474cfae04ef8449107d10f3a Via: 1.1 google x-xss-protection: 1; mode=block -Date: Wed, 29 Jan 2025 00:48:09 GMT +Date: Wed, 05 Feb 2025 22:13:10 GMT x-robots-tag: noindex, nofollow Content-Length: 157 x-content-type-options: nosniff x-frame-options: SAMEORIGIN -{"intent":"seti_1QmPRtFY0qyl6XeWcZg9X8nm","secret":"seti_1QmPRtFY0qyl6XeWcZg9X8nm_secret_RfkxnMPYamN3MX8malrVzNSp92epEXx","status":"requires_payment_method"} \ No newline at end of file +{"intent":"seti_1QpGqIFY0qyl6XeWPDWZ3EOW","secret":"seti_1QpGqIFY0qyl6XeWPDWZ3EOW_secret_RiiGVipMngT2CsEkk0rvOVM2WhRGn4l","status":"requires_payment_method"} \ No newline at end of file diff --git a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault/0007_get_v1_elements_sessions.tail b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault/0007_get_v1_elements_sessions.tail index aebd5ba263c..2ae4c7eb00e 100644 --- a/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault/0007_get_v1_elements_sessions.tail +++ b/StripePayments/StripePaymentsTestUtils/Resources/recorded_network_traffic/PaymentSheetAPITest/testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault/0007_get_v1_elements_sessions.tail @@ -1,9 +1,9 @@ GET -https:\/\/api\.stripe\.com\/v1\/elements\/sessions\?client_secret=seti_1QmPRtFY0qyl6XeWcZg9X8nm_secret_RfkxnMPYamN3MX8malrVzNSp92epEXx&customer_session_client_secret=cuss_secret_RfkxQ8QbjaJwenOlNY6lwOxAhuqEL9RuCl0qmGjbP93jxY7&expand%5B0%5D=payment_method_preference\.setup_intent\.payment_method&locale=en-US&mobile_app_id=com\.stripe\.StripeiOSTestHostApp&type=setup_intent$ +https:\/\/api\.stripe\.com\/v1\/elements\/sessions\?client_secret=seti_1QpGqIFY0qyl6XeWPDWZ3EOW_secret_RiiGVipMngT2CsEkk0rvOVM2WhRGn4l&customer_session_client_secret=cuss_secret_RiiGTZxzpCkczhmF2fOdBQ7hiGAVaACu416Rfqd9DmarTkv&expand%5B0%5D=payment_method_preference\.setup_intent\.payment_method&locale=en-US&mobile_app_id=com\.stripe\.StripeiOSTestHostApp&type=setup_intent$ 200 application/json access-control-allow-methods: GET, HEAD, PUT, PATCH, POST, DELETE -content-security-policy: base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=CHAOYFwlc47KzUuH5v0Dl2YUJypcc48y8axxygFZdPZ2KolhlmkW8Z1ud31GjvB29txJ7KV37KZQIU1U +content-security-policy: base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=cFdVR4NSpO4G9YuVMNkoNxooGw8Ihsq69e78yHE1mWLIGdLBmvtIh2P6fDkh_Og3mtcwc0oIekgFvowj Server: nginx Cache-Control: no-cache, no-store reporting-endpoints: coop="https://q.stripe.com/coop-report" @@ -14,23 +14,22 @@ Access-Control-Allow-Origin: * x-stripe-routing-context-priority-tier: api-testmode x-stripe-priority-routing-enabled: true report-to: {"group":"coop","max_age":8640,"endpoints":[{"url":"https://q.stripe.com/coop-report"}],"include_subdomains":true} -request-id: req_QW3B3R0ss32DuF -Content-Length: 18819 +request-id: req_eGcyeWocr5quFR +Content-Length: 18969 Vary: Origin -Date: Wed, 29 Jan 2025 00:48:09 GMT +Date: Wed, 05 Feb 2025 22:13:11 GMT stripe-version: 2020-08-27 access-control-expose-headers: Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required access-control-max-age: 300 access-control-allow-credentials: true Content-Type: application/json -x-content-type-options: nosniff { "payment_method_preference" : { "country_code" : "US", "object" : "payment_method_preference", "setup_intent" : { - "id" : "seti_1QmPRtFY0qyl6XeWcZg9X8nm", + "id" : "seti_1QpGqIFY0qyl6XeWPDWZ3EOW", "description" : null, "next_action" : null, "livemode" : false, @@ -42,8 +41,8 @@ x-content-type-options: nosniff ], "object" : "setup_intent", "last_setup_error" : null, - "created" : 1738111689, - "client_secret" : "seti_1QmPRtFY0qyl6XeWcZg9X8nm_secret_RfkxnMPYamN3MX8malrVzNSp92epEXx", + "created" : 1738793590, + "client_secret" : "seti_1QpGqIFY0qyl6XeWPDWZ3EOW_secret_RiiGVipMngT2CsEkk0rvOVM2WhRGn4l", "automatic_payment_methods" : null, "cancellation_reason" : null, "status" : "requires_payment_method" @@ -187,7 +186,7 @@ x-content-type-options: nosniff "elements_spm_max_visible_payment_methods" : false, "elements_disable_link_email_otp" : false, "cbc_in_link_popup" : true, - "elements_disable_progressive_cursor" : true, + "elements_disable_progressive_cursor" : false, "elements_enable_external_payment_method_picpay" : false, "elements_enable_external_payment_method_planpay" : false, "elements_enable_external_payment_method_samsung_pay" : false, @@ -212,7 +211,7 @@ x-content-type-options: nosniff "elements_enable_external_payment_method_mybank" : false }, "merchant_logo_url" : null, - "session_id" : "elements_session_0nC55ZppXxu", + "session_id" : "elements_session_0D3EWxeAezE", "card_installments_enabled" : false, "account_id" : "acct_1G6m1pFY0qyl6XeW", "merchant_id" : "acct_1G6m1pFY0qyl6XeW", @@ -241,9 +240,9 @@ x-content-type-options: nosniff "paypal_merchant_id" : null }, "experiments_data" : { - "arb_id" : "2fe9f556-29a6-4d3f-b38f-2bbaff490092", + "arb_id" : "0a67d04a-4f68-44ec-b7e0-2a872dd3ad7c", "experiment_metadata" : { - "seed" : "d6d51d6ceb22a2d4d0cb03447c0e71b2775297fa576d40ae2bc4f926fdc36ecb", + "seed" : "9b0424a6c822c9d049e1245c834c1658932b02d87684324ca862d43e128332e4", "semi_dominant_payment_methods" : [ ] @@ -297,6 +296,7 @@ x-content-type-options: nosniff "link_bank_onboarding_enabled" : false, "link_hcaptcha_rqdata" : null, "link_user_session_id_accuracy_test" : false, + "link_lookup_hcaptcha_enabled" : false, "link_financial_incentives_experiment_enabled" : false, "link_passthrough_mode_enabled" : false, "link_no_code_default_values_identification" : true, @@ -308,6 +308,7 @@ x-content-type-options: nosniff "link_popup_smart_defaults_enabled" : false, "link_hcaptcha_site_key" : "20000000-ffff-ffff-ffff-000000000002", "link_crypto_onramp_force_cvc_reverification" : false, + "link_wanderlust_in_elements_enabled" : false, "link_email_verification_login_enabled" : false, "link_only_for_payment_method_types_enabled" : false, "link_bank_incentives_enabled" : false, @@ -351,7 +352,7 @@ x-content-type-options: nosniff "payment_methods" : [ { "object" : "payment_method", - "id" : "pm_1QmPRrFY0qyl6XeW4TKGyB2p", + "id" : "pm_1QpGqHFY0qyl6XeW0UDbaJ26", "billing_details" : { "email" : null, "phone" : null, @@ -392,17 +393,17 @@ x-content-type-options: nosniff "country" : "US" }, "livemode" : false, - "created" : 1738111688, + "created" : 1738793589, "allow_redisplay" : "always", "type" : "card", - "customer" : "cus_RfkxGqn2f6j6vt" + "customer" : "cus_RiiGxsbYWSEeFg" } ], "payment_methods_with_link_details" : [ { "payment_method" : { "object" : "payment_method", - "id" : "pm_1QmPRrFY0qyl6XeW4TKGyB2p", + "id" : "pm_1QpGqHFY0qyl6XeW0UDbaJ26", "billing_details" : { "email" : null, "phone" : null, @@ -443,19 +444,19 @@ x-content-type-options: nosniff "country" : "US" }, "livemode" : false, - "created" : 1738111688, + "created" : 1738793589, "allow_redisplay" : "always", "type" : "card", - "customer" : "cus_RfkxGqn2f6j6vt" + "customer" : "cus_RiiGxsbYWSEeFg" }, "link_payment_details" : null } ], - "default_payment_method" : "pm_1QmPRrFY0qyl6XeW4TKGyB2p", + "default_payment_method" : "pm_1QpGqHFY0qyl6XeW0UDbaJ26", "customer_session" : { "object" : "customer_session", - "api_key_expiry" : 1738113487, - "id" : "cuss_1QmPRrFY0qyl6XeWsjATJ8oY", + "api_key_expiry" : 1738795389, + "id" : "cuss_1QpGqGFY0qyl6XeWG43JpqnI", "livemode" : false, "components" : { "customer_sheet" : { @@ -468,16 +469,17 @@ x-content-type-options: nosniff "mobile_payment_element" : { "enabled" : true, "features" : { - "payment_method_remove" : "enabled", + "payment_method_save_allow_redisplay_override" : null, + "payment_method_redisplay" : "enabled", "payment_method_save" : "enabled", + "payment_method_set_as_default" : "enabled", "payment_method_allow_redisplay_filters" : [ "unspecified", "limited", "always" ], - "payment_method_save_allow_redisplay_override" : null, - "payment_method_remove_last" : "enabled", - "payment_method_redisplay" : "enabled" + "payment_method_remove" : "enabled", + "payment_method_remove_last" : "enabled" } }, "payment_element" : { @@ -488,8 +490,8 @@ x-content-type-options: nosniff "enabled" : false } }, - "customer" : "cus_RfkxGqn2f6j6vt", - "api_key" : "ek_test_YWNjdF8xRzZtMXBGWTBxeWw2WGVXLEFGeWtOVFo4TThiM3RVOGoxVkpvb09MWTNsZm4xcGc_00FlQ0TO0X" + "customer" : "cus_RiiGxsbYWSEeFg", + "api_key" : "ek_test_YWNjdF8xRzZtMXBGWTBxeWw2WGVXLEN3bnN5WEZEY3d3NEFtdWJsRmEyODJxZGNsN0paMGY_00Q4BCUOFR" } }, "klarna_express_config" : { From ea32e91ecd20f2cc9da08a6b16ab941623718500 Mon Sep 17 00:00:00 2001 From: Joyce Qin Date: Wed, 5 Feb 2025 14:16:54 -0800 Subject: [PATCH 12/14] revert timeout --- .../PaymentSheet/PaymentSheet+APITest.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/PaymentSheet+APITest.swift b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/PaymentSheet+APITest.swift index 4b7ef56bf0e..0e4b616ff79 100644 --- a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/PaymentSheet+APITest.swift +++ b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/PaymentSheet+APITest.swift @@ -439,7 +439,7 @@ class PaymentSheetAPITest: STPNetworkStubbingTestCase { print(error) } } - await fulfillment(of: [expectation], timeout: 10000) + await fulfillment(of: [expectation], timeout: STPTestingNetworkRequestTimeout) } func testPaymentSheetLoadAndConfirmWithSetupIntentSetAsDefault() async throws { From 2fc6c052ef42627e315fdc6c348416f296e704f5 Mon Sep 17 00:00:00 2001 From: Joyce Qin Date: Wed, 5 Feb 2025 17:44:46 -0800 Subject: [PATCH 13/14] do not show apple pay in customersheet when adding first saved pm --- .../CustomerSavedPaymentMethodsViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSavedPaymentMethodsViewController.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSavedPaymentMethodsViewController.swift index 289b538b1b8..b516cad758f 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSavedPaymentMethodsViewController.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/CustomerSheet/CustomerSavedPaymentMethodsViewController.swift @@ -662,7 +662,7 @@ class CustomerSavedPaymentMethodsViewController: UIViewController { mostRecentlyAddedPaymentMethod: mostRecentlyAddedPaymentMethod, savedPaymentMethodsConfiguration: self.configuration, configuration: .init( - showApplePay: isApplePayEnabled, + showApplePay: showApplePay, allowsRemovalOfLastSavedPaymentMethod: allowsRemovalOfLastSavedPaymentMethod, paymentMethodRemove: paymentMethodRemove, paymentMethodSyncDefault: paymentMethodSyncDefault, From 14809727afaba9b3d194ddf0d679c63688ef5495 Mon Sep 17 00:00:00 2001 From: Joyce Qin Date: Mon, 10 Feb 2025 10:49:29 -0800 Subject: [PATCH 14/14] cleanup --- .../CustomerSheetTestPlaygroundController.swift | 2 +- .../PlaygroundController.swift | 2 +- .../Source/PaymentSheet/PaymentSheet+API.swift | 14 ++++++++------ .../PaymentSheet/PaymentSheet+DeferredAPI.swift | 4 ++-- .../CustomerSheet/CustomerSheetTests.swift | 2 +- .../PaymentSheet/PaymentSheet+APITest.swift | 12 ++++-------- .../PaymentSheet/STPElementsSessionTest.swift | 3 +++ 7 files changed, 20 insertions(+), 19 deletions(-) diff --git a/Example/PaymentSheet Example/PaymentSheet Example/CustomerSheetTestPlaygroundController.swift b/Example/PaymentSheet Example/PaymentSheet Example/CustomerSheetTestPlaygroundController.swift index 3ecb0c7c22f..ae395d7d373 100644 --- a/Example/PaymentSheet Example/PaymentSheet Example/CustomerSheetTestPlaygroundController.swift +++ b/Example/PaymentSheet Example/PaymentSheet Example/CustomerSheetTestPlaygroundController.swift @@ -4,7 +4,7 @@ // import Combine -@_spi(STP) @_spi(CustomerSessionBetaAccess) @_spi(CardBrandFilteringBeta) @_spi(AllowsSetAsDefaultPM) import StripePaymentSheet +@_spi(STP) @_spi(CustomerSessionBetaAccess) @_spi(CardBrandFilteringBeta) import StripePaymentSheet import SwiftUI class CustomerSheetTestPlaygroundController: ObservableObject { diff --git a/Example/PaymentSheet Example/PaymentSheet Example/PlaygroundController.swift b/Example/PaymentSheet Example/PaymentSheet Example/PlaygroundController.swift index 964462aeff1..20eceb22054 100644 --- a/Example/PaymentSheet Example/PaymentSheet Example/PlaygroundController.swift +++ b/Example/PaymentSheet Example/PaymentSheet Example/PlaygroundController.swift @@ -14,7 +14,7 @@ import Contacts import PassKit @_spi(STP) import StripeCore @_spi(STP) import StripePayments -@_spi(CustomerSessionBetaAccess) @_spi(STP) @_spi(PaymentSheetSkipConfirmation) @_spi(ExperimentalAllowsRemovalOfLastSavedPaymentMethodAPI) @_spi(EmbeddedPaymentElementPrivateBeta) @_spi(CardBrandFilteringBeta) @_spi(AllowsSetAsDefaultPM) import StripePaymentSheet +@_spi(CustomerSessionBetaAccess) @_spi(STP) @_spi(PaymentSheetSkipConfirmation) @_spi(ExperimentalAllowsRemovalOfLastSavedPaymentMethodAPI) @_spi(EmbeddedPaymentElementPrivateBeta) @_spi(CardBrandFilteringBeta) import StripePaymentSheet import SwiftUI import UIKit diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheet+API.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheet+API.swift index 94aead4ebce..854efb196fe 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheet+API.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheet+API.swift @@ -200,8 +200,8 @@ extension PaymentSheet { params, with: authenticationContext, completion: { actionStatus, paymentIntent, error in - if let paymentIntent, !elementsSession.paymentMethodSetAsDefaultForPaymentSheet { - setDefaultPaymentMethodIfNecessary(actionStatus: actionStatus, intent: .paymentIntent(paymentIntent), configuration: configuration) + if let paymentIntent { + setDefaultPaymentMethodIfNecessary(actionStatus: actionStatus, intent: .paymentIntent(paymentIntent), configuration: configuration, paymentMethodSetAsDefault: elementsSession.paymentMethodSetAsDefaultForPaymentSheet) } paymentHandlerCompletion(actionStatus, error) } @@ -222,8 +222,8 @@ extension PaymentSheet { setupIntentParams, with: authenticationContext, completion: { actionStatus, setupIntent, error in - if let setupIntent, !elementsSession.paymentMethodSetAsDefaultForPaymentSheet { - setDefaultPaymentMethodIfNecessary(actionStatus: actionStatus, intent: .setupIntent(setupIntent), configuration: configuration) + if let setupIntent { + setDefaultPaymentMethodIfNecessary(actionStatus: actionStatus, intent: .setupIntent(setupIntent), configuration: configuration, paymentMethodSetAsDefault: elementsSession.paymentMethodSetAsDefaultForPaymentSheet) } paymentHandlerCompletion(actionStatus, error) } @@ -571,7 +571,7 @@ extension PaymentSheet { /// A helper method that sets the Customer's default payment method if necessary. /// - Parameter actionStatus: The final status returned by `STPPaymentHandler`'s completion block. - static func setDefaultPaymentMethodIfNecessary(actionStatus: STPPaymentHandlerActionStatus, intent: PaymentOrSetupIntent, configuration: PaymentElementConfiguration) { + static func setDefaultPaymentMethodIfNecessary(actionStatus: STPPaymentHandlerActionStatus, intent: PaymentOrSetupIntent, configuration: PaymentElementConfiguration, paymentMethodSetAsDefault: Bool) { guard // Did we successfully save this payment method? @@ -580,7 +580,9 @@ extension PaymentSheet { intent.isSetupFutureUsageSet, let paymentMethod = intent.paymentMethod, // Can it appear in the list of saved PMs? - PaymentSheet.supportedSavedPaymentMethods.contains(paymentMethod.type) + PaymentSheet.supportedSavedPaymentMethods.contains(paymentMethod.type), + // Should it write to local storage? + !paymentMethodSetAsDefault else { return } diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheet+DeferredAPI.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheet+DeferredAPI.swift index 81e1c3058ee..f547460257e 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheet+DeferredAPI.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheet+DeferredAPI.swift @@ -53,8 +53,8 @@ extension PaymentSheet { // Overwrite `completion` to ensure we set the default if necessary before completing. let completion = { (status: STPPaymentHandlerActionStatus, paymentOrSetupIntent: PaymentOrSetupIntent?, error: NSError?, deferredIntentConfirmationType: STPAnalyticsClient.DeferredIntentConfirmationType) in - if let paymentOrSetupIntent, !allowsSetAsDefaultPM { - setDefaultPaymentMethodIfNecessary(actionStatus: status, intent: paymentOrSetupIntent, configuration: configuration) + if let paymentOrSetupIntent { + setDefaultPaymentMethodIfNecessary(actionStatus: status, intent: paymentOrSetupIntent, configuration: configuration, paymentMethodSetAsDefault: allowsSetAsDefaultPM) } completion(makePaymentSheetResult(for: status, error: error), deferredIntentConfirmationType) } diff --git a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/CustomerSheet/CustomerSheetTests.swift b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/CustomerSheet/CustomerSheetTests.swift index 51044ae7302..99c91c365c5 100644 --- a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/CustomerSheet/CustomerSheetTests.swift +++ b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/CustomerSheet/CustomerSheetTests.swift @@ -7,7 +7,7 @@ import Foundation @_spi(STP) @testable import StripeCore @_spi(STP) @testable import StripePayments -@_spi(STP) @_spi(CustomerSessionBetaAccess) @_spi(CardBrandFilteringBeta) @_spi(AllowsSetAsDefaultPM) @testable import StripePaymentSheet +@_spi(STP) @_spi(CustomerSessionBetaAccess) @_spi(CardBrandFilteringBeta) @testable import StripePaymentSheet import OHHTTPStubs import OHHTTPStubsSwift diff --git a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/PaymentSheet+APITest.swift b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/PaymentSheet+APITest.swift index 0e4b616ff79..fc72babd146 100644 --- a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/PaymentSheet+APITest.swift +++ b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/PaymentSheet+APITest.swift @@ -49,10 +49,6 @@ class PaymentSheetAPITest: STPNetworkStubbingTestCase { return makeNewCardPaymentOption() }() - lazy var newCardDefaultPaymentOption: PaymentSheet.PaymentOption = { - return makeNewCardPaymentOption(setAsDefaultPM: true) - }() - private func makeNewCardPaymentOption(setAsDefaultPM: Bool = false) -> PaymentSheet.PaymentOption { let cardParams = STPPaymentMethodCardParams() cardParams.number = "4242424242424242" @@ -390,7 +386,7 @@ class PaymentSheetAPITest: STPNetworkStubbingTestCase { authenticationContext: self, intent: loadResult.intent, elementsSession: loadResult.elementsSession, - paymentOption: self.newCardDefaultPaymentOption, + paymentOption: self.makeNewCardPaymentOption(setAsDefaultPM: loadResult.elementsSession.paymentMethodSetAsDefaultForPaymentSheet), paymentHandler: self.paymentHandler, analyticsHelper: ._testValue() ) { result, _ in @@ -468,7 +464,7 @@ class PaymentSheetAPITest: STPNetworkStubbingTestCase { authenticationContext: self, intent: loadResult.intent, elementsSession: loadResult.elementsSession, - paymentOption: self.newCardDefaultPaymentOption, + paymentOption: self.makeNewCardPaymentOption(setAsDefaultPM: loadResult.elementsSession.paymentMethodSetAsDefaultForPaymentSheet), paymentHandler: self.paymentHandler, analyticsHelper: ._testValue() ) { result, _ in @@ -547,7 +543,7 @@ class PaymentSheetAPITest: STPNetworkStubbingTestCase { authenticationContext: self, intent: .deferredIntent(intentConfig: intentConfig), elementsSession: loadResult.elementsSession, - paymentOption: self.newCardDefaultPaymentOption, + paymentOption: self.makeNewCardPaymentOption(setAsDefaultPM: loadResult.elementsSession.paymentMethodSetAsDefaultForPaymentSheet), paymentHandler: self.paymentHandler, analyticsHelper: ._testValue() ) { result, _ in @@ -616,7 +612,7 @@ class PaymentSheetAPITest: STPNetworkStubbingTestCase { authenticationContext: self, intent: .deferredIntent(intentConfig: intentConfig), elementsSession: loadResult.elementsSession, - paymentOption: self.newCardDefaultPaymentOption, + paymentOption: self.makeNewCardPaymentOption(setAsDefaultPM: loadResult.elementsSession.paymentMethodSetAsDefaultForPaymentSheet), paymentHandler: self.paymentHandler, analyticsHelper: ._testValue() ) { result, _ in diff --git a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/STPElementsSessionTest.swift b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/STPElementsSessionTest.swift index 369afe97712..207325f7798 100644 --- a/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/STPElementsSessionTest.swift +++ b/StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/STPElementsSessionTest.swift @@ -53,6 +53,7 @@ class STPElementsSessionTest: XCTestCase { XCTAssertEqual(elementsSession.cardBrandChoice?.eligible, true) XCTAssertEqual(elementsSession.flags, ["cbc_in_link_popup": true, "disable_cbc_in_link_popup": false]) XCTAssertTrue(elementsSession.isApplePayEnabled) + XCTAssertFalse(elementsSession.paymentMethodSetAsDefaultForPaymentSheet) XCTAssertEqual(elementsSession.allResponseFields as NSDictionary, elementsSessionJson as NSDictionary) } @@ -262,6 +263,7 @@ class STPElementsSessionTest: XCTestCase { XCTAssertEqual(.legacy, savePaymentMethodConsentBehavior) } + func testSetAsDefault_enabled() { let elementsSession = STPElementsSession._testValue(paymentMethodTypes: ["card"], customerSessionData: [ @@ -280,6 +282,7 @@ class STPElementsSessionTest: XCTestCase { let allowsSetAsDefault = elementsSession.paymentMethodSetAsDefaultForPaymentSheet XCTAssertTrue(allowsSetAsDefault) } + func testSetAsDefault_disabled() { let elementsSession = STPElementsSession._testValue(paymentMethodTypes: ["card"], customerSessionData: [