Skip to content

Commit

Permalink
fix(payment): PAYMENTS-5178 Default vaulted instrument is not used as…
Browse files Browse the repository at this point in the history
… default payment method
  • Loading branch information
Tharaae committed Apr 1, 2020
1 parent 39816e7 commit 4637f04
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/app/payment/Payment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,14 @@ export function mapToPaymentProps({

const isTermsConditionsRequired = isTermsConditionsEnabled;
const selectedPayment = find(checkout.payments, { providerType: PaymentMethodProviderType.Hosted });
const selectedPaymentMethod = selectedPayment ? getPaymentMethod(selectedPayment.providerId, selectedPayment.gatewayId) : undefined;

let selectedPaymentMethod;
if (selectedPayment) {
selectedPaymentMethod = getPaymentMethod(selectedPayment.providerId, selectedPayment.gatewayId);
} else {
selectedPaymentMethod = find(methods, { config: { hasDefaultStoredInstrument: true } });
}

const filteredMethods = selectedPaymentMethod ? compact([selectedPaymentMethod]) : methods;

return {
Expand Down

0 comments on commit 4637f04

Please sign in to comment.