final docs

This commit is contained in:
IGNY8 VPS (Salman)
2025-12-05 07:09:29 +00:00
parent d92a99ecc3
commit f91037b729
9 changed files with 173 additions and 2778 deletions

View File

@@ -5,16 +5,16 @@
## ✅ WORKING ENDPOINTS
### Billing V2 Endpoints (New)
### Billing API Endpoints
| Endpoint | Method | Status | Notes |
|----------|--------|--------|-------|
| `/api/v1/billing/v2/invoices/` | GET | ✅ 401 | Auth required (correct) |
| `/api/v1/billing/v2/payments/` | GET | ✅ 401 | Auth required (correct) |
| `/api/v1/billing/v2/credit-packages/` | GET | ✅ 401 | Auth required (correct) |
| `/api/v1/billing/v2/transactions/` | GET | ✅ 401 | Auth required (correct) |
| `/api/v1/billing/v2/transactions/balance/` | GET | ✅ 401 | Auth required (correct) |
| `/api/v1/billing/v2/admin/stats/` | GET | ✅ 401 | Auth required (correct) |
| `/api/v1/billing/invoices/` | GET | ✅ 401 | Auth required (correct) |
| `/api/v1/billing/payments/` | GET | ✅ 401 | Auth required (correct) |
| `/api/v1/billing/credit-packages/` | GET | ✅ 401 | Auth required (correct) |
| `/api/v1/billing/transactions/` | GET | ✅ 401 | Auth required (correct) |
| `/api/v1/billing/transactions/balance/` | GET | ✅ 401 | Auth required (correct) |
| `/api/v1/billing/admin/stats/` | GET | ✅ 401 | Auth required (correct) |
### Account Endpoints
@@ -27,21 +27,19 @@
## ❌ ISSUES FIXED
### Frontend API Path Issues
**Problem:** Frontend was calling `/api/billing/v2/...` instead of `/api/v1/billing/v2/...`
### Frontend API Path Alignment
**Problem:** Frontend must always call the canonical `/api/v1/billing/...` endpoints (no `/v2` alias).
**Files Fixed:**
- `frontend/src/services/billing.api.ts` - Added `/v1/` prefix to all endpoints
- `frontend/src/services/billing.api.ts` ensured all billing calls use `/v1/billing/...`
**Changes:**
```typescript
// Before:
fetchAPI('/billing/v2/invoices/')
fetchAPI('/account/settings/')
fetchAPI('/billing/invoices/')
// After:
fetchAPI('/v1/billing/v2/invoices/')
fetchAPI('/v1/account/settings/')
fetchAPI('/v1/billing/invoices/')
```
### Component Export Issues
@@ -84,33 +82,33 @@ await createManualPayment({...}) // ✅
| Account Settings | `/account/settings` | ✅ Ready | `/v1/account/settings/` |
| Team Management | `/account/team` | ✅ Ready | `/v1/account/team/` |
| Usage Analytics | `/account/usage` | ✅ Ready | `/v1/account/usage/analytics/` |
| Purchase Credits | `/account/purchase-credits` | ✅ Ready | `/v1/billing/v2/credit-packages/` |
| Purchase Credits | `/account/purchase-credits` | ✅ Ready | `/v1/billing/credit-packages/` |
### Billing Pages
| Page | Route | Status | Backend API |
|------|-------|--------|-------------|
| Credits Overview | `/billing/credits` | ✅ Ready | `/v1/billing/v2/transactions/balance/` |
| Transactions | `/billing/transactions` | ✅ Ready | `/v1/billing/v2/transactions/` |
| Usage | `/billing/usage` | ✅ Ready | `/v1/billing/v2/transactions/` |
| Credits Overview | `/billing/credits` | ✅ Ready | `/v1/billing/transactions/balance/` |
| Transactions | `/billing/transactions` | ✅ Ready | `/v1/billing/transactions/` |
| Usage | `/billing/usage` | ✅ Ready | `/v1/billing/transactions/` |
| Plans | `/settings/plans` | ✅ Ready | `/v1/auth/plans/` |
### Admin Pages
| Page | Route | Status | Backend API |
|------|-------|--------|-------------|
| Admin Dashboard | `/admin/billing` | ⏳ Partial | `/v1/billing/v2/admin/stats/` |
| Admin Dashboard | `/admin/billing` | ⏳ Partial | `/v1/billing/admin/stats/` |
| Billing Management | `/admin/billing` | ⏳ Partial | Multiple endpoints |
## 🔧 URL STRUCTURE
### Correct URL Pattern
```
Frontend calls: /v1/billing/v2/invoices/
Frontend calls: /v1/billing/invoices/
API Base URL: https://api.igny8.com/api
Full URL: https://api.igny8.com/api/v1/billing/v2/invoices/
Full URL: https://api.igny8.com/api/v1/billing/invoices/
Backend route: /api/v1/billing/v2/ → igny8_core.business.billing.urls
Backend route: /api/v1/billing/ → igny8_core.business.billing.urls
```
### API Base URL Detection