refactor: implement provisioning API endpoints #15

Open
opened 2026-02-20 11:10:13 +00:00 by Clotho · 0 comments
Member

Issue

Per TODO.md (P2-048) and comment in routes/api.php (line 38), provisioning API endpoints are commented out pending implementation.

Current State

routes/api.php contains:

// TODO: Create ProductApiController and EntitlementApiController in
//       Mod\Commerce\Controllers\Api\ for provisioning endpoints
// Route::get("/products", [ProductApiController::class, "index"]);
// Route::post("/entitlements", [EntitlementApiController::class, "create"]);

Required Implementation

1. ProductApiController

Create Controllers/Api/ProductApiController.php:

  • index() - List available products/plans
  • show($id) - Get product details and pricing
  • variants($id) - Get product variants/options

2. EntitlementApiController

Create Controllers/Api/EntitlementApiController.php:

  • create() - Provision entitlement for external integration
  • revoke() - Remove entitlement
  • verify() - Check entitlement status
  • list() - Get all entitlements for workspace

3. Authentication

  • Use API token authentication (Sanctum)
  • Validate workspace ownership
  • Rate limit per token (separate from checkout limits)

4. Use Cases

These endpoints enable external integrations:

  • WHMCS provisioning modules
  • Custom billing portals
  • Partner integrations
  • Automated testing/provisioning scripts

Tests Required

  • tests/Feature/ProductApiControllerTest.php
  • tests/Feature/EntitlementApiControllerTest.php

Priority

P2 - High: Required for external integrations before launch.


Created by discovery scan (issue #2) - References TODO.md P2-048, routes/api.php:38

## Issue Per TODO.md (P2-048) and comment in `routes/api.php` (line 38), provisioning API endpoints are commented out pending implementation. ## Current State `routes/api.php` contains: ```php // TODO: Create ProductApiController and EntitlementApiController in // Mod\Commerce\Controllers\Api\ for provisioning endpoints // Route::get("/products", [ProductApiController::class, "index"]); // Route::post("/entitlements", [EntitlementApiController::class, "create"]); ``` ## Required Implementation ### 1. ProductApiController Create `Controllers/Api/ProductApiController.php`: - `index()` - List available products/plans - `show($id)` - Get product details and pricing - `variants($id)` - Get product variants/options ### 2. EntitlementApiController Create `Controllers/Api/EntitlementApiController.php`: - `create()` - Provision entitlement for external integration - `revoke()` - Remove entitlement - `verify()` - Check entitlement status - `list()` - Get all entitlements for workspace ### 3. Authentication - Use API token authentication (Sanctum) - Validate workspace ownership - Rate limit per token (separate from checkout limits) ### 4. Use Cases These endpoints enable external integrations: - WHMCS provisioning modules - Custom billing portals - Partner integrations - Automated testing/provisioning scripts ## Tests Required - `tests/Feature/ProductApiControllerTest.php` - `tests/Feature/EntitlementApiControllerTest.php` ## Priority **P2 - High:** Required for external integrations before launch. --- _Created by discovery scan (issue #2) - References TODO.md P2-048, routes/api.php:38_
Clotho added the
review
discovery
labels 2026-02-20 11:10:13 +00:00
Charon added
PHP
refactor
P2
and removed
review
discovery
labels 2026-02-20 12:17:11 +00:00
Clotho was assigned by Charon 2026-02-20 12:21:05 +00:00
Charon added the
agent-ready
label 2026-02-21 01:31:39 +00:00
Sign in to join this conversation.
No description provided.