Redirect on any credentials change (including sandbox checkbox)

otherwise we may use wrong state/host e.g. for webhook subscription
This commit is contained in:
Alex P 2023-03-10 10:34:28 +02:00
parent 4c59337247
commit 8188faeec4
No known key found for this signature in database
GPG key ID: 54487A734A204D71
2 changed files with 3 additions and 11 deletions

View file

@ -322,16 +322,6 @@ class SettingsListener {
}
$this->settings->persist();
if ( $credentials_change_status ) {
if ( in_array(
$credentials_change_status,
array( self::CREDENTIALS_ADDED, self::CREDENTIALS_CHANGED ),
true
) ) {
$this->webhook_registrar->register();
}
}
if ( $this->cache->has( PayPalBearer::CACHE_KEY ) ) {
$this->cache->delete( PayPalBearer::CACHE_KEY );
}
@ -345,7 +335,7 @@ class SettingsListener {
}
$redirect_url = false;
if ( self::CREDENTIALS_ADDED === $credentials_change_status ) {
if ( self::CREDENTIALS_UNCHANGED !== $credentials_change_status ) {
$redirect_url = $this->get_onboarding_redirect_url();
}