From d5354b2c7806268b070d01ff02e253c5892a92b1 Mon Sep 17 00:00:00 2001 From: Danae Millan <41606954+a-danae@users.noreply.github.com> Date: Tue, 9 Jul 2024 17:44:48 +0200 Subject: [PATCH 1/3] Fix check for when a subscription isn't using a source (#3253) --- .../class-wc-stripe-subscriptions-legacy-sepa-token-update.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/compat/class-wc-stripe-subscriptions-legacy-sepa-token-update.php b/includes/compat/class-wc-stripe-subscriptions-legacy-sepa-token-update.php index a3d65b89e..b294942ae 100644 --- a/includes/compat/class-wc-stripe-subscriptions-legacy-sepa-token-update.php +++ b/includes/compat/class-wc-stripe-subscriptions-legacy-sepa-token-update.php @@ -124,7 +124,7 @@ private function set_subscription_updated_payment_method( WC_Subscription $subsc $source_id = $subscription->get_meta( self::SOURCE_ID_META_KEY ); // Bail out if the subscription is already using a pm_. - if ( 0 === strpos( $source_id, 'src_' ) ) { + if ( 0 !== strpos( $source_id, 'src_' ) ) { throw new \Exception( sprintf( 'The subscription is not using a Stripe Source for renewals.', $subscription->get_id() ) ); } From d3a827c2050add443ff8299b9d7d83921811ed13 Mon Sep 17 00:00:00 2001 From: Danae Millan <41606954+a-danae@users.noreply.github.com> Date: Wed, 10 Jul 2024 00:24:34 +0200 Subject: [PATCH 2/3] Prevent tokens associated with sources from being displayed with the updated checkout experience (#3241) * Stop creating a token when the payment method uses sources and UPE is enabled * Delete the local tokens that use sources and were already migrated on the Stripe side * Revert "Delete the local tokens that use sources and were already migrated on the Stripe side" This reverts commit 1827a7b613dc639ccde4cd90d489ac5f6c590238. * Delete local tokens that use sources If they were migrated to payment methods on the Stripe end, new tokens will be created for the migrated payment methods. * Add changelog entries --- changelog.txt | 1 + includes/class-wc-stripe-payment-tokens.php | 17 +++++++++++++---- readme.txt | 1 + 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/changelog.txt b/changelog.txt index f1016bee0..30f394b57 100644 --- a/changelog.txt +++ b/changelog.txt @@ -14,6 +14,7 @@ * Fix - Ensure subscriptions purchased with iDEAL or Bancontact are correctly set to SEPA debit prior to processing the intitial payment. * Tweak - Stripe API version updated to support 2024-06-20. * Fix - Ensure SEPA tokens are attached to customers in the legacy checkout experience when the payment method is saved. This addresses subscription recurring payment "off-session" errors with SEPA. +* Fix - Prevent saved SEPA Sources from being displayed as available payment methods when the Updated checkout experience is enabled. = 8.4.0 - 2024-06-13 = * Tweak - Resets the list of payment methods when any Stripe key is updated. diff --git a/includes/class-wc-stripe-payment-tokens.php b/includes/class-wc-stripe-payment-tokens.php index e6629966e..2872c4a9a 100644 --- a/includes/class-wc-stripe-payment-tokens.php +++ b/includes/class-wc-stripe-payment-tokens.php @@ -262,15 +262,19 @@ public function woocommerce_get_customer_upe_payment_tokens( $tokens, $user_id, } try { - $stored_tokens = []; - + $stored_tokens = []; $deprecated_tokens = []; foreach ( $tokens as $token ) { if ( in_array( $token->get_gateway_id(), self::UPE_REUSABLE_GATEWAYS_BY_PAYMENT_METHOD, true ) ) { - // APM tokens from before Split PE was in place that will get removed. - if ( 'stripe' === $token->get_gateway_id() && 'sepa' === $token->get_type() ) { + // Remove the following deprecated tokens: + // - APM tokens from before Split PE was in place. + // - Tokens using the sources API. Payments using these will fail with the PaymentMethods API. + if ( + ( 'stripe' === $token->get_gateway_id() && 'sepa' === $token->get_type() ) || + str_starts_with( $token->get_token(), 'src_' ) + ) { $deprecated_tokens[ $token->get_token() ] = $token; continue; } @@ -310,8 +314,13 @@ public function woocommerce_get_customer_upe_payment_tokens( $tokens, $user_id, // Retrieve the real APM behind SEPA PaymentMethods. $payment_method_type = $this->get_original_payment_method_type( $payment_method ); + // Create a new token when: + // - The payment method doesn't have an associated token in WooCommerce. + // - The payment method is not a source. + // - The payment method belongs to the gateway ID being retrieved or the gateway ID is empty (meaning we're looking for all payment methods). if ( ! isset( $stored_tokens[ $payment_method->id ] ) && + ! str_starts_with( $payment_method->id, 'src_' ) && ( $this->is_valid_payment_method_type_for_gateway( $payment_method_type, $gateway_id ) || empty( $gateway_id ) ) ) { $token = $this->add_token_to_user( $payment_method, $customer ); diff --git a/readme.txt b/readme.txt index 4c617aa3d..d0c55a6da 100644 --- a/readme.txt +++ b/readme.txt @@ -145,5 +145,6 @@ If you get stuck, you can ask for help in the Plugin Forum. * Fix - Ensure SEPA tokens are attached to customers in the legacy checkout experience when the payment method is saved. This addresses subscription recurring payment "off-session" errors with SEPA. * Tweak - Limit the configure webhooks button to 1 click per minute to prevent multiple webhook creations. * Fix - Address Klarna currency rules to ensure correct presentment and availability based on merchant and customer locations. +* Fix - Prevent saved SEPA Sources from being displayed as available payment methods when the Updated checkout experience is enabled. [See changelog for all versions](https://raw.githubusercontent.com/woocommerce/woocommerce-gateway-stripe/trunk/changelog.txt). From fe2938d25d16f0aae6ae40e89243bdf33c5bbd72 Mon Sep 17 00:00:00 2001 From: Wesley Rosa Date: Tue, 9 Jul 2024 19:39:04 -0300 Subject: [PATCH 3/3] Removing Giropay due deprecation (#3229) * Removing Giropay due deprecation * Disabling Giropay on the block checkout (UPE) * Disable Giropay on shortcode checkout (UPE) * Disable Giropay on shortcode checkout (UPE) * Changelog and readme updates * Fix tests * Fix tests * Fix tests * Fix tests * Fix check for when a subscription isn't using a source * Update client/settings/general-settings-section/__tests__/general-settings-section.test.js Co-authored-by: Diego Curbelo * Update client/settings/general-settings-section/__tests__/general-settings-section.test.js Co-authored-by: Diego Curbelo * Update client/settings/general-settings-section/__tests__/general-settings-section.test.js Co-authored-by: Diego Curbelo * Update client/settings/general-settings-section/__tests__/general-settings-section.test.js Co-authored-by: Diego Curbelo * Update client/settings/general-settings-section/__tests__/general-settings-section.test.js Co-authored-by: Diego Curbelo * Update client/settings/general-settings-section/__tests__/general-settings-section.test.js Co-authored-by: Diego Curbelo * Replacing Giropay with Alipay on the rest settings controller test --------- Co-authored-by: Wesley Rosa Co-authored-by: Danae Millan Co-authored-by: Diego Curbelo --- changelog.txt | 1 + client/blocks/upe/index.js | 1 + .../general-settings-section.test.js | 103 +++++++----------- .../payment-methods-list.js | 10 ++ .../class-wc-gateway-stripe-giropay.php | 6 +- .../class-wc-stripe-upe-payment-gateway.php | 1 - ...s-wc-stripe-upe-payment-method-giropay.php | 12 ++ readme.txt | 1 + ...ass-wc-rest-stripe-settings-controller.php | 4 +- ...st-class-wc-stripe-upe-payment-gateway.php | 2 - ...est-class-wc-stripe-upe-payment-method.php | 14 --- tests/phpunit/test-wc-stripe.php | 16 +-- 12 files changed, 74 insertions(+), 97 deletions(-) diff --git a/changelog.txt b/changelog.txt index 30f394b57..b6b11f953 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,6 @@ *** Changelog *** = 8.5.0 - 2024-xx-xx = +* Tweak - Remove Giropay from the list of payment methods (for all versions) due deprecation. * Tweak - Additional visual improvement for the webhook configuration notice. * Add - Allow changing display order of payment methods in the new checkout experience. * Add - Update the payment method associated with a subscription to a PaymentMethod when it's using a Stripe Source that was migrated to PaymentMethods. diff --git a/client/blocks/upe/index.js b/client/blocks/upe/index.js index fef8ed4b1..9a88532d9 100644 --- a/client/blocks/upe/index.js +++ b/client/blocks/upe/index.js @@ -25,6 +25,7 @@ const api = new WCStripeAPI( const upeMethods = getPaymentMethodsConstants(); Object.entries( getBlocksConfiguration()?.paymentMethodsConfig ) .filter( ( [ upeName ] ) => upeName !== 'link' ) + .filter( ( [ upeName ] ) => upeName !== 'giropay' ) // Skip giropay as it was deprecated by Jun, 30th 2024. .forEach( ( [ upeName, upeConfig ] ) => { let iconName = upeName; diff --git a/client/settings/general-settings-section/__tests__/general-settings-section.test.js b/client/settings/general-settings-section/__tests__/general-settings-section.test.js index 8f150784a..50ce2ffaa 100644 --- a/client/settings/general-settings-section/__tests__/general-settings-section.test.js +++ b/client/settings/general-settings-section/__tests__/general-settings-section.test.js @@ -48,7 +48,7 @@ describe( 'GeneralSettingsSection', () => { global.wcSettings = { currency: { code: 'EUR' } }; useGetCapabilities.mockReturnValue( { card_payments: 'active', - giropay_payments: 'active', + alipay_payments: 'active', } ); useManualCapture.mockReturnValue( [ false ] ); useGetAvailablePaymentMethodIds.mockReturnValue( [ 'card', 'link' ] ); @@ -132,17 +132,11 @@ describe( 'GeneralSettingsSection', () => { it( 'should allow to enable a payment method when UPE is enabled', () => { useGetAvailablePaymentMethodIds.mockReturnValue( [ 'card', - 'giropay', - 'sofort', + 'alipay', 'sepa_debit', ] ); useGetOrderedPaymentMethodIds.mockReturnValue( { - orderedPaymentMethodIds: [ - 'card', - 'giropay', - 'sofort', - 'sepa_debit', - ], + orderedPaymentMethodIds: [ 'card', 'alipay', 'sepa_debit' ], setOrderedPaymentMethodIds: jest.fn(), saveOrderedPaymentMethodIds: jest.fn(), } ); @@ -158,26 +152,25 @@ describe( 'GeneralSettingsSection', () => { ); - const giropayCheckbox = screen.getByRole( 'checkbox', { - name: /giropay/, + const alipayCheckbox = screen.getByRole( 'checkbox', { + name: /Alipay/, } ); expect( updateEnabledMethodsMock ).not.toHaveBeenCalled(); - expect( giropayCheckbox ).not.toBeChecked(); + expect( alipayCheckbox ).not.toBeChecked(); - userEvent.click( giropayCheckbox ); + userEvent.click( alipayCheckbox ); expect( updateEnabledMethodsMock ).toHaveBeenCalledWith( [ 'card', - 'giropay', + 'alipay', ] ); } ); it( 'should allow to enable a payment method when UPE is disabled', () => { useGetAvailablePaymentMethodIds.mockReturnValue( [ 'card', - 'giropay', - 'sofort', + 'alipay', 'sepa_debit', ] ); const updateEnabledMethodsMock = jest.fn(); @@ -186,12 +179,7 @@ describe( 'GeneralSettingsSection', () => { updateEnabledMethodsMock, ] ); useGetOrderedPaymentMethodIds.mockReturnValue( { - orderedPaymentMethodIds: [ - 'card', - 'giropay', - 'sofort', - 'sepa_debit', - ], + orderedPaymentMethodIds: [ 'card', 'alipay', 'sepa_debit' ], setOrderedPaymentMethodIds: jest.fn(), saveOrderedPaymentMethodIds: jest.fn(), } ); @@ -202,26 +190,25 @@ describe( 'GeneralSettingsSection', () => { ); - const giropayCheckbox = screen.getByRole( 'checkbox', { - name: /giropay/, + const alipayCheckbox = screen.getByRole( 'checkbox', { + name: /Alipay/, } ); expect( updateEnabledMethodsMock ).not.toHaveBeenCalled(); - expect( giropayCheckbox ).not.toBeChecked(); + expect( alipayCheckbox ).not.toBeChecked(); - userEvent.click( giropayCheckbox ); + userEvent.click( alipayCheckbox ); expect( updateEnabledMethodsMock ).toHaveBeenCalledWith( [ 'card', - 'giropay', + 'alipay', ] ); } ); it( 'should show modal to disable a payment method', () => { useGetAvailablePaymentMethodIds.mockReturnValue( [ 'card', - 'giropay', - 'sofort', + 'alipay', 'sepa_debit', ] ); const updateEnabledMethodsMock = jest.fn(); @@ -259,8 +246,7 @@ describe( 'GeneralSettingsSection', () => { it( 'should not allow to disable a payment method when canceled via modal', () => { useGetAvailablePaymentMethodIds.mockReturnValue( [ 'card', - 'giropay', - 'sofort', + 'alipay', 'sepa_debit', ] ); const updateEnabledMethodsMock = jest.fn(); @@ -291,8 +277,7 @@ describe( 'GeneralSettingsSection', () => { it( 'should allow to disable a payment method when confirmed via modal', () => { useGetAvailablePaymentMethodIds.mockReturnValue( [ 'card', - 'giropay', - 'sofort', + 'alipay', 'sepa_debit', ] ); const updateEnabledMethodsMock = jest.fn(); @@ -322,10 +307,7 @@ describe( 'GeneralSettingsSection', () => { it( 'does not display the payment method checkbox when currency is not supprted', () => { global.wcSettings = { currency: { code: 'USD' } }; - useGetAvailablePaymentMethodIds.mockReturnValue( [ - 'card', - 'giropay', - ] ); + useGetAvailablePaymentMethodIds.mockReturnValue( [ 'card', 'alipay' ] ); render( @@ -345,10 +327,7 @@ describe( 'GeneralSettingsSection', () => { } ); it( 'does not display the payment method checkbox when manual capture is enabled', () => { - useGetAvailablePaymentMethodIds.mockReturnValue( [ - 'card', - 'giropay', - ] ); + useGetAvailablePaymentMethodIds.mockReturnValue( [ 'card', 'alipay' ] ); useManualCapture.mockReturnValue( [ true ] ); render( @@ -363,7 +342,7 @@ describe( 'GeneralSettingsSection', () => { ).toBeInTheDocument(); expect( screen.queryByRole( 'checkbox', { - name: 'giropay', + name: 'Alipay', } ) ).not.toBeInTheDocument(); } ); @@ -379,17 +358,17 @@ describe( 'GeneralSettingsSection', () => { name: 'Card', description: 'Pay with Card', }, - giropay: { - name: 'Giropay', - description: 'Pay with Giropay', + alipay: { + name: 'Alipay', + description: 'Pay with Alipay', }, }, isCustomizing: false, customizePaymentMethod: customizePaymentMethodMock, } ); - useGetAvailablePaymentMethodIds.mockReturnValue( [ 'giropay' ] ); + useGetAvailablePaymentMethodIds.mockReturnValue( [ 'alipay' ] ); useGetOrderedPaymentMethodIds.mockReturnValue( { - orderedPaymentMethodIds: [ 'giropay' ], + orderedPaymentMethodIds: [ 'alipay' ], setOrderedPaymentMethodIds: jest.fn(), saveOrderedPaymentMethodIds: jest.fn(), } ); @@ -402,7 +381,7 @@ describe( 'GeneralSettingsSection', () => { expect( screen.queryByRole( 'checkbox', { - name: 'giropay', + name: 'Alipay', } ) ).toBeInTheDocument(); expect( @@ -418,9 +397,9 @@ describe( 'GeneralSettingsSection', () => { ); // Expect the customization section to be open - expect( screen.getByLabelText( 'Name' ) ).toHaveValue( 'Giropay' ); + expect( screen.getByLabelText( 'Name' ) ).toHaveValue( 'Alipay' ); expect( screen.getByLabelText( 'Description' ) ).toHaveValue( - 'Pay with Giropay' + 'Pay with Alipay' ); expect( screen.queryByRole( 'button', { @@ -455,9 +434,9 @@ describe( 'GeneralSettingsSection', () => { } ); it( 'should display customization section in the payment method when UPE is enabled', () => { - useGetAvailablePaymentMethodIds.mockReturnValue( [ 'giropay' ] ); + useGetAvailablePaymentMethodIds.mockReturnValue( [ 'alipay' ] ); useGetOrderedPaymentMethodIds.mockReturnValue( { - orderedPaymentMethodIds: [ 'giropay' ], + orderedPaymentMethodIds: [ 'alipay' ], setOrderedPaymentMethodIds: jest.fn(), saveOrderedPaymentMethodIds: jest.fn(), } ); @@ -470,7 +449,7 @@ describe( 'GeneralSettingsSection', () => { expect( screen.queryByRole( 'checkbox', { - name: 'giropay', + name: 'Alipay', } ) ).toBeInTheDocument(); expect( @@ -481,12 +460,9 @@ describe( 'GeneralSettingsSection', () => { } ); it( 'displays the payment method checkbox when manual capture is disabled', () => { - useGetAvailablePaymentMethodIds.mockReturnValue( [ - 'card', - 'giropay', - ] ); + useGetAvailablePaymentMethodIds.mockReturnValue( [ 'card', 'alipay' ] ); useGetOrderedPaymentMethodIds.mockReturnValue( { - orderedPaymentMethodIds: [ 'card', 'giropay' ], + orderedPaymentMethodIds: [ 'card', 'alipay' ], setOrderedPaymentMethodIds: jest.fn(), saveOrderedPaymentMethodIds: jest.fn(), } ); @@ -504,16 +480,13 @@ describe( 'GeneralSettingsSection', () => { ).toBeInTheDocument(); expect( screen.queryByRole( 'checkbox', { - name: 'giropay', + name: 'Alipay', } ) ).toBeInTheDocument(); } ); it( 'should not render payment methods that are not part of the account capabilities', () => { - useGetAvailablePaymentMethodIds.mockReturnValue( [ - 'card', - 'giropay', - ] ); + useGetAvailablePaymentMethodIds.mockReturnValue( [ 'card', 'alipay' ] ); useGetCapabilities.mockReturnValue( { card_payments: 'active', } ); @@ -526,7 +499,7 @@ describe( 'GeneralSettingsSection', () => { expect( screen.queryByRole( 'checkbox', { - name: 'giropay', + name: 'Alipay', } ) ).not.toBeInTheDocument(); } ); @@ -537,7 +510,7 @@ describe( 'GeneralSettingsSection', () => { } ); useGetAvailablePaymentMethodIds.mockReturnValue( [ 'card', - 'giropay', + 'alipay', 'sepa_debit', 'sofort', 'eps', diff --git a/client/settings/general-settings-section/payment-methods-list.js b/client/settings/general-settings-section/payment-methods-list.js index 770737968..560c3768c 100644 --- a/client/settings/general-settings-section/payment-methods-list.js +++ b/client/settings/general-settings-section/payment-methods-list.js @@ -244,6 +244,11 @@ const GeneralSettingsSection = ( { onReorder={ onReorder } > { availablePaymentMethods.map( ( method ) => { + // Skip giropay as it was deprecated by Jun, 30th 2024. + if ( method === 'giropay' ) { + return null; + } + const { Icon, label, @@ -286,6 +291,11 @@ const GeneralSettingsSection = ( { ) : ( { availablePaymentMethods.map( ( method ) => { + // Skip giropay as it was deprecated by Jun, 30th 2024. + if ( method === 'giropay' ) { + return null; + } + const { Icon, label, diff --git a/includes/payment-methods/class-wc-gateway-stripe-giropay.php b/includes/payment-methods/class-wc-gateway-stripe-giropay.php index ab32c94f8..433db3454 100644 --- a/includes/payment-methods/class-wc-gateway-stripe-giropay.php +++ b/includes/payment-methods/class-wc-gateway-stripe-giropay.php @@ -122,11 +122,7 @@ public function get_supported_currency() { * @return bool */ public function is_available() { - if ( ! in_array( get_woocommerce_currency(), $this->get_supported_currency() ) ) { - return false; - } - - return parent::is_available(); + return false; } /** diff --git a/includes/payment-methods/class-wc-stripe-upe-payment-gateway.php b/includes/payment-methods/class-wc-stripe-upe-payment-gateway.php index 467b9436b..0c472b4e2 100644 --- a/includes/payment-methods/class-wc-stripe-upe-payment-gateway.php +++ b/includes/payment-methods/class-wc-stripe-upe-payment-gateway.php @@ -23,7 +23,6 @@ class WC_Stripe_UPE_Payment_Gateway extends WC_Gateway_Stripe { const UPE_AVAILABLE_METHODS = [ WC_Stripe_UPE_Payment_Method_CC::class, WC_Stripe_UPE_Payment_Method_Alipay::class, - WC_Stripe_UPE_Payment_Method_Giropay::class, WC_Stripe_UPE_Payment_Method_Klarna::class, WC_Stripe_UPE_Payment_Method_Affirm::class, WC_Stripe_UPE_Payment_Method_Afterpay_Clearpay::class, diff --git a/includes/payment-methods/class-wc-stripe-upe-payment-method-giropay.php b/includes/payment-methods/class-wc-stripe-upe-payment-method-giropay.php index fb0205872..b243dbbb4 100644 --- a/includes/payment-methods/class-wc-stripe-upe-payment-method-giropay.php +++ b/includes/payment-methods/class-wc-stripe-upe-payment-method-giropay.php @@ -27,4 +27,16 @@ public function __construct() { 'woocommerce-gateway-stripe' ); } + + /** + * Returns boolean dependent on whether payment method + * can be used at checkout + * + * @param int|null $order_id + * @param string|null $account_domestic_currency The account's default currency. + * @return bool + */ + public function is_enabled_at_checkout( $order_id = null, $account_domestic_currency = null ) { + return false; + } } diff --git a/readme.txt b/readme.txt index d0c55a6da..7ad9f4ec4 100644 --- a/readme.txt +++ b/readme.txt @@ -129,6 +129,7 @@ If you get stuck, you can ask for help in the Plugin Forum. == Changelog == = 8.5.0 - 2024-xx-xx = +* Tweak - Remove Giropay from the list of payment methods (for all versions) due deprecation. * Tweak - Additional visual improvement for the webhook configuration notice. * Add - Allow changing display order of payment methods in the new checkout experience. * Add - Update the payment method associated with a subscription to a PaymentMethod when it's using a Stripe Source that was migrated to PaymentMethods. diff --git a/tests/phpunit/admin/test-class-wc-rest-stripe-settings-controller.php b/tests/phpunit/admin/test-class-wc-rest-stripe-settings-controller.php index 27479735f..a91275282 100644 --- a/tests/phpunit/admin/test-class-wc-rest-stripe-settings-controller.php +++ b/tests/phpunit/admin/test-class-wc-rest-stripe-settings-controller.php @@ -122,7 +122,7 @@ public function test_enum_fields( $rest_key, $option_name, $original_valid_value 'bancontact_payments' => 'active', 'card_payments' => 'active', 'eps_payments' => 'active', - 'giropay_payments' => 'active', + 'alipay_payments' => 'active', 'ideal_payments' => 'active', 'p24_payments' => 'active', 'sepa_debit_payments' => 'active', @@ -357,7 +357,7 @@ public function enum_field_provider() { 'enabled_payment_method_ids', 'upe_checkout_experience_accepted_payments', [ 'card' ], - [ 'card', 'giropay' ], + [ 'card', 'alipay' ], [ 'foo' ], true, ], diff --git a/tests/phpunit/test-class-wc-stripe-upe-payment-gateway.php b/tests/phpunit/test-class-wc-stripe-upe-payment-gateway.php index f70a74151..f7ca7b17d 100644 --- a/tests/phpunit/test-class-wc-stripe-upe-payment-gateway.php +++ b/tests/phpunit/test-class-wc-stripe-upe-payment-gateway.php @@ -255,7 +255,6 @@ public function get_upe_available_payment_methods_provider() { [ WC_Stripe_UPE_Payment_Method_CC::STRIPE_ID, WC_Stripe_UPE_Payment_Method_Alipay::STRIPE_ID, - WC_Stripe_UPE_Payment_Method_Giropay::STRIPE_ID, WC_Stripe_UPE_Payment_Method_Klarna::STRIPE_ID, WC_Stripe_UPE_Payment_Method_Affirm::STRIPE_ID, WC_Stripe_UPE_Payment_Method_Afterpay_Clearpay::STRIPE_ID, @@ -277,7 +276,6 @@ public function get_upe_available_payment_methods_provider() { [ WC_Stripe_UPE_Payment_Method_CC::STRIPE_ID, WC_Stripe_UPE_Payment_Method_Alipay::STRIPE_ID, - WC_Stripe_UPE_Payment_Method_Giropay::STRIPE_ID, WC_Stripe_UPE_Payment_Method_Eps::STRIPE_ID, WC_Stripe_UPE_Payment_Method_Bancontact::STRIPE_ID, WC_Stripe_UPE_Payment_Method_Boleto::STRIPE_ID, diff --git a/tests/phpunit/test-class-wc-stripe-upe-payment-method.php b/tests/phpunit/test-class-wc-stripe-upe-payment-method.php index ba9ebe1e2..161f4065b 100644 --- a/tests/phpunit/test-class-wc-stripe-upe-payment-method.php +++ b/tests/phpunit/test-class-wc-stripe-upe-payment-method.php @@ -219,9 +219,6 @@ public function test_payment_methods_show_correct_default_outputs() { $mock_alipay_details = [ 'type' => 'alipay', ]; - $mock_giropay_details = [ - 'type' => 'giropay', - ]; $mock_p24_details = [ 'type' => 'p24', ]; @@ -255,7 +252,6 @@ public function test_payment_methods_show_correct_default_outputs() { $card_method = $this->mock_payment_methods['card']; $alipay_method = $this->mock_payment_methods['alipay']; - $giropay_method = $this->mock_payment_methods['giropay']; $p24_method = $this->mock_payment_methods['p24']; $eps_method = $this->mock_payment_methods['eps']; $sepa_method = $this->mock_payment_methods['sepa_debit']; @@ -286,14 +282,6 @@ public function test_payment_methods_show_correct_default_outputs() { $this->assertFalse( $alipay_method->is_reusable() ); $this->assertEquals( 'alipay', $alipay_method->get_retrievable_type() ); - $this->assertEquals( 'giropay', $giropay_method->get_id() ); - $this->assertEquals( 'giropay', $giropay_method->get_label() ); - $this->assertEquals( 'giropay', $giropay_method->get_title() ); - $this->assertEquals( 'giropay', $giropay_method->get_title( $mock_giropay_details ) ); - $this->assertFalse( $giropay_method->is_reusable() ); - $this->assertEquals( 'giropay', $giropay_method->get_retrievable_type() ); - $this->assertEquals( '', $giropay_method->get_testing_instructions() ); - $this->assertEquals( 'p24', $p24_method->get_id() ); $this->assertEquals( 'Przelewy24', $p24_method->get_label() ); $this->assertEquals( 'Przelewy24', $p24_method->get_title() ); @@ -393,7 +381,6 @@ public function test_card_payment_method_capability_is_always_enabled() { update_option( 'woocommerce_stripe_settings', $stripe_settings ); $card_method = $this->mock_payment_methods['card']; - $giropay_method = $this->mock_payment_methods['giropay']; $klarna_method = $this->mock_payment_methods['klarna']; $afterpay_clearpay_method = $this->mock_payment_methods['afterpay_clearpay']; $affirm_method = $this->mock_payment_methods['affirm']; @@ -409,7 +396,6 @@ public function test_card_payment_method_capability_is_always_enabled() { $wechat_pay_method = $this->mock_payment_methods['wechat_pay']; $this->assertTrue( $card_method->is_enabled_at_checkout() ); - $this->assertFalse( $giropay_method->is_enabled_at_checkout() ); $this->assertFalse( $klarna_method->is_enabled_at_checkout() ); $this->assertFalse( $affirm_method->is_enabled_at_checkout() ); $this->assertFalse( $afterpay_clearpay_method->is_enabled_at_checkout() ); diff --git a/tests/phpunit/test-wc-stripe.php b/tests/phpunit/test-wc-stripe.php index e20e6b690..66bd176d7 100644 --- a/tests/phpunit/test-wc-stripe.php +++ b/tests/phpunit/test-wc-stripe.php @@ -158,8 +158,8 @@ public function test_turning_on_upe_with_no_stripe_legacy_payment_methods_enable public function test_turning_on_upe_enables_the_correct_upe_methods_based_on_which_legacy_payment_methods_were_enabled_and_vice_versa() { $this->upe_helper->enable_upe_feature_flag(); - // Enable giropay and iDEAL LPM gateways. - update_option( 'woocommerce_stripe_giropay_settings', [ 'enabled' => 'yes' ] ); + // Enable Alipay and iDEAL LPM gateways. + update_option( 'woocommerce_stripe_alipay_settings', [ 'enabled' => 'yes' ] ); update_option( 'woocommerce_stripe_ideal_settings', [ 'enabled' => 'yes' ] ); $this->upe_helper->reload_payment_gateways(); @@ -170,12 +170,12 @@ public function test_turning_on_upe_enables_the_correct_upe_methods_based_on_whi $this->assertEquals( 'yes', $stripe_settings['enabled'] ); $this->assertEquals( 'yes', $stripe_settings['upe_checkout_experience_enabled'] ); $this->assertNotContains( 'card', $stripe_settings['upe_checkout_experience_accepted_payments'] ); - $this->assertContains( 'giropay', $stripe_settings['upe_checkout_experience_accepted_payments'] ); + $this->assertContains( 'alipay', $stripe_settings['upe_checkout_experience_accepted_payments'] ); $this->assertContains( 'ideal', $stripe_settings['upe_checkout_experience_accepted_payments'] ); - // Make sure the giropay and iDEAL LPMs were disabled. - $giropay_settings = get_option( 'woocommerce_stripe_giropay_settings' ); - $this->assertEquals( 'no', $giropay_settings['enabled'] ); + // Make sure the Alipay and iDEAL LPMs were disabled. + $alipay_settings = get_option( 'woocommerce_stripe_alipay_settings' ); + $this->assertEquals( 'no', $alipay_settings['enabled'] ); $ideal_settings = get_option( 'woocommerce_stripe_ideal_settings' ); $this->assertEquals( 'no', $ideal_settings['enabled'] ); @@ -191,8 +191,8 @@ public function test_turning_on_upe_enables_the_correct_upe_methods_based_on_whi $stripe_settings = get_option( 'woocommerce_stripe_settings' ); $this->assertEquals( 'no', $stripe_settings['enabled'] ); // Check that the correct LPMs were re-enabled. - $giropay_settings = get_option( 'woocommerce_stripe_giropay_settings' ); - $this->assertEquals( 'yes', $giropay_settings['enabled'] ); + $alipay_settings = get_option( 'woocommerce_stripe_alipay_settings' ); + $this->assertEquals( 'yes', $alipay_settings['enabled'] ); $ideal_settings = get_option( 'woocommerce_stripe_ideal_settings' ); $this->assertEquals( 'yes', $ideal_settings['enabled'] ); $eps_settings = get_option( 'woocommerce_stripe_eps_settings' );