Skip to content

Commit

Permalink
Merge pull request #107 from helga1507/paypal-202
Browse files Browse the repository at this point in the history
PAYPAL-202 Add paypalcommercecreditcards to PaymentMethodIdMapper
  • Loading branch information
helga1507 authored Aug 12, 2020
2 parents 2a3b569 + dfea8c2 commit 84b73f2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/payment/payment-method-ids.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ export const BRAINTREE_GOOGLEPAY = 'googlepaybraintree';

export const PAYPAL_COMMERCE = 'paypalcommerce';
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 @@ -7,6 +7,7 @@ import {
BRAINTREE_VISACHECKOUT,
PAYPAL_COMMERCE,
PAYPAL_COMMERCE_CREDIT,
PAYPAL_COMMERCE_CREDIT_CARDS,
} from '../payment-method-ids';

/**
Expand All @@ -30,7 +31,13 @@ function isBraintreePaymentMethod(id) {
* @return {Boolean}
*/
function isPaypalCommercePaymentMethod(id) {
return (id === PAYPAL_COMMERCE_CREDIT);
switch (id) {
case PAYPAL_COMMERCE_CREDIT:
case PAYPAL_COMMERCE_CREDIT_CARDS:
return true;
default:
return false;
}
}

export default class PaymentMethodIdMapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,9 @@ describe('PaymentMethodIdMapper', () => {
paymentMethod = { id: PAYMENT_METHODS.PAYPAL_COMMERCE_CREDIT };
expect(paymentMethodIdMapper.mapToId(paymentMethod)).toEqual(PAYMENT_METHODS.PAYPAL_COMMERCE);
});

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

0 comments on commit 84b73f2

Please sign in to comment.