Sebastien Rousseau

PAIN001

Ṣíṣe ìdá fáìlì ìsanwó ISO 20022 laifọwọyi pẹ̀lú pain001

Dídá ISO 20022 pain.001.001.09 XML láti CSV tàbí SQLite pẹ̀lú ìfọwọ́sí XSD laifọwọyi

6 min read
Banner for: Ṣíṣe ìdá fáìlì ìsanwó ISO 20022 laifọwọyi pẹ̀lú pain001

Àkótán alákóso / àwọn kókó pàtàkì

  • ISO 20022 pain.001 (CustomerCreditTransferInitiation) ni structured XML message format tí a fi ń bẹ̀rẹ̀ credit transfers labẹ SEPA (EPC SCT rulebook) àti CBPR+ (SWIFT cross-border messaging standard, dandan fún correspondent banks láti novembre 2025).
  • pain001 ⧉ ń ka payment data láti CSV tàbí SQLite, ó ń map rows sí hierarchy pain.001.001.09 (GrpHdr -> PmtInf -> CdtTrfTxInf), ó sì ń render conformant XML file nípasẹ̀ templated generator — laini Python mẹ́ta láti data sí validated XML.
  • XSD validation ń ṣiṣẹ́ lórí gbogbo generated file kí output tó di pípa mọ́; library náà ń raise descriptive exception tó tọ́ka sí failing element, cardinality tàbí type mismatch, kí errors lè jẹ́ mímú ní generation time dípò bank submission.
  • CtrlSum àti NbOfTxs ni a ń ṣirò láti transaction set, kì í ṣe kí a tẹ̀ wọ́n manually — ó yọ́ ìdí rejection payment file tó wọ́pọ̀ jù lọ ní SEPA àti CBPR+ processing gateways.
  • SEPA Credit Transfer (EUR, nínú SEPA zone) àti CBPR+ (cross-border, multi-currency) message variants méjèèjì ni support nípasẹ̀ message_type parameter, pẹ̀lú field-level validation differences tí a ń ṣàkóso internally.

pain001 ⧉ jẹ́ ilé-ìkàwé Python open-source fún dídá ISO 20022 payment initiation files. Ó ń ka payment data láti structured input (CSV tàbí SQLite), ó ń validate data, ó ń render conformant pain.001.001.09 XML document, ó sì ń validate output sí ISO 20022 XSD schema — gbogbo rẹ̀ nínú function call kan.

Àpilẹ̀kọ yìí ṣàlàyé ISO 20022 pain.001 message structure, bí pain001 ṣe ń map input data sí message elements, validation pipeline, àti SEPA vs CBPR+ configuration options.

Ìlànà message ISO 20022 pain.001

ISO 20022 pain.001.001.09 (CustomerCreditTransferInitiation) message ní ipele mẹ́ta:

GrpHdr (Group Header) — ọkan fún fáìlì kọọkan:

Element Àlàyé Àpẹẹrẹ
MsgId Unique message identifier ACME20240115-001
CreDtTm Ọjọ́ àti àsìkò creation 2024-01-15T09:00:00
NbOfTxs Total number of transactions 3
CtrlSum Àpapọ̀ gbogbo instructed amounts 15000.00
InitgPty/Nm Orúkọ initiating party Acme Corp

PmtInf (Payment Information) — ọkan tàbí ju bẹ́ẹ̀ lọ fún fáìlì kọọkan; ó ń group transactions nípa debtor account àti payment date:

Element Àlàyé
PmtInfId Payment information identifier
PmtMtd Payment method — TRF nigbagbogbo fún credit transfer
ReqdExctnDt/Dt Requested execution date
Dbtr/Nm Orúkọ debtor (sender)
DbtrAcct/Id/IBAN Debtor IBAN
DbtrAgt/FinInstnId/BICFI Debtor bank BIC

CdtTrfTxInf (Credit Transfer Transaction Information) — ọkan tàbí ju bẹ́ẹ̀ lọ fún PmtInf block kọọkan:

