Affectations bancaires
Les liens entre une opération bancaire et les factures qu'elle solde. EN CRÉER UNE EST UN BROUILLON et rien de plus : cela n'écrit aucun paiement, ne touche aucune ligne de grand livre et laisse la facture impayée. L'argent bouge à POST /api/v1/bank_operations/{id}/reconciliation, qui prend le jeu d'affectations COMPLET et la version de l'opération - si bien que brouillonner reste bon marché et que solder reste lié à une version. Il n'existe au plus qu'une affectation ACTIVE par couple (opération, facture) ; une seconde est un validation_failed, jamais un duplicate_record. Les montants sont toujours des magnitudes POSITIVES OU NULLES - le sens du mouvement vit sur le direction de l'opération - et s'envoient sous forme de chaînes ou de nombres entiers, jamais de flottants JSON, parce qu'un double ne peut pas porter les quatre décimales que stocke la colonne. Si les affectations actives dépassaient alors le mouvement, le refus est allocation_exceeds_operation. RIEN N'EST JAMAIS SUPPRIMÉ : une affectation est une pièce d'audit, si bien que le DELETE écrit status: "rejected" et vous rend la ligne, et une affectation CONFIRMÉE y est refusée parce que l'argent doit d'abord revenir par la ressource de rapprochement.
List a bank operation's allocations
Returns every allocation of the operation, oldest first - the order an operator built the split in.
Draft an allocation against a bank operation
Creates a `proposed` allocation. **This is a draft and nothing else**: no payment is written, no ledger line is touched and the invoice stays unpaid. Settling the money is `POST /api/v1/bank_operations/{id}/reconciliation`, which takes the complete allocation set and the operation's `version`.
Update a bank allocation
Changes the drafted amount, or withdraws the allocation by setting `status: 'rejected'`. Both fields are optional but at least one is required; the fields you send are applied and the rest keep their stored values.
Withdraw a bank allocation
**Deletes nothing.** An allocation is an audit record, so this writes `status: 'rejected'` and returns the row as it now stands - which is why the response carries a body at all.