Skip to content

Commit

Permalink
Merge branch 'develop' into fix/gateway-individual-settings
Browse files Browse the repository at this point in the history
  • Loading branch information
timur27 authored Mar 8, 2024
2 parents 2b25747 + 47b046b commit 8820114
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions changelog/fix-8334-leftover-onboarding-sandbox-mode
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fix
Comment: Prevent leftover sandbox mode onboarding and allow for live onboarding on subsequent retries.


8 changes: 8 additions & 0 deletions includes/class-wc-payments-account.php
Original file line number Diff line number Diff line change
Expand Up @@ -1085,6 +1085,14 @@ public function maybe_handle_onboarding() {
) ) {
// Redirect non-onboarded account to the onboarding flow, otherwise to payments overview page.
if ( ! $this->is_stripe_connected() ) {
$should_onboard_in_test_mode = isset( $_GET['test_mode'] ) ? boolval( wc_clean( wp_unslash( $_GET['test_mode'] ) ) ) : false;
if ( ! $should_onboard_in_test_mode && WC_Payments_Onboarding_Service::is_test_mode_enabled() ) {
// If there is no test mode in the URL informing us to onboard in test mode,
// but the onboarding test mode is enabled in our DB, we should disable it.
// This is most likely a leftover from a previous onboarding attempt.
WC_Payments_Onboarding_Service::set_test_mode( false );
}

$this->redirect_to_onboarding_flow_page( $source );
} else {
// Accounts with Stripe account connected will be redirected to the overview page.
Expand Down

0 comments on commit 8820114

Please sign in to comment.