Skip to content

Commit a56d29d

Browse files
author
Timur Karimov
committed
throw ex during migration
1 parent 7c0fde3 commit a56d29d

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

includes/migrations/class-gateway-settings-sync.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace WCPay\Migrations;
99

10+
use Exception;
1011
use WC_Payment_Gateway_WCPay;
1112

1213
defined( 'ABSPATH' ) || exit;
@@ -63,20 +64,14 @@ public function maybe_sync() {
6364

6465
/**
6566
* Syncs gateway setting objects.
67+
*
68+
* @throws Exception
6669
*/
6770
private function sync() {
6871
$enabled_payment_methods = $this->main_gateway->get_option( 'upe_enabled_payment_method_ids', [] );
6972

7073
foreach ( $this->all_registered_gateways as $gateway ) {
71-
// Skip the main gateway as it's settings are already in sync.
72-
if ( 'card' !== $gateway->get_stripe_id() ) {
73-
if ( in_array( $gateway->get_stripe_id(), $enabled_payment_methods, true ) ) {
74-
$gateway->enable();
75-
$gateway->update_option( 'upe_enabled_payment_method_ids', $enabled_payment_methods );
76-
} else {
77-
$gateway->update_option( 'upe_enabled_payment_method_ids', $enabled_payment_methods );
78-
}
79-
}
74+
throw new Exception( 'Migration unsuccessful.' );
8075
}
8176
}
8277
}

0 commit comments

Comments
 (0)