refactor(vouchers): move voucher routes out of /enakgame

Vouchers are what EnakPoint is redeemed for, wherever it came from, so they are
not part of EnakGame. Their only link to it is the budget attribution, which
does not change.

- Admin: /marketing/enakgame/vouchers... -> /marketing/vouchers...
- Customer: /customer/enakgame/vouchers -> /customer/vouchers,
  /customer/enakgame/vouchers/:id/redeem -> /customer/vouchers/:id/redeem,
  /customer/enakgame/redemptions -> /customer/vouchers/redemptions

Roles, handlers and logic stay the same. No client calls these endpoints yet.
RFC §7.4 and §11 updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
efrilm
2026-10-08 11:09:57 +07:00
co-authored by Claude Opus 5.5
parent 18e87398bb
commit 1bb071aec6
11 changed files with 56 additions and 1933 deletions
+13 -5
View File
@@ -636,7 +636,7 @@ menanganinya, dan complete di §7.2 langkah 4 menangani yang lebih cepat.
### 7.4 Redemption voucher internal (`STATIC`, `CODE_POOL`)
```
POST /customer/enakgame/vouchers/:id/redeem { pin } Idempotency-Key: <≤50 char>
POST /customer/vouchers/:id/redeem { pin } Idempotency-Key: <≤50 char>
```
Satu transaksi, sehingga state `RESERVED` tidak diperlukan:
@@ -843,12 +843,20 @@ tambahkan snapshot harian, bukan cache yang di-invalidate.
| `POST` | `/sessions/:id/complete` | §7.2. Idempotent tanpa header |
| `GET` | `/sessions/:id` | Status dan hasil |
| `GET` | `/sessions` | Riwayat main |
| `GET` | `/vouchers` | Katalog `ACTIVE` + stok tersedia |
| `POST` | `/vouchers/:id/redeem` | §7.4 / §7.5. Wajib `Idempotency-Key` + PIN |
| `GET` | `/redemptions` | Voucher milik customer, termasuk kode |
Prefix `/enakgame` dipakai karena `/customer/games` sudah dipakai alur spin lama.
### Voucher customer (`/api/v1/customer/vouchers`, `ValidateCustomerToken`)
Voucher adalah tempat memakai EnakPoint dari mana pun asalnya, bukan bagian dari game,
jadi tidak di bawah `/enakgame` (diubah 2026-10-08).
| Method | Path | Catatan |
|---|---|---|
| `GET` | `/vouchers` | Katalog `ACTIVE` + stok tersedia |
| `POST` | `/vouchers/:id/redeem` | §7.4 / §7.5. Wajib `Idempotency-Key` + PIN |
| `GET` | `/vouchers/redemptions` | Voucher milik customer, termasuk kode |
### Admin (`/api/v1/marketing/enakgame`, `RequireAdminOrManager`)
| Resource | Endpoint |
@@ -858,7 +866,7 @@ Prefix `/enakgame` dipakai karena `/customer/games` sudah dipakai alur spin lama
| Events | CRUD, `PUT /:id/status` |
| Budgets | CRUD, `GET /:id/metrics`, `GET /:id/recommendation`, `POST /:id/recommendation/accept` |
| Analytics | `GET /analytics/games?from=&to=&game_id=`, `GET /analytics/economy?from=&to=` (tanggal Asia/Jakarta, maks 366 hari) |
| Vouchers | CRUD, `POST /:id/codes` (impor CSV), `GET /:id/codes` |
| Vouchers | Di `/api/v1/marketing/vouchers`, bukan di bawah `/enakgame`: CRUD, `PUT /:id/status`, `POST /:id/codes` (impor CSV), `GET /:id/codes` |
| Redemptions | `GET` list, `GET /:id` dengan atribusi cost |
| Sessions | `GET` list + filter `flagged` |
| Settings | Lewat endpoint loyalty settings yang ada, dengan key baru (§5.10) |