diff --git a/src/Admin.php b/src/Admin.php index e859bd9..bcc2460 100644 --- a/src/Admin.php +++ b/src/Admin.php @@ -305,9 +305,23 @@ private function render_details_with_license( $details ) { $output .= 'Your license has expired. Please renew your license to get updates.'; } } elseif ( 'suspended' === $this->integration->get_license_status() ) { - $output .= 'Your license has been suspended. Please contact support.'; + if ( ! empty( $details['homepage'] ) ) { + $output .= \sprintf( + 'Your license has been suspended. Please contact support.', + esc_url( $details['homepage'] ) + ); + } else { + $output .= 'Your license has been suspended. Please contact support.'; + } } else { - $output .= 'Unable to upgrade. Please contact support.'; + if ( ! empty( $details['homepage'] ) ) { + $output .= \sprintf( + 'Upgrade package file missing, unable to upgrade. Please contact support.', + esc_url( $details['homepage'] ) + ); + } else { + $output .= 'Upgrade package file missing, unable to upgrade. Please contact support.'; + } } } } else { diff --git a/src/Integration.php b/src/Integration.php index 8023904..0fddcb0 100644 --- a/src/Integration.php +++ b/src/Integration.php @@ -243,7 +243,7 @@ public function get_license_renewal_url() { [ '{license_code}', '{email}' ], [ $this->get_license_code() ? $this->get_license_code() : '', - ! empty( $data['email'] ) ? $data['email'] : '', + ! empty( $data['buyer_email'] ) ? $data['buyer_email'] : '', ], $data['renewal_url'] ); diff --git a/tests/IntegrationApiRequestTest.php b/tests/IntegrationApiRequestTest.php index 866fa82..c13a298 100644 --- a/tests/IntegrationApiRequestTest.php +++ b/tests/IntegrationApiRequestTest.php @@ -90,8 +90,8 @@ public function error_404_with_error_body_returns_wp_error_with_api_code() { $result = $integration->api_request( 'updates' ); $this->assertInstanceOf( WP_Error::class, $result ); - $this->assertSame( 'product_not_exists', $result->get_error_code() ); - $this->assertSame( 'Requested product does not exists', $result->get_error_message() ); + $this->assertSame( 'plugin_not_exists', $result->get_error_code() ); + $this->assertSame( 'Requested plugin does not exits on this provider', $result->get_error_message() ); } /** @test */ diff --git a/tests/IntegrationLicenseTest.php b/tests/IntegrationLicenseTest.php index de70550..79af241 100644 --- a/tests/IntegrationLicenseTest.php +++ b/tests/IntegrationLicenseTest.php @@ -139,7 +139,7 @@ public function get_license_renewal_url_replaces_placeholders() { if ( 'my-plugin42_data' === $key ) { return [ 'renewal_url' => 'https://example.com/renew?license={license_code}&email={email}', - 'email' => 'user@example.com', + 'buyer_email' => 'user@example.com', ]; } if ( 'my-plugin42_code' === $key ) { @@ -195,7 +195,7 @@ public function get_license_renewal_url_handles_missing_license_code() { if ( 'my-plugin42_data' === $key ) { return [ 'renewal_url' => 'https://example.com/renew?license={license_code}&email={email}', - 'email' => 'user@example.com', + 'buyer_email' => 'user@example.com', ]; } if ( 'my-plugin42_code' === $key ) { diff --git a/tests/fixtures/error-product-not-found.json b/tests/fixtures/error-product-not-found.json index 8076bf9..5c64a53 100644 --- a/tests/fixtures/error-product-not-found.json +++ b/tests/fixtures/error-product-not-found.json @@ -1,7 +1,7 @@ { - "code": "product_not_exists", - "message": "Requested product does not exists", - "data": { - "status": 404 - } -} + "code": "plugin_not_exists", + "message": "Requested plugin does not exits on this provider", + "data": { + "status": 404 + } +} \ No newline at end of file