Element Àlàyé
PmtId/EndToEndId End-to-end reference tí a pa mọ́ jálẹ̀ chain
Amt/InstdAmt Instructed amount pẹ̀lú currency attribute
CdtrAgt/FinInstnId/BICFI Creditor bank BIC
Cdtr/Nm Orúkọ creditor (receiver)
CdtrAcct/Id/IBAN Creditor IBAN
RmtInf/Ustrd Unstructured remittance information, bí invoice reference

Dídá XML láti CSV

pain001 invocation kékeré:

from pain001 import create_xml_v9

create_xml_v9(
    data_file="payments.csv",
    data_file_type="csv",
    xml_file_path="output/pain001.xml"
)

CSV file ń map column names sí message fields. Àpẹẹrẹ kékeré:

id,date,nb_of_txs,ctrl_sum,initiating_party_name,debtor_name,debtor_account_IBAN,debtor_agent_BIC,creditor_name,creditor_account_IBAN,creditor_agent_BIC,instd_amt,instd_amt_ccy,end_to_end_id,remittance_info
1,2024-01-15,1,1000.00,Acme Corp,Acme Corp,GB29NWBK60161331926819,NWBKGB2L,Supplier Ltd,DE89370400440532013000,COBADEFFXXX,1000.00,EUR,ACME20240115001,INV-2024-0042

Library náà ń ka ctrl_sum àti nb_of_txs láti CSV row fún single-row files. Fún multi-row files (ọ̀pọ̀ transactions nínú batch kan), pain001 ń compute values wọ̀nyí láti transaction set dípò fífi ìgbàgbọ́ sí input values, èyí tó ń dena mismatches.

SQLite interface ń lo column-name convention kan náà. Pass data_file_type="sqlite" àti path data_file sí SQLite database file; pain001 ń ka payment table by default.

Ìlànà XML tí a dá

Pain.001.001.09 document tí a render dáadáa fún CSV row lókè:

<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.09">
  <CstmrCdtTrfInitn>
    <GrpHdr>
      <MsgId>ACME20240115-001</MsgId>
      <CreDtTm>2024-01-15T09:00:00</CreDtTm>
      <NbOfTxs>1</NbOfTxs>
      <CtrlSum>1000.00</CtrlSum>
      <InitgPty><Nm>Acme Corp</Nm></InitgPty>
    </GrpHdr>
    <PmtInf>
      <PmtInfId>ACME20240115-PMT-001</PmtInfId>
      <PmtMtd>TRF</PmtMtd>
      <ReqdExctnDt><Dt>2024-01-16</Dt></ReqdExctnDt>
      <Dbtr><Nm>Acme Corp</Nm></Dbtr>
      <DbtrAcct><Id><IBAN>GB29NWBK60161331926819</IBAN></Id></DbtrAcct>
      <DbtrAgt><FinInstnId><BICFI>NWBKGB2L</BICFI></FinInstnId></DbtrAgt>
      <CdtTrfTxInf>
        <PmtId><EndToEndId>ACME20240115001</EndToEndId></PmtId>
        <Amt><InstdAmt Ccy="EUR">1000.00</InstdAmt></Amt>
        <CdtrAgt><FinInstnId><BICFI>COBADEFFXXX</BICFI></FinInstnId></CdtrAgt>
        <Cdtr><Nm>Supplier Ltd</Nm></Cdtr>
        <CdtrAcct><Id><IBAN>DE89370400440532013000</IBAN></Id></CdtrAcct>
        <RmtInf><Ustrd>INV-2024-0042</Ustrd></RmtInf>
      </CdtTrfTxInf>
    </PmtInf>
  </CstmrCdtTrfInitn>
</Document>

XSD validation pipeline

Lẹ́yìn rendering, pain001 ń validate output sí ISO 20022 pain.001.001.09 XSD schema. Validation ń ṣàyẹ̀wò:

Nígbà tí validation bá kùnà, pain001 ń raise ValidationError pẹ̀lú lxml error message tó ń tọ́ka sí failing XPath expression, element name àti constraint. Èyí ń fi misconfigurations hàn ní generation time dípò bank submission, níbi tí rejection codes sábà máa ń jẹ́ aláìkúnrẹ́rẹ́.

