Skip to content

Commit

Permalink
remove double check of existing transient
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Paun committed Dec 12, 2024
1 parent 8e2e624 commit 400a2d9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 1 addition & 3 deletions includes/class-wc-payments-account.php
Original file line number Diff line number Diff line change
Expand Up @@ -2042,9 +2042,7 @@ private function init_stripe_onboarding( string $setup_mode, string $wcpay_conne
}

// When the new account is created, if we have test drive settings, save them to the new account.
if ( get_transient( self::WOOPAY_TEST_DRIVE_SETTINGS_FOR_LIVE_ACCOUNT ) ) {
$this->onboarding_service->save_test_drive_settings_to_new_account();
}
$this->onboarding_service->maybe_save_test_drive_settings_to_new_account();

// We have an account that needs to be verified (has a URL to redirect the merchant to).
// Store the relevant onboarding data.
Expand Down
6 changes: 2 additions & 4 deletions includes/class-wc-payments-onboarding-service.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,7 @@ public function create_embedded_kyc_session( array $self_assessment_data, bool $
$this->set_embedded_kyc_in_progress();

// When the new account is created, if we have test drive settings, save them to the new account.
if ( get_transient( WC_Payments_Account::WOOPAY_TEST_DRIVE_SETTINGS_FOR_LIVE_ACCOUNT ) ) {
$this->save_test_drive_settings_to_new_account();
}
$this->maybe_save_test_drive_settings_to_new_account();

// Remember if we should enable WooPay by default.
set_transient(
Expand Down Expand Up @@ -913,7 +911,7 @@ public static function get_source( ?string $referer = null, ?array $get_params =
*
* @return void
*/
public function save_test_drive_settings_to_new_account() {
public function maybe_save_test_drive_settings_to_new_account() {
if ( ! get_transient( WC_Payments_Account::WOOPAY_TEST_DRIVE_SETTINGS_FOR_LIVE_ACCOUNT ) ) {
return;
}
Expand Down

0 comments on commit 400a2d9

Please sign in to comment.