mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 10:55:00 +08:00
Merge pull request #1562 from woocommerce/PCP-1742-upgrade-tracking-integration
Upgrade tracking integration (1742)
This commit is contained in:
commit
867949cce0
28 changed files with 3188 additions and 1199 deletions
|
@ -17,6 +17,7 @@ use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
|
|||
use WooCommerce\PayPalCommerce\ApiClient\Factory\WebhookEventFactory;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Factory\WebhookFactory;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use WP_Error;
|
||||
|
||||
/**
|
||||
* Class WebhookEndpoint
|
||||
|
@ -193,7 +194,7 @@ class WebhookEndpoint {
|
|||
);
|
||||
$response = $this->request( $url, $args );
|
||||
|
||||
if ( is_wp_error( $response ) ) {
|
||||
if ( $response instanceof WP_Error ) {
|
||||
throw new RuntimeException(
|
||||
__( 'Not able to delete the webhook.', 'woocommerce-paypal-payments' )
|
||||
);
|
||||
|
@ -201,10 +202,7 @@ class WebhookEndpoint {
|
|||
|
||||
$status_code = (int) wp_remote_retrieve_response_code( $response );
|
||||
if ( 204 !== $status_code ) {
|
||||
$json = null;
|
||||
if ( is_array( $response ) ) {
|
||||
$json = json_decode( $response['body'] );
|
||||
}
|
||||
$json = json_decode( $response['body'] ) ?? null;
|
||||
throw new PayPalApiException(
|
||||
$json,
|
||||
$status_code
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue