From 7bd882442f60d488f4763052f62ce00bebdf0070 Mon Sep 17 00:00:00 2001 From: Nathan Bloomfield Date: Wed, 8 Jan 2025 22:01:58 -0600 Subject: [PATCH] Lint fixes (#3673) * Lint fixes --------- Co-authored-by: nbloomf Co-authored-by: Anne Mirasol --- changelog.txt | 1 + .../abstract-wc-stripe-payment-gateway.php | 2 +- ...ass-wc-rest-stripe-settings-controller.php | 1 - includes/admin/stripe-eps-settings.php | 4 +- includes/admin/stripe-p24-settings.php | 4 +- includes/admin/stripe-sepa-settings.php | 4 +- .../class-wc-stripe-intent-controller.php | 2 +- includes/class-wc-stripe-webhook-handler.php | 1 - ...subscriptions-legacy-sepa-token-update.php | 7 + .../class-wc-stripe-payment-tokens.php | 39 ++-- readme.txt | 1 + woocommerce-gateway-stripe.php | 169 +++++++++--------- 12 files changed, 121 insertions(+), 114 deletions(-) diff --git a/changelog.txt b/changelog.txt index cf49c8940..66665bc71 100644 --- a/changelog.txt +++ b/changelog.txt @@ -5,6 +5,7 @@ * Fix - Return to the correct page when redirect-based payment method fails. * Fix - Show default recipient for Payment Authentication Requested email. * Fix - Correctly handles IPP failed payments webhook calls by extracting the order ID from the payment intent metadata. +* Dev - Fix lint issues raised by WordPress code standards. * Fix - Fix ECE crash in classic cart and checkout pages for non-English language sites. * Fix - Correctly handles UK postcodes redacted by Apple Pay. * Tweak - Avoid re-sending Processing Order customer email when merchant wins dispute. diff --git a/includes/abstracts/abstract-wc-stripe-payment-gateway.php b/includes/abstracts/abstract-wc-stripe-payment-gateway.php index d018b98cf..1f16ce8f3 100644 --- a/includes/abstracts/abstract-wc-stripe-payment-gateway.php +++ b/includes/abstracts/abstract-wc-stripe-payment-gateway.php @@ -1408,7 +1408,7 @@ public function get_level3_data_from_order( $order ) { $currency = $order->get_currency(); $stripe_line_items = array_map( - function( $item ) use ( $currency ) { + function ( $item ) use ( $currency ) { if ( is_a( $item, 'WC_Order_Item_Product' ) ) { $product_id = $item->get_variation_id() ? $item->get_variation_id() diff --git a/includes/admin/class-wc-rest-stripe-settings-controller.php b/includes/admin/class-wc-rest-stripe-settings-controller.php index 39b0c4c40..8e6dbb35f 100644 --- a/includes/admin/class-wc-rest-stripe-settings-controller.php +++ b/includes/admin/class-wc-rest-stripe-settings-controller.php @@ -439,7 +439,6 @@ private function update_is_debug_log_enabled( WP_REST_Request $request ) { } $this->gateway->update_option( 'logging', $is_debug_log_enabled ? 'yes' : 'no' ); - } /** diff --git a/includes/admin/stripe-eps-settings.php b/includes/admin/stripe-eps-settings.php index 5a0698b92..74c8a55bd 100644 --- a/includes/admin/stripe-eps-settings.php +++ b/includes/admin/stripe-eps-settings.php @@ -1,4 +1,6 @@ __( 'Webhook Endpoints', 'woocommerce-gateway-stripe' ), 'type' => 'title', /* translators: webhook URL */ - 'description' => $this->display_admin_settings_webhook_description(), + 'description' => $this->display_admin_settings_webhook_description(), // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable ], ] ); diff --git a/includes/admin/stripe-p24-settings.php b/includes/admin/stripe-p24-settings.php index 9de838db4..43d34a78b 100644 --- a/includes/admin/stripe-p24-settings.php +++ b/includes/admin/stripe-p24-settings.php @@ -1,4 +1,6 @@ __( 'Webhook Endpoints', 'woocommerce-gateway-stripe' ), 'type' => 'title', /* translators: webhook URL */ - 'description' => $this->display_admin_settings_webhook_description(), + 'description' => $this->display_admin_settings_webhook_description(), // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable ], ] ); diff --git a/includes/admin/stripe-sepa-settings.php b/includes/admin/stripe-sepa-settings.php index 8101f1f64..da3a826d6 100644 --- a/includes/admin/stripe-sepa-settings.php +++ b/includes/admin/stripe-sepa-settings.php @@ -1,4 +1,6 @@ __( 'Webhook Endpoints', 'woocommerce-gateway-stripe' ), 'type' => 'title', /* translators: webhook URL */ - 'description' => $this->display_admin_settings_webhook_description(), + 'description' => $this->display_admin_settings_webhook_description(), // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable ], ] ); diff --git a/includes/class-wc-stripe-intent-controller.php b/includes/class-wc-stripe-intent-controller.php index c6a976879..ccd967cfc 100644 --- a/includes/class-wc-stripe-intent-controller.php +++ b/includes/class-wc-stripe-intent-controller.php @@ -1101,7 +1101,7 @@ public function confirm_change_payment_from_setup_intent_ajax() { throw new WC_Stripe_Exception( 'subscription_not_found', __( "We're not able to process this subscription change payment request payment. Please try again later.", 'woocommerce-gateway-stripe' ) ); } - $setup_intent_id = isset( $_POST['intent_id'] ) ? wc_clean( wp_unslash( $_POST['intent_id'] ) ) : null; + $setup_intent_id = ( isset( $_POST['intent_id'] ) && is_string( $_POST['intent_id'] ) ) ? sanitize_text_field( wp_unslash( $_POST['intent_id'] ) ) : null; if ( empty( $setup_intent_id ) ) { throw new WC_Stripe_Exception( 'intent_not_found', __( "We're not able to process this subscription change payment request payment. Please try again later.", 'woocommerce-gateway-stripe' ) ); diff --git a/includes/class-wc-stripe-webhook-handler.php b/includes/class-wc-stripe-webhook-handler.php index 87cdd57e4..818756bcf 100644 --- a/includes/class-wc-stripe-webhook-handler.php +++ b/includes/class-wc-stripe-webhook-handler.php @@ -1200,7 +1200,6 @@ protected function handle_deferred_payment_intent_succeeded( $order, $intent_id do_action( 'wc_gateway_stripe_process_payment', $charge, $order ); $this->process_response( $charge, $order ); - } /** 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 c6cc78ad0..b0f8ec430 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 @@ -90,16 +90,19 @@ public function maybe_update_subscription_source( WC_Subscription $subscription */ private function get_subscription_to_migrate( $subscription_id ) { if ( ! WC_Stripe_Feature_Flags::is_upe_checkout_enabled() ) { + // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped throw new \Exception( sprintf( '---- Skipping migration of subscription #%d. The Legacy experience is enabled.', $subscription_id ) ); } if ( ! class_exists( 'WC_Subscriptions' ) ) { + // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped throw new \Exception( sprintf( '---- Skipping migration of subscription #%d. The WooCommerce Subscriptions extension is not active.', $subscription_id ) ); } $subscription = wcs_get_subscription( $subscription_id ); if ( ! $subscription ) { + // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped throw new \Exception( sprintf( '---- Skipping migration of subscription #%d. Subscription not found.', $subscription_id ) ); } @@ -121,6 +124,7 @@ private function set_subscription_updated_payment_method( WC_Subscription $subsc // Bail out if the subscription is already using a pm_. if ( 0 !== strpos( $source_id, 'src_' ) ) { + // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped throw new \Exception( sprintf( 'The subscription is not using a Stripe Source for renewals.', $subscription->get_id() ) ); } @@ -129,11 +133,13 @@ private function set_subscription_updated_payment_method( WC_Subscription $subsc // Bail out, if the source object isn't expected to be migrated. eg Card sources are not migrated. if ( isset( $source_object->type ) && 'card' === $source_object->type ) { + // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped throw new \Exception( sprintf( 'Skipping migration of Source for subscription #%d. Source is a card.', $subscription->get_id() ) ); } // Bail out if the src_ hasn't been migrated to pm_ yet. if ( ! isset( $source_object->metadata->migrated_payment_method ) ) { + // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped throw new \Exception( sprintf( 'The Source has not been migrated to PaymentMethods on the Stripe account.', $subscription->get_id() ) ); } @@ -153,6 +159,7 @@ private function set_subscription_updated_payment_method( WC_Subscription $subsc private function set_subscription_updated_payment_gateway_id( WC_Subscription $subscription ) { // The subscription is not using the legacy SEPA gateway ID. if ( WC_Gateway_Stripe_Sepa::ID !== $subscription->get_payment_method() ) { + // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped throw new \Exception( sprintf( '---- Skipping migration of subscription #%d. Subscription is not using the legacy SEPA payment method.', $subscription->get_id() ) ); } diff --git a/includes/payment-tokens/class-wc-stripe-payment-tokens.php b/includes/payment-tokens/class-wc-stripe-payment-tokens.php index 2369ae993..ba44bbed8 100644 --- a/includes/payment-tokens/class-wc-stripe-payment-tokens.php +++ b/includes/payment-tokens/class-wc-stripe-payment-tokens.php @@ -192,22 +192,19 @@ public function woocommerce_get_customer_payment_tokens_legacy( $tokens, $custom } else { unset( $stored_tokens[ $source->id ] ); } + } elseif ( ! isset( $stored_tokens[ $source->id ] ) && WC_Stripe_Payment_Methods::CARD === $source->object ) { + $token = new WC_Payment_Token_CC(); + $token->set_token( $source->id ); + $token->set_gateway_id( WC_Gateway_Stripe::ID ); + $token->set_card_type( strtolower( $source->brand ) ); + $token->set_last4( $source->last4 ); + $token->set_expiry_month( $source->exp_month ); + $token->set_expiry_year( $source->exp_year ); + $token->set_user_id( $customer_id ); + $token->save(); + $tokens[ $token->get_id() ] = $token; } else { - if ( ! isset( $stored_tokens[ $source->id ] ) && WC_Stripe_Payment_Methods::CARD === $source->object ) { - $token = new WC_Stripe_Payment_Token_CC(); - $token->set_token( $source->id ); - $token->set_gateway_id( WC_Gateway_Stripe::ID ); - $token->set_card_type( strtolower( $source->brand ) ); - $token->set_last4( $source->last4 ); - $token->set_expiry_month( $source->exp_month ); - $token->set_expiry_year( $source->exp_year ); - $token->set_user_id( $customer_id ); - $token->set_fingerprint( $source->fingerprint ); - $token->save(); - $tokens[ $token->get_id() ] = $token; - } else { - unset( $stored_tokens[ $source->id ] ); - } + unset( $stored_tokens[ $source->id ] ); } } } @@ -446,10 +443,8 @@ public function woocommerce_payment_token_deleted( $token_id, $token ) { } $stripe_customer->detach_payment_method( $token->get_token() ); - } else { - if ( WC_Gateway_Stripe::ID === $token->get_gateway_id() || WC_Gateway_Stripe_Sepa::ID === $token->get_gateway_id() ) { - $stripe_customer->delete_source( $token->get_token() ); - } + } elseif ( WC_Gateway_Stripe::ID === $token->get_gateway_id() || WC_Gateway_Stripe_Sepa::ID === $token->get_gateway_id() ) { + $stripe_customer->delete_source( $token->get_token() ); } } catch ( WC_Stripe_Exception $e ) { WC_Stripe_Logger::log( 'Error: ' . $e->getMessage() ); @@ -471,10 +466,8 @@ public function woocommerce_payment_token_set_default( $token_id ) { if ( WC_Stripe_UPE_Payment_Gateway::ID === $token->get_gateway_id() ) { $stripe_customer->set_default_payment_method( $token->get_token() ); } - } else { - if ( WC_Gateway_Stripe::ID === $token->get_gateway_id() || WC_Gateway_Stripe_Sepa::ID === $token->get_gateway_id() ) { - $stripe_customer->set_default_source( $token->get_token() ); - } + } elseif ( WC_Gateway_Stripe::ID === $token->get_gateway_id() || WC_Gateway_Stripe_Sepa::ID === $token->get_gateway_id() ) { + $stripe_customer->set_default_source( $token->get_token() ); } } catch ( WC_Stripe_Exception $e ) { WC_Stripe_Logger::log( 'Error: ' . $e->getMessage() ); diff --git a/readme.txt b/readme.txt index f7a2330b0..3ba9388c8 100644 --- a/readme.txt +++ b/readme.txt @@ -115,6 +115,7 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o * Fix - Return to the correct page when redirect-based payment method fails. * Fix - Show default recipient for Payment Authentication Requested email. * Fix - Correctly handles IPP failed payments webhook calls by extracting the order ID from the payment intent metadata. +* Dev - Fix lint issues raised by WordPress code standards. * Fix - Fix ECE crash in classic cart and checkout pages for non-English language sites. * Fix - Correctly handles UK postcodes redacted by Apple Pay. * Tweak - Avoid re-sending Processing Order customer email when merchant wins dispute. diff --git a/woocommerce-gateway-stripe.php b/woocommerce-gateway-stripe.php index 1fd543e2d..4068a6a64 100644 --- a/woocommerce-gateway-stripe.php +++ b/woocommerce-gateway-stripe.php @@ -188,84 +188,85 @@ public function __construct() { */ public function init() { if ( is_admin() ) { - require_once dirname( __FILE__ ) . '/includes/admin/class-wc-stripe-privacy.php'; + require_once __DIR__ . '/includes/admin/class-wc-stripe-privacy.php'; } - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-feature-flags.php'; - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-upe-compatibility.php'; - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-co-branded-cc-compatibility.php'; - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-exception.php'; - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-logger.php'; - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-helper.php'; - include_once dirname( __FILE__ ) . '/includes/class-wc-stripe-api.php'; - include_once dirname( __FILE__ ) . '/includes/class-wc-stripe-mode.php'; - require_once dirname( __FILE__ ) . '/includes/compat/trait-wc-stripe-subscriptions-utilities.php'; - require_once dirname( __FILE__ ) . '/includes/compat/trait-wc-stripe-subscriptions.php'; - require_once dirname( __FILE__ ) . '/includes/compat/trait-wc-stripe-pre-orders.php'; - require_once dirname( __FILE__ ) . '/includes/compat/class-wc-stripe-subscriptions-legacy-sepa-token-update.php'; - require_once dirname( __FILE__ ) . '/includes/abstracts/abstract-wc-stripe-payment-gateway.php'; - require_once dirname( __FILE__ ) . '/includes/abstracts/abstract-wc-stripe-payment-gateway-voucher.php'; - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-action-scheduler-service.php'; - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-webhook-state.php'; - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-webhook-handler.php'; - require_once dirname( __FILE__ ) . '/includes/payment-tokens/trait-wc-stripe-fingerprint.php'; - require_once dirname( __FILE__ ) . '/includes/payment-tokens/interface-wc-stripe-payment-method-comparison.php'; - require_once dirname( __FILE__ ) . '/includes/payment-tokens/class-wc-stripe-cc-payment-token.php'; - require_once dirname( __FILE__ ) . '/includes/payment-tokens/class-wc-stripe-sepa-payment-token.php'; - require_once dirname( __FILE__ ) . '/includes/payment-tokens/class-wc-stripe-link-payment-token.php'; - require_once dirname( __FILE__ ) . '/includes/payment-tokens/class-wc-stripe-cash-app-payment-token.php'; - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-apple-pay-registration.php'; - require_once dirname( __FILE__ ) . '/includes/class-wc-gateway-stripe.php'; - require_once dirname( __FILE__ ) . '/includes/constants/class-wc-stripe-currency-code.php'; - require_once dirname( __FILE__ ) . '/includes/constants/class-wc-stripe-payment-methods.php'; - require_once dirname( __FILE__ ) . '/includes/constants/class-wc-stripe-intent-status.php'; - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-stripe-upe-payment-gateway.php'; - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-stripe-upe-payment-method.php'; - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-stripe-upe-payment-method-cc.php'; - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-stripe-upe-payment-method-alipay.php'; - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-stripe-upe-payment-method-giropay.php'; - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-stripe-upe-payment-method-ideal.php'; - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-stripe-upe-payment-method-klarna.php'; - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-stripe-upe-payment-method-affirm.php'; - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-stripe-upe-payment-method-afterpay-clearpay.php'; - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-stripe-upe-payment-method-bancontact.php'; - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-stripe-upe-payment-method-boleto.php'; - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-stripe-upe-payment-method-oxxo.php'; - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-stripe-upe-payment-method-eps.php'; - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-stripe-upe-payment-method-sepa.php'; - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-stripe-upe-payment-method-p24.php'; - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-stripe-upe-payment-method-sofort.php'; - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-stripe-upe-payment-method-multibanco.php'; - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-stripe-upe-payment-method-link.php'; - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-stripe-upe-payment-method-cash-app-pay.php'; - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-stripe-upe-payment-method-wechat-pay.php'; - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-bancontact.php'; - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-sofort.php'; - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-giropay.php'; - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-eps.php'; - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-ideal.php'; - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-p24.php'; - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-alipay.php'; - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-sepa.php'; - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-multibanco.php'; - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-boleto.php'; - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-oxxo.php'; - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-stripe-payment-request.php'; - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-stripe-express-checkout-element.php'; - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-stripe-express-checkout-helper.php'; - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-stripe-express-checkout-ajax-handler.php'; - require_once dirname( __FILE__ ) . '/includes/compat/class-wc-stripe-woo-compat-utils.php'; - require_once dirname( __FILE__ ) . '/includes/connect/class-wc-stripe-connect.php'; - require_once dirname( __FILE__ ) . '/includes/connect/class-wc-stripe-connect-api.php'; - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-order-handler.php'; - require_once dirname( __FILE__ ) . '/includes/payment-tokens/class-wc-stripe-payment-tokens.php'; - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-customer.php'; - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-intent-controller.php'; - require_once dirname( __FILE__ ) . '/includes/admin/class-wc-stripe-inbox-notes.php'; - require_once dirname( __FILE__ ) . '/includes/admin/class-wc-stripe-upe-compatibility-controller.php'; - require_once dirname( __FILE__ ) . '/includes/migrations/class-allowed-payment-request-button-types-update.php'; - require_once dirname( __FILE__ ) . '/includes/migrations/class-migrate-payment-request-data-to-express-checkout-data.php'; - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-account.php'; + require_once __DIR__ . '/includes/class-wc-stripe-feature-flags.php'; + require_once __DIR__ . '/includes/class-wc-stripe-upe-compatibility.php'; + require_once __DIR__ . '/includes/class-wc-stripe-co-branded-cc-compatibility.php'; + require_once __DIR__ . '/includes/class-wc-stripe-exception.php'; + require_once __DIR__ . '/includes/class-wc-stripe-logger.php'; + require_once __DIR__ . '/includes/class-wc-stripe-helper.php'; + include_once __DIR__ . '/includes/class-wc-stripe-api.php'; + include_once __DIR__ . '/includes/class-wc-stripe-mode.php'; + require_once __DIR__ . '/includes/compat/trait-wc-stripe-subscriptions-utilities.php'; + require_once __DIR__ . '/includes/compat/trait-wc-stripe-subscriptions.php'; + require_once __DIR__ . '/includes/compat/trait-wc-stripe-pre-orders.php'; + require_once __DIR__ . '/includes/compat/class-wc-stripe-subscriptions-legacy-sepa-token-update.php'; + require_once __DIR__ . '/includes/abstracts/abstract-wc-stripe-payment-gateway.php'; + require_once __DIR__ . '/includes/abstracts/abstract-wc-stripe-payment-gateway-voucher.php'; + require_once __DIR__ . '/includes/class-wc-stripe-action-scheduler-service.php'; + require_once __DIR__ . '/includes/class-wc-stripe-webhook-state.php'; + require_once __DIR__ . '/includes/class-wc-stripe-webhook-handler.php'; + require_once __DIR__ . '/includes/payment-tokens/trait-wc-stripe-fingerprint.php'; + require_once __DIR__ . '/includes/payment-tokens/interface-wc-stripe-payment-method-comparison.php'; + require_once __DIR__ . '/includes/payment-tokens/class-wc-stripe-cc-payment-token.php'; + require_once __DIR__ . '/includes/payment-tokens/class-wc-stripe-sepa-payment-token.php'; + require_once __DIR__ . '/includes/payment-tokens/class-wc-stripe-link-payment-token.php'; + require_once __DIR__ . '/includes/payment-tokens/class-wc-stripe-cash-app-payment-token.php'; + require_once __DIR__ . '/includes/class-wc-stripe-apple-pay-registration.php'; + require_once __DIR__ . '/includes/class-wc-gateway-stripe.php'; + require_once __DIR__ . '/includes/constants/class-wc-stripe-currency-code.php'; + require_once __DIR__ . '/includes/constants/class-wc-stripe-payment-methods.php'; + require_once __DIR__ . '/includes/constants/class-wc-stripe-intent-status.php'; + require_once __DIR__ . '/includes/payment-methods/class-wc-stripe-upe-payment-gateway.php'; + 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-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'; + require_once __DIR__ . '/includes/payment-methods/class-wc-stripe-upe-payment-method-affirm.php'; + require_once __DIR__ . '/includes/payment-methods/class-wc-stripe-upe-payment-method-afterpay-clearpay.php'; + require_once __DIR__ . '/includes/payment-methods/class-wc-stripe-upe-payment-method-bancontact.php'; + require_once __DIR__ . '/includes/payment-methods/class-wc-stripe-upe-payment-method-boleto.php'; + require_once __DIR__ . '/includes/payment-methods/class-wc-stripe-upe-payment-method-oxxo.php'; + require_once __DIR__ . '/includes/payment-methods/class-wc-stripe-upe-payment-method-eps.php'; + require_once __DIR__ . '/includes/payment-methods/class-wc-stripe-upe-payment-method-sepa.php'; + require_once __DIR__ . '/includes/payment-methods/class-wc-stripe-upe-payment-method-p24.php'; + require_once __DIR__ . '/includes/payment-methods/class-wc-stripe-upe-payment-method-sofort.php'; + require_once __DIR__ . '/includes/payment-methods/class-wc-stripe-upe-payment-method-multibanco.php'; + require_once __DIR__ . '/includes/payment-methods/class-wc-stripe-upe-payment-method-link.php'; + require_once __DIR__ . '/includes/payment-methods/class-wc-stripe-upe-payment-method-cash-app-pay.php'; + require_once __DIR__ . '/includes/payment-methods/class-wc-stripe-upe-payment-method-wechat-pay.php'; + require_once __DIR__ . '/includes/payment-methods/class-wc-gateway-stripe-bancontact.php'; + require_once __DIR__ . '/includes/payment-methods/class-wc-gateway-stripe-sofort.php'; + require_once __DIR__ . '/includes/payment-methods/class-wc-gateway-stripe-giropay.php'; + require_once __DIR__ . '/includes/payment-methods/class-wc-gateway-stripe-eps.php'; + require_once __DIR__ . '/includes/payment-methods/class-wc-gateway-stripe-ideal.php'; + require_once __DIR__ . '/includes/payment-methods/class-wc-gateway-stripe-p24.php'; + require_once __DIR__ . '/includes/payment-methods/class-wc-gateway-stripe-alipay.php'; + require_once __DIR__ . '/includes/payment-methods/class-wc-gateway-stripe-sepa.php'; + require_once __DIR__ . '/includes/payment-methods/class-wc-gateway-stripe-multibanco.php'; + require_once __DIR__ . '/includes/payment-methods/class-wc-gateway-stripe-boleto.php'; + require_once __DIR__ . '/includes/payment-methods/class-wc-gateway-stripe-oxxo.php'; + require_once __DIR__ . '/includes/payment-methods/class-wc-stripe-payment-request.php'; + require_once __DIR__ . '/includes/payment-methods/class-wc-stripe-express-checkout-element.php'; + require_once __DIR__ . '/includes/payment-methods/class-wc-stripe-express-checkout-helper.php'; + require_once __DIR__ . '/includes/payment-methods/class-wc-stripe-express-checkout-ajax-handler.php'; + require_once __DIR__ . '/includes/compat/class-wc-stripe-woo-compat-utils.php'; + require_once __DIR__ . '/includes/connect/class-wc-stripe-connect.php'; + require_once __DIR__ . '/includes/connect/class-wc-stripe-connect-api.php'; + require_once __DIR__ . '/includes/class-wc-stripe-order-handler.php'; + require_once __DIR__ . '/includes/payment-tokens/class-wc-stripe-payment-tokens.php'; + require_once __DIR__ . '/includes/class-wc-stripe-customer.php'; + require_once __DIR__ . '/includes/class-wc-stripe-intent-controller.php'; + require_once __DIR__ . '/includes/admin/class-wc-stripe-inbox-notes.php'; + require_once __DIR__ . '/includes/admin/class-wc-stripe-upe-compatibility-controller.php'; + require_once __DIR__ . '/includes/migrations/class-allowed-payment-request-button-types-update.php'; + require_once __DIR__ . '/includes/migrations/class-migrate-payment-request-data-to-express-checkout-data.php'; + require_once __DIR__ . '/includes/class-wc-stripe-account.php'; + new Allowed_Payment_Request_Button_Types_Update(); new Migrate_Payment_Request_Data_To_Express_Checkout_Data(); @@ -284,24 +285,24 @@ public function init() { $intent_controller->init_hooks(); if ( is_admin() ) { - require_once dirname( __FILE__ ) . '/includes/admin/class-wc-stripe-admin-notices.php'; - require_once dirname( __FILE__ ) . '/includes/admin/class-wc-stripe-settings-controller.php'; + require_once __DIR__ . '/includes/admin/class-wc-stripe-admin-notices.php'; + require_once __DIR__ . '/includes/admin/class-wc-stripe-settings-controller.php'; if ( isset( $_GET['area'] ) && 'payment_requests' === $_GET['area'] ) { - require_once dirname( __FILE__ ) . '/includes/admin/class-wc-stripe-payment-requests-controller.php'; + require_once __DIR__ . '/includes/admin/class-wc-stripe-payment-requests-controller.php'; new WC_Stripe_Payment_Requests_Controller(); } else { new WC_Stripe_Settings_Controller( $this->account ); } if ( WC_Stripe_Feature_Flags::is_upe_checkout_enabled() ) { - require_once dirname( __FILE__ ) . '/includes/admin/class-wc-stripe-payment-gateways-controller.php'; + require_once __DIR__ . '/includes/admin/class-wc-stripe-payment-gateways-controller.php'; new WC_Stripe_Payment_Gateways_Controller(); } } // REMOVE IN THE FUTURE. - require_once dirname( __FILE__ ) . '/includes/deprecated/class-wc-stripe-apple-pay.php'; + require_once __DIR__ . '/includes/deprecated/class-wc-stripe-apple-pay.php'; add_filter( 'woocommerce_payment_gateways', [ $this, 'add_gateways' ] ); add_filter( 'pre_update_option_woocommerce_stripe_settings', [ $this, 'gateway_settings_update' ], 10, 2 ); @@ -786,7 +787,7 @@ public function initialize_subscriptions_updater() { if ( ! class_exists( 'WCS_Background_Repairer' ) ) { return; } - require_once dirname( __FILE__ ) . '/includes/migrations/class-wc-stripe-subscriptions-repairer-legacy-sepa-tokens.php'; + require_once __DIR__ . '/includes/migrations/class-wc-stripe-subscriptions-repairer-legacy-sepa-tokens.php'; $logger = wc_get_logger(); $updater = new WC_Stripe_Subscriptions_Repairer_Legacy_SEPA_Tokens( $logger ); @@ -796,7 +797,7 @@ public function initialize_subscriptions_updater() { } public function load_plugin_textdomain() { - load_plugin_textdomain( 'woocommerce-gateway-stripe', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' ); + load_plugin_textdomain( 'woocommerce-gateway-stripe', false, plugin_basename( __DIR__ ) . '/languages' ); } } @@ -859,7 +860,7 @@ function wcstripe_deactivated() { function woocommerce_gateway_stripe_woocommerce_block_support() { if ( class_exists( 'Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType' ) ) { - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-blocks-support.php'; + require_once __DIR__ . '/includes/class-wc-stripe-blocks-support.php'; // priority is important here because this ensures this integration is // registered before the WooCommerce Blocks built-in Stripe registration. // Blocks code has a check in place to only register if 'stripe' is not