Skip to main content

pacs008-loader-mt103: MT103 → pacs.008 loader

Convert legacy SWIFT MT103 single customer credit transfers into the flat records that the pacs008 library validates and turns into ISO 20022 pacs.008 XML. A single parse_mt103(text) call returns a one-element list[dict] ready to feed straight into pacs.008 generation.

Latest release: v0.0.3. The first deliverable of the MT→MX converter project. SWIFT MT-MX coexistence for cross-border payments ends in November 2025; this loader bridges the window where upstream systems still emit MT103 but downstream tooling expects pacs.008.

Contents

Overview

pacs008-loader-mt103 is a small, focused companion to the pacs008 ISO 20022 FI-to-FI Customer Credit Transfer library. It does one thing well: parse the mandatory + common-denominator MT103 grammar and hand back a flat record whose keys are exactly the ones pacs008 validates against the pacs.008.001.08 JSON schema. The correctness proof is that a realistic MT103 maps to a record that passes SchemaValidator("pacs.008.001.08").validate_batch(...) with zero errors.

Install

pacs008-loader-mt103 requires Python 3.10+ and pulls in pacs008 automatically.

pip install pacs008-loader-mt103

Quick Start

from pacs008_loader_mt103 import parse_mt103

mt103 = """:20:REF20240712001
:23B:CRED
:32A:260712EUR12345,67
:50K:/DE89370400440532013000
JOHN DOE
123 MAIN STREET
BERLIN
:52A:DEUTDEFF
:57A:CHASUS33
:59:/GB29NWBK60161331926819
ACME TRADING LTD
1 CORPORATE AVENUE
LONDON
:70:INVOICE 998877
:71A:SHA
"""

records = parse_mt103(mt103)
print(records[0]["interbank_settlement_amount"])   # 12345.67
print(records[0]["charge_bearer"])                 # SHAR

# Validate against the real pacs.008 schema:
from pacs008.validation.schema_validator import SchemaValidator
total, valid, errors = SchemaValidator("pacs.008.001.08").validate_batch(records)
assert valid == 1 and not errors

Field Mapping

parse_mt103(text: str) -> list[dict] — an MT103 is a single transfer, so the list always holds exactly one record.

MT103 field Meaning pacs.008 key Notes
:20: Sender's Reference msg_id Also fills end_to_end_id when :21: is absent
:21: Related Reference end_to_end_id Falls back to :20:
:32A: Value Date + Currency + Amount creation_date_time, interbank_settlement_currency, interbank_settlement_amount Date → ISO datetime at midnight; amount comma-decimal → float
:50A/50F/50K: Ordering Customer debtor_name Name from option A (BIC), F (1/ sub-field) or K (name+address)
:52A/52D: Ordering Institution debtor_agent_bic BIC from option A (or a BIC in option D)
:57A/57D: Account With Institution creditor_agent_bic BIC from option A (or a BIC in option D)
:59/59A/59F: Beneficiary Customer creditor_name Name from plain 59, option A (BIC) or F (1/)
:71A: Details of Charges charge_bearer OURDEBT, BENCRED, SHASHAR
(synthesised) nb_of_txs Always 1
(synthesised) settlement_method Defaults to CLRG

Assumptions and defaults

  • settlement_method = "CLRG" — a bank-to-bank MT103 typically settles through a clearing system. Override downstream for cover payments (COVE) or correspondent-account settlement (INDA / INGA).
  • nb_of_txs = 1 — an MT103 carries exactly one customer transfer.
  • creation_date_time — MT103 has no message timestamp, so the :32A: value date at 00:00:00 is used. Two-digit years follow the SWIFT sliding window (00–79 → 20YY, 80–99 → 19YY).
  • Absent optional fields are omitted, not guessed. A schema-valid pacs.008 record needs the debtor agent BIC (:52a:), creditor agent BIC (:57a:) and charge bearer (:71A:); a well-formed interbank MT103 carries all three. When block 4 lacks an ordering / account-with institution, real pacs.008 generation falls back to the Sender / Receiver BIC in the application header (blocks 1/2) — that fallback is the caller's responsibility; this loader reads block 4 only.
  • Hard requirements — only :20:, :32A: and a beneficiary (:59:/:59A:/:59F:) raise ValueError. Everything else is best-effort. The loader never crashes on unexpected input.

Out of scope

This is the correct core MT103 → pacs.008 mapping, not every optional field. Deliberately excluded in v0.0.1:

  • :33B: instructed currency/amount and :36: exchange rate (FX legs).
  • :70: remittance information and :72: sender-to-receiver info.
  • :23B: / :23E: operation and instruction codes, :26T:, :77B: regulatory reporting, :77T: envelope contents.
  • :53a: / :54a: / :55a: / :56a: correspondent and intermediary institutions.
  • The SWIFT application header (blocks 1/2) as an agent-BIC fallback.

Examples

Two runnable scripts live in examples/, exercised in CI:

Development

git clone https://github.com/sebastienrousseau/pacs008-loader-mt103
cd pacs008-loader-mt103
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytest                          # 100% line + branch coverage gate
interrogate pacs008_loader_mt103  # 100% docstring gate
mypy pacs008_loader_mt103       # strict

Security

pacs008-loader-mt103 parses a flat text format with no XML envelope — the XXE / billion-laughs surface lives upstream. Field regexes are anchored and bounded, so catastrophic backtracking is not a concern. See SECURITY.md.

License

Licensed under the Apache License, Version 2.0. Any contribution submitted for inclusion shall be licensed as above, without additional terms.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pacs008_loader_mt103-0.0.12.tar.gz (37.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pacs008_loader_mt103-0.0.12-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file pacs008_loader_mt103-0.0.12.tar.gz.

File metadata

  • Download URL: pacs008_loader_mt103-0.0.12.tar.gz
  • Upload date:
  • Size: 37.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pacs008_loader_mt103-0.0.12.tar.gz
Algorithm Hash digest
SHA256 fe9216a5f46407487f4187d1b1d75d1c3caf61ce1298bdeadcf694035582faef
MD5 04a0a10684608be2232d13dfce865813
BLAKE2b-256 6116b3a2f9a1f60d04f8361bf41c766572773323fc430c980d7c7070546bd053

See more details on using hashes here.

Provenance

The following attestation bundles were made for pacs008_loader_mt103-0.0.12.tar.gz:

Publisher: release.yml on sebastienrousseau/pacs008-loader-mt103

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pacs008_loader_mt103-0.0.12-py3-none-any.whl.

File metadata

File hashes

Hashes for pacs008_loader_mt103-0.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 c4e6ec2c6b0b2ecbabbd330cb6d0f606d58828da4bf81d4e3d176af7457830ad
MD5 8e41cd1539d21319dec49fa0f5b84fd8
BLAKE2b-256 c76d6bfd5aefed5161d9ef9038a87280c6ea03877eff3eedd5a1c8c8f53007ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for pacs008_loader_mt103-0.0.12-py3-none-any.whl:

Publisher: release.yml on sebastienrousseau/pacs008-loader-mt103

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.0.12 This release

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page