@@ -19,6 +19,7 @@ import {
1919 CouponErrorLimitReached ,
2020 CustomerSessionManager ,
2121 PaymentIntentManager ,
22+ determinePaymentMethodType ,
2223} from '@fxa/payments/customer' ;
2324import { EligibilityService } from '@fxa/payments/eligibility' ;
2425import {
@@ -574,9 +575,13 @@ export class CartService {
574575 }
575576
576577 let paymentInfo : PaymentInfo | undefined ;
577- if ( customer ?. invoice_settings . default_payment_method ) {
578+ const paymentMethodType = determinePaymentMethodType (
579+ customer ,
580+ subscriptions
581+ ) ;
582+ if ( paymentMethodType ?. type === 'stripe' ) {
578583 const paymentMethodPromise = this . paymentMethodManager . retrieve (
579- customer . invoice_settings . default_payment_method
584+ paymentMethodType . paymentMethodId
580585 ) ;
581586 const customerSessionPromise = cart . stripeCustomerId
582587 ? this . customerSessionManager . create ( cart . stripeCustomerId )
@@ -591,6 +596,10 @@ export class CartService {
591596 brand : paymentMethod . card ?. brand ,
592597 customerSessionClientSecret : customerSession ?. client_secret ,
593598 } ;
599+ } else if ( paymentMethodType ?. type === 'external_paypal' ) {
600+ paymentInfo = {
601+ type : 'external_paypal' ,
602+ } ;
594603 } else if ( subscriptions . length ) {
595604 const firstListedSubscription = subscriptions [ 0 ] ;
596605 // fetch payment method info
0 commit comments