askrobots / dbbasic-object-server
Public
Runs live, versioned Python application objects on one VM, with a suite of apps: projects, notes, tasks, files and more.
exchange_confirm_remittance.py · 1.3 KB · 29 lines
| 1 | """action_exchange_confirm_remittance -- a remittance checked against the bank. |
| 2 | |
| 3 | POST {inbox_id, received_on?} |
| 4 | |
| 5 | A remittance from a partner is the payer saying it paid; the bank statement |
| 6 | is the proof (docs/box-to-box-exchange.md, "Payments"). Received, it waits in |
| 7 | the inbox as awaiting_confirmation (the attention queue |
| 8 | remittances_to_confirm). A person who has seen the money arrive confirms it |
| 9 | here, and the payment is recorded then: one payments row per invoice it |
| 10 | settles, under the payments collection's own rules (its locked overpayment |
| 11 | check refuses a payment that would take an invoice past what it is worth). |
| 12 | The caller must be allowed to update each invoice AND to create the payment |
| 13 | (app-payments gives that to role:manager; the customer who owns an invoice |
| 14 | may not record money received on it), asked of the policy for every payment |
| 15 | before anything is written. A second confirmation is |
| 16 | refused, and the payment's reference names the document, so nothing is |
| 17 | recorded twice. |
| 18 | """ |
| 19 | |
| 20 | import object_exchange_box as box |
| 21 | |
| 22 | |
| 23 | def POST(request): |
| 24 | try: |
| 25 | return box.confirm_remittance(box.base_dir(), request.get("inbox_id") or "", |
| 26 | request.get("_identity"), |
| 27 | received_on=request.get("received_on") or "") |
| 28 | except box.Refusal as refusal: |
| 29 | return refusal.answer() |