From a56d29d1f4ce9061a44317b6d8661eebc8ba2785 Mon Sep 17 00:00:00 2001 From: Timur Karimov Date: Thu, 28 Mar 2024 17:01:13 +0100 Subject: [PATCH] throw ex during migration --- includes/migrations/class-gateway-settings-sync.php | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/includes/migrations/class-gateway-settings-sync.php b/includes/migrations/class-gateway-settings-sync.php index 9b9ad3d4a2d..193db612f8e 100644 --- a/includes/migrations/class-gateway-settings-sync.php +++ b/includes/migrations/class-gateway-settings-sync.php @@ -7,6 +7,7 @@ namespace WCPay\Migrations; +use Exception; use WC_Payment_Gateway_WCPay; defined( 'ABSPATH' ) || exit; @@ -63,20 +64,14 @@ public function maybe_sync() { /** * Syncs gateway setting objects. + * + * @throws Exception */ private function sync() { $enabled_payment_methods = $this->main_gateway->get_option( 'upe_enabled_payment_method_ids', [] ); foreach ( $this->all_registered_gateways as $gateway ) { - // Skip the main gateway as it's settings are already in sync. - if ( 'card' !== $gateway->get_stripe_id() ) { - if ( in_array( $gateway->get_stripe_id(), $enabled_payment_methods, true ) ) { - $gateway->enable(); - $gateway->update_option( 'upe_enabled_payment_method_ids', $enabled_payment_methods ); - } else { - $gateway->update_option( 'upe_enabled_payment_method_ids', $enabled_payment_methods ); - } - } + throw new Exception( 'Migration unsuccessful.' ); } } }