File size: 462 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
import { isPaidWithCreditCard } from 'calypso/lib/purchases';
import { getAddPaymentMethodUrlFor, getChangePaymentMethodUrlFor } from './paths';
export function getChangeOrAddPaymentMethodUrlFor( siteSlug, purchase ) {
if ( isPaidWithCreditCard( purchase ) ) {
const {
payment: { creditCard },
} = purchase;
return getChangePaymentMethodUrlFor( siteSlug, purchase.id, creditCard.id );
}
return getAddPaymentMethodUrlFor( siteSlug, purchase.id );
}
|