Skip to content

Commit

Permalink
Merge pull request stripe#2793 from stripe/tmcquinn/removeSavedPaymen…
Browse files Browse the repository at this point in the history
…tMethodMessage

Add remove msg to PaymentSheet and CustomerSheet
  • Loading branch information
tmcquinn-stripe authored Jul 30, 2023
2 parents 05cda47 + 31a7740 commit 1fc1283
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ extension CustomerSavedPaymentMethodsCollectionViewController: PaymentOptionCell

let alertController = UIAlertController(
title: paymentMethod.removalMessage.title,
message: paymentMethod.removalMessage.message,
message: self.savedPaymentMethodsConfiguration.removeSavedPaymentMethodMessage ?? paymentMethod.removalMessage.message,
preferredStyle: .alert
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ extension CustomerSheet {
/// you **must** provide an appropriate value as part of `defaultBillingDetails`.
public var billingDetailsCollectionConfiguration = PaymentSheet.BillingDetailsCollectionConfiguration()

/// Optional configuration to display a custom message when a saved payment method is removed.
public var removeSavedPaymentMethodMessage: String?

public init () {
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ extension PaymentSheet {
/// If `never` is used for a required field for the Payment Method used during checkout,
/// you **must** provide an appropriate value as part of `defaultBillingDetails`.
public var billingDetailsCollectionConfiguration = BillingDetailsCollectionConfiguration()

/// Optional configuration to display a custom message when a saved payment method is removed.
public var removeSavedPaymentMethodMessage: String?
}

/// Configuration related to the Stripe Customer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class SavedPaymentOptionsViewController: UIViewController {
let customerID: String?
let showApplePay: Bool
let showLink: Bool
let removeSavedPaymentMethodMessage: String?
}

var hasRemovablePaymentMethods: Bool {
Expand Down Expand Up @@ -371,7 +372,7 @@ extension SavedPaymentOptionsViewController: PaymentOptionCellDelegate {

let alertController = UIAlertController(
title: paymentMethod.removalMessage.title,
message: paymentMethod.removalMessage.message,
message: configuration.removeSavedPaymentMethodMessage ?? paymentMethod.removalMessage.message,
preferredStyle: .alert
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ class PaymentSheetFlowControllerViewController: UIViewController {
configuration: .init(
customerID: configuration.customer?.id,
showApplePay: isApplePayEnabled,
showLink: isLinkEnabled
showLink: isLinkEnabled,
removeSavedPaymentMethodMessage: configuration.removeSavedPaymentMethodMessage
),
appearance: configuration.appearance
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ class PaymentSheetViewController: UIViewController {
configuration: .init(
customerID: configuration.customer?.id,
showApplePay: showApplePay,
showLink: showLink
showLink: showLink,
removeSavedPaymentMethodMessage: configuration.removeSavedPaymentMethodMessage
),
appearance: configuration.appearance,
delegate: self
Expand Down

0 comments on commit 1fc1283

Please sign in to comment.