Skip to main content

Module camt

Module camt 

Source
Expand description

CAMT.052 (ISO 20022 “Bank to Customer Account Report”) parser.

HICAZ answers HKCAZ with one or more complete camt.052 XML documents. Each <Ntry> (entry) of a <Rpt> (report) becomes one Transaction:

Document/BkToCstmrAcctRpt/Rpt
  Acct/Ccy                               account currency (fallback for Amt)
  Ntry
    Amt @Ccy, CdtDbtInd (CRDT|DBIT)      amount and sign
    RvslInd                              reversal (Storno)
    Sts (or Sts/Cd)                      BOOK | PDNG | INFO
    BookgDt/Dt (or DtTm)                 booking date  -> Transaction::date
    ValDt/Dt   (or DtTm)                 value date    -> Transaction::valuta_date
    AcctSvcrRef                          bank reference
    BkTxCd/Prtry/Cd                      DK code "SWIFT+GVC+primanota[+ext]"
    AddtlNtryInf                         booking text  -> posting_text
    NtryDtls/TxDtls                      first TxDtls only:
      Refs/EndToEndId, Refs/MndtId, Refs/AcctSvcrRef
      RltdPties/{Dbtr,Cdtr,UltmtDbtr,UltmtCdtr}[/Pty]/Nm
      RltdPties/{DbtrAcct,CdtrAcct}/Id/IBAN
      RltdAgts/{DbtrAgt,CdtrAgt}/FinInstnId/{BIC,BICFI}
      Purp/Cd                            ISO 20022 purpose code
      RmtInf/Ustrd                       remittance text, parts joined with a line break
      RltdPties/Cdtr[/Pty]/Id/PrvtId/Othr/Id          -> creditor_id (SEPA creditor ID)
      RltdPties/Dbtr[/Pty]/Id/{PrvtId,OrgId}/Othr/Id  -> debtor_id

Dates follow the same rule as MT940 (crate::formats::mt940): date is the booking date and valuta_date the value date; an entry without a booking date (typically a pending one) falls back to its value date.

Element names are matched without namespace prefix, so camt.052.001.02 and the later versions (001.08, …) parse with the same code. Written from the ISO 20022 message definition and the German banking industry’s (DK) camt usage notes as seen in bank responses; unknown elements are ignored.

Functions§

parse_camt052
Parse one camt.052 XML document into transactions, in document order.