Upgrade/downgrade flow — tier changes without new DLID #631

Closed
opened 2026-06-12 08:01:59 +00:00 by jmiller · 2 comments
Owner

Phase 5.2 — Tier Upgrade/Downgrade

Parent: #616 | Depends on: #618, #619, #630

Upgrade scenario

Customer has CRM license, purchases POS upgrade:

  1. Shop detects existing DLID for this customer
  2. Calls PATCH /api/v1/licensing/licenses/{id} with tier: "pos"
  3. Gitea updates license tier
  4. Entitlements auto-rebuilt: now includes Base + CRM + ERP + POS
  5. Customer's existing DLID immediately works for ERP + POS update servers
  6. No reinstall needed — next Joomla update check picks up new repos

Downgrade scenario

Customer downgrades from Suite to CRM:

  1. Tier changed to "crm"
  2. Entitlements rebuilt: only Base + CRM
  3. Existing extensions continue working (GPL) but no longer receive updates
  4. Update servers return empty XML for non-entitled products

Add-on scenario

Customer has POS license, adds HRM as individual add-on:

  1. Custom entitlement added: AddCustomEntitlement(licenseID, "hrm", "MokoSuiteHRM")
  2. HRM entitlement added WITHOUT changing tier
  3. Custom entitlements survive tier changes

Prorated billing (Shop side)

  • Calculate remaining days on current subscription
  • Credit toward new tier price
  • Extend or adjust expiry as needed

Acceptance criteria

  • Tier change rebuilds entitlements instantly
  • Same DLID works for new repos immediately
  • Downgrade removes update access but doesn't break installed extensions
  • Add-on entitlements persist across tier changes
  • Prorated billing calculation in Shop
## Phase 5.2 — Tier Upgrade/Downgrade Parent: #616 | Depends on: #618, #619, #630 ### Upgrade scenario Customer has CRM license, purchases POS upgrade: 1. Shop detects existing DLID for this customer 2. Calls `PATCH /api/v1/licensing/licenses/{id}` with `tier: "pos"` 3. Gitea updates license tier 4. Entitlements auto-rebuilt: now includes Base + CRM + ERP + POS 5. Customer's existing DLID immediately works for ERP + POS update servers 6. No reinstall needed — next Joomla update check picks up new repos ### Downgrade scenario Customer downgrades from Suite to CRM: 1. Tier changed to "crm" 2. Entitlements rebuilt: only Base + CRM 3. Existing extensions continue working (GPL) but no longer receive updates 4. Update servers return empty XML for non-entitled products ### Add-on scenario Customer has POS license, adds HRM as individual add-on: 1. Custom entitlement added: `AddCustomEntitlement(licenseID, "hrm", "MokoSuiteHRM")` 2. HRM entitlement added WITHOUT changing tier 3. Custom entitlements survive tier changes ### Prorated billing (Shop side) - Calculate remaining days on current subscription - Credit toward new tier price - Extend or adjust expiry as needed ### Acceptance criteria - [ ] Tier change rebuilds entitlements instantly - [ ] Same DLID works for new repos immediately - [ ] Downgrade removes update access but doesn't break installed extensions - [ ] Add-on entitlements persist across tier changes - [ ] Prorated billing calculation in Shop
Author
Owner

Branch created: feature/631-upgrade-downgrade-flow-tier-changes-with

git fetch origin
git checkout feature/631-upgrade-downgrade-flow-tier-changes-with
Branch created: [`feature/631-upgrade-downgrade-flow-tier-changes-with`](https://code.mokoconsulting.tech/MokoConsulting/MokoGitea-APP/src/branch/feature/631-upgrade-downgrade-flow-tier-changes-with) ```bash git fetch origin git checkout feature/631-upgrade-downgrade-flow-tier-changes-with ```
Author
Owner

All Gitea-side acceptance criteria met

The upgrade/downgrade/add-on flow is fully implemented in the models built for #618/#619:

Upgrade

PATCH /api/v1/licensing/licenses/{id} with {"tier": "pos"}
UpdateLicenseTier()RebuildEntitlements() → entitlements rebuilt from tier repos
→ Next Joomla update check picks up new repos via /updates/{product}.xml

Downgrade

Same PATCH with lower tier → RebuildEntitlements() removes higher-tier repos
→ Update endpoint returns empty <updates/> for non-entitled products
→ Installed extensions continue working (GPL), just no more updates

Add-on

AddCustomEntitlement(licenseID, "hrm", "MokoSuiteHRM")IsCustom: true
RebuildEntitlements() only deletes is_custom = false entries
→ Custom entitlements survive tier changes

Prorated billing

This is a Shop/CRM concern — tracked in MokoSuiteShop #28 and MokoSuiteCRM #57.

## All Gitea-side acceptance criteria met The upgrade/downgrade/add-on flow is fully implemented in the models built for #618/#619: ### Upgrade `PATCH /api/v1/licensing/licenses/{id}` with `{"tier": "pos"}` → `UpdateLicenseTier()` → `RebuildEntitlements()` → entitlements rebuilt from tier repos → Next Joomla update check picks up new repos via `/updates/{product}.xml` ### Downgrade Same PATCH with lower tier → `RebuildEntitlements()` removes higher-tier repos → Update endpoint returns empty `<updates/>` for non-entitled products → Installed extensions continue working (GPL), just no more updates ### Add-on `AddCustomEntitlement(licenseID, "hrm", "MokoSuiteHRM")` → `IsCustom: true` → `RebuildEntitlements()` only deletes `is_custom = false` entries → Custom entitlements survive tier changes ### Prorated billing This is a Shop/CRM concern — tracked in MokoSuiteShop #28 and MokoSuiteCRM #57.
Sign in to join this conversation.