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 1caddf400e..f4adc18867 100644 --- a/includes/payment-methods/class-wc-stripe-upe-payment-gateway.php +++ b/includes/payment-methods/class-wc-stripe-upe-payment-gateway.php @@ -39,7 +39,7 @@ class WC_Stripe_UPE_Payment_Gateway extends WC_Gateway_Stripe { WC_Stripe_UPE_Payment_Method_Link::class, WC_Stripe_UPE_Payment_Method_Wechat_Pay::class, WC_Stripe_UPE_Payment_Method_Cash_App_Pay::class, - WC_Stripe_UPE_Payment_Method_Bacs::class, + WC_Stripe_UPE_Payment_Method_Bacs_Debit::class, ]; /** @@ -163,7 +163,7 @@ public function __construct() { continue; } - if ( WC_Stripe_UPE_Payment_Method_Bacs::class === $payment_method_class && ! WC_Stripe_Feature_Flags::is_bacs_lpm_enabled() ) { + if ( WC_Stripe_UPE_Payment_Method_Bacs_Debit::class === $payment_method_class && ! WC_Stripe_Feature_Flags::is_bacs_lpm_enabled() ) { continue; } diff --git a/includes/payment-methods/class-wc-stripe-upe-payment-method-bacs.php b/includes/payment-methods/class-wc-stripe-upe-payment-method-bacs-debit.php similarity index 94% rename from includes/payment-methods/class-wc-stripe-upe-payment-method-bacs.php rename to includes/payment-methods/class-wc-stripe-upe-payment-method-bacs-debit.php index 7034cf8e17..ec2e664506 100644 --- a/includes/payment-methods/class-wc-stripe-upe-payment-method-bacs.php +++ b/includes/payment-methods/class-wc-stripe-upe-payment-method-bacs-debit.php @@ -6,7 +6,7 @@ /** * The Bacs Direct Debit Payment Method class extending UPE base class. */ -class WC_Stripe_UPE_Payment_Method_Bacs extends WC_Stripe_UPE_Payment_Method { +class WC_Stripe_UPE_Payment_Method_Bacs_Debit extends WC_Stripe_UPE_Payment_Method { /** * The Stripe ID for the payment method. */ @@ -55,7 +55,7 @@ public function get_retrievable_type() { } public function create_payment_token_for_user( $user_id, $payment_method ) { - $token = new WC_Payment_Token_Bacs(); + $token = new WC_Payment_Token_Bacs_Debit(); $token->set_token( $payment_method->id ); $token->set_gateway_id( $this->id ); $token->set_last4( $payment_method->bacs_debit->last4 ); diff --git a/includes/payment-tokens/class-wc-stripe-bacs-payment-token.php b/includes/payment-tokens/class-wc-stripe-bacs-payment-token.php index e3643a9047..b13600daea 100644 --- a/includes/payment-tokens/class-wc-stripe-bacs-payment-token.php +++ b/includes/payment-tokens/class-wc-stripe-bacs-payment-token.php @@ -5,7 +5,7 @@ // phpcs:disable WordPress.Files.FileName -class WC_Payment_Token_Bacs extends WC_Payment_Token implements WC_Stripe_Payment_Method_Comparison_Interface { +class WC_Payment_Token_Bacs_Debit extends WC_Payment_Token implements WC_Stripe_Payment_Method_Comparison_Interface { use WC_Stripe_Fingerprint_Trait; protected $type = WC_Stripe_Payment_Methods::BACS_DEBIT; diff --git a/includes/payment-tokens/class-wc-stripe-payment-tokens.php b/includes/payment-tokens/class-wc-stripe-payment-tokens.php index 7ce348771c..4ab7cc6db2 100644 --- a/includes/payment-tokens/class-wc-stripe-payment-tokens.php +++ b/includes/payment-tokens/class-wc-stripe-payment-tokens.php @@ -28,7 +28,7 @@ class WC_Stripe_Payment_Tokens { WC_Stripe_UPE_Payment_Method_Sepa::STRIPE_ID => WC_Stripe_UPE_Payment_Gateway::ID . '_' . WC_Stripe_UPE_Payment_Method_Sepa::STRIPE_ID, WC_Stripe_UPE_Payment_Method_Sofort::STRIPE_ID => WC_Stripe_UPE_Payment_Gateway::ID . '_' . WC_Stripe_UPE_Payment_Method_Sofort::STRIPE_ID, WC_Stripe_UPE_Payment_Method_Cash_App_Pay::STRIPE_ID => WC_Stripe_UPE_Payment_Gateway::ID . '_' . WC_Stripe_UPE_Payment_Method_Cash_App_Pay::STRIPE_ID, - WC_Stripe_UPE_Payment_Method_Bacs::STRIPE_ID => WC_Stripe_UPE_Payment_Gateway::ID . '_' . WC_Stripe_UPE_Payment_Method_Bacs::STRIPE_ID, + WC_Stripe_UPE_Payment_Method_Bacs_Debit::STRIPE_ID => WC_Stripe_UPE_Payment_Gateway::ID . '_' . WC_Stripe_UPE_Payment_Method_Bacs_Debit::STRIPE_ID, ]; /** @@ -526,9 +526,8 @@ private function add_token_to_user( $payment_method, WC_Stripe_Customer $custome $token->set_last4( $payment_method->card->last4 ); $token->set_fingerprint( $payment_method->card->fingerprint ); break; - - case WC_Stripe_UPE_Payment_Method_Bacs::STRIPE_ID: - $token = new WC_Payment_Token_Bacs(); + case WC_Stripe_UPE_Payment_Method_Bacs_Debit::STRIPE_ID: + $token = new WC_Payment_Token_Bacs_Debit(); $token->set_token( $payment_method->id ); $token->set_last4( $payment_method->bacs_debit->last4 ); $token->set_fingerprint( $payment_method->bacs_debit->fingerprint ); diff --git a/tests/phpunit/helpers/class-wc-helper-order.php b/tests/phpunit/helpers/class-wc-helper-order.php index ffd9674392..0a58b0a9e8 100644 --- a/tests/phpunit/helpers/class-wc-helper-order.php +++ b/tests/phpunit/helpers/class-wc-helper-order.php @@ -107,7 +107,7 @@ public static function create_order( $customer_id = 1, $product = null, $order_p // Set payment gateway. $payment_gateways = WC()->payment_gateways->payment_gateways(); - $order->set_payment_method( $payment_gateways['bacs'] ); + $order->set_payment_method( $payment_gateways['bacs_debit'] ); // Set totals. $order->set_shipping_total( 10 ); 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 49672c0d7a..2503013c7f 100644 --- a/tests/phpunit/test-class-wc-stripe-upe-payment-method.php +++ b/tests/phpunit/test-class-wc-stripe-upe-payment-method.php @@ -141,7 +141,7 @@ private function reset_payment_method_mocks( $exclude_methods = [] ) { foreach ( WC_Stripe_UPE_Payment_Gateway::UPE_AVAILABLE_METHODS as $payment_method_class ) { // Bacs is under flag, remove when is enabled by default. - if ( WC_Stripe_UPE_Payment_Method_Bacs::class === $payment_method_class ) { + if ( WC_Stripe_UPE_Payment_Method_Bacs_Debit::class === $payment_method_class ) { continue; } diff --git a/woocommerce-gateway-stripe.php b/woocommerce-gateway-stripe.php index b551b2221d..5e7022c391 100644 --- a/woocommerce-gateway-stripe.php +++ b/woocommerce-gateway-stripe.php @@ -224,7 +224,7 @@ public function init() { require_once __DIR__ . '/includes/payment-methods/class-wc-stripe-upe-payment-method.php'; require_once __DIR__ . '/includes/payment-methods/class-wc-stripe-upe-payment-method-cc.php'; require_once __DIR__ . '/includes/payment-methods/class-wc-stripe-upe-payment-method-alipay.php'; - require_once __DIR__ . '/includes/payment-methods/class-wc-stripe-upe-payment-method-bacs.php'; + require_once __DIR__ . '/includes/payment-methods/class-wc-stripe-upe-payment-method-bacs-debit.php'; require_once __DIR__ . '/includes/payment-methods/class-wc-stripe-upe-payment-method-giropay.php'; require_once __DIR__ . '/includes/payment-methods/class-wc-stripe-upe-payment-method-ideal.php'; require_once __DIR__ . '/includes/payment-methods/class-wc-stripe-upe-payment-method-klarna.php';