Parse pain.002 status report file
parse_pain002Parse a pain.002 payment-status report XML file to extract per-transaction accepted/rejected statuses and reason codes from the bank's acknowledgement. Optionally validate against a pain.002 XSD.
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.
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. |