Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(payment): PI-3048 [Checkout.com] Remove issuers dropdown and sending BIC #2141

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ package-lock.json @bigcommerce/team-checkout @bigcommerce/team-integrations @big
/packages/core/payment/paymentMethod/MasterpassPaymentMethod.tsx @bigcommerce/team-integrations
/packages/core/payment/paymentMethod/MonerisPaymentMethod.tsx @bigcommerce/team-integrations
/packages/core/payment/paymentMethod/OpyPaymentMethod.tsx @bigcommerce/team-integrations
/packages/core/payment/paymentMethod/SquarePaymentMethod.tsx @bigcommerce/team-integrations
/packages/core/payment/paymentMethod/StripePaymentMethod.tsx @bigcommerce/team-integrations
/packages/core/payment/paymentMethod/StripeUPEPaymentMethod.tsx @bigcommerce/team-integrations
/packages/core/payment/paymentMethod/StripeV3CustomCardForm.tsx @bigcommerce/team-integrations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ describe('when using Checkoutcom payment', () => {
let defaultProps: PaymentMethodProps;
let localeContext: LocaleContextType;
let fawryMethod: PaymentMethod;
let idealMethod: PaymentMethod;
let alternateMethodA: PaymentMethod;
let alternateMethodB: PaymentMethod;
let PaymentMethodTest: FunctionComponent<PaymentMethodProps>;
Expand Down Expand Up @@ -72,7 +73,11 @@ describe('when using Checkoutcom payment', () => {
id: 'fawry',
gateway: PaymentMethodId.Checkoutcom,
};

idealMethod = {
...getPaymentMethod(),
id: 'ideal',
gateway: PaymentMethodId.Checkoutcom,
};
alternateMethodA = {
...getPaymentMethod(),
id: 'oxxo',
Expand Down Expand Up @@ -217,4 +222,38 @@ describe('when using Checkoutcom payment', () => {

expect(defaultProps.onUnhandledError).toHaveBeenCalled();
});

it('does not render the fields when ideal experiment is on', () => {
jest.spyOn(checkoutState.data, 'getConfig').mockReturnValue({
...getStoreConfig(),
checkoutSettings: {
...getStoreConfig().checkoutSettings,
features: {
...getStoreConfig().checkoutSettings.features,
'PI-2979.checkoutcom_enable_ideal_hosted_page': true,
},
},
});

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

expect(container.firstChild).toBeNull();
});

it('renders the fields for other APMs when ideal experiment is on', () => {
jest.spyOn(checkoutState.data, 'getConfig').mockReturnValue({
...getStoreConfig(),
checkoutSettings: {
...getStoreConfig().checkoutSettings,
features: {
...getStoreConfig().checkoutSettings.features,
'PI-2979.checkoutcom_enable_ideal_hosted_page': true,
},
},
});

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

expect(container.firstChild).not.toBeNull();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ const CheckoutcomCustomPaymentMethod: FunctionComponent<PaymentMethodProps> = ({
checkoutState,
...rest
}) => {
const { getConfig } = checkoutState.data;
const isIdealHostedPageExperimentOn =
getConfig()?.checkoutSettings.features['PI-2979.checkoutcom_enable_ideal_hosted_page'];

const checkoutCustomMethod = method.id;
const CheckoutcomCustomFieldset =
checkoutCustomMethod in checkoutcomCustomFormFields
Expand All @@ -37,7 +41,10 @@ const CheckoutcomCustomPaymentMethod: FunctionComponent<PaymentMethodProps> = ({

const billingAddress = checkoutState.data.getBillingAddress();

if (!isCheckoutcomPaymentMethod(checkoutCustomMethod)) {
if (
!isCheckoutcomPaymentMethod(checkoutCustomMethod) ||
(checkoutCustomMethod === 'ideal' && isIdealHostedPageExperimentOn)
) {
return null;
}

Expand Down