Skip to content

CAP-COM-ORD-006Invoice a sale through Accounting

Markdown

CAP-COM-ORD-006

Invoice a sale through Accounting

Markdown
  • DocumentDraft
  • Product intentConfirmed
  • ImplementationObserved

KindCapabilityProduct areaCommerceModuleCustomer purchases, purchased benefits and vendor stockRevision1

Read atservices-commerce c8b66a98react-console baf6dae3

The Formal Contract

The narrative above explains; the sections below are authoritative — the rules, scenarios and tests this document binds.

Outcomes
Pay-now billing begins with a pro forma and terms billing begins with a real invoice.Invoice amounts reconcile with the order and explain their discounts.
Surfaces
apijob
Intent sources
services-commerce:docs/milestones/plans/COMM-M2-plan.md#A1services-commerce:docs/milestones/plans/COMM-M2-plan.md#D6services-commerce:docs/milestones/plans/COMM-M2-plan.md#D9services-commerce:docs/milestones/plans/COMM-M2-plan.md#D11services-commerce:docs/milestones/plans/COMM-M2-plan.md#D12services-commerce:docs/milestones/plans/COMM-M1-plan.md#A20

Controls

28 controls apply, from the corpus control catalogue.

TC-IAM-006 TC-AZ-001 TC-AZ-002 TC-AZ-003 TC-AZ-004 TC-AZ-006 TC-TEN-001 TC-TEN-002 TC-TEN-003 TC-TEN-004 TC-CRY-001 TC-CRY-004 TC-DAT-001 TC-DAT-002 TC-DAT-003 TC-LOG-004 TC-LOG-005 TC-AVL-004 TC-MON-001 TC-MON-002 TC-MON-004 TC-PI-001 TC-PI-002 TC-PI-003 TC-PI-004 TC-PI-005 TC-PRV-001 TC-PRV-002

Permissions

KeyChecked atScope
commerce.orders.createapitenant
commerce.orders.tenderapitenant

Business Rules

12 rules, 12 to be proved before approval. A rule's product intent is derived from its origin: 12 confirmed by a product decision, the rest inheriting this capability's confirmed.

IdRuleKindEnforced atProvenance
01must prove
Confirmed
Commerce saves the order before requesting its issued Accounting invoice, using a stable billing key for retries, with a pro forma for pay-now sales and a real invoice for terms sales.
no proof recorded yet
lifecycleservicetest
services-commerce:modules/orders/tests/e2e/billing-and-tender.e2e.spec.js#billed the order at placement: billed, placed, one pro forma sale invoice linked under the first bill key, the line carrying its invoice line
02must prove
Confirmed
An invoice that remains draft after an issue request blocks payment on the order.
no proof recorded yet
validationservicetest
services-commerce:modules/orders/tests/unit/billing/issue-before-tender.spec.js#answers an issue Accounting answers still a draft as a refusal, invoice_not_issued, so the order is blocked and not tendered
03must prove
Confirmed
Unanswered billing remains pending for a same-key sweep retry, and an order unbilled for more than an hour raises an operational exception without charging a payment.
no proof recorded yet
lifecycleservicetest
services-commerce:modules/orders/tests/integration/services/orders/financial-sweeps.integration.spec.js#escalates an order placed over an hour ago whose billing gets no answer, placed_without_invoice, and counts the attempt
04must prove
Confirmed
Unbuildable or configuration-refused invoices block billing and raise an exception, with the sweep able to retry after staff correct the configuration.
no proof recorded yet
validationservicetest
services-commerce:modules/orders/tests/unit/billing/invoice-request.spec.js#refuses an order discount its lines do not carry, 409 unallocated_order_discount, with both figures
05must prove
Confirmed
Invoice discount explanations list promotion display names in application order followed by any order-discount share, omit internal codes and mark truncated long explanations.
no proof recorded yet
calculationservicetest
services-commerce:modules/orders/tests/unit/billing/invoice-request.spec.js#joins the promotions' names in sequence order, then the order-discount share
06must prove
Confirmed
An order discount is allocated proportionally across item prices without negative lines, with tax on each net amount so a later line credit uses that line’s discounted value and tax.
✓ A thirty-dollar discount over values of one hundred, fifty and twenty-five dollars allocates seventeen dollars fourteen cents, eight dollars fifty-seven cents and four dollars twenty-nine cents.✗ Billing does not represent the discount as a negative item line.
no proof recorded yet
calculationservicetest
services-commerce:modules/orders/tests/e2e/order-discount-tax.e2e.spec.js#shares the $30.00 over the lines as $17.14, $8.57 and $4.29, the nets $82.86, $41.43 and $20.71
07must prove
Confirmed
Application and product-price adjustments become the invoiced unit price, rounded half away from zero and explained by a rounding adjustment when needed, preserving quantity, price and discount arithmetic.
no proof recorded yet
calculationservicetest
services-commerce:modules/orders/tests/e2e/application-adjustments.e2e.spec.js#rounds the unit price half away from zero to $96.67 and keeps the line at $290.01
08must prove
Confirmed
Billing requires invoice and order totals to reconcile to the minor unit; a changed Accounting tax amount updates the order once and refuses the first payment attempt with both amounts.
no proof recorded yet
invariantservicetest
services-commerce:modules/checkout/tests/e2e/accounting-tax.e2e.spec.js#refuses the first tender 409 invoice_tax_mismatch, naming both figures, the new total and the shipped line as the cause
09must prove
Confirmed
Billing accepts terms orders, orders requiring no payment and zero-total pay-now orders; other pay-now and deposit orders still require payment.
no proof recorded yet
lifecycleservicetest
services-commerce:modules/orders/tests/unit/tender/tender-rules.spec.js#accepts a terms order, a no-tender order and a zero-total pay-now order; a pay-now and a deposit order wait for their tender
10must prove
Confirmed
Console orders accepted on terms can open the default paid-in-full delivery condition before payment, while an explicit pay-first product policy and portal terms orders continue to wait.
no proof recorded yet
policyservicetest
services-commerce:modules/orders/tests/e2e/billing-and-tender.e2e.spec.js#opens the gate of the console order when it is billed: the invoice is unpaid and the line is no longer waiting
11must prove
Confirmed
Billing attaches each Accounting invoice-line reference to its order line for later money reads.
no proof recorded yet
invariantservice, databasetest
services-commerce:modules/orders/tests/integration/services/persistence/orders.queries.integration.spec.js#answers the line whole with its purchase, the invoice line id billing wrote, and the provenance of its price
12must prove
Confirmed
The order fee becomes an undiscounted invoice line on its configured fee product using the pricing description.
no proof recorded yet
calculationservicetest
services-commerce:modules/orders/tests/e2e/extension-line-adjustments.e2e.spec.js#requests the invoice with the fee as a line of the product, undiscounted

Scenarios

IdGivenWhenThenProvenance
01The documented pay-now example totals two hundred thirteen dollars.Staff place it for billing.Accounting receives an issued pro forma for that amount while the order still awaits payment.documented

Edge Cases

IdGivenWhenThenProvenance
02Billing cannot find an open batch for the applicable policy.Attempt billing, configure the batch and allow retry processing.Billing first blocks with an exception and later proceeds when the missing configuration is available.unknown

The Markdown files under specs/ in rhythmsoftware/rhythm-v2-docs are the canonical source of truth. This reader is a generated, read-only projection of them.