Skip to content

Enhancement/8094 managing api failure#8113

Merged
Miraeld merged 72 commits intodevelopfrom
enhancement/8094-managing-api-failure
Mar 6, 2026
Merged

Enhancement/8094 managing api failure#8113
Miraeld merged 72 commits intodevelopfrom
enhancement/8094-managing-api-failure

Conversation

@Miraeld
Copy link
Copy Markdown
Contributor

@Miraeld Miraeld commented Mar 2, 2026

Description

Fixes #8094
After completing the RocketCDN express checkout, users may encounter situations where the subscription activation fails. This PR adds two recovery mechanisms:

  1. Admin Notice: When activation fails without CDN configuration (is_active=false, cdn_url empty), displays a notice with a link to retry activation via express checkout.
  2. Auto-Retry: When activation fails but CDN URL exists (is_active=false, cdn_url exists), automatically retries activation on next admin page load.

This prevents users from getting stuck with incomplete RocketCDN subscriptions after checkout.

Type of change

  • Enhancement (non-breaking change which improves an existing functionality).

Detailed scenario

What was tested

Automated Testing:

  • 7 integration tests for activation failed notice (all edge cases: capability checks, screen checks, white label, active subscriptions, etc.)
  • 7 integration tests for auto-retry activation (all scenarios: token validation, API failures, successful retry)
  • All 14 tests passing

Manual Testing:

  • Verified notice displays when is_active=false and cdn_url is empty
  • Verified auto-retry triggers when is_active=false but cdn_url exists
  • Verified notice includes correct express checkout URL
  • Verified notice respects white label settings

How to test

Needs API errors.

Affected Features & Quality Assurance Scope

Direct Impact:

  • RocketCDN activation flow
  • RocketCDN admin notices
  • WP Rocket Settings page (admin notices display)

QA Testing Scope:

  • RocketCDN express checkout completion
  • RocketCDN activation scenarios (success, failure, partial failure)
  • Admin notice display logic
  • White label account behavior (notices should not display)
  • User capability checks (non-admin users should not see notices)

Technical description

Documentation

Flow Diagram:

Express Checkout Complete
          ↓
   Get Subscription Status
          ↓
    ┌──────────────┐
    │ is_active?   │
    └──────┬───────┘
           │
     ┌─────┴─────┐
     No         Yes → All good!
     │
     ↓
┌─────────────┐
│ has cdn_url?│
└─────┬───────┘
      │
  ┌───┴────┐
  No      Yes
  │        │
  ↓        ↓
Show     Auto-retry
Notice   Activation

Implementation:

  • NoticesSubscriber::activation_failed_notice(): Displays admin notice when subscription is inactive without CDN URL. Reads express checkout URL from UserClient API.

  • DataManagerSubscriber::maybe_retry_activation(): Fires on admin_init, checks if subscription has CDN URL but is_active=false, then calls APIClient to retry activation via PATCH request.

  • Both methods share subscription status checks via APIClient::get_subscription_data() which reads from rocketcdn_status transient.

Mandatory Checklist

Code validation

  • I validated all the Acceptance Criteria. If possible, provide screenshots or videos.
  • I triggered all changed lines of code at least once without new errors/warnings/notices.
  • I implemented built-in tests to cover the new/changed code.

Code style

  • I wrote a self-explanatory code about what it does.
  • I protected entry points against unexpected inputs.
  • I did not introduce unnecessary complexity.
  • Output messages (errors, notices, logs) are explicit enough for users to understand the issue and are actionnable.

Unticked items justification

N/A - All items completed.

Additional Checks

  • In the case of complex code, I wrote comments to explain it.
  • When possible, I prepared ways to observe the implemented system (logs, data, etc.).
  • I added error handling logic when using functions that could throw errors (HTTP/API request, filesystem, etc.)

jeawhanlee and others added 30 commits February 24, 2026 09:09
- Modified AdminPageSubscriber to include 'is_monthly' parameter in the button URL.
- Enhanced rocketcdn.js to toggle visibility of pricing based on billing cycle selection.
- Added a new function to update the button URL with the correct 'is_monthly' value based on the selected billing cycle.
Copy link
Copy Markdown
Contributor

@wordpressfan wordpressfan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important point to be handled

Comment thread inc/Engine/CDN/RocketCDN/DataManagerSubscriber.php
Base automatically changed from feature/8018-plugin-ui-rocketcdn-one-click-purchase to develop March 4, 2026 12:09
@wordpressfan
Copy link
Copy Markdown
Contributor

@Miraeld plz fix conflicts and send it to QA
Thanks.

Miraeld added 2 commits March 5, 2026 01:28
- Introduced a new Tracking instance in NoticesSubscriber to track banner views.
- Implemented track_rocketcdn_activation_failed_banner_viewed method in Tracking class.
- Updated NoticesSubscriber to call the tracking method when the activation failed banner is viewed.
- Modified the activation failed notice action link to include an ID for tracking.
- Added event listener in rocketcdn.js to track clicks on the activation failed CTA.
- Created trackRocketCDNActivationCTA function to handle Mixpanel tracking for CTA clicks.
@Miraeld
Copy link
Copy Markdown
Contributor Author

Miraeld commented Mar 6, 2026

Screenshot 2026-03-06 at 13 34 38 @Mai-Saad

@Miraeld Miraeld added this pull request to the merge queue Mar 6, 2026
Merged via the queue into develop with commit 2e0dc67 Mar 6, 2026
15 checks passed
@Miraeld Miraeld deleted the enhancement/8094-managing-api-failure branch March 6, 2026 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RocketCDN One-Click Checkout - Handle API failure

4 participants