Parse pain.002 status report file
parse_pain002Parse a pain.002 payment-status report into structured data, extracting per-transaction accepted/rejected status and reason codes from local XML files.
Instructions
Parse a pain.002 payment-status report file on disk into structured data.
Use this to read the bank's acknowledgement of a submitted pain.001 —
the per-transaction accepted/rejected status and reason codes. Reads
``xml_file_path`` from the local filesystem. For the account statement
that later confirms booked entries, use ``parse_camt053`` instead.
Wraps :func:`pain001.parse_pain002_report`. When ``xsd_file_path`` is
provided, the document is first validated against that XSD; on a
schema or parse error the tool returns ``{"error": ...}`` rather than
raising.
Args:
xml_file_path: Filesystem path to the pain.002 XML report.
xsd_file_path: Optional path to a pain.002 XSD for upfront
validation.
Returns:
A dict with the group header and transaction statuses, or an
``{"error": ...}`` payload on failure.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"xml_file_path": "<xml_file_path>"
},
"name": "parse_pain002"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| xml_file_path | Yes | Local filesystem path to the pain.002 payment-status report XML file to parse. | |
| xsd_file_path | No | Optional local path to a pain.002 XSD; when given, the document is validated against it before parsing. Omit to skip schema validation. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| error | No | ||
| message_id | No | ||
| group_status | No | ||
| payment_statuses | No | ||
| creation_datetime | No | ||
| original_message_id | No | ||
| original_message_name_id | No |