Generate reversal document
generate_reversalGenerate a validated reversal XML document from a bank statement by specifying the ISO return reason code, enabling automated processing of returned payments.
Instructions
Generate a validated camt.053.001.14 reversal document from a statement.
This is the headline one-shot workflow: pass an incoming statement and a
return-reason code and get back the reversal XML (nothing is written to
disk). Preview which entries will be reversed first with ``filter_entries``
using the same ``reason_code``.
This is the headline one-shot workflow: parse the incoming camt.053, pick
the entries with the requested return reason (e.g. AC04 Closed Account),
and emit a validated camt.053.001.14 reversal statement.
Returns the validated XML document as a string, or an ``{"error": ...}``
payload (serialized) if generation fails.
Args:
xml: The raw incoming statement XML as a string.
reason_code: The ISO external return reason to reverse (default
``"AC04"``).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| xml | Yes | The raw incoming camt.053 statement XML document as a string; the entries carrying reason_code are reversed into a new camt.053.001.14 document. | |
| reason_code | No | An ISO external return reason code, e.g. 'AC04' Closed Account. Must be exactly one of: 'AC01', 'AC02', 'AC03', 'AC04', 'AC06', 'AC13', 'AC14', 'AG01', 'AG02', 'AM01', 'AM02', 'AM03', 'AM04', 'AM05', 'AM06', 'AM07', 'AM08', 'AM09', 'BE01', 'BE05', 'CNOR', 'DNOR', 'DT01', 'ED01', 'ED05', 'FF01', 'MD01', 'MD06', 'MD07', 'MS02', 'MS03', 'NARR', 'NOAS', 'NOOR', 'RC01', 'RR01', 'RR02', 'RR03', 'RR04', 'SL01', 'TM01' (see list_return_reasons). | AC04 |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |