Skip to content

Commit

Permalink
Instant Debits: cleaned up logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
kgaidis-stripe committed May 8, 2024
1 parent ebf04fa commit 5eb722c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -716,12 +716,7 @@ extension PaymentSheetFormFactory {
)
}
}(),
emailElement: (
// TODO: does this email logic make sense?
(configuration.billingDetailsCollectionConfiguration.email != .never)
? makeEmail()
: nil
),
emailElement: makeEmail(),
theme: theme
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,6 @@ final class InstantDebitsPaymentMethodElement: Element {
emailElement: PaymentMethodElement?,
theme: ElementsUITheme = .default
) {
let willShowEmailField = (configuration.billingDetailsCollectionConfiguration.email != .never)
let hasDefaultEmail = (
configuration.billingDetailsCollectionConfiguration.attachDefaultsToPaymentMethod
&& configuration.defaultBillingDetails.email != nil
)

// Fail loudly: This is an integration error
assert(
// TODO: is it a mandatory step to provide an email???
(willShowEmailField || hasDefaultEmail),
"If email is not collected, they must be provided through defaults"
)

self.configuration = configuration
self.linkedBankInfoView = BankAccountInfoView(frame: .zero, theme: theme)
self.linkedBankInfoSectionElement = SectionElement(
Expand Down

0 comments on commit 5eb722c

Please sign in to comment.