SEPA vs CBPR+ configuration

SEPA Credit Transfer (ISO 20022 pain.001.001.09 labẹ EPC SCT rulebook) àti CBPR+ (SWIFT's Cross-Border Payments and Reporting Plus standard) ń lo message schema kan náà, ṣùgbọ́n wọ́n yàtọ̀ ní mandatory field sets àti value constraints:

Aspect SEPA SCT CBPR+
Currency EUR nìkan Multi-currency
IBAN mandatory Bẹ́ẹ̀ ni Bẹ́ẹ̀ ni (creditor)
BIC mandatory Rárá (SEPA zone routing) Bẹ́ẹ̀ ni
Charge bearer (ChrgBr) SLEV DEBT, CRED, tàbí SHAR
Scope SEPA zone (orílẹ̀-èdè 36) Global correspondent banking

Ṣètò message type nípasẹ̀ payment_initiation_message_type parameter:

create_xml_v9(
    data_file="payments.csv",
    data_file_type="csv",
    xml_file_path="output/pain001.xml",
    payment_initiation_message_type="pain.001.001.09"  # default; also accepts "pain.001.001.03" for legacy SEPA
)

CBPR+ compliance di dandan fún SWIFT correspondent banking ní novembre 2023 fún inbound messages àti novembre 2025 fún outbound. Dídá pain.001 files tó conform sí CBPR+ ń bẹ̀rẹ̀ pé BIC field wà ní kíkún àti pé ChrgBr element wà.

Ìbéèrè tí a máa ń béèrè

Kí ni ìyàtọ̀ láàárín pain.001 àti pain.008? pain.001 (CustomerCreditTransferInitiation) ń bẹ̀rẹ̀ credit transfer — banki sender ń debit account sender, ó sì ń credit receiver. pain.008 (CustomerDirectDebitInitiation) ń bẹ̀rẹ̀ direct debit — banki creditor ń gba owó láti debtor. Library pain001 ń generate pain.001 files nìkan.

ISO 20022 version wo ni pain001 ń target? Primary target ni pain.001.001.09, version tí CBPR+ ń fẹ́ àti tí EPC fi dandan fún new SEPA implementations. Library náà tún support pain.001.001.03 (legacy SEPA version) nípasẹ̀ payment_initiation_message_type parameter fún organisations tó ṣi ń lo older bank interfaces.

Ṣé pain001 lè ṣàkóso debtor accounts púpọ̀ nínú fáìlì kan? Bẹ́ẹ̀ ni. A lè produce ọ̀pọ̀ PmtInf blocks pẹ̀lú debtor IBANs tó yàtọ̀ nípa grouping CSV rows pẹ̀lú debtor account values tó yàtọ̀. pain001 ń create PmtInf block kan fún unique combination kọọkan ti (debtor IBAN, execution date), pẹ̀lú gbogbo matching transactions tí a nest gẹ́gẹ́ bí CdtTrfTxInf children.

Kí ló ṣẹlẹ̀ tí XSD validation bá kùnà? pain001 ń raise pain001.exceptions.ValidationError pẹ̀lú lxml validation message. XML file kì í kọ sí disk tí validation bá kùnà, nítorí náà valid files nìkan ni yóò dé output path. Àwọn common failure causes ni: IBAN nínú wrong format, BIC tí kì í ṣe characters 8 tàbí 11, currency code tí kò sí ní ISO 4217, tàbí missing mandatory elements nígbà tí required CSV column kò sí.

Àwọn ìtọ́kasí

  1. European Payments Council. SEPA Credit Transfer Scheme Customer-to-Bank Implementation Guidelines (v1.1). EPC, 2023. https://www.europeanpaymentscouncil.eu/document-library/implementation-guidelines/sepa-credit-transfer-scheme-customer-bank
  2. SWIFT. CBPR+ Usage Guidelines — Customer Credit Transfer Initiation (pain.001). SWIFT Standards, 2023. https://www.swift.com/standards/iso-20022/cbpr-plus-usage-guidelines
  3. ISO. ISO 20022 — Financial services — Universal financial industry message scheme. ISO.org, 2023. https://www.iso20022.org/
  4. Rousseau, S. pain001 — ISO 20022 payment file generator. GitHub, 2023. https://github.com/sebastienrousseau/pain001

A ṣe àtúnyẹ̀wò kẹ́yìn .

Àyẹ̀wò àkọ́kọ́ .

Tẹ àpilẹ̀kọ yìí jáde lẹ́ẹ̀kan sí i

Daakọ ọ̀nà fún Medium

# Ṣíṣe ìdá fáìlì ìsanwó ISO 20022 laifọwọyi pẹ̀lú pain001 — Sebastien Rousseau

> Originally published at [https://sebastienrousseau.com/yo/2023-09-29-automating-iso-20022-compliant-payment-file-creation-with-pain001/](https://sebastienrousseau.com/yo/2023-09-29-automating-iso-20022-compliant-payment-file-creation-with-pain001/)

pain001 jẹ́ ilé-ìkàwé Python open-source tó ń dá àwọn fáìlì ìsanwó XML ISO 20022 pain.001.001.09 láti data CSV tàbí SQLite, pẹ̀lú ìfọwọ́sí XSD laifọwọyi, iṣiro control-sum, àti support fún SEPA SCT àti CBPR+ cross-border message formats.

Read the full article on sebastienrousseau.com: https://sebastienrousseau.com/yo/2023-09-29-automating-iso-20022-compliant-payment-file-creation-with-pain001/

Daakọ ọ̀nà fún Mastodon

Ṣíṣe ìdá fáìlì ìsanwó ISO 20022 laifọwọyi pẹ̀lú pain001 — Sebastien Rousseau

pain001 jẹ́ ilé-ìkàwé Python open-source tó ń dá àwọn fáìlì ìsanwó XML ISO 20022 pain.001.001.09 láti data CSV tàbí SQLite, pẹ̀lú ìfọwọ́sí XSD laifọwọyi, iṣiro control-sum, àti support fún SEPA SCT àti CBPR+ cross-border message formats.

https://sebastienrousseau.com/yo/2023-09-29-automating-iso-20022-compliant-payment-file-creation-with-pain001/

Daakọ tí a ṣe ìtọ́nà fún LinkedIn

Ṣíṣe ìdá fáìlì ìsanwó ISO 20022 laifọwọyi pẹ̀lú pain001 — Sebastien Rousseau

pain001 jẹ́ ilé-ìkàwé Python open-source tó ń dá àwọn fáìlì ìsanwó XML ISO 20022 pain.001.001.09 láti data CSV tàbí SQLite, pẹ̀lú ìfọwọ́sí XSD laifọwọyi, iṣiro control-sum, àti support fún SEPA SCT àti CBPR+ cross-border message formats.

Èyí ni àwọn èrò àgbékalẹ̀ pàtàkì:

- Ìlànà message ISO 20022 pain.001. ISO 20022 pain.001.001.09 (CustomerCreditTransferInitiation) message ní ipele mẹ́ta:.
- Dídá XML láti CSV. pain001 invocation kékeré:.
- Ìlànà XML tí a dá. Pain.001.001.09 document tí a render dáadáa fún CSV row lókè:.
- XSD validation pipeline. Lẹ́yìn rendering, pain001 ń validate output sí ISO 20022 pain.001.001.09 XSD schema.

Kí ni ọ̀nà àgbékalẹ̀ ilé-iṣẹ́ yín sí àwọn ìpèníjà tí a sọ nínú àpilẹ̀kọ yìí?

→ https://sebastienrousseau.com/yo/2023-09-29-automating-iso-20022-compliant-payment-file-creation-with-pain001/

#Pain001 #Iso20022 #Pain.001.001.09 #Customercredittransferinitiation #SepaCreditTransfer

Sebastien Rousseau | CC-BY-4.0
Tọka àpilẹkọ yìí

Ṣíṣe ìdá fáìlì ìsanwó ISO 20022 laifọwọyi pẹ̀lú pain001 — Sebastien Rousseau

pain001 jẹ́ ilé-ìkàwé Python open-source tó ń dá àwọn fáìlì ìsanwó XML ISO 20022 pain.001.001.09 láti data CSV tàbí SQLite, pẹ̀lú ìfọwọ́sí XSD laifọwọyi, iṣiro control-sum, àti support fún SEPA SCT àti CBPR+ cross-border message formats.

BibTeX

@online{rousseau2023ṣíṣe,
  author  = {Rousseau, Sebastien},
  title   = {{Ṣíṣe ìdá fáìlì ìsanwó ISO 20022 laifọwọyi pẹ̀lú pain001 — Sebastien Rousseau}},
  year    = {2023},
  url     = {https://sebastienrousseau.com/yo/2023-09-29-automating-iso-20022-compliant-payment-file-creation-with-pain001/},
  urldate = {2023}
}

RIS

TY  - GEN
AU  - Rousseau, Sebastien
TI  - Ṣíṣe ìdá fáìlì ìsanwó ISO 20022 laifọwọyi pẹ̀lú pain001 — Sebastien Rousseau
PY  - 2023
UR  - https://sebastienrousseau.com/yo/2023-09-29-automating-iso-20022-compliant-payment-file-creation-with-pain001/
ER  -

Vancouver

Rousseau S. Ṣíṣe ìdá fáìlì ìsanwó ISO 20022 laifọwọyi pẹ̀lú pain001 — Sebastien Rousseau. sebastienrousseau.com. 2023 Sep 29. Available from: https://sebastienrousseau.com/yo/2023-09-29-automating-iso-20022-compliant-payment-file-creation-with-pain001/

Chicago

Rousseau, Sebastien. "Ṣíṣe ìdá fáìlì ìsanwó ISO 20022 laifọwọyi pẹ̀lú pain001 — Sebastien Rousseau." sebastienrousseau.com. September 29, 2023. https://sebastienrousseau.com/yo/2023-09-29-automating-iso-20022-compliant-payment-file-creation-with-pain001/.

APA

Rousseau, S. (2023, September 29). Ṣíṣe ìdá fáìlì ìsanwó ISO 20022 laifọwọyi pẹ̀lú pain001 — Sebastien Rousseau. sebastienrousseau.com. https://sebastienrousseau.com/yo/2023-09-29-automating-iso-20022-compliant-payment-file-creation-with-pain001/

Tun àpilẹkọ yìí jade

Ṣíṣe ìdá fáìlì ìsanwó ISO 20022 laifọwọyi pẹ̀lú pain001 — Sebastien Rousseau

pain001 jẹ́ ilé-ìkàwé Python open-source tó ń dá àwọn fáìlì ìsanwó XML ISO 20022 pain.001.001.09 láti data CSV tàbí SQLite, pẹ̀lú ìfọwọ́sí XSD laifọwọyi, iṣiro control-sum, àti support fún SEPA SCT àti CBPR+ cross-border message formats.

A ti fun àpilẹkọ yìí ni iwe-ẹri labẹ Creative Commons Attribution 4.0 International. Atunjade nilo idanimọ si URL akọkọ.

Ṣíṣe ìdá fáìlì ìsanwó ISO 20022 laifọwọyi pẹ̀lú pain001 — Sebastien Rousseau

pain001 jẹ́ ilé-ìkàwé Python open-source tó ń dá àwọn fáìlì ìsanwó XML ISO 20022 pain.001.001.09 láti data CSV tàbí SQLite, pẹ̀lú ìfọwọ́sí XSD laifọwọyi, iṣiro control-sum, àti support fún SEPA SCT àti CBPR+ cross-border message formats.

Originally published at https://sebastienrousseau.com/yo/2023-09-29-automating-iso-20022-compliant-payment-file-creation-with-pain001/ by Sebastien Rousseau.
Licensed under CC-BY-4.0.