Skip to content

ATS-COM-ORD-006Invoice a sale through Accounting: Capability Test Specification

Markdown

ATS-COM-ORD-006

Invoice a sale through Accounting: Capability Test Specification

Markdown
  • DocumentProposed

KindAcceptance test setProduct areaCommerceModuleCustomer purchases, purchased benefits and vendor stockRevision2

Read atservices-commerce c8b66a98macroservice-libraries 54536a44react-console baf6dae3

Coverage

  • Rule covered
  • Transition gap: FND-COM-ORD-063
  • Validation covered
  • Permission gap: FND-COM-ORD-063
  • Edge gap: FND-COM-ORD-063
  • Failure covered
  • Boundary covered
  • Concurrency gap: FND-COM-ORD-063
  • Invariant gap: FND-COM-ORD-063
  • Interaction covered

Test Scenarios

16 scenarios proving CAP-COM-ORD-006; 12 bound to an existing test.

01 Billing chooses the sale’s invoice typetransitionapitest
Proves
BR-CAP-COM-ORD-006-01
Preconditions
The fixtures provide pay-now and terms policies.
Steps
[ { "do": "Place purchases under each policy and inspect their invoices.", "provenance": "test", "source": "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" } ]
Expected
The pay-now sale links its issued pro forma; terms billing links a real invoice and accepts on terms.
Data
Use the controlled records and transports established by the cited tests.
Bound to
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
services-commerce:modules/orders/tests/e2e/billing-and-tender.e2e.spec.js#creates the pro forma and issues it at placement, in that order, under the bill key and its issue key
services-commerce:modules/orders/tests/e2e/billing-and-tender.e2e.spec.js#bills a real invoice at placement and accepts the order on terms, the obligation waiting on the invoice
Source
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
02 An unissued invoice blocks payment readinessvalidationunitnegativetest
Proves
BR-CAP-COM-ORD-006-02
Preconditions
Accounting’s issue response still describes a draft.
Steps
[ { "do": "Call the issue-before-payment helper.", "provenance": "test", "source": "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" } ]
Expected
The helper returns invoice_not_issued instead of a billable result.
Data
Use the controlled records and transports established by the cited tests.
Bound to
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
Source
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
03 Billing retries preserve pending work and escalationfailureapitest
Proves
BR-CAP-COM-ORD-006-03
Preconditions
Unanswered billing includes a fresh order and one older than an hour.
Steps
[ { "do": "Run financial billing sweeps against the configured transport.", "provenance": "test", "source": "services-commerce:modules/orders/tests/integration/services/orders/financial-sweeps.integration.spec.js#bills the pending orders of both tenants and the old one, leaves the fresh attempt alone, escalates nothing yet" } ]
Expected
Recoverable billing completes and the persistently old case raises placed_without_invoice.
Data
Use the controlled records and transports established by the cited tests.
Bound to
services-commerce:modules/orders/tests/integration/services/orders/financial-sweeps.integration.spec.js#bills the pending orders of both tenants and the old one, leaves the fresh attempt alone, escalates nothing yet
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
services-commerce:modules/orders/tests/e2e/billing-and-tender.e2e.spec.js#leaves the order placed and pending with one attempt; the buyer’s tender bills it first and proceeds
Source
services-commerce:modules/orders/tests/integration/services/orders/financial-sweeps.integration.spec.js#bills the pending orders of both tenants and the old one, leaves the fresh attempt alone, escalates nothing yet
04 Unrepresented charges refuse invoice constructionvalidationunitnegativetest
Proves
BR-CAP-COM-ORD-006-04
Preconditions
The order holds a discount or fee unsupported by its lines.
Steps
[ { "do": "Build the corresponding invoice requests.", "provenance": "test", "source": "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" } ]
Expected
The builder returns unallocated_order_discount or unbilled_order_charge with explanatory amounts.
Data
Use the controlled records and transports established by the cited tests.
Bound to
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
services-commerce:modules/orders/tests/unit/billing/invoice-request.spec.js#refuses a fee no fee line carries, 409 unbilled_order_charge, naming the kind
Source
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
05 Invoice reasons retain customer promotion namesboundaryunittest
Proves
BR-CAP-COM-ORD-006-05
Preconditions
A discounted line has two named promotions and an order allocation.
Steps
[ { "do": "Construct the discount description for normal, absent and long cases.", "provenance": "test", "source": "services-commerce:modules/orders/tests/unit/billing/invoice-request.spec.js#joins the promotions' names in sequence order, then the order-discount share" } ]
Expected
Names appear in sequence with the order share, absent discounts have no reason and long text is marked as truncated.
Data
Use the controlled records and transports established by the cited tests.
Bound to
services-commerce:modules/orders/tests/unit/billing/invoice-request.spec.js#joins the promotions' names in sequence order, then the order-discount share
services-commerce:modules/orders/tests/unit/billing/invoice-request.spec.js#names no discount reason for a line without an allocation
services-commerce:modules/orders/tests/unit/billing/invoice-request.spec.js#cuts a reason longer than Accounting takes, marked, so the invoice is never refused for it
Source
services-commerce:modules/orders/tests/unit/billing/invoice-request.spec.js#joins the promotions' names in sequence order, then the order-discount share
06 Allocated order savings remain creditable by lineruleapitest
Proves
BR-CAP-COM-ORD-006-06
Preconditions
One hundred, fifty and twenty-five dollar items share thirty dollars off at eight-percent tax.
Steps
[ { "do": "Place, bill and cancel the middle line.", "provenance": "test", "source": "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" } ]
Expected
The shares are 17.14, 8.57 and 4.29; the middle credit uses 41.43 net and 3.31 tax.
Data
Use the controlled records and transports established by the cited tests.
Bound to
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
services-commerce:modules/orders/tests/e2e/order-discount-tax.e2e.spec.js#taxes each placed line on its own net at 8 %: $6.63, $3.31 and $1.66
services-commerce:modules/orders/tests/e2e/order-discount-tax.e2e.spec.js#credits the cancelled $50.00 Book its net $41.43 and its tax $3.31: $44.74
services-commerce:modules/orders/tests/unit/billing/invoice-request.spec.js#sends no negative line and expects the order’s 30000, 3000 and 27000
Source
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
07 Unit adjustments preserve invoice arithmeticboundaryapitest
Proves
BR-CAP-COM-ORD-006-07
Preconditions
The fixtures include a one-unit proration and a ten-dollar reduction across three hundred-dollar units.
Steps
[ { "do": "Place and bill the adjusted purchases.", "provenance": "test", "source": "services-commerce:modules/orders/tests/e2e/application-adjustments.e2e.spec.js#makes the unit price the prorated $50.00 and the line $50.00, the price row’s $100.00 and the proration beside it" } ]
Expected
The first unit prices at fifty dollars; the second prices at 96.67 with a 290.01 line and rounding explanation.
Data
Use the controlled records and transports established by the cited tests.
Bound to
services-commerce:modules/orders/tests/e2e/application-adjustments.e2e.spec.js#makes the unit price the prorated $50.00 and the line $50.00, the price row’s $100.00 and the proration beside it
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
services-commerce:modules/orders/tests/e2e/application-adjustments.e2e.spec.js#requests an invoice line whose unit price times its quantity is the line total
services-commerce:modules/orders/tests/e2e/extension-line-adjustments.e2e.spec.js#requests an invoice line whose unit price times its quantity less its discount is the line total
Source
services-commerce:modules/orders/tests/e2e/application-adjustments.e2e.spec.js#makes the unit price the prorated $50.00 and the line $50.00, the price row’s $100.00 and the proration beside it
08 Changed Accounting tax is acknowledged before charginginvariantapinegativetest
Proves
BR-CAP-COM-ORD-006-08
Preconditions
A shipped gift is quoted under one address but invoiced with a different tax amount.
Steps
[ { "do": "Attempt payment and then retry after reviewing the revised total.", "provenance": "test", "source": "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" } ]
Expected
The first attempt reports invoice_tax_mismatch and updates the order once; the reviewed retry succeeds.
Data
Use the controlled records and transports established by the cited tests.
Bound to
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
services-commerce:modules/checkout/tests/e2e/accounting-tax.e2e.spec.js#re-priced the order to the invoice: the header, each line, the event, no tender recorded
services-commerce:modules/checkout/tests/e2e/accounting-tax.e2e.spec.js#accepts the second tender, of the new total, first time: one refusal, no loop
Source
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
09 Billing acceptance follows payment requirementtransitionunittest
Proves
BR-CAP-COM-ORD-006-09
Preconditions
Inputs cover terms, no-payment, free pay-now, positive pay-now and deposit requirements.
Steps
[ { "do": "Evaluate acceptance at billing for the five cases.", "provenance": "test", "source": "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" } ]
Expected
Only the first three are ready for acceptance without a further payment.
Data
Use the controlled records and transports established by the cited tests.
Bound to
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
Source
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
10 Terms opens the appropriate console delivery gateinteractionapitest
Proves
BR-CAP-COM-ORD-006-10
Preconditions
Fixtures include default terms delivery, an explicit pay-first policy and portal terms.
Steps
[ { "do": "Bill the orders and inspect their delivery conditions.", "provenance": "test", "source": "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" } ]
Expected
The default console condition opens unpaid while explicit pay-first and portal cases wait.
Data
Use the controlled records and transports established by the cited tests.
Bound to
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
services-commerce:modules/orders/tests/e2e/billing-and-tender.e2e.spec.js#leaves a console order waiting when the product’s own policy requires payment first
services-commerce:modules/orders/tests/e2e/billing-and-tender.e2e.spec.js#leaves the portal order on terms waiting on its invoice, as before
Source
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
11 A billed line retains its Accounting line connectioninvariantapitest
Proves
BR-CAP-COM-ORD-006-11
Preconditions
The fixture order has billed lines with frozen purchases.
Steps
[ { "do": "Read the line through persistence.", "provenance": "test", "source": "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" } ]
Expected
Its invoice-line connection and original purchase are returned together.
Data
Use an isolated workspace with the records and responses named in the preconditions.
Bound to
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
Source
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
12 The order fee uses a separate undiscounted invoice lineruleapitest
Proves
BR-CAP-COM-ORD-006-12
Preconditions
A purchase has the fixture three-dollar fee and a configured fee product.
Steps
[ { "do": "Place the order and inspect the billing request.", "provenance": "test", "source": "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" } ]
Expected
The fee is a line on that product with no discount.
Data
Use an isolated workspace with the records and responses named in the preconditions.
Bound to
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
Source
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
13 An unissued invoice prevents a processor requestinteractionapiproposed
Proves
BR-CAP-COM-ORD-006-02 BR-CAP-COM-ORD-007-11
Preconditions
Accounting returns an invoice that remains draft after issue.
Steps
[ { "do": "Attempt payment and inspect recorded payment calls.", "provenance": "proposed", "source": [ "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", "services-commerce:modules/orders/tests/e2e/billing-and-tender.e2e.spec.js#refuses the tender 409 order_not_billed when billing it now gets no answer either, charging nothing" ] } ]
Expected
Payment is refused before any charge request.
Data
Use an isolated workspace with the records and responses named in the preconditions.
Source
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,services-commerce:modules/orders/tests/e2e/billing-and-tender.e2e.spec.js#refuses the tender 409 order_not_billed when billing it now gets no answer either, charging nothing
14 Invoice line links support the displayed money positioninteractionapiproposed
Proves
BR-CAP-COM-ORD-006-11 BR-CAP-COM-ORD-010-06
Preconditions
A sale has billed lines and Accounting positions for their references.
Steps
[ { "do": "Refresh money and read the order and line records.", "provenance": "proposed", "source": [ "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", "services-commerce:modules/orders/tests/integration/services/mirror/refresh-money-mirror.integration.spec.js#raises accepted_without_invoice_line on the billed line the view lacks, one open row counting both findings, and still writes the mirror it could derive" ] } ]
Expected
The displayed amounts derive from the linked positions and the links stay intact.
Data
Use an isolated workspace with the records and responses named in the preconditions.
Source
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,services-commerce:modules/orders/tests/integration/services/mirror/refresh-money-mirror.integration.spec.js#raises accepted_without_invoice_line on the billed line the view lacks, one open row counting both findings, and still writes the mirror it could derive
15 Cancellation credits the discounted billed lineinteractionapiproposed
Proves
BR-CAP-COM-ORD-006-06 BR-CAP-COM-ORD-014-05
Preconditions
The fixture three-line order allocates a thirty-dollar order discount.
Steps
[ { "do": "Bill it and cancel the middle line.", "provenance": "proposed", "source": [ "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", "services-commerce:modules/orders/tests/unit/cancellations/cancellation-plan.spec.js#credits 2 of 5 units at the discounted amount with the tax share, estimates the refund from the funded part, and approves the document" ] } ]
Expected
Its credit uses the retained 41.43-dollar net and 3.31-dollar tax, preserving the other lines.
Data
Use an isolated workspace with the records and responses named in the preconditions.
Source
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,services-commerce:modules/orders/tests/unit/cancellations/cancellation-plan.spec.js#credits 2 of 5 units at the discounted amount with the tax share, estimates the refund from the funded part, and approves the document
16 Issued billing determines whether the created sale can accept paymentinteractionapiproposed
Proves
BR-CAP-COM-ORD-006-01 BR-CAP-COM-ORD-005-01 BR-CAP-COM-ORD-007-01
Preconditions
A placed pay-now sale is saved and Accounting initially leaves its invoice draft.
Steps
[ { "do": "Attempt payment, recover invoice issue and attempt payment again.", "provenance": "proposed", "source": [ "services-commerce:modules/orders/tests/e2e/order-discount-tax.e2e.spec.js", "services-commerce:modules/orders/services/billing/bill-order.ts:billOrder", "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", "services-commerce:modules/orders/tests/e2e/billing-and-tender.e2e.spec.js#bills a real invoice at placement and accepts the order on terms, the obligation waiting on the invoice", "services-commerce:modules/orders/services/orders/financial-sweeps.ts:sweepBilling" ] } ]
Expected
No first charge occurs and the recovered invoice permits payment on the same sale.
Data
Use an isolated workspace with the records and responses named in the preconditions.
Source
services-commerce:modules/orders/tests/e2e/order-discount-tax.e2e.spec.js,services-commerce:modules/orders/services/billing/bill-order.ts:billOrder,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,services-commerce:modules/orders/tests/e2e/billing-and-tender.e2e.spec.js#bills a real invoice at placement and accepts the order on terms, the obligation waiting on the invoice,services-commerce:modules/orders/services/orders/financial-sweeps.ts:sweepBilling

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.