Convert MT101 to pain.001 records
convert_mt101Convert a legacy SWIFT MT101 message into flat records for pain.001 XML generation. Parse multiple transfers per message and feed results to validation and message generation tools.
Instructions
Convert a legacy SWIFT MT101 message into pain.001-ready records.
Use this to bridge the Nov-2025+ SWIFT MT→MX migration: parse an MT101
(*Request for Transfer*) into the flat records the other tools consume —
feed the result straight to ``validate_records`` /
``validate_payment_scheme`` and then ``generate_message`` to emit
pain.001.001.09 XML. An MT101 can request many transfers (repeating
sequence B), so this returns *one record per transaction*. Operates on
the supplied text only; no file is read or written.
Wraps :func:`pain001_loader_mt101.loader.parse_mt101`. Sequence-A
ordering-customer / account-servicing fields apply to every transaction
unless a sequence-B block overrides them; fields the MT101 does not
carry are synthesised to schema defaults (``payment_method`` ``"TRF"``,
``service_level_code`` ``"SEPA"``, etc.).
Args:
mt101_text: The MT101 payload as a string.
Returns:
A list of flat pain.001 records (one per transaction), or an
``{"error": ...}`` dict if the MT101 is missing a mandatory field
(``:20:``, ``:30:``, or per transaction ``:21:`` / ``:32B:`` /
a named beneficiary) or is otherwise malformed.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mt101_text | Yes | A legacy SWIFT MT101 (Request for Transfer) message as text — a bare ':tag:' field list or a raw '{4:...-}' block-4 envelope. An MT101 may carry several sequence-B transfers; each becomes its own record. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |