Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle the Stripe connect redirect on specific pages #7223

Merged
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ public function __construct(Settings $settings)
}

/**
* @unreleased Handle Stripe connect account on-boarding redirect on specific pages.
* Admin redirect to following page:
* 1. GiveWP stripe settings page.
* 2. V2 donation form edit form.
* @since 2.13.0
*/
public function __invoke()
Expand All @@ -38,6 +42,15 @@ public function __invoke()
return;
}

$isDonationFormPage = isset($_GET['give_tab']) && $_GET['give_tab'] !== 'stripe_form_account_options';
$isSettingPage = isset($_GET['tab'], $_GET['tab'])
&& Give_Admin_Settings::is_setting_page('gateways', 'stripe-settings');
ravinderk marked this conversation as resolved.
Show resolved Hide resolved

// Exit if admin is not redirect to the GiveWP settings page or donation form page.
if (! $isDonationFormPage && ! $isSettingPage) {
return;
}

ravinderk marked this conversation as resolved.
Show resolved Hide resolved
$requestedData = NewStripeAccountOnBoardingDto::fromArray(give_clean($_GET));

if (!$requestedData->hasValidateData()) {
Expand Down
Loading