Repository navigation
docs: invoices and orders pages match the code - #90
Merged
Merged
Conversation
Signed-off-by: colton <colton@futurebuild.ai>
…ields tables
docs: routes table adds POST /invoices/{id}/write-offs (internal/invoice), POST /credit-memos/{id}/applications (internal/invoice) and POST /credit-memos/{id}/refunds (internal/payment) with what each does, its role guard and its body, each quoted from the route fragment, the handler and the AR or payment core.
docs: lifecycle table gains the invoice written_off and the credit memo applied and refunded transitions with their blockers, and the events list gains the constants the AR core and the payment module write.
docs: orders Order field table gains deposit_unapplied_cents with its meaning and the SQL that computes it.
Signed-off-by: colton <colton@futurebuild.ai>
Routes: name the two routes that sit under another module (the email route is internal/document and the credit memo refunds route is internal/payment); fix the payments list row to name the route's actual purpose (ListApplications on the invoice module, all application kinds, oldest first, reversals included). Lifecycle: written_off and paid transition rows explain that an application that takes the open amount to zero on an invoice with a live write off closes it as written_off and writes invoice.written_off; the credit memo partial and applied rows say a refund writes credit_memo.refunded first, then the status event. Write off blockers: drop the invented invoice_not_open key and rely on the plain invalid_state_transition the code returns. Apply blockers: list exceeds_open_credit for lines that together exceed the memo's open credit and invalid_state_transition for a memo that is not open or partial. Write off and refund rows: add the GL effect (DR 5040 / CR 1020 on write off, DR 1020 / CR 1010 on refund) and the SUBLEDGER rows. Signed-off-by: colton <colton@futurebuild.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Two drift fixes from the previous pass are still in this PR. This commit
adds the four items the lead's ruling named: three missing routes in
docs/modules/invoices.mdand one missing field indocs/modules/orders.md.1. Route census column name
After:
Evidence:
head -10 core/api/ROUTES.txtreads "method, pattern, module,handler. The module column is the registering package's directory relative
to the Go module root." The census uses
module, notpackage.2. Owner of
/api/v1/invoices/{id}/paymentsBefore:
After:
Evidence:
grep '/api/v1/invoices/{id}/payments' core/api/ROUTES.txt->internal/invoice h.HandleApplications(ROUTES.txt line 239). The handlerlives in
core/internal/invoice/handler.go.3. Three missing routes in invoices.md
Added to the Routes table:
POST /api/v1/invoices/{id}/write-offs(internal/invoice, ROUTES.txtline 241; fragment line 455 in
core/api/fragments/invoice.yaml):write off part or all of an open invoice as bad debt; user guard
admin,owner,finance(the wall atcore/internal/app/serve/wire_branch_wall.goline 120 plus the servicerequireFinanceatcore/internal/invoice/service_ar.goline 89);body
{amount_cents, reason}(1 to 500 chars) plus revision. ADR 0005section 9.4.
POST /api/v1/credit-memos/{id}/applications(internal/invoice,ROUTES.txt line 143; fragment line 536 in
core/api/fragments/invoice.yaml): apply a credit memo's open creditto invoices of the same customer and currency; user guard
admin,owner,sales,finance(the wall atcore/internal/app/serve/wire_branch_wall.goline 120); body{applications: [{invoice_id, amount_cents}], revision}. ADR 0005section 9.4.
POST /api/v1/credit-memos/{id}/refunds(internal/payment, ROUTES.txtline 144; fragment line 315 in
core/api/fragments/payment.yaml): paya credit memo's open credit out; user guard
admin,owner,finance,cashier(the wall atcore/internal/app/serve/wire_branch_wall.goline 135) with theservice
who.financeatcore/internal/payment/service_card.goline192 keeping it to
admin,owner,finance; body{amount_cents, reason, method: card|check|ach|other, payment_id?}with a card refund going back through the gateway. ADR 0005 section
9.4.
The lifecycle table gains the invoice
written_off, the invoicepaid,the invoice
reopened, the credit memopartial, and the credit memoappliedtransitions with their events, and a paragraph after the voidparagraph lists the
409blockers for each new route. The events listgains the constants the AR core writes
(
EventInvoicePartial,EventInvoicePaid,EventInvoiceWrittenOff,EventInvoiceReopened,EventCreditPartial,EventCreditApplied,EventCreditReopened) and notes that the payment module writescredit_memo.refundeditself.4.
deposit_unapplied_centsin orders.mdAdded to the Order fields table:
Evidence:
core/api/fragments/order.yamllines 1042, 1185, 1226, 1371(schema);
core/internal/order/model.goline 134 (Go fieldDepositUnappliedCents);core/internal/order/repository.gosummaryColumnslines 186-188 (theSUM(pm.amount_unapplied * 100)over posted payments).
What did not change
docs/modules/orders.mdhad no FALSE rows in the drift pass. The pagegets only the field added.
Drift table
The full drift table (one row per factual sentence on both pages) lives
at
/home/colton/Desktop/FBHQ/gable-v1/mm/docs-drift-table.md(outsidethe repository). The previous section's totals stand:
invoices.md: 41 TRUE, 2 FALSE, 0 UNVERIFIABLE (the two FALSE rows arefixed here).
orders.md: 32 TRUE, 0 FALSE, 0 UNVERIFIABLE.The "Additions for the lead's ruling on the missing items" section of
the table is the evidence for the four additions above; the writer
copied only what the rows showed.
Code defects for the lead
None found.
Pre-push
python3 .github/scripts/reuse_gate.py-> REUSE gate passed.bash scripts/check-shape.sh->check-shape: OK.git diff origin/refactor/v1..HEAD | grep -cP '^\+.*[\x{2013}\x{2014}]'->0.git diff origin/refactor/v1..HEAD | grep -c '^+.* -- '->0.git log --format='%ae %ce' origin/refactor/v1..HEAD | sort -u->colton@futurebuild.ai colton@futurebuild.ai.git log --format=%B origin/refactor/v1..HEAD | grep '^Signed-off-by' | sort -u->Signed-off-by: colton <colton@futurebuild.ai>.0.Two commits on
refactor/docs-drift-invoices-orders(the first from theprevious pass, this one added on top):
🤖 Generated with Claude Code