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

Amazon Pay ECE: Hide settings for legacy checkout #4120

Merged
merged 4 commits into from
Mar 24, 2025
Merged
Show file tree
Hide file tree
Changes from 3 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: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
* Fix - Compatibility with email preview in the Auth Requested email
* Update - Update Alipay and bank debit icons.
* Tweak - Update payment method type check for charge.succeeded webhook.
* Fix - Hide Amazon Pay in settings when legacy checkout is enabled.

= 9.3.1 - 2025-03-14 =
* Fix - Temporarily disables the subscriptions detached notice feature due to long loading times on stores with many subscriptions.
Expand Down
14 changes: 14 additions & 0 deletions client/settings/payment-request-section/__tests__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import {
PAYMENT_METHOD_CARD,
PAYMENT_METHOD_LINK,
PAYMENT_METHOD_AMAZON_PAY,
} from 'wcstripe/stripe-utils/constants';

jest.mock( 'wcstripe/data', () => ( {
Expand Down Expand Up @@ -37,6 +38,7 @@ describe( 'PaymentRequestSection', () => {
useGetAvailablePaymentMethodIds.mockReturnValue( [
PAYMENT_METHOD_CARD,
PAYMENT_METHOD_LINK,
PAYMENT_METHOD_AMAZON_PAY,
] );
useAmazonPayEnabledSettings.mockReturnValue( [ false, jest.fn() ] );
global.wc_stripe_settings_params = {
Expand Down Expand Up @@ -139,6 +141,18 @@ describe( 'PaymentRequestSection', () => {
expect( screen.queryByText( 'Amazon Pay' ) ).toBeNull();
} );

it( 'hide Amazon Pay if legacy checkout is enabled', () => {
// Amazon Pay is only available as a UPE payment method.
useGetAvailablePaymentMethodIds.mockReturnValue( [
PAYMENT_METHOD_CARD,
] );
useAmazonPayEnabledSettings.mockReturnValue( [ true, jest.fn() ] );

render( <PaymentRequestSection /> );

expect( screen.queryByText( 'Amazon Pay' ) ).toBeNull();
} );

it( 'test Amazon Pay checkbox not checked', () => {
const container = render( <PaymentRequestSection /> );
const amazonPayCheckbox = container.getByRole( 'checkbox', {
Expand Down
4 changes: 3 additions & 1 deletion client/settings/payment-request-section/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import PaymentMethodMissingCurrencyPill from '../../components/payment-method-mi
import {
PAYMENT_METHOD_CARD,
PAYMENT_METHOD_LINK,
PAYMENT_METHOD_AMAZON_PAY,
} from 'wcstripe/stripe-utils/constants';

const PaymentRequestSection = () => {
Expand Down Expand Up @@ -77,7 +78,8 @@ const PaymentRequestSection = () => {
);

const isAmazonPayAvailable =
wc_stripe_settings_params.is_amazon_pay_available; // eslint-disable-line camelcase
wc_stripe_settings_params.is_amazon_pay_available && // eslint-disable-line camelcase
availablePaymentMethodIds.includes( PAYMENT_METHOD_AMAZON_PAY );

return (
<Card className="express-checkouts">
Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,6 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
* Fix - Compatibility with email preview in the Auth Requested email
* Update - Update Alipay and bank debit icons.
* Tweak - Update payment method type check for charge.succeeded webhook.
* Fix - Hide Amazon Pay in settings when legacy checkout is enabled.

[See changelog for all versions](https://raw.githubusercontent.com/woocommerce/woocommerce-gateway-stripe/trunk/changelog.txt).
Loading