Skip to content

CAP-ACC-BAT-011Assign new documents to the appropriate batch stream

Markdown

CAP-ACC-BAT-011

Assign new documents to the appropriate batch stream

Markdown
  • DocumentDraft
  • Product intentProposed
  • ImplementationObserved

KindCapabilityProduct areaAccountingModuleBatch ManagementRevision1

Read atservices-accounting f47cb263react-console baf6dae3

The Formal Contract

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

Outcomes
Default and ordered matching choices select recurring intake for applicable document facts.
Surfaces
consoleapi
Constraints
Transaction callers supply assignment facts and retain ownership of their documents.
Intent sources
services-accounting:docs/milestones/ACCT-M1-books-and-invoices.md#D3

Controls

24 controls apply, from the corpus control catalogue.

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

Permissions

KeyChecked atScope
accounting.batch-assignment-settings.readapitenant
accounting.batch-assignment-settings.updateapitenant
accounting.batch-assignment-settings.deleteapitenant

Business Rules

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

IdRuleKindEnforced atProvenance
01must prove
Proposed
A unit has one assignment-settings record comprising a required default recurring configuration and no more than one hundred ordered rules.
validationapi, databasetest
02must prove
Proposed
Saving replaces settings and their entire ordered rule list atomically, assigning positions from one and preserving the previous list if replacement fails.
policyservice, databasetest
services-accounting:modules/batches/tests/integration/services/persistence/batch-assignment-settings.integration.spec.js#keeps the previous settings and rules after the database refused a rule the save had already replaced them with
03must prove
Proposed
The first save creates settings, and later saves require the current version rather than a missing or stale version.
validationservicetest
services-accounting:modules/batches/tests/e2e/batch-assignment-settings.e2e.spec.js#answers 409 StaleObject to a save at the version first read
04must prove
Proposed
Referenced recurring configurations and merchant or bank accounts must belong to the settings’ unit, with invalid rule references identified.
validationservice, databasetest
services-accounting:modules/batches/tests/e2e/batch-assignment-settings.e2e.spec.js#answers 400 to another unit’s recurring batch in a rule
05must prove
Proposed
An assignment rule can select one merchant account or one bank account, but not both.
validationapi, databasetest
services-accounting:modules/batches/tests/e2e/batch-assignment-settings.e2e.spec.js#answers 400 naming bank_account_id to a rule naming both a merchant and a bank account
06must prove
Proposed
Transaction, payment and card criteria use the declared vocabulary without duplicates, and an omitted or empty criterion means unrestricted.
validationapi, databasetest
services-accounting:modules/batches/tests/e2e/batch-assignment-settings.e2e.spec.js#answers 400 to a transaction type the vocabulary does not have
07must prove
Proposed
Selection uses the first rule in position order matching every supplied criterion, including the exact bank account, and otherwise returns the default.
calculationservicetest
services-accounting:modules/batches/tests/unit/rules/batch-assignment-rules.spec.js#answers the first matching rule by position, whatever order the rules are listed in
08must prove
Proposed
A transaction lacking a fact matches only an unrestricted criterion for that fact, while the contract delegates companion-payment and order facts to the caller.
calculationservicedocumented
09must prove
Proposed
The selected recurring configuration supplies an accepting active batch, and missing settings, a missing active batch or refused intake prevents default assignment even though inactive configuration can still supply an Open batch.
policyservicetest
10must prove
Proposed
Evaluation accepts transaction facts and returns the selected recurring configuration and matching position, or no position for the default, without writing a transaction.
calculationapi, servicetest
services-accounting:modules/batches/tests/e2e/batch-assignment-settings.e2e.spec.js#answers the first rule by position when two rules match
11must prove
Proposed
Read permission covers settings and evaluation, update covers save and delete covers removal, which also removes owned rules and releases their recurring references.
permissionapi, consoletest
12must prove
Proposed
Default selection returns no batch for pro forma work and prefers a referenced Open order batch before consulting assignment rules.
policyserviceobserved

Scenarios

IdGivenWhenThenProvenance
01Checks use the default stream and the first rule selects the card merchant’s stream.A card payment and a check arrive without batches.Each document takes the accepting active batch chosen by its matching rule or default.test
02An assignment rule specifies the operating bank account.An administrator evaluates a payment using a different bank account.Selection uses the default rather than matching the different bank.test
services-accounting:modules/batches/tests/e2e/batch-assignment-settings.e2e.spec.js#REGRESSION — answers the default, not the bank account rule, for a payment into another bank account (legacy problem B)

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.