Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,23 @@ private function render_details_with_license( $details ) {
$output .= '<strong style="color:red;">Your license has expired. Please renew your license to get updates.</strong>';
}
} elseif ( 'suspended' === $this->integration->get_license_status() ) {
$output .= '<strong>Your license has been suspended. Please contact support.</strong>';
if ( ! empty( $details['homepage'] ) ) {
$output .= \sprintf(
'<strong>Your license has been suspended. Please <a href="%s">contact support</a>.</strong>',
esc_url( $details['homepage'] )
);
} else {
$output .= '<strong>Your license has been suspended. Please contact support.</strong>';
}
} else {
$output .= '<strong>Unable to upgrade. Please contact support.</strong>';
if ( ! empty( $details['homepage'] ) ) {
$output .= \sprintf(
'<strong>Upgrade package file missing, unable to upgrade. Please <a href="%s">contact support</a>.</strong>',
esc_url( $details['homepage'] )
);
} else {
$output .= '<strong>Upgrade package file missing, unable to upgrade. Please contact support.</strong>';
}
}
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/Integration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']
);
Expand Down
4 changes: 2 additions & 2 deletions tests/IntegrationApiRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
4 changes: 2 additions & 2 deletions tests/IntegrationLicenseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down Expand Up @@ -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 ) {
Expand Down
12 changes: 6 additions & 6 deletions tests/fixtures/error-product-not-found.json
Original file line number Diff line number Diff line change
@@ -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
}
}