feat: organization wallet reads and partner sales report (#53, PR B) #162

Merged
amiryahaya merged 5 commits from feat/partner-reports-53 into main 2026-11-05 13:40:30 +01:00
Owner

Summary

Issue #53, PR B: the organization's wallet reads and its sales report (API only; the web pages are PR C).

  • GET /v1/orgs/{id}/wallets and GET .../wallets/{wallet_id}/entries (ewallet.view): balances per currency and the statement, newest first, each line with the invoice code of the sale behind it. Another organization's wallet is a 404; the operation key is never returned.
  • GET /v1/orgs/{id}/reports/sales (reports.sales.view, max 2000 rows, else 422) and .../export (reports.sales.export, XLSX, max 100,000 rows, heavy class, two at a time per node): completed itinerary sales of the organization on Nairobi days, filters currency / itinerary / literal search, totals per currency (gross, refunded, net), never converted. A sale is flagged refunded only when its own payment was refunded.
  • Admin report code shares acquireSlot / sendWorkbook with the new handler.

Review

Dual pass (ponytail complexity: no Must-fix; correctness: one Important). Fixed test-first: an extra payment refunded on its own flagged the whole sale as refunded; invalid-UTF-8/NUL search was a 500, now 422. Deferred minors (duplication of the wallet JSON/paging code, likeEscaper fourth copy, and similar) are listed in the ledger.

Coverage

make cover: total 91.4% (minimum 80%). make lint: 0 issues.

Owner [verify]

  • Reads need an active organization (members of a non-active organization hold no grants); the spec said any status.
  • The JSON report uses the default rate class; only the export is heavy.

🤖 Generated with Claude Code

## Summary Issue #53, PR B: the organization's wallet reads and its sales report (API only; the web pages are PR C). - `GET /v1/orgs/{id}/wallets` and `GET .../wallets/{wallet_id}/entries` (`ewallet.view`): balances per currency and the statement, newest first, each line with the invoice code of the sale behind it. Another organization's wallet is a 404; the operation key is never returned. - `GET /v1/orgs/{id}/reports/sales` (`reports.sales.view`, max 2000 rows, else 422) and `.../export` (`reports.sales.export`, XLSX, max 100,000 rows, `heavy` class, two at a time per node): completed itinerary sales of the organization on Nairobi days, filters currency / itinerary / literal search, totals per currency (gross, refunded, net), never converted. A sale is flagged refunded only when its own payment was refunded. - Admin report code shares `acquireSlot` / `sendWorkbook` with the new handler. ## Review Dual pass (ponytail complexity: no Must-fix; correctness: one Important). Fixed test-first: an extra payment refunded on its own flagged the whole sale as refunded; invalid-UTF-8/NUL search was a 500, now 422. Deferred minors (duplication of the wallet JSON/paging code, `likeEscaper` fourth copy, and similar) are listed in the ledger. ## Coverage `make cover`: total 91.4% (minimum 80%). `make lint`: 0 issues. ## Owner [verify] - Reads need an active organization (members of a non-active organization hold no grants); the spec said any status. - The JSON report uses the `default` rate class; only the export is `heavy`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
fix(reports): an extra refunded payment does not refund the sale; plain-text search (#53)
All checks were successful
ci / changes (pull_request) Successful in 28s
ci / clients (pull_request) Successful in 2m30s
ci / web-partner (pull_request) Successful in 6m18s
ci / web-admin (pull_request) Successful in 9m42s
ci / web-ticket (pull_request) Successful in 13m37s
ci / api (pull_request) Successful in 16m28s
ci / ci-gate (pull_request) Successful in 4s
af45f02b1a
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
primatekuntech/kws!162
No description provided.