Règles d'imputation bancaires
Des consignes permanentes qui imputent le RELIQUAT NON RAPPROCHÉ d'une opération bancaire sur un compte choisi. Une règle ne lettre JAMAIS une facture et ne crée aucun rapprochement : un rapprochement confirmé prime toujours sur elle, et ce qu'une règle décide, c'est seulement où atterrit ce qui reste. LE CHEMIN FIXE LA PORTÉE DÉFINITIVEMENT - une règle créée sous un espace de travail lie chacune de ses entreprises sauf celles qui en sont exclues, une règle créée sous une entreprise ne lie que celle-là, et scope et company_id envoyés dans le corps sont ignorés, parce que changer le niveau changerait la précédence. LA PORTÉE L'EMPORTE SUR LA PRIORITÉ : une règle société prime sur une règle d'espace de travail quels que soient leurs numéros, et priority n'ordonne que les règles de même portée. Le vocabulaire de conditions est FERMÉ et une clé inconnue est refusée plutôt qu'ignorée ; description_matches en particulier est un fragment littéral insensible aux accents et à la casse, et non une expression régulière. preview répond ce qu'une règle FERAIT d'une opération sans rien écrire, et ne demande que le scope de lecture.
List a workspace's bank rules
Returns every imputation rule of the workspace - both the workspace-scoped ones and the company-scoped ones - in the order the engine walks them: `priority` ascending, then `id` ascending. Note that the LIST order is not the PRECEDENCE order: a company rule beats a workspace rule whatever its priority, so use `scope` to tell the two levels apart.
Create a workspace bank rule
Creates a rule that applies to EVERY company of the workspace, unless that company is excluded from it. To create a rule bound to a single company, post to the company-scoped path instead - the path is what sets the precedence level, and it cannot be changed afterwards. An `Idempotency-Key` is accepted and optional: this write creates no provider-side effect and is safely replayable.
List the bank rules governing a company
Returns the rules that GOVERN this company: its own company-scoped rules AND the workspace rules it is not excluded from. The workspace rules are included on purpose - they bind this company's operations and are named in the explanation the PREVIEW publishes, so a list without them could not explain an imputation. Disabled rules are listed too; use `enabled` to filter.
Create a company bank rule
Creates a rule bound to this one company. A company rule OUTRANKS every workspace rule whatever its priority, and it can never be excluded - it already applies to exactly one company, so its `excluded_company_ids` is always empty. An `Idempotency-Key` is accepted and optional.
Retrieve a bank rule
Returns one imputation rule. `excluded_company_ids` is derived on every read, so it reflects the rule as it is now.
Update a bank rule
Updates the rule in place. Enabling and disabling is a PATCH of `enabled` rather than a separate endpoint. The precedence level is fixed at creation, so `scope` and `company_id` sent in the body are IGNORED rather than refused - which is what lets you read a rule and send the whole object back with one field changed. `workspace_id` is the exception - it is read by the shared workspace-grant gate, so echoing one your token holds no grant for is refused with 403. An `Idempotency-Key` is accepted and optional.
Delete a bank rule
Deletes the rule and its exclusions. It stops FUTURE classifications and rewrites no past one: a rule owns no accounting entry and no payment, so nothing that has already been posted moves. The body is the rule as it stood when you asked for it to go.
Preview what a bank rule would do
Simulates the rule against real operations AND WRITES NOTHING - no allocation, no payment, no accounting entry. That is why it requires only `read`: forcing you to hold `write` in order to inspect a rule would be backwards. Each row says whether the rule would determine that operation's projection, the lines it would produce, and - through `overridden_by` - whether a higher-precedence source already wins it.