summaryrefslogtreecommitdiff
path: root/libeufin/iso20022.rst
blob: 304bd0d82025bcbdb6ca11433ef367448396f58a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
ISO 20022
#########

ISO 20022 is the standard that defines many XML messages for FinTech.  It is
very general, and often countries/orgs define subsets (TVS, technical
validation subset) of the schema.

Documentation for message fields can be viewed at https://www.iso20022.org/standardsrepository

The primary syntax for ISO 20022 messages is XML.  To avoid LibEuFin clients
having to deal with XML, we define a mapping from ISO 20022 messages into JSON.

The specifics of this mapping are:

 * The JSON should be "idiomatic" and easy to process
 * When possible, the highly nested structures of ISO 20022 should be flattened
 * It must be possible round-trip between the LibEuFin JSON and ISO 20022
   XML messages. The mapping of message types is not 1-to-1, as some ISO 20022 messages are
   very similar and can be mapped to the same JSON structure.
 * JSON-mapped messages are not explicitly versioned.  Instead, changes
   are made in a backwards-compatible way, possibly preserving old versions
   of message elements in the same schema.


Cash Management (camt)
======================

LibEuFin combines camt.052, camt.053 and camt.054, as they essentially
have the same structure and serve the same purpose:  Reporting transactions
on a customer's bank account.

.. code-block:: typescript

   interface CashManagementResponseMessage {
     // ISO: MessageIdentification
     messageId: string;

     messageType: "report" | "statement" | "notification";

     // ISO: CreationDateTime
     creationDateTime: string;

     entries: Entry[];

   }

   interface Entry {
     transactions: Transaction[];
   }

   interface Transaction {
     creditDebitIndicator: "credit" | "debit";
     amount: string;
     currency: string;

     bookingDate?: string;
     valueDate?: string;

     accountServicerRef?: string;

     bankTransactionCode: BankTransactionCode;

     details: TransactionDetails[];
   }

   interface TransactionDetails {
     creditDebitIndicator: "credit" | "debit";
     amount: string;
     currency: string;

     // Referenced message ID
     messageId: string;

     endToEndId: string;
     paymentIdentificationId?: string;

     bankTransactionCode: BankTransactionCode;
   }

   interface BankTransactionCode {
     domain?: string;
     family?: string;
     subfamily?: string;
     proprietaryIssuer?: string;
     proprietaryCode?: string;
   }