Skip to content

Commit 3944a99

Browse files
author
Timur Karimov
committed
skip main gateway from updates on migration script
1 parent 67e989e commit 3944a99

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

docker-compose-override.yml

Whitespace-only changes.

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,20 @@ public function maybe_sync() {
6262
}
6363

6464
/**
65-
* Deletes the active webhook.
65+
* Syncs gateway setting objects.
6666
*/
6767
private function sync() {
6868
$enabled_payment_methods = $this->main_gateway->get_option( 'upe_enabled_payment_method_ids', [] );
6969

7070
foreach ( $this->all_registered_gateways as $gateway ) {
71-
if ( in_array( $gateway->get_stripe_id(), $enabled_payment_methods, true ) ) {
72-
$gateway->enable();
73-
$gateway->update_option( 'upe_enabled_payment_method_ids', $enabled_payment_methods );
74-
} else {
75-
$gateway->update_option( 'upe_enabled_payment_method_ids', $enabled_payment_methods );
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+
}
7679
}
7780
}
7881
}

0 commit comments

Comments
 (0)