test(core): the adapter runs settlements, recoveries, numbers and vendor references
bookspec's X-H1b examples state BS-arap-4, -6 and -10 to -14 through new events and queries; the adapter runs each through the real API, none reimplemented. - settlement: `Store::settle` with the applications, the fee and the deposit account; the party is the first document's customer or vendor, so the engine itself finds an invoice mixed with a bill, two customers, a document twice, more than a document owes, a discount that needs a reason, a discount on an asset bill and a fee above the cash. Each engine error is read as the examples' word (the fee case from the one InvalidSettlement error that can arise from exact inputs). - recovery (BS-arap-11, reverse-then-plain-entry): in the write-off's fiscal year `Store::reverse_entry` of the write-off then `Store::receive_payment`; in a later year a plain entry, deposit debited and the recoveries account credited, naming the invoice. The engine has no recovery command; the two calls are the pick's own procedure. - a bill's vendor reference and duplicate reason go to `BillFields`, so `Ledger::check_vendor_ref` is what refuses a second bill; each invoice is numbered with `Ledger::next_invoice_number`; a line's own account goes to `DocumentLine`. - queries `document` (`Ledger::invoice_state`/`bill_state`) and `invoice_numbers` (the number the engine stored, read as its place in the order of issue). Wanderbooks passes all 80 examples it runs. The runner skips eleven for the options it did not pick (six new: documents-kept-apart, compare-exactly, recovery-movement, net-of-expected-discount, net-against-the-deposit, apportion-across-the-lines), so the pinned count is 11. No engine disagreed with an example. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
946777628f
commit
ea4d8bc86e
6 files changed
+242
-11
No files matched your search
@@ -144,6 +144,22 @@ pub(crate) fn refusal(e: &LedgerError) -> String {
|
||||
LedgerError::InvalidSchedule(_) => "invalid_schedule",
|
||||
LedgerError::UntaggedControlLine { .. } => "untagged_control_line",
|
||||
LedgerError::PaymentBeforeDocument { .. } => "payment_before_document",
|
||||
LedgerError::DuplicateVendorRef { .. } => "duplicate_vendor_reference",
|
||||
// An invoice with a bill, and documents of two parties, are the one
|
||||
// refusal: a customer and a vendor are two parties (BS-arap-6).
|
||||
LedgerError::SettlementMixedKinds(_) | LedgerError::SettlementPartiesDiffer(..) => {
|
||||
"settlement_mixes_parties"
|
||||
}
|
||||
LedgerError::SettlementDuplicateDocument(_) => "settlement_repeats_a_document",
|
||||
LedgerError::Overpayment(..) => "application_above_owed",
|
||||
LedgerError::DiscountNeedsReason { .. } => "discount_needs_reason",
|
||||
LedgerError::DiscountOnAssetBill { .. } => "discount_on_asset_bill",
|
||||
// The cash and the discounts the adapter hands over always cover the
|
||||
// applications exactly, so the one way the engine's exactness check
|
||||
// fails is a fee above the cash (BS-arap-6).
|
||||
LedgerError::InvalidSettlement(why) if why.contains("the fee is above the cash") => {
|
||||
"fee_above_cash"
|
||||
}
|
||||
LedgerError::UnbalancedEntry { .. } => "unbalanced",
|
||||
LedgerError::TooFewLines => "too_few_lines",
|
||||
LedgerError::NegativeAmountLine => "negative_amount",
|
||||
|
||||
Reference in new issue
Block a user