Skip to content

Commit

Permalink
make sure to store sandbox_on even when method throws error
Browse files Browse the repository at this point in the history
  • Loading branch information
websupporter committed Oct 6, 2020
1 parent 2608f19 commit 722b67a
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ public function handle_request(): bool {
try {
$data = $this->request_data->read_request( $this->nonce() );
$is_sandbox = isset( $data['env'] ) && 'sandbox' === $data['env'];
$this->settings->set( 'sandbox_on', $is_sandbox );
$this->settings->persist();
$endpoint = $is_sandbox ? $this->login_seller_sandbox : $this->login_seller_production;
$credentials = $endpoint->credentials_for(
$data['sharedId'],
Expand All @@ -128,7 +130,6 @@ public function handle_request(): bool {
}
$this->settings->set( 'client_secret', $credentials->client_secret );
$this->settings->set( 'client_id', $credentials->client_id );
$this->settings->set( 'sandbox_on', $is_sandbox );
$this->settings->persist();
if ( $this->cache->has( PayPalBearer::CACHE_KEY ) ) {
$this->cache->delete( PayPalBearer::CACHE_KEY );
Expand Down

0 comments on commit 722b67a

Please sign in to comment.