Adds the dashboard side of a customer's wallet (docs/prd-point-coin.md F7, PC-107), under /marketing for admins and managers: - GET /marketing/customers/:id/wallet returns the customer, the ledger and spendable balances, every lot that still holds something (flagged when expired), and a page of history. Unlike the customer's own view, each row carries the real names behind it: the transfer counterparty, the admin or cashier, and the outlet, plus the reason and metadata. - POST /marketing/customers/:id/wallet/adjust takes a signed amount and a required reason. It writes an ADJUSTMENT pointing at the admin through the wallet engine, refuses to take more than the customer can spend, and accepts an optional idempotency key so a retried request adjusts once. Reasons describing a cash-out are refused (K7). The customer must belong to the caller's organization; otherwise both endpoints answer 404. Positive adjustments create non-expiring lots until the expiry model is decided (F12, note N4). The mapping from ledger rows to what the apps show is now shared between the customer and dashboard views. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
15 lines
542 B
Go
15 lines
542 B
Go
package contract
|
|
|
|
// AdjustCustomerWalletRequest is POST /marketing/customers/:id/wallet/adjust
|
|
// (docs/prd-point-coin.md F7).
|
|
type AdjustCustomerWalletRequest struct {
|
|
// POINT or COIN.
|
|
Currency string `json:"currency"`
|
|
// Signed: positive adds to the balance, negative takes from it. Never zero.
|
|
Amount int64 `json:"amount"`
|
|
Reason string `json:"reason"`
|
|
// Optional. Sending the same key again returns the first result instead of
|
|
// adjusting twice, so a retried request is safe.
|
|
IdempotencyKey string `json:"idempotency_key"`
|
|
}
|