Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a78b57c
platform: httpx.NextGaplessNumber, the gapless counter mint (ADR 0005…
Oct 8, 2026
bc87c15
migration 097: invoices and credit memos onto the wire contract (coun…
Oct 8, 2026
a38d120
gl: PostReversal (a dated, currencied reversal of a posted entry); ac…
Oct 8, 2026
02891e9
inventory: UnrestockQty, the reverse of RestockQty (a voided restocki…
Oct 8, 2026
73b1e3e
invoices and credit memos: the module on the contract (wire types, re…
Oct 8, 2026
e75fce2
invoices and credit memos: contract fragment, goldens, order void int…
Oct 8, 2026
077fbda
api client: usage for invoices and credit memos; accounts and gl enum…
Oct 8, 2026
4cec7c8
invoices and credit memos: wire tests (shape, list, overdue, terms, v…
Oct 8, 2026
beaa75c
invoices and credit memos: transaction proofs, migration test, branch…
Oct 8, 2026
f303a88
contract changes for C2-3; AGENTS.md money table and open status set
Oct 8, 2026
bd87eb0
invoices: partial void, kit void and payment versus void race tests
Oct 8, 2026
8da03bd
invoices: route guard and machine key vocabulary tests
Oct 8, 2026
738a146
web: invoices and credit memos on the contract: desk invoice and cred…
Oct 8, 2026
3bd1f29
credit memo edit need not repeat the customer or the invoice
Oct 8, 2026
dfe2983
closed fiscal period is 409 period_closed on the fulfilment invoice t…
Oct 8, 2026
3ba69c3
migration test: a role, not a name, as the price adjuster
Oct 8, 2026
922884c
review round: reverse the legacy entry of an invoice with no gl_entry…
Oct 8, 2026
31d3ebb
Merge remote-tracking branch 'origin/refactor/v1' into refactor/c2-3-…
Oct 8, 2026
acb7518
e2e(invoices): read the product and inventory lists as cursor envelopes
Oct 9, 2026
7df2654
test(invoice): prove the last credit memo takes the tax remainder whe…
Oct 9, 2026
fa45aa6
fix(payment): reverse an approved card charge when the invoice refuse…
Oct 9, 2026
b63c317
fix(invoice): void of a draft credit memo posted meanwhile answers a …
Oct 9, 2026
facf380
fix(migrations): 097 maps a negative legacy credit memo amount to -AB…
Oct 9, 2026
540641a
fix(invoice): refuse the void of a counter invoice until C2-5 owns th…
Oct 9, 2026
ed536e7
fix(invoice): one kit refusal message for credit memo lines
Oct 9, 2026
25c1ebc
fix(payment): say whether a refused card charge was reversed, and rev…
Oct 9, 2026
a5ee12b
Merge remote-tracking branch 'origin/refactor/v1' into refactor/c2-3-…
Oct 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ The convention table at `Key Conventions → Database` ("cents in app code") is

| Surface | Wire format | Notes |
|---|---|---|
| ERP `/api/v1/orders`, `/api/v1/invoices` | **int64 cents** | `order/repository.go` does `dollarsToInt64Cents()` on read, `/100.0` on write. DB column is `DECIMAL(10,2)` dollars |
| ERP `/api/v1/orders`, `/api/v1/invoices`, `/api/v1/credit-memos` | **int64 cents** (`*_cents`), unit prices int64 ten thousandths, quantities decimal strings | Converted onto ADR 0001 by C2-2 (orders) and C2-3 (invoices, credit memos): the list envelope, a lowercase status with the transitions route, a document number (`IN-` and `CM-` gapless), a revision with its `ETag`, the shared sales line shape (`docs/adr/0005-sales-and-money-core.md` sections 2 and 6). Credit memo lines, totals and open amounts are NEGATIVE. DB columns stay `NUMERIC`; the modules convert in SQL |
| Portal `/api/portal/v1/*` | **float64 dollars** | `portal/model.go:61` has a TODO to migrate. Don't mix with ERP frontend helpers |
| Quotes `/api/v1/quotes` | **int64 cents** (`*_cents`), unit prices int64 ten thousandths (`unit_price_ten_thousandths`) | Converted by R1-15 onto ADR 0001; the template is `docs/refactor/MODULE-RECIPE.md`. DB columns stay `NUMERIC`; the module converts in SQL, never through float64 |
| Customers `/api/v1/customers` | **int64 cents** (`credit_limit_cents`, null for no limit; `balance_cents`, read only) | Converted by C2-1 onto ADR 0001 with ship-tos and the payment terms master (`docs/adr/0005-sales-and-money-core.md` section 7). `customers.credit_limit` is NULL for no limit and 0 is no credit. DB columns stay `NUMERIC(12,2)`; the module converts in SQL |
Expand All @@ -216,7 +216,7 @@ When rendering money on **ERP pages**, use `formatCents()` from `web/apps/desk/s

### AR balance: read live from invoices; `customers.balance_due` is a secondary record
For **reads / decisions**, compute the customer's AR balance live from open invoices —
`SUM(total_amount) FROM invoices WHERE status IN ('UNPAID','PARTIAL','OVERDUE')`. The
`SUM(total_amount) FROM invoices WHERE status IN ('UNPAID','PARTIAL')`. The
canonical status set lives in `invoice.OpenInvoiceStatuses`; the portal AR summary,
dashboard, reporting, and the order **credit-limit gate** (`order.Service.overCreditLimit`)
all go through it, so they agree. The credit gate no longer reads the denormalized
Expand Down
8 changes: 6 additions & 2 deletions core/api/ROUTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,11 @@ POST /api/v1/configurator/validate internal/configurator h.handleValidate
DELETE /api/v1/contacts/{id} internal/customer h.HandleDeleteContact
GET /api/v1/contacts/{id} internal/customer h.HandleGetContact
PUT /api/v1/contacts/{id} internal/customer h.HandleUpdateContact
GET /api/v1/credit-memos/{customerId} internal/invoice h.HandleListCreditMemos
GET /api/v1/credit-memos internal/invoice h.HandleListCreditMemos
POST /api/v1/credit-memos internal/invoice h.HandleCreateCreditMemo
GET /api/v1/credit-memos/{id} internal/invoice h.HandleGetCreditMemo
PUT /api/v1/credit-memos/{id} internal/invoice h.HandleUpdateCreditMemo
POST /api/v1/credit-memos/{id}/transitions internal/invoice h.HandleCreditTransition
GET /api/v1/customers internal/customer h.HandleListCustomers
POST /api/v1/customers internal/customer h.HandleCreateCustomer
GET /api/v1/customers/{customerId}/activities internal/crm h.HandleListActivities
Expand Down Expand Up @@ -213,9 +217,9 @@ POST /api/v1/inventory/adjust internal/inventory h.AdjustStock
POST /api/v1/inventory/transfer internal/inventory h.MoveStock
GET /api/v1/invoices internal/invoice h.HandleList
GET /api/v1/invoices/{id} internal/invoice h.HandleGet
POST /api/v1/invoices/{id}/credit-memo internal/invoice h.HandleCreateCreditMemo
POST /api/v1/invoices/{id}/email internal/document h.HandleEmailInvoice
GET /api/v1/invoices/{id}/payments internal/payment h.GetPaymentHistory
POST /api/v1/invoices/{id}/transitions internal/invoice h.HandleTransition
GET /api/v1/locations internal/location list
POST /api/v1/locations internal/location create
DELETE /api/v1/locations/{id} internal/location h.DeleteLocation
Expand Down
2 changes: 2 additions & 0 deletions core/api/fragments/accounts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ components:
- PAYMENT
- ADJUSTMENT
- REFUND
- CREDIT_MEMO
- REVERSAL
amount:
type: integer
format: int64
Expand Down
2 changes: 1 addition & 1 deletion core/api/fragments/gl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ components:
type: string
source:
type: string
description: MANUAL, INVOICE, PAYMENT, ADJUSTMENT, CLOSING, VENDOR_INVOICE, VENDOR_PAYMENT, REVERSAL, RETURN or DEPOSIT.
description: MANUAL, INVOICE, PAYMENT, ADJUSTMENT, CLOSING, VENDOR_INVOICE, VENDOR_PAYMENT, REVERSAL, RETURN, DEPOSIT, CREDIT_MEMO or WRITE_OFF.
source_ref_id:
type: string
format: uuid
Expand Down
Loading
Loading