Skip to content

Commit

Permalink
feat(payments): PAYPAL-1474 added paypalcommerceinline method id into…
Browse files Browse the repository at this point in the history
… payment mapper file
  • Loading branch information
serhii-tkachenko committed Aug 25, 2022
1 parent 4e9b73c commit 685a1e0
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 @@ -8,4 +8,5 @@ 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';
export const PAYPAL_COMMERCE_INLINE = 'paypalcommerceinline';
export const PAYPAL_COMMERCE_VENMO = 'paypalcommercevenmo';
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
PAYPAL_COMMERCE_CREDIT,
PAYPAL_COMMERCE_CREDIT_CARDS,
PAYPAL_COMMERCE_ALTERNATIVE_METHODS,
PAYPAL_COMMERCE_INLINE,
PAYPAL_COMMERCE_VENMO,
} from '../payment-method-ids';

Expand Down Expand Up @@ -37,6 +38,7 @@ function isPaypalCommercePaymentMethod(id) {
case PAYPAL_COMMERCE_CREDIT:
case PAYPAL_COMMERCE_CREDIT_CARDS:
case PAYPAL_COMMERCE_ALTERNATIVE_METHODS:
case PAYPAL_COMMERCE_INLINE:
case PAYPAL_COMMERCE_VENMO:
return true;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ describe('PaymentMethodIdMapper', () => {
expect(paymentMethodIdMapper.mapToId(paymentMethod)).toEqual(PAYMENT_METHODS.PAYPAL_COMMERCE);
});

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

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

0 comments on commit 685a1e0

Please sign in to comment.