Generate reversal document
generate_reversalParse an incoming camt.053 bank statement, select entries with a specified return reason code (e.g., AC04 for closed accounts), and generate a validated reversal XML document.
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 | The ISO external return reason code whose entries are reversed, e.g. 'AC04' Closed Account (the default). Preview the matches with filter_entries using the same code; call list_return_reasons for all accepted codes. | AC04 |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |