Pending draft: match a posted payment to open invoices or bills (human approves in Taokeh)
create_payment_match_draftFILES A PENDING DRAFT ONLY — NOTHING CHANGES UNTIL A HUMAN REVIEWS AND APPROVES IT IN TAOKEH. Propose how ONE bank line already posted as a customer payment (money in) or a supplier payment (money out) settles open invoices or bills — the owner's "this deposit paid these three invoices". An admin or bookkeeper reviews it and approves; only that tap allocates, exactly as Banking → Match → Save does, and the documents then read as paid. Pass bankTransactionId (a POSTED line from bank_review_queue with status "posted") and allocations: [{saleId, amount}] for money in, [{purchaseId, amount}] for money out, ringgit, adding up to the WHOLE line to the sen (the in-app pane's ±0.10 rounding allowance does not apply to a proposal). At most 50 documents. WHICH DOCUMENTS: only the ones Banking → Match offers this line — the open invoices of the customer the line is posted against (or, when that customer has none open, the invoices of the company's walk-in customer — the one the owner marked on its customer page, else a customer named 'CASH SALES'), or the supplier's open bills. A line with no customer at all is offered nothing. A document of ANY other party is refused, because no screen in Taokeh offers it: if the payment was posted against the wrong customer, or no customer, the owner unposts the line in Banking, sets the right customer, and posts it again — then file this. A refusal lists the documents the line can take, with their ids. ALSO REFUSED BY NAME, at filing and again at approval: a line not posted, not a customer/supplier payment, already matched (a match someone saved is never replaced), or on a foreign-currency account (the owner settles those in the app); a document not open; an amount over what a document still owes; a document dated AFTER the payment (an advance is allocated by hand); the same document twice; a pending match already filed for the line. If the line or a document changes before approval (paid, credited, re-tagged, matched), approval refuses and nothing is allocated. note: one short line for the owner saying how you know (the remittance, the customer's message).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| note | No | A SHORT note for the owner: how you know which documents it paid. | |
| lines | No | NOT a filter on this tool. Pass the documents as `allocations`: [{saleId or purchaseId, amount}]. | |
| notes | No | NOT a filter on this tool. Pass the owner note as `note`. | |
| bankLineId | No | NOT a filter on this tool. Pass the bank line as `bankTransactionId`. | |
| allocations | Yes | Where the money goes. An unknown key is refused by name. | |
| needsReview | No | Set true when something gave you pause. | |
| transactionId | No | NOT a filter on this tool. Pass the bank line as `bankTransactionId`. | |
| bankTransactionId | Yes | REQUIRED — the posted bank line, from bank_review_queue (status "posted"). |