diff --git a/Library/TestHelpers/Stripe+PaymentMethod.swift b/Library/TestHelpers/Stripe+PaymentMethod.swift index dcc4984022..4b4673f476 100644 --- a/Library/TestHelpers/Stripe+PaymentMethod.swift +++ b/Library/TestHelpers/Stripe+PaymentMethod.swift @@ -22,15 +22,15 @@ extension STPPaymentMethod { ]) static let sampleStringPaymentOption: (STPPaymentMethod) -> PaymentSheet.PaymentOption = { paymentMethod in - PaymentSheet.PaymentOption.saved(paymentMethod: paymentMethod) + PaymentSheet.PaymentOption.saved(paymentMethod: paymentMethod, confirmParams: nil) } static let samplePaymentOptionsDisplayData: (PaymentSheet.PaymentOption) -> PaymentSheetPaymentOptionsDisplayData = { paymentOption in switch paymentOption { - case let .saved(paymentMethod): + case .saved: return PaymentSheetPaymentOptionsDisplayData(image: .add, label: "••••1234") - case .applePay, .new, .link: + case .applePay, .new, .link, .external: return PaymentSheetPaymentOptionsDisplayData(image: .add, label: "Unknown") } } diff --git a/Library/ViewModels/PaymentMethodSettingsViewModel.swift b/Library/ViewModels/PaymentMethodSettingsViewModel.swift index 61e567e318..da2cde545a 100644 --- a/Library/ViewModels/PaymentMethodSettingsViewModel.swift +++ b/Library/ViewModels/PaymentMethodSettingsViewModel.swift @@ -157,6 +157,11 @@ public final class PaymentMethodSettingsViewModel: PaymentMethodsViewModelType, var configuration = PaymentSheet.Configuration() configuration.merchantDisplayName = Strings.general_accessibility_kickstarter() configuration.allowsDelayedPaymentMethods = true + + if featureStripeLinkEnabled() { + configuration.defaultBillingDetails.email = AppEnvironment.current.currentUserEmail + } + let data = PaymentSheetSetupData( clientSecret: envelope.clientSecret, configuration: configuration, diff --git a/Library/ViewModels/PledgePaymentMethodsViewModel.swift b/Library/ViewModels/PledgePaymentMethodsViewModel.swift index eb2a13c47b..4a6eacc619 100644 --- a/Library/ViewModels/PledgePaymentMethodsViewModel.swift +++ b/Library/ViewModels/PledgePaymentMethodsViewModel.swift @@ -346,6 +346,10 @@ public final class PledgePaymentMethodsViewModel: PledgePaymentMethodsViewModelT configuration.merchantDisplayName = Strings.general_accessibility_kickstarter() configuration.allowsDelayedPaymentMethods = paymentSheetType == .setupIntent + if featureStripeLinkEnabled() { + configuration.defaultBillingDetails.email = AppEnvironment.current.currentUserEmail + } + let data = PaymentSheetSetupData( clientSecret: clientSecret, configuration: configuration,