Skip to content

Commit

Permalink
feat(checkout): INT-1916 Customize barclacard payment method title logos
Browse files Browse the repository at this point in the history
  • Loading branch information
FranciscoOnt committed Nov 12, 2019
1 parent 9a60ad9 commit ebec263
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/app/payment/paymentMethod/PaymentMethodTitle.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ describe('PaymentMethodTitle', () => {
const methodIds = [
PaymentMethodId.Amazon,
PaymentMethodId.ChasePay,
PaymentMethodType.Barclaycard,
PaymentMethodType.GooglePay,
PaymentMethodType.Masterpass,
];
Expand All @@ -210,4 +211,26 @@ describe('PaymentMethodTitle', () => {
.toEqual(0);
});
});

it('renders a different logo for each methodId for Barclaycard', () => {
const imageExtension = '.png';
const imageFolder = '/img/payment-providers/';
const method = PaymentMethodType.Barclaycard;
const id = 'card';

const component = mount(<PaymentMethodTitleTest
{ ...defaultProps }
method={ {
...defaultProps.method,
id,
method,
} }
/>);

const expectedPath = `${config.cdnPath}${imageFolder}${method}_${id.toLowerCase()}${imageExtension}`;

expect(component.find('[data-test="payment-method-logo"]').prop('src'))
.toEqual(expectedPath);

});
});
4 changes: 4 additions & 0 deletions src/app/payment/paymentMethod/PaymentMethodTitle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ function getPaymentMethodTitle(
logoUrl: cdnPath('/img/payment-providers/zip.png'),
titleText: language.translate('payment.zip_display_name_text'),
},
[PaymentMethodType.Barclaycard]: {
logoUrl: cdnPath(`/img/payment-providers/barclaycard_${method.id.toLowerCase()}.png`),
titleText: '',
},
};

// KLUDGE: 'paypal' is actually a credit card method. It is the only
Expand Down
1 change: 1 addition & 0 deletions src/app/payment/paymentMethod/PaymentMethodType.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
enum PaymentMethodType {
Barclaycard = 'barclaycard',
Chasepay = 'chasepay',
CreditCard = 'credit-card',
GooglePay = 'googlepay',
Expand Down

0 comments on commit ebec263

Please sign in to comment.