Skip to content

Commit

Permalink
fix(payment): INT-2595 Removed credit card fields in Adyen v1 using P…
Browse files Browse the repository at this point in the history
…aypal
  • Loading branch information
roberbnd committed May 29, 2020
1 parent 58953fa commit 7caae80
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 7caae80

Please sign in to comment.