Skip to content

Commit

Permalink
feat(payments): PAYPAL-702 Add alternative to mapper
Browse files Browse the repository at this point in the history
  • Loading branch information
Olga Lashkul committed Oct 20, 2020
1 parent 94f9ab3 commit f7b5134
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/payment/payment-method-ids.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ export const BRAINTREE_VISACHECKOUT = 'braintreevisacheckout';
export const BRAINTREE_GOOGLEPAY = 'googlepaybraintree';

export const PAYPAL_COMMERCE = 'paypalcommerce';
export const PAYPAL_COMMERCE_ALTERNATIVE_METHODS = 'paypalcommercealternativemethods';
export const PAYPAL_COMMERCE_CREDIT = 'paypalcommercecredit';
export const PAYPAL_COMMERCE_CREDIT_CARDS = 'paypalcommercecreditcards';
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
PAYPAL_COMMERCE,
PAYPAL_COMMERCE_CREDIT,
PAYPAL_COMMERCE_CREDIT_CARDS,
PAYPAL_COMMERCE_ALTERNATIVE_METHODS,
} from '../payment-method-ids';

/**
Expand All @@ -34,6 +35,7 @@ function isPaypalCommercePaymentMethod(id) {
switch (id) {
case PAYPAL_COMMERCE_CREDIT:
case PAYPAL_COMMERCE_CREDIT_CARDS:
case PAYPAL_COMMERCE_ALTERNATIVE_METHODS:
return true;
default:
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,9 @@ describe('PaymentMethodIdMapper', () => {
paymentMethod = { id: PAYMENT_METHODS.PAYPAL_COMMERCE_CREDIT_CARDS };
expect(paymentMethodIdMapper.mapToId(paymentMethod)).toEqual(PAYMENT_METHODS.PAYPAL_COMMERCE);
});

it('returns "paypalcommerce" if the payment method is "paypalcommercealternativemethods"', () => {
paymentMethod = { id: PAYMENT_METHODS.PAYPAL_COMMERCE_ALTERNATIVE_METHODS };
expect(paymentMethodIdMapper.mapToId(paymentMethod)).toEqual(PAYMENT_METHODS.PAYPAL_COMMERCE);
});
});

0 comments on commit f7b5134

Please sign in to comment.