Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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 @@ -740,7 +740,7 @@ extension PayWithLinkViewController.WalletViewController: LinkPaymentMethodPicke
let newPaymentVC = PayWithLinkViewController.NewPaymentViewController(
linkAccount: linkAccount,
context: context,
isAddingFirstPaymentMethod: false
isAddingFirstPaymentMethod: viewModel.paymentMethods.isEmpty
)

bottomSheetController?.pushContentViewController(newPaymentVC)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,31 +499,22 @@ private extension PayWithLinkViewController {
paymentDetails: [ConsumerPaymentDetails]
) {
let viewController: BottomSheetContentViewController
if paymentDetails.isEmpty {
// Check if only bank accounts are supported - if so, launch Financial Connections directly
let supportedTypes = context.getSupportedPaymentDetailsTypes(linkAccount: linkAccount)
if supportedTypes == [.bankAccount] {
startFinancialConnections { [weak self] result in
guard let self else { return }
switch result {
case .completed:
self.loadAndPresentWallet()
case .canceled:
self.cancel(shouldReturnToPaymentSheet: false)
case .failed(let error):
self.finish(withResult: .failed(error: error), deferredIntentConfirmationType: nil)
}
// Check if only bank accounts are supported - if so, launch Financial Connections directly
let supportedTypes = context.getSupportedPaymentDetailsTypes(linkAccount: linkAccount)
if paymentDetails.isEmpty && supportedTypes == [.bankAccount] {
startFinancialConnections { [weak self] result in
guard let self else { return }
switch result {
case .completed:
self.loadAndPresentWallet()
case .canceled:
self.cancel(shouldReturnToPaymentSheet: false)
case .failed(let error):
self.finish(withResult: .failed(error: error), deferredIntentConfirmationType: nil)
}
// Show a loading view while Financial Connections is being prepared
viewController = LoaderViewController(context: context)
} else {
let addPaymentMethodVC = NewPaymentViewController(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Checking my understanding: We're removing this because when more than just bank accounts are supported and the user has no payment methods, we'll just show the wallet (line 519) so they can add any of the supported types. Is that right?

linkAccount: linkAccount,
context: context,
isAddingFirstPaymentMethod: true
)
viewController = addPaymentMethodVC
}
// Show a loading view while Financial Connections is being prepared
viewController = LoaderViewController(context: context)
} else {
let walletViewController = WalletViewController(
linkAccount: linkAccount,
Expand Down
Loading