-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[BANKCON-14524] Allow pay by bank when linkCardBrand criteria is met & dedupe instant debits #4021
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -165,12 +165,29 @@ extension PaymentSheet { | |
// External Payment Methods | ||
+ elementsSession.externalPaymentMethods.map { PaymentMethodType.external($0) } | ||
|
||
if | ||
elementsSession.orderedPaymentMethodTypes.contains(.link), | ||
!elementsSession.orderedPaymentMethodTypes.contains(.USBankAccount), | ||
!intent.isDeferredIntent, | ||
// We should manually add Instant Debits as a payment method when: | ||
// - Link is an available payment method. | ||
// - US Bank Account is *not* an available payment method. | ||
// - Not a deferred intent flow. | ||
// - Link Funding Sources contains Bank Account. | ||
var eligibleForInstantDebits: Bool { | ||
elementsSession.orderedPaymentMethodTypes.contains(.link) && | ||
!elementsSession.orderedPaymentMethodTypes.contains(.USBankAccount) && | ||
!intent.isDeferredIntent && | ||
elementsSession.linkFundingSources?.contains(.bankAccount) == true | ||
{ | ||
} | ||
Comment on lines
+173
to
+178
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this need to be a and out of curiosity/learning how does this compile? I would have expected it to be something like:
I get the inferred But what are all the other pieces? it almost looks like an in-line computed property but the declaration is inside of a function 🤔 so I am not immediately sure the step-by-step execution for it to compile into a boolean There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tried in Xcode and I guess it can't be a Is there a name for computed properties inside of functions, and is this new or old? 🤔 |
||
|
||
// We should manually add Link Card Brand as a payment method when: | ||
// - Link Funding Sources contains Bank Account. | ||
// - US Bank Account is *not* an available payment method. | ||
// - Link Card Brand is the Link Mode | ||
var eligibleForLinkCardBrand: Bool { | ||
elementsSession.linkFundingSources?.contains(.bankAccount) == true && | ||
!elementsSession.orderedPaymentMethodTypes.contains(.USBankAccount) && | ||
elementsSession.linkSettings?.linkMode == .linkCardBrand | ||
} | ||
|
||
if eligibleForInstantDebits { | ||
let availabilityStatus = configurationSatisfiesRequirements( | ||
requirements: [.financialConnectionsSDK], | ||
configuration: configuration, | ||
|
@@ -179,6 +196,16 @@ extension PaymentSheet { | |
if availabilityStatus == .supported { | ||
recommendedPaymentMethodTypes.append(.instantDebits) | ||
} | ||
// Else if here so we don't show both Instant Debits and Link Card Brand together. | ||
} else if eligibleForLinkCardBrand { | ||
let availabilityStatus = configurationSatisfiesRequirements( | ||
requirements: [.financialConnectionsSDK], | ||
configuration: configuration, | ||
intent: intent | ||
) | ||
if availabilityStatus == .supported { | ||
recommendedPaymentMethodTypes.append(.linkCardBrand) | ||
} | ||
} | ||
|
||
if let merchantPaymentMethodOrder = configuration.paymentMethodOrder?.map({ $0.lowercased() }) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to update this UI test. With Panther enabled there's a second payment method available in this scenario now, and so the
Add a card
text was no longer shown. Here's the changes to this screen with Panther: