Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Header text says manage cards instead of manage payment methods when only cards available #4449

Merged
merged 6 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ re-entering the security code (CVV/CVC). */
/* Title shown above a view containing the customer's card that they can delete or update */
"Manage card" = "Manage card";

/* Title shown above a view containing a list of the customer's cards that they can delete or update */
"Manage cards" = "Manage cards";

/* Title shown above a view containing the customer's payment method that they can delete or update */
"Manage payment method" = "Manage payment method";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ extension String.Localized {
)
}

static var manage_cards: String {
STPLocalizedString(
"Manage cards",
"Title shown above a view containing a list of the customer's cards that they can delete or update"
)
}

static var bank_account_details_cannot_be_changed: String {
STPLocalizedString(
"Bank account details cannot be changed.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,15 @@ class VerticalSavedPaymentMethodsViewController: UIViewController {
}

private var headerText: String {
let nonCardPaymentMethods = paymentMethods.filter({ $0.type != .card })
let onlyCards = nonCardPaymentMethods.isEmpty
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I typically like to name booleans in a way that answers a yes or no question.. e.g.(is..., has..., etc) -- e.g. hasOnlyCards

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense, renamed it to hasOnlyCards

if isEditingPaymentMethods {
if onlyCards {
return paymentMethods.count == 1 ? .Localized.manage_card : .Localized.manage_cards
}
return paymentMethods.count == 1 ? .Localized.manage_payment_method : .Localized.manage_payment_methods
}

let nonCardPaymentMethods = paymentMethods.filter({ $0.type != .card })
return nonCardPaymentMethods.isEmpty ? .Localized.select_card : .Localized.select_payment_method
return onlyCards ? .Localized.select_card : .Localized.select_payment_method
}

var canRemovePaymentMethods: Bool {
Expand Down
Loading