Skip to content

Commit

Permalink
Check if the WPCOM token is connected
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgemd24 committed Aug 20, 2024
1 parent 94e9f2f commit cc5adf7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,11 @@ protected function handle_actions() {
} else {
$this->integration_status_response = json_decode( wp_remote_retrieve_body( $integration_remote_request_response ), true ) ?? [];

// If the merchant isn't connected to the Google App, it's not necessary to display an error indicating that the partner token isn't associated.
if ( ! $this->integration_status_response['is_partner_token_healthy'] && isset( $this->integration_status_response['errors'] ['rest_api_partner_token']['error_code'] ) && $this->integration_status_response['errors'] ['rest_api_partner_token']['error_code'] === 'wpcom_partner_token_not_associated' ) {
unset( $this->integration_status_response['errors'] ['rest_api_partner_token'] );

Check warning on line 898 in src/ConnectionTest.php

View check run for this annotation

Codecov / codecov/patch

src/ConnectionTest.php#L897-L898

Added lines #L897 - L898 were not covered by tests
}

if ( json_last_error() || ! isset( $this->integration_status_response['site'] ) ) {
$this->response .= wp_remote_retrieve_body( $integration_remote_request_response );
}
Expand Down

0 comments on commit cc5adf7

Please sign in to comment.