Skip to content

Commit

Permalink
Merge pull request #310 from roberbnd/INT-2595
Browse files Browse the repository at this point in the history
fix(payment) Removed  credit card fields in Adyen v1 using Paypal
  • Loading branch information
PascalZajac authored Jun 8, 2020
2 parents 6638fed + 7caae80 commit c01ec34
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
20 changes: 20 additions & 0 deletions src/app/payment/paymentMethod/PaymentMethod.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,26 @@ describe('PaymentMethod', () => {
.toHaveBeenCalledWith(expect.any(Error));
});

it('renders as hosted paypal payment method in Adyen v1', () => {
let method: PaymentMethod;

method = {
...getPaymentMethod(),
id: 'paypal',
gateway: PaymentMethodId.Adyen,
type: PaymentMethodProviderType.Hosted,
};

const container = mount(<PaymentMethodTest { ...defaultProps } method={ method } />);

expect(container.find(HostedPaymentMethod).props())
.toEqual(expect.objectContaining({
deinitializePayment: expect.any(Function),
initializePayment: expect.any(Function),
method,
}));
});

describe('when using hosted / offsite payment', () => {
let method: PaymentMethod;

Expand Down
3 changes: 2 additions & 1 deletion src/app/payment/paymentMethod/PaymentMethod.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ const PaymentMethodComponent: FunctionComponent<PaymentMethodProps & WithCheckou
return <PaypalExpressPaymentMethod { ...props } />;
}

if (method.id === PaymentMethodId.PaypalPaymentsPro) {
if (method.type !== PaymentMethodProviderType.Hosted &&
method.id === PaymentMethodId.PaypalPaymentsPro) {
return <PaypalPaymentsProPaymentMethod { ...props } />;
}

Expand Down

0 comments on commit c01ec34

Please sign in to comment.