account = $account; } /** * Checks whether it's worth doing the migration. */ public function maybe_migrate() { $account_data = $this->account->get_cached_account_data(); // no need to migrate anything, maybe the site is disconnected. // the plugin will eventually fetch new account data. if ( empty( $account_data ) ) { return; } // we have account data, do we have the fees for sofort/sepa/giropay/p24 etc? // if we do, no need to migrate. $account_fees = $this->account->get_fees(); if ( ! empty( $account_fees['giropay']['base'] ) ) { return; } $this->migrate(); } /** * Does the actual migration. */ private function migrate() { $this->account->refresh_account_data(); } }