Add SellerStatus API caching.

Add GooglePay capability notice.
This commit is contained in:
Pedro Silva 2023-09-25 10:12:27 +01:00
parent 1581f34a44
commit 561d43baf6
No known key found for this signature in database
GPG key ID: E2EE20C0669D24B3
7 changed files with 140 additions and 26 deletions

View file

@ -136,15 +136,9 @@ class PartnersEndpoint {
'response' => $response,
)
);
// Register the failure on api failure registry.
$this->failure_registry->add_failure( FailureRegistry::SELLER_STATUS_KEY );
throw $error;
}
$this->failure_registry->clear_failures( FailureRegistry::SELLER_STATUS_KEY );
$json = json_decode( wp_remote_retrieve_body( $response ) );
$status_code = (int) wp_remote_retrieve_response_code( $response );
if ( 200 !== $status_code ) {
@ -157,9 +151,15 @@ class PartnersEndpoint {
'response' => $response,
)
);
// Register the failure on api failure registry.
$this->failure_registry->add_failure( FailureRegistry::SELLER_STATUS_KEY );
throw $error;
}
$this->failure_registry->clear_failures( FailureRegistry::SELLER_STATUS_KEY );
$status = $this->seller_status_factory->from_paypal_reponse( $json );
return $status;
}