@lucianpacurar/iso20022.js 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +212 -0
  3. package/dist/index.d.ts +1896 -0
  4. package/dist/index.js +10039 -0
  5. package/dist/index.mjs +10023 -0
  6. package/dist/src/camt/003/cash-management-get-account.d.ts +26 -0
  7. package/dist/src/camt/004/cash-management-return-account.d.ts +30 -0
  8. package/dist/src/camt/005/cash-management-get-transaction.d.ts +26 -0
  9. package/dist/src/camt/006/cash-management-return-transaction.d.ts +43 -0
  10. package/dist/src/camt/053/cash-management-end-of-day-report.d.ts +90 -0
  11. package/dist/src/camt/index.d.ts +5 -0
  12. package/dist/src/camt/types.d.ts +191 -0
  13. package/dist/src/camt/utils.d.ts +12 -0
  14. package/dist/src/errors.d.ts +24 -0
  15. package/dist/src/index.d.ts +61 -0
  16. package/dist/src/iso20022.d.ts +375 -0
  17. package/dist/src/lib/countries.d.ts +254 -0
  18. package/dist/src/lib/currencies.d.ts +1 -0
  19. package/dist/src/lib/index.d.ts +4 -0
  20. package/dist/src/lib/interfaces.d.ts +30 -0
  21. package/dist/src/lib/types.d.ts +376 -0
  22. package/dist/src/pain/001/ach-credit-payment-initiation.d.ts +159 -0
  23. package/dist/src/pain/001/payment-initiation.d.ts +105 -0
  24. package/dist/src/pain/001/rtp-credit-payment-initiation.d.ts +118 -0
  25. package/dist/src/pain/001/sepa-credit-payment-initiation.d.ts +126 -0
  26. package/dist/src/pain/001/swift-credit-payment-initiation.d.ts +72 -0
  27. package/dist/src/pain/002/payment-status-report.d.ts +75 -0
  28. package/dist/src/pain/002/types.d.ts +73 -0
  29. package/dist/src/pain/002/utils.d.ts +4 -0
  30. package/dist/src/parseUtils.d.ts +21 -0
  31. package/dist/src/utils/format.d.ts +1 -0
  32. package/dist/test/camt/003/cash-management-get-account.test.d.ts +1 -0
  33. package/dist/test/camt/004/cash-management-return-account.test.d.ts +1 -0
  34. package/dist/test/camt/005/cash-management-get-transaction.test.d.ts +1 -0
  35. package/dist/test/camt/006/cash-management-return-transaction.test.d.ts +1 -0
  36. package/dist/test/camt/053/cash-management-end-of-day-report.test.d.ts +1 -0
  37. package/dist/test/pain/001/ach-credit-payment-initiation.test.d.ts +1 -0
  38. package/dist/test/pain/001/rtp-credit-payment-initiation.test.d.ts +1 -0
  39. package/dist/test/pain/001/sepa-credit-payment-initiation.test.d.ts +1 -0
  40. package/dist/test/pain/001/swift-credit-payment-initiation.test.d.ts +1 -0
  41. package/dist/test/pain/002/payment-status-report.test.d.ts +1 -0
  42. package/dist/test/parseUtils.test.d.ts +1 -0
  43. package/package.json +82 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Svapnil Ankolkar
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,212 @@
1
+ <div align="center">
2
+ <a href="https://iso20022js.com">
3
+ <img alt="iso20022.js logo" src="https://github.com/user-attachments/assets/662bc55f-2be0-41dc-b79e-d62f325b1f80" height="128">
4
+ </a>
5
+ <h1>iso20022.js</h1>
6
+ <a href=""><img alt="github stars" src="https://img.shields.io/github/stars/svapnil/iso20022.js?color=FFD700&label=Stars&logo=Github"></a>
7
+ <a href="https://coveralls.io/github/svapnil/iso20022.js?branch=main"><img alt="coverage" src="https://coveralls.io/repos/github/svapnil/iso20022.js/badge.svg?branch=main"></a>
8
+ </div>
9
+
10
+
11
+ This package is meant for companies using ISO20022 to send and receive payment information, specifically initiating SEPA, ACH, FedWire, RTP, SWIFT payments and receiving cash management files.
12
+
13
+ Read the Docs: https://docs.iso20022js.com
14
+
15
+ The mission of this NPM package is to connect the most widely used programming language to the most widely used payment standard.
16
+
17
+ If you're interested in using iso20022.js and would like to use different payment types or ingest files using CAMT, please email [iso20022js@woodside.sh](mailto:iso20022js@woodside.sh).
18
+
19
+ [![Book with Cal](https://cal.com/book-with-cal-dark.svg)](https://cal.com/woodside/iso20022js?utm_source=banner&utm_campaign=oss)
20
+
21
+ <a href="https://news.ycombinator.com/item?id=41163645">
22
+ <img
23
+ style="width: 250px; height: 54px;" width="250" height="54"
24
+ alt="Featured on Hacker News"
25
+ src="https://hackernews-badge.vercel.app/api?id=41163645"
26
+ />
27
+ </a>
28
+
29
+
30
+ # Installation
31
+
32
+ ```bash
33
+ npm install iso20022.js
34
+ ```
35
+
36
+ # Examples
37
+
38
+ Examples of ISO20022 messages being created across different payment types:
39
+
40
+ ```bash
41
+ npx tsx examples/sepa-credit-transfer.ts
42
+ npx tsx examples/rtp-credit-transfer.ts
43
+ npx tsx examples/swift-credit-transfer.ts
44
+ npx tsx examples/get-account-messages.ts
45
+ ```
46
+
47
+ # Usage
48
+
49
+ ### Full Payment Initiation Example: Sending a SEPA Transfer
50
+
51
+ ```ts
52
+ import { ISO20022 } from 'iso20022.js';
53
+
54
+ const iso20022 = new ISO20022({
55
+ initiatingParty: {
56
+ name: 'Acme Corporation',
57
+ id: 'ACMECORP',
58
+ account: {
59
+ iban: 'ES1234567890123456789012'
60
+ },
61
+ agent: {
62
+ bic: 'BANKESMMXXX',
63
+ bankAddress: {
64
+ country: 'ES'
65
+ }
66
+ }
67
+ },
68
+ });
69
+
70
+ const creditPaymentInitiation = iso20022.createSEPACreditPaymentInitiation([
71
+ {
72
+ type: 'sepa',
73
+ direction: 'credit',
74
+ amount: 1000,
75
+ currency: 'EUR',
76
+ creditor: {
77
+ name: 'Hans Schmidt',
78
+ account: {
79
+ iban: 'DE1234567890123456789012'
80
+ },
81
+ agent: {
82
+ bic: 'DEUTDEFFXXX'
83
+ },
84
+ address: {
85
+ streetName: 'Example Street',
86
+ buildingNumber: '123',
87
+ townName: 'Berlin',
88
+ countrySubDivision: 'Berlin',
89
+ postalCode: '10115',
90
+ country: 'DE'
91
+ }
92
+ }
93
+ }
94
+ ]);
95
+
96
+ console.log(creditPaymentInitiation.toString());
97
+ ```
98
+
99
+ Note that amounts are reresented in the smallest decimal unit (`$100.55` is stored as a number `10055`) and the decimal precision of a currency can be retrieved from `getCurrencyPrecision(Ccy)`
100
+
101
+ ### Example: Sending an ACH Payment
102
+
103
+ ```ts
104
+ // Send an ACH Payment Anywhere in the U.S.
105
+ const payment = iso20022.createACHCreditPaymentInitiation({
106
+ paymentInstructions: [
107
+ {
108
+ type: 'ach',
109
+ direction: 'credit',
110
+ amount: 1250000, // $12,500.00 Dollars
111
+ currency: 'USD',
112
+ creditor: {
113
+ name: 'Alex Kan',
114
+ account: {
115
+ accountNumber: '333456118812',
116
+ },
117
+ agent: {
118
+ abaRoutingNumber: '021000021',
119
+ }
120
+ },
121
+ remittanceInformation: 'PAYROLL - BIWEEKLY SALARY SR SOFTWARE ENGINEER'
122
+ }],
123
+ });
124
+ ```
125
+
126
+ ### Cash Management: Ingesting a CAMT.053 file
127
+
128
+ ```ts
129
+ import { CashManagementEndOfDayReport } from 'iso20022.js';
130
+
131
+ const xml = fs.readFileSync('balance_report.xml', 'utf8');
132
+ const report = CashManagementEndOfDayReport.fromXML(xml);
133
+
134
+ console.log(report.transactions);
135
+ ```
136
+
137
+ ### Cash Management: Create an account request CAMT.003 file
138
+
139
+ ```ts
140
+ import { ISO20022 } from 'iso20022.js';
141
+ import { CashManagementGetAccount } from 'iso20022.js';
142
+
143
+ const msg = new CashManagementGetAccount({
144
+ ...
145
+ });
146
+ const xml = msg.serialize();
147
+ const json = msg.toJSON();
148
+
149
+ const msg2 = CashManagementGetAccount.fromXML(xml);
150
+ const msg3 = CashManagementGetAccount.fromJSON(json);
151
+ ```
152
+
153
+ ### Generic class implementation (preview)
154
+
155
+ If you need generic implementation to a type of message implemented you can do the following
156
+
157
+ ```ts
158
+ const type = "CAMT.006"; // can come as an input
159
+ import { getISO20022Implementation } from 'iso20022.js';
160
+
161
+ let impl = getISO20022Implementation(type);
162
+ if (impl) {
163
+ const msg1 = impl.fromXml("some xml content");
164
+ const msg2 = impl.fromJSON({ some: object }); // following the ISO format
165
+ const msg3 = new impl({config: object}); // following the internal data definition
166
+ const xml1 = msg1.serialize(); // generate a xml message as string
167
+ const json2 = msg1.toJSON(); // generate a js object that can then be stringify
168
+ const data = msg1.data; // the internal representation of the message
169
+ }
170
+ ```
171
+
172
+ ### Testing
173
+
174
+ ```bash
175
+ npm run test
176
+ ```
177
+
178
+ ## About ISO20022
179
+
180
+ ISO20022 is the standard format for financial transactions. This library aims to build a powerful yet simple API to create these files, following Typescript conventions.
181
+
182
+ You might want to use this package if you need to create these types of files.
183
+
184
+ # Features
185
+
186
+ | Feature | Description | Todo |
187
+ | ---------------------- | ---------------------------------------------------- | ---- |
188
+ | SWIFT Credit Transfer | Create SWIFT credit transfer messages | ✅ |
189
+ | CAMT Transactions | Ingest transaction data from CAMT files | ✅ |
190
+ | CAMT Requests | Query and Responses on accounts and transactions | ✅ |
191
+ | SEPA Credit Transfer | Create SEPA credit transfer messages | ✅ |
192
+ | ACH Credit Transfer | Create ACH credit transfer messages | ✅ |
193
+ | RTP / Fednow Credit Transfer | Create Fednow credit transfer messages | ✅ |
194
+ | FedWire Credit Transfer | Create FedWire credit transfer messages | 🚧 |
195
+
196
+
197
+ # Reasons to use `iso20022.js`
198
+
199
+ | Feature | Description | |
200
+ | ---------------------- | ---------------------------------------------------- | ---- |
201
+ | XML Generation | Generate valid ISO 20022 XML files | ✅ |
202
+ | Type Safety | Built with TypeScript for enhanced type checking | ✅ |
203
+ | Extensible | Easy to extend for custom message types | ✅ |
204
+ | Validation | Built-in validation for ISO 20022 message structures | ✅ |
205
+
206
+ # Security
207
+
208
+ `iso20022.js` is local, open source, and free to use. This means that payment instructions are created on your machine, not on a remote server.
209
+
210
+ We take security seriously, and are consistently looking for ways to improve. If you have any suggestions or find any security issues, please [open an issue](https://github.com/svapnil/iso20022.js/issues/new/choose).
211
+
212
+ **NOTE: We are tracking the [libxmljs vulnerability](https://github.com/svapnil/iso20022.js/issues/26), a dependency we use in our unit tests and have a plan to deprecate. Note that production use of `iso20022.js` is not affected by this vulnerability.**