feat(payments): refund refund_due payments to the customer's wallet (#36, refunds slice) #100
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
primatekuntech/kws!100
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/36-refunds"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Refunds slice of #36 (does not close it: overstay, vehicle add-on and top-up tickets remain).
What
payments.Service.Refund: refunds arefund_duepayment to the customer's wallet (payment's currency, wallet created in the same transaction), marks itrefunded. Idempotent; ledger keyrefund:<payment id>.POST /v1/admin/payments/{id}/refund(Idempotency-Key) andGET /v1/admin/payments/refunds-due?limit=(1..200). Permissionadmin_portal.finance.manage, platform scope only. OpenAPI + live contract tests.walletstore.EnsureWalletTxcreates the wallet inside the caller's transaction (a separate connection hung the pool under parallel refunds; pinned by a starvation test).docs/superpowers/plans/2026-10-26-refunds.md.Rulings and known limits (ADR 0015)
refund_due, refunded outside the system.succeededpayment (customer cancellation, tour-operator refunds) is not built; it belongs with #37.Review
Dual pass done: Pass 1 (ponytail) no Must fix; Pass 2 found a pool-hang in the wallet creation, fixed in
9635bc9, Pass 1 re-check: Ship. Open nit: no direct test that a rolled-back refund leaves no wallet.Checks
make cover: 89.3% (minimum 80%).go test -race ./...,make lint,make contractgreen (implementer run).make clientsis left to CI.Deploy
No migration, no new environment variables, no worker change.
🤖 Generated with Claude Code
POST /v1/admin/payments/{id}/refund and GET /v1/admin/payments/refunds-due, guarded by admin_portal.finance.manage at platform scope (the waive check, generalised to take the permission). OpenAPI operations, live contract calls, ADR 0015, and ADR 0012/spec/CLAUDE.md updated. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>