@coderoftime/fints 0.1.0 → 0.3.0
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.
- package/CHANGELOG.md +519 -1
- package/README.md +138 -40
- package/dist/client.d.ts +49 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +242 -0
- package/dist/client.js.map +1 -0
- package/dist/core/account.d.ts +46 -7
- package/dist/core/account.d.ts.map +1 -1
- package/dist/core/account.js +143 -24
- package/dist/core/account.js.map +1 -1
- package/dist/core/amount.d.ts +15 -4
- package/dist/core/amount.d.ts.map +1 -1
- package/dist/core/amount.js +46 -9
- package/dist/core/amount.js.map +1 -1
- package/dist/core/balance.d.ts +4 -0
- package/dist/core/balance.d.ts.map +1 -1
- package/dist/core/balance.js +11 -5
- package/dist/core/balance.js.map +1 -1
- package/dist/core/bank-info.d.ts +21 -4
- package/dist/core/bank-info.d.ts.map +1 -1
- package/dist/core/bank-info.js +26 -5
- package/dist/core/bank-info.js.map +1 -1
- package/dist/core/client.d.ts +81 -19
- package/dist/core/client.d.ts.map +1 -1
- package/dist/core/config.d.ts +40 -20
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +85 -30
- package/dist/core/config.js.map +1 -1
- package/dist/core/errors.d.ts +100 -26
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +136 -53
- package/dist/core/errors.js.map +1 -1
- package/dist/core/feedback.d.ts +11 -1
- package/dist/core/feedback.d.ts.map +1 -1
- package/dist/core/feedback.js +14 -2
- package/dist/core/feedback.js.map +1 -1
- package/dist/core/transaction.d.ts +11 -1
- package/dist/core/transaction.d.ts.map +1 -1
- package/dist/core/transaction.js +21 -4
- package/dist/core/transaction.js.map +1 -1
- package/dist/core/transport.d.ts +48 -6
- package/dist/core/transport.d.ts.map +1 -1
- package/dist/core/transport.js +126 -29
- package/dist/core/transport.js.map +1 -1
- package/dist/formats/camt.d.ts +28 -5
- package/dist/formats/camt.d.ts.map +1 -1
- package/dist/formats/camt.js +132 -50
- package/dist/formats/camt.js.map +1 -1
- package/dist/formats/mt940.d.ts +29 -5
- package/dist/formats/mt940.d.ts.map +1 -1
- package/dist/formats/mt940.js +209 -113
- package/dist/formats/mt940.js.map +1 -1
- package/dist/formats/readers.d.ts +6 -2
- package/dist/formats/readers.d.ts.map +1 -1
- package/dist/formats/readers.js +28 -29
- package/dist/formats/readers.js.map +1 -1
- package/dist/formats/record-budget.d.ts +7 -0
- package/dist/formats/record-budget.d.ts.map +1 -0
- package/dist/formats/record-budget.js +17 -0
- package/dist/formats/record-budget.js.map +1 -0
- package/dist/formats/sepa-purpose.d.ts +9 -0
- package/dist/formats/sepa-purpose.d.ts.map +1 -1
- package/dist/formats/sepa-purpose.js +32 -2
- package/dist/formats/sepa-purpose.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/session/app-approval.d.ts +11 -5
- package/dist/session/app-approval.d.ts.map +1 -1
- package/dist/session/app-approval.js +23 -12
- package/dist/session/app-approval.js.map +1 -1
- package/dist/session/dialog-runner.d.ts +11 -11
- package/dist/session/dialog-runner.d.ts.map +1 -1
- package/dist/session/dialog-runner.js +34 -19
- package/dist/session/dialog-runner.js.map +1 -1
- package/dist/session/login-guard.d.ts +54 -49
- package/dist/session/login-guard.d.ts.map +1 -1
- package/dist/session/login-guard.js +170 -83
- package/dist/session/login-guard.js.map +1 -1
- package/dist/session/sepa-accounts.d.ts +20 -14
- package/dist/session/sepa-accounts.d.ts.map +1 -1
- package/dist/session/sepa-accounts.js +62 -46
- package/dist/session/sepa-accounts.js.map +1 -1
- package/dist/session/session-setup.d.ts +41 -24
- package/dist/session/session-setup.d.ts.map +1 -1
- package/dist/session/session-setup.js +106 -63
- package/dist/session/session-setup.js.map +1 -1
- package/dist/session/session-state.d.ts +10 -6
- package/dist/session/session-state.d.ts.map +1 -1
- package/dist/session/session-state.js +72 -18
- package/dist/session/session-state.js.map +1 -1
- package/dist/session/signed-dialog.d.ts +83 -0
- package/dist/session/signed-dialog.d.ts.map +1 -0
- package/dist/session/signed-dialog.js +185 -0
- package/dist/session/signed-dialog.js.map +1 -0
- package/dist/session/tan-selection.d.ts +26 -18
- package/dist/session/tan-selection.d.ts.map +1 -1
- package/dist/session/tan-selection.js +44 -33
- package/dist/session/tan-selection.js.map +1 -1
- package/dist/session/user-prompts.d.ts +14 -5
- package/dist/session/user-prompts.d.ts.map +1 -1
- package/dist/session/user-prompts.js +53 -18
- package/dist/session/user-prompts.js.map +1 -1
- package/dist/tan/challenge.d.ts +47 -24
- package/dist/tan/challenge.d.ts.map +1 -1
- package/dist/tan/challenge.js +56 -51
- package/dist/tan/challenge.js.map +1 -1
- package/dist/tan/flicker.d.ts +11 -1
- package/dist/tan/flicker.d.ts.map +1 -1
- package/dist/tan/flicker.js +70 -24
- package/dist/tan/flicker.js.map +1 -1
- package/dist/tan/tan-image.d.ts +6 -2
- package/dist/tan/tan-image.d.ts.map +1 -1
- package/dist/tan/tan-image.js +14 -6
- package/dist/tan/tan-image.js.map +1 -1
- package/dist/tan/tan-models.d.ts +14 -2
- package/dist/tan/tan-models.d.ts.map +1 -1
- package/dist/tan/tan-models.js +24 -7
- package/dist/tan/tan-models.js.map +1 -1
- package/dist/util/arguments.d.ts +13 -0
- package/dist/util/arguments.d.ts.map +1 -0
- package/dist/util/arguments.js +40 -0
- package/dist/util/arguments.js.map +1 -0
- package/dist/util/async.d.ts +4 -3
- package/dist/util/async.d.ts.map +1 -1
- package/dist/util/async.js +6 -7
- package/dist/util/async.js.map +1 -1
- package/dist/util/bytes.d.ts +3 -4
- package/dist/util/bytes.d.ts.map +1 -1
- package/dist/util/bytes.js +13 -21
- package/dist/util/bytes.js.map +1 -1
- package/dist/util/call-context.d.ts.map +1 -1
- package/dist/util/call-context.js +3 -2
- package/dist/util/call-context.js.map +1 -1
- package/dist/util/dates.d.ts +6 -20
- package/dist/util/dates.d.ts.map +1 -1
- package/dist/util/dates.js +58 -28
- package/dist/util/dates.js.map +1 -1
- package/dist/util/errors.d.ts +13 -3
- package/dist/util/errors.d.ts.map +1 -1
- package/dist/util/errors.js +19 -6
- package/dist/util/errors.js.map +1 -1
- package/dist/util/immutable-map.d.ts +5 -2
- package/dist/util/immutable-map.d.ts.map +1 -1
- package/dist/util/immutable-map.js +15 -12
- package/dist/util/immutable-map.js.map +1 -1
- package/dist/util/inspect.d.ts +11 -0
- package/dist/util/inspect.d.ts.map +1 -0
- package/dist/util/inspect.js +14 -0
- package/dist/util/inspect.js.map +1 -0
- package/dist/util/json.d.ts +4 -0
- package/dist/util/json.d.ts.map +1 -1
- package/dist/util/json.js +18 -0
- package/dist/util/json.js.map +1 -1
- package/dist/util/text.d.ts +38 -5
- package/dist/util/text.d.ts.map +1 -1
- package/dist/util/text.js +90 -16
- package/dist/util/text.js.map +1 -1
- package/dist/util/xml.d.ts +9 -6
- package/dist/util/xml.d.ts.map +1 -1
- package/dist/util/xml.js +129 -56
- package/dist/util/xml.js.map +1 -1
- package/dist/v3/account-extension.d.ts.map +1 -1
- package/dist/v3/account-extension.js +7 -10
- package/dist/v3/account-extension.js.map +1 -1
- package/dist/v3/bank-connection.d.ts +54 -0
- package/dist/v3/bank-connection.d.ts.map +1 -0
- package/dist/v3/bank-connection.js +118 -0
- package/dist/v3/bank-connection.js.map +1 -0
- package/dist/v3/dialog.d.ts +84 -46
- package/dist/v3/dialog.d.ts.map +1 -1
- package/dist/v3/dialog.js +174 -60
- package/dist/v3/dialog.js.map +1 -1
- package/dist/v3/message.d.ts +32 -11
- package/dist/v3/message.d.ts.map +1 -1
- package/dist/v3/message.js +144 -83
- package/dist/v3/message.js.map +1 -1
- package/dist/v3/parameter-store.d.ts +111 -0
- package/dist/v3/parameter-store.d.ts.map +1 -0
- package/dist/v3/parameter-store.js +197 -0
- package/dist/v3/parameter-store.js.map +1 -0
- package/dist/v3/parameters.d.ts +44 -17
- package/dist/v3/parameters.d.ts.map +1 -1
- package/dist/v3/parameters.js +136 -60
- package/dist/v3/parameters.js.map +1 -1
- package/dist/v3/protocol.d.ts +50 -50
- package/dist/v3/protocol.d.ts.map +1 -1
- package/dist/v3/protocol.js +91 -210
- package/dist/v3/protocol.js.map +1 -1
- package/dist/v3/queries.d.ts +51 -0
- package/dist/v3/queries.d.ts.map +1 -0
- package/dist/v3/queries.js +128 -0
- package/dist/v3/queries.js.map +1 -0
- package/dist/v3/segments.d.ts +43 -19
- package/dist/v3/segments.d.ts.map +1 -1
- package/dist/v3/segments.js +84 -33
- package/dist/v3/segments.js.map +1 -1
- package/dist/v3/syntax.d.ts +68 -13
- package/dist/v3/syntax.d.ts.map +1 -1
- package/dist/v3/syntax.js +183 -102
- package/dist/v3/syntax.js.map +1 -1
- package/package.json +10 -6
- package/src/client.ts +293 -0
- package/src/core/account.ts +153 -24
- package/src/core/amount.ts +45 -10
- package/src/core/balance.ts +12 -5
- package/src/core/bank-info.ts +29 -5
- package/src/core/client.ts +83 -19
- package/src/core/config.ts +95 -35
- package/src/core/errors.ts +148 -54
- package/src/core/feedback.ts +16 -2
- package/src/core/transaction.ts +22 -4
- package/src/core/transport.ts +153 -32
- package/src/formats/camt.ts +153 -45
- package/src/formats/mt940.ts +244 -122
- package/src/formats/readers.ts +28 -31
- package/src/formats/record-budget.ts +18 -0
- package/src/formats/sepa-purpose.ts +29 -2
- package/src/index.ts +4 -2
- package/src/session/app-approval.ts +51 -38
- package/src/session/dialog-runner.ts +61 -31
- package/src/session/login-guard.ts +189 -87
- package/src/session/sepa-accounts.ts +63 -45
- package/src/session/session-setup.ts +105 -68
- package/src/session/session-state.ts +74 -23
- package/src/session/signed-dialog.ts +222 -0
- package/src/session/tan-selection.ts +50 -39
- package/src/session/user-prompts.ts +62 -18
- package/src/tan/challenge.ts +87 -64
- package/src/tan/flicker.ts +72 -23
- package/src/tan/tan-image.ts +15 -6
- package/src/tan/tan-models.ts +26 -7
- package/src/util/arguments.ts +40 -0
- package/src/util/async.ts +10 -9
- package/src/util/bytes.ts +14 -20
- package/src/util/call-context.ts +3 -2
- package/src/util/dates.ts +64 -33
- package/src/util/errors.ts +22 -6
- package/src/util/immutable-map.ts +15 -12
- package/src/util/inspect.ts +14 -0
- package/src/util/json.ts +16 -0
- package/src/util/text.ts +87 -15
- package/src/util/xml.ts +130 -52
- package/src/v3/account-extension.ts +7 -12
- package/src/v3/bank-connection.ts +126 -0
- package/src/v3/dialog.ts +186 -92
- package/src/v3/message.ts +140 -79
- package/src/v3/parameter-store.ts +226 -0
- package/src/v3/parameters.ts +166 -66
- package/src/v3/protocol.ts +103 -253
- package/src/v3/queries.ts +198 -0
- package/src/v3/segments.ts +86 -31
- package/src/v3/syntax.ts +172 -93
- package/dist/session/bank-connection.d.ts +0 -28
- package/dist/session/bank-connection.d.ts.map +0 -1
- package/dist/session/bank-connection.js +0 -48
- package/dist/session/bank-connection.js.map +0 -1
- package/dist/session/parameter-data.d.ts +0 -83
- package/dist/session/parameter-data.d.ts.map +0 -1
- package/dist/session/parameter-data.js +0 -68
- package/dist/session/parameter-data.js.map +0 -1
- package/dist/session/pin-tan-client.d.ts +0 -54
- package/dist/session/pin-tan-client.d.ts.map +0 -1
- package/dist/session/pin-tan-client.js +0 -153
- package/dist/session/pin-tan-client.js.map +0 -1
- package/dist/session/pin-tan-dialog.d.ts +0 -71
- package/dist/session/pin-tan-dialog.d.ts.map +0 -1
- package/dist/session/pin-tan-dialog.js +0 -124
- package/dist/session/pin-tan-dialog.js.map +0 -1
- package/dist/session/protocol.d.ts +0 -209
- package/dist/session/protocol.d.ts.map +0 -1
- package/dist/session/protocol.js +0 -75
- package/dist/session/protocol.js.map +0 -1
- package/dist/session/response-handler.d.ts +0 -48
- package/dist/session/response-handler.d.ts.map +0 -1
- package/dist/session/response-handler.js +0 -121
- package/dist/session/response-handler.js.map +0 -1
- package/dist/v3/client.d.ts +0 -24
- package/dist/v3/client.d.ts.map +0 -1
- package/dist/v3/client.js +0 -16
- package/dist/v3/client.js.map +0 -1
- package/src/session/bank-connection.ts +0 -51
- package/src/session/parameter-data.ts +0 -137
- package/src/session/pin-tan-client.ts +0 -186
- package/src/session/pin-tan-dialog.ts +0 -160
- package/src/session/protocol.ts +0 -311
- package/src/session/response-handler.ts +0 -130
- package/src/v3/client.ts +0 -29
package/dist/core/transport.js
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { invalidArgument } from '../util/errors.js';
|
|
2
|
+
import { trimBlanks } from '../util/text.js';
|
|
2
3
|
import { FinTsTransportError } from './errors.js';
|
|
4
|
+
/** The longest delay `setTimeout` takes; it fires at once for a longer one, such as `Infinity`. */
|
|
5
|
+
const maxTimeoutMs = 2 ** 31 - 1;
|
|
3
6
|
/**
|
|
4
7
|
* Default `FinTsTransport`: HTTP POST with `fetch`.
|
|
5
8
|
*
|
|
9
|
+
* Without the `fetch` option it sends with the global `fetch` as it is at each request, and cannot bypass what that
|
|
10
|
+
* does, for plain http to a local server (`FinTsConfig.allowInsecureUrl`) as for https: whatever replaces that `fetch`
|
|
11
|
+
* or handles its requests, such as a test's stub of `globalThis.fetch` or on Node.js a global dispatcher (undici's
|
|
12
|
+
* `setGlobalDispatcher`), gets every message, PIN and TAN included, and a proxy that the runtime takes from the
|
|
13
|
+
* environment, as Node.js does with `NODE_USE_ENV_PROXY=1`, and Deno and Bun do from `HTTP_PROXY`, sees the PIN of
|
|
14
|
+
* plain http unencrypted. Exempt the host with `NO_PROXY`, such as `localhost,127.0.0.1,::1`, or pass a `fetch` that
|
|
15
|
+
* connects directly.
|
|
16
|
+
*
|
|
6
17
|
* In a browser it only reaches servers that allow the page's origin (CORS), which bank servers do not: a web app needs
|
|
7
18
|
* a server of its own between browser and bank, reached with a `FinTsTransport` of its own.
|
|
8
19
|
*/
|
|
@@ -10,33 +21,52 @@ export class HttpTransport {
|
|
|
10
21
|
timeoutMs;
|
|
11
22
|
maxResponseBytes;
|
|
12
23
|
fetchFn;
|
|
24
|
+
/**
|
|
25
|
+
* Throws `TypeError` if `timeoutMs` is not a positive number of at most 2147483647, or `maxResponseBytes` is not a
|
|
26
|
+
* positive number.
|
|
27
|
+
*/
|
|
13
28
|
constructor(options = {}) {
|
|
14
|
-
|
|
29
|
+
const custom = options.fetch;
|
|
30
|
+
// Called as a plain function: a browser's native `fetch` fails as a method of another object.
|
|
31
|
+
this.fetchFn = custom === undefined ? (input, init) => fetch(input, init) : (input, init) => custom(input, init);
|
|
15
32
|
this.timeoutMs = options.timeoutMs ?? 90_000;
|
|
16
33
|
this.maxResponseBytes = options.maxResponseBytes ?? 16 << 20;
|
|
34
|
+
if (!isPositive(this.timeoutMs) || this.timeoutMs > maxTimeoutMs) {
|
|
35
|
+
throw invalidArgument(`Must be a positive number of at most ${maxTimeoutMs}`, 'timeoutMs');
|
|
36
|
+
}
|
|
37
|
+
if (!isPositive(this.maxResponseBytes))
|
|
38
|
+
throw invalidArgument('Must be a positive number', 'maxResponseBytes');
|
|
17
39
|
}
|
|
18
|
-
|
|
40
|
+
/** Fails with `FinTsTransportError` at the timeout or once `signal` is aborted; sends nothing if it is already. */
|
|
41
|
+
async post(url, body, contentType, signal) {
|
|
42
|
+
if (signal?.aborted)
|
|
43
|
+
throw new FinTsTransportError('Request aborted');
|
|
19
44
|
const controller = new AbortController();
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
reject(new FinTsTransportError('Request timed out'));
|
|
26
|
-
}, this.timeoutMs);
|
|
45
|
+
// Raced with the exchange, for a `fetch` that cannot abort a request.
|
|
46
|
+
const stopped = new Promise((_, reject) => {
|
|
47
|
+
controller.signal.addEventListener('abort', () => {
|
|
48
|
+
reject(controller.signal.reason);
|
|
49
|
+
});
|
|
27
50
|
});
|
|
51
|
+
const stop = (message) => () => {
|
|
52
|
+
controller.abort(new FinTsTransportError(message));
|
|
53
|
+
};
|
|
54
|
+
const timer = setTimeout(stop('Request timed out'), this.timeoutMs);
|
|
55
|
+
const abort = stop('Request aborted');
|
|
56
|
+
signal?.addEventListener('abort', abort);
|
|
28
57
|
try {
|
|
29
|
-
return await Promise.race([this.exchange(url, body, contentType, controller.signal),
|
|
58
|
+
return await Promise.race([this.exchange(url, body, contentType, controller.signal), stopped]);
|
|
30
59
|
}
|
|
31
60
|
catch (error) {
|
|
61
|
+
if (controller.signal.aborted)
|
|
62
|
+
throw controller.signal.reason;
|
|
32
63
|
if (error instanceof FinTsTransportError)
|
|
33
64
|
throw error;
|
|
34
|
-
|
|
35
|
-
throw new FinTsTransportError('Request timed out');
|
|
36
|
-
throw new FinTsTransportError(describe(error));
|
|
65
|
+
throw new FinTsTransportError(failureMessage(error));
|
|
37
66
|
}
|
|
38
67
|
finally {
|
|
39
68
|
clearTimeout(timer);
|
|
69
|
+
signal?.removeEventListener('abort', abort);
|
|
40
70
|
}
|
|
41
71
|
}
|
|
42
72
|
async exchange(url, body, contentType, signal) {
|
|
@@ -46,47 +76,114 @@ export class HttpTransport {
|
|
|
46
76
|
headers: { 'Content-Type': contentType, 'Cache-Control': 'no-cache', Pragma: 'no-cache' },
|
|
47
77
|
// The PIN travels in the body: never let the request be repeated at another address.
|
|
48
78
|
redirect: 'manual',
|
|
79
|
+
// In a browser: no cookies of the page and no referrer go with the PIN, and no cache keeps the exchange.
|
|
80
|
+
credentials: 'omit',
|
|
81
|
+
referrerPolicy: 'no-referrer',
|
|
82
|
+
cache: 'no-store',
|
|
49
83
|
signal,
|
|
50
84
|
});
|
|
51
85
|
if (response.type === 'opaqueredirect') {
|
|
52
86
|
throw new FinTsTransportError('The server redirects the request, which the client does not follow');
|
|
53
87
|
}
|
|
88
|
+
// A `fetch` that ignores `redirect`, as one over XMLHttpRequest does, shows a redirect it followed only here.
|
|
89
|
+
if (response.redirected || (response.url && response.url !== withoutFragment(url))) {
|
|
90
|
+
await discard(response);
|
|
91
|
+
throw new FinTsTransportError('The fetch followed a redirect: the request may have gone to another address');
|
|
92
|
+
}
|
|
54
93
|
if (response.status < 200 || response.status > 299) {
|
|
55
|
-
await response
|
|
56
|
-
throw new FinTsTransportError(`HTTP ${response.status} ${response.statusText}
|
|
94
|
+
await discard(response);
|
|
95
|
+
throw new FinTsTransportError(trimBlanks(`HTTP ${response.status} ${response.statusText}`), {
|
|
57
96
|
statusCode: response.status,
|
|
58
97
|
});
|
|
59
98
|
}
|
|
99
|
+
const announced = response.headers.get('Content-Length');
|
|
100
|
+
if (announced !== null && /^\d+$/.test(announced) && Number(announced) > this.maxResponseBytes) {
|
|
101
|
+
await discard(response);
|
|
102
|
+
throw this.tooLarge();
|
|
103
|
+
}
|
|
60
104
|
return this.readBody(response);
|
|
61
105
|
}
|
|
62
106
|
async readBody(response) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
107
|
+
// A `fetch` that does not stream, as one over XMLHttpRequest or node-fetch, gives no body or one of another kind.
|
|
108
|
+
const body = response.body;
|
|
109
|
+
if (typeof body?.getReader !== 'function') {
|
|
110
|
+
const bytes = new Uint8Array(await response.arrayBuffer());
|
|
111
|
+
if (bytes.length > this.maxResponseBytes)
|
|
112
|
+
throw this.tooLarge();
|
|
113
|
+
return bytes;
|
|
114
|
+
}
|
|
115
|
+
const reader = body.getReader();
|
|
116
|
+
// Copied as they arrive: many tiny chunks kept as they are would take many times the bytes they hold, and a `fetch`
|
|
117
|
+
// may refill the chunk it handed out.
|
|
118
|
+
let bytes = new Uint8Array(0);
|
|
67
119
|
let size = 0;
|
|
68
120
|
for (;;) {
|
|
69
121
|
const { done, value } = await reader.read();
|
|
70
122
|
if (done)
|
|
71
123
|
break;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
if (size > this.maxResponseBytes) {
|
|
124
|
+
const end = size + value.length;
|
|
125
|
+
if (end > this.maxResponseBytes) {
|
|
75
126
|
await reader.cancel().catch(() => undefined);
|
|
76
|
-
throw
|
|
127
|
+
throw this.tooLarge();
|
|
128
|
+
}
|
|
129
|
+
if (end > bytes.length) {
|
|
130
|
+
const grown = new Uint8Array(Math.min(Math.max(2 * bytes.length, end), this.maxResponseBytes));
|
|
131
|
+
grown.set(bytes.subarray(0, size));
|
|
132
|
+
bytes = grown;
|
|
77
133
|
}
|
|
134
|
+
bytes.set(value, size);
|
|
135
|
+
size = end;
|
|
78
136
|
}
|
|
79
|
-
return
|
|
137
|
+
return bytes.slice(0, size);
|
|
138
|
+
}
|
|
139
|
+
tooLarge() {
|
|
140
|
+
return new FinTsTransportError(`Response larger than ${this.maxResponseBytes} bytes`);
|
|
80
141
|
}
|
|
81
142
|
close() {
|
|
82
143
|
// `fetch` keeps no connection the transport could release.
|
|
83
144
|
}
|
|
84
145
|
}
|
|
85
|
-
/**
|
|
86
|
-
function
|
|
146
|
+
/** `url` as `Response.url` gives it: without fragment. */
|
|
147
|
+
function withoutFragment(url) {
|
|
148
|
+
const copy = new URL(url);
|
|
149
|
+
copy.hash = '';
|
|
150
|
+
return copy.href;
|
|
151
|
+
}
|
|
152
|
+
/** Cancels the body of a response the transport rejects, unless it cannot be cancelled, as a Node.js stream cannot. */
|
|
153
|
+
async function discard(response) {
|
|
154
|
+
try {
|
|
155
|
+
await response.body?.cancel();
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
// The response is rejected all the same.
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function isPositive(value) {
|
|
162
|
+
return Number.isFinite(value) && value > 0;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* The message of a failed request, with the reason its cause gives: Node.js reports `fetch failed` and the reason in the
|
|
166
|
+
* cause. Only messages and codes, since the error may hold the request, PIN and TAN included.
|
|
167
|
+
*/
|
|
168
|
+
export function failureMessage(error) {
|
|
87
169
|
if (!(error instanceof Error))
|
|
88
170
|
return String(error);
|
|
89
|
-
const
|
|
90
|
-
return
|
|
171
|
+
const reason = error.cause instanceof Error ? reasonOf(error.cause) : '';
|
|
172
|
+
return reason ? `${error.message}: ${reason}` : error.message;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* The message of `cause`, or where it has none, the distinct messages of its `errors` or its `code`: Node.js reports a
|
|
176
|
+
* failed connection to a host with IPv6 and IPv4 addresses as an `AggregateError` without a message.
|
|
177
|
+
*/
|
|
178
|
+
function reasonOf(cause) {
|
|
179
|
+
if (cause.message)
|
|
180
|
+
return cause.message;
|
|
181
|
+
if (cause instanceof AggregateError) {
|
|
182
|
+
const messages = cause.errors.flatMap((error) => (error instanceof Error && error.message ? [error.message] : []));
|
|
183
|
+
if (messages.length > 0)
|
|
184
|
+
return [...new Set(messages)].join('; ');
|
|
185
|
+
}
|
|
186
|
+
const code = cause.code;
|
|
187
|
+
return typeof code === 'string' ? code : '';
|
|
91
188
|
}
|
|
92
189
|
//# sourceMappingURL=transport.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../../src/core/transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../../src/core/transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAgDlD,mGAAmG;AACnG,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AAEjC;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,aAAa;IACf,SAAS,CAAS;IAClB,gBAAgB,CAAS;IACjB,OAAO,CAAe;IAEvC;;;OAGG;IACH,YAAY,UAAgC,EAAE;QAC5C,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;QAC7B,8FAA8F;QAC9F,IAAI,CAAC,OAAO,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,C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AAC;AAChE,CAAC;AAED;;;GAGG;AACH,SAAS,QAAQ,CAAC,KAAY;IAC5B,IAAI,KAAK,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC,OAAO,CAAC;IACxC,IAAI,KAAK,YAAY,cAAc,EAAE,CAAC;QACpC,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACnH,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpE,CAAC;IACD,MAAM,IAAI,GAAa,KAA4B,CAAC,IAAI,CAAC;IACzD,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;AAC9C,CAAC"}
|
package/dist/formats/camt.d.ts
CHANGED
|
@@ -1,12 +1,35 @@
|
|
|
1
1
|
import { Transaction, type TransactionStatus } from '../core/transaction.js';
|
|
2
|
-
|
|
2
|
+
import { RecordBudget } from './record-budget.js';
|
|
3
|
+
/** One report (camt.052), statement (camt.053) or notification (camt.054): the entries of one account. */
|
|
4
|
+
export interface CamtStatement {
|
|
5
|
+
/** The bank's identification of the statement (`Id`). */
|
|
6
|
+
readonly reference: string | undefined;
|
|
7
|
+
/** The account the statement is for: its IBAN, or the bank's other identification of it where it states none. */
|
|
8
|
+
readonly accountId: string | undefined;
|
|
9
|
+
/** The currency of the account, where the statement states it. */
|
|
10
|
+
readonly currency: string | undefined;
|
|
11
|
+
/** The transactions of the statement, in the order the bank lists them. */
|
|
12
|
+
readonly transactions: readonly Transaction[];
|
|
13
|
+
}
|
|
14
|
+
/** Parser for ISO 20022 camt.052, camt.053 and camt.054 account reports, statements and notifications. */
|
|
3
15
|
export declare const Camt: Readonly<{
|
|
4
16
|
/**
|
|
5
|
-
* Parses
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* `status` overrides the booking status stated in the entries.
|
|
17
|
+
* Parses the transactions of all statements in one list, which does not tell the account of each: a document may hold
|
|
18
|
+
* statements of several accounts, which `parse` keeps apart. Throws as `parse` does.
|
|
9
19
|
*/
|
|
10
20
|
parseTransactions(xml: string, status?: TransactionStatus): Transaction[];
|
|
21
|
+
/**
|
|
22
|
+
* Parses all statements, each with the account it is for. Throws `FormatError` for malformed XML, for XML nested more
|
|
23
|
+
* than 100 levels deep or of more than 500,000 nodes besides text or one per 16 characters, whichever is more, for a
|
|
24
|
+
* document without any statement, for an entry without amount, currency, credit/debit indicator or date, for a date
|
|
25
|
+
* it cannot read, for remittance information of more than 65,536 characters, and for more than 200,000 statements and
|
|
26
|
+
* transactions.
|
|
27
|
+
*
|
|
28
|
+
* `status` overrides the booking status stated in the entries, unless it is `undefined` or `null`; throws `TypeError`
|
|
29
|
+
* for one other than `booked` and `pending`.
|
|
30
|
+
*/
|
|
31
|
+
parse(xml: string, status?: TransactionStatus): CamtStatement[];
|
|
11
32
|
}>;
|
|
33
|
+
/** `Camt.parse`, which takes each statement and transaction from `budget`, before it builds it. */
|
|
34
|
+
export declare function parseCamt(xml: string, status: TransactionStatus | undefined, budget: RecordBudget): CamtStatement[];
|
|
12
35
|
//# sourceMappingURL=camt.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"camt.d.ts","sourceRoot":"","sources":["../../src/formats/camt.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"camt.d.ts","sourceRoot":"","sources":["../../src/formats/camt.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,WAAW,EAAE,KAAK,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAO5F,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,0GAA0G;AAC1G,MAAM,WAAW,aAAa;IAC5B,yDAAyD;IACzD,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,iHAAiH;IACjH,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,kEAAkE;IAClE,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,2EAA2E;IAC3E,QAAQ,CAAC,YAAY,EAAE,SAAS,WAAW,EAAE,CAAC;CAC/C;AAKD,0GAA0G;AAC1G,eAAO,MAAM,IAAI;IACf;;;OAGG;2BACoB,MAAM,WAAW,iBAAiB,GAAG,WAAW,EAAE;IAIzE;;;;;;;;;OASG;eACQ,MAAM,WAAW,iBAAiB,GAAG,aAAa,EAAE;EAG/D,CAAC;AAOH,mGAAmG;AACnG,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,GAAG,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,aAAa,EAAE,CAoBnH"}
|
package/dist/formats/camt.js
CHANGED
|
@@ -1,33 +1,72 @@
|
|
|
1
|
-
import { Amount } from '../core/amount.js';
|
|
2
|
-
import { Transaction } from '../core/transaction.js';
|
|
1
|
+
import { addsUpTo, Amount } from '../core/amount.js';
|
|
2
|
+
import { requireStatus, Transaction } from '../core/transaction.js';
|
|
3
3
|
import { parseIsoDate } from '../util/dates.js';
|
|
4
|
-
import { FormatError } from '../util/errors.js';
|
|
4
|
+
import { fail, FormatError } from '../util/errors.js';
|
|
5
|
+
import { frozenWithInspect } from '../util/inspect.js';
|
|
6
|
+
import { counted, maskedId, nonBlank, trimBlanks } from '../util/text.js';
|
|
5
7
|
import { parseXml } from '../util/xml.js';
|
|
8
|
+
import { maxFieldLength } from './mt940.js';
|
|
9
|
+
import { RecordBudget } from './record-budget.js';
|
|
6
10
|
import { providedReference, SepaPurpose } from './sepa-purpose.js';
|
|
7
|
-
/**
|
|
11
|
+
/** Local names of the elements of a document that hold the entries of one account. */
|
|
12
|
+
const statementNames = new Set(['Rpt', 'Stmt', 'Ntfctn']);
|
|
13
|
+
/** Parser for ISO 20022 camt.052, camt.053 and camt.054 account reports, statements and notifications. */
|
|
8
14
|
export const Camt = Object.freeze({
|
|
9
15
|
/**
|
|
10
|
-
* Parses
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* `status` overrides the booking status stated in the entries.
|
|
16
|
+
* Parses the transactions of all statements in one list, which does not tell the account of each: a document may hold
|
|
17
|
+
* statements of several accounts, which `parse` keeps apart. Throws as `parse` does.
|
|
14
18
|
*/
|
|
15
19
|
parseTransactions(xml, status) {
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
return Camt.parse(xml, status).flatMap((s) => s.transactions);
|
|
21
|
+
},
|
|
22
|
+
/**
|
|
23
|
+
* Parses all statements, each with the account it is for. Throws `FormatError` for malformed XML, for XML nested more
|
|
24
|
+
* than 100 levels deep or of more than 500,000 nodes besides text or one per 16 characters, whichever is more, for a
|
|
25
|
+
* document without any statement, for an entry without amount, currency, credit/debit indicator or date, for a date
|
|
26
|
+
* it cannot read, for remittance information of more than 65,536 characters, and for more than 200,000 statements and
|
|
27
|
+
* transactions.
|
|
28
|
+
*
|
|
29
|
+
* `status` overrides the booking status stated in the entries, unless it is `undefined` or `null`; throws `TypeError`
|
|
30
|
+
* for one other than `booked` and `pending`.
|
|
31
|
+
*/
|
|
32
|
+
parse(xml, status) {
|
|
33
|
+
return parseCamt(xml, forcedStatus(status), new RecordBudget());
|
|
18
34
|
},
|
|
19
35
|
});
|
|
36
|
+
/** The `status` of `Camt.parse`; `undefined` for `null`, the status the entries state. */
|
|
37
|
+
function forcedStatus(status) {
|
|
38
|
+
return status === undefined || status === null ? undefined : requireStatus(status);
|
|
39
|
+
}
|
|
40
|
+
/** `Camt.parse`, which takes each statement and transaction from `budget`, before it builds it. */
|
|
41
|
+
export function parseCamt(xml, status, budget) {
|
|
42
|
+
const root = parseXml(trimBlanks(xml));
|
|
43
|
+
const statements = root.childElements.flatMap((message) => message.childElements.filter((c) => statementNames.has(c.localName)));
|
|
44
|
+
if (statements.length === 0)
|
|
45
|
+
throw new FormatError('camt document without report, statement or notification');
|
|
46
|
+
return statements.map((statement) => {
|
|
47
|
+
budget.take();
|
|
48
|
+
const account = statement.child('Acct');
|
|
49
|
+
const entries = statement.childrenNamed('Ntry');
|
|
50
|
+
return frozenWithInspect({
|
|
51
|
+
reference: statement.textAt(['Id']),
|
|
52
|
+
accountId: account?.textAt(['Id', 'IBAN']) ?? account?.textAt(['Id', 'Othr', 'Id']),
|
|
53
|
+
currency: account?.textAt(['Ccy']),
|
|
54
|
+
transactions: Object.freeze(entries.flatMap((entry) => new CamtEntry(entry, status, budget).transactions())),
|
|
55
|
+
}, (s) => `CamtStatement(${maskedId(s.accountId ?? '')}, ${counted(s.transactions.length, 'transaction')})`);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
20
58
|
/** Width of the purpose lines banks cut the remittance information into, as in MT940 and DTAUS. */
|
|
21
59
|
const cutLineLength = 35;
|
|
22
60
|
/**
|
|
23
|
-
* One booking (`Ntry`) of a report; a batch booking yields one transaction per transaction detail (`TxDtls`) when
|
|
24
|
-
*
|
|
61
|
+
* One booking (`Ntry`) of a report; a batch booking yields one transaction per transaction detail (`TxDtls`) when the
|
|
62
|
+
* details state their amounts and these add up to the booked amount.
|
|
25
63
|
*
|
|
26
64
|
* Nothing is guessed: what the entry lacks, and what the reader needs, is a `FormatError`. The one exception is the
|
|
27
65
|
* value date, which `Transaction.valueDate` requires: an entry with a booking date only takes that.
|
|
28
66
|
*/
|
|
29
67
|
class CamtEntry {
|
|
30
68
|
entry;
|
|
69
|
+
budget;
|
|
31
70
|
amountElement;
|
|
32
71
|
currency;
|
|
33
72
|
debit;
|
|
@@ -35,10 +74,13 @@ class CamtEntry {
|
|
|
35
74
|
status;
|
|
36
75
|
bookingDate;
|
|
37
76
|
valueDate;
|
|
77
|
+
bookingText;
|
|
78
|
+
bankReference;
|
|
38
79
|
/** German banks send `transaction type+GVC+prima nota`, for example `NDDT+105+9310`. */
|
|
39
80
|
proprietaryCode;
|
|
40
|
-
constructor(entry, forcedStatus) {
|
|
81
|
+
constructor(entry, forcedStatus, budget) {
|
|
41
82
|
this.entry = entry;
|
|
83
|
+
this.budget = budget;
|
|
42
84
|
this.amountElement = entry.child('Amt') ?? fail('camt entry without amount');
|
|
43
85
|
this.currency = this.amountElement.getAttribute('Ccy') ?? fail('camt amount without currency');
|
|
44
86
|
this.debit = debitIndicator(entry.textAt(['CdtDbtInd'])) ?? fail('camt entry without credit/debit indicator');
|
|
@@ -46,6 +88,8 @@ class CamtEntry {
|
|
|
46
88
|
this.status = forcedStatus ?? this.statusOfEntry();
|
|
47
89
|
this.bookingDate = dateOf(entry.child('BookgDt'));
|
|
48
90
|
this.valueDate = dateOf(entry.child('ValDt')) ?? this.bookingDate ?? fail('camt entry without date');
|
|
91
|
+
this.bookingText = entry.textAt(['AddtlNtryInf']);
|
|
92
|
+
this.bankReference = entry.textAt(['AcctSvcrRef']);
|
|
49
93
|
this.proprietaryCode = entry.textAt(['BkTxCd', 'Prtry', 'Cd'])?.split('+') ?? [];
|
|
50
94
|
}
|
|
51
95
|
statusOfEntry() {
|
|
@@ -53,48 +97,53 @@ class CamtEntry {
|
|
|
53
97
|
return code === 'PDNG' || code === 'INFO' ? 'pending' : 'booked';
|
|
54
98
|
}
|
|
55
99
|
transactions() {
|
|
56
|
-
const total =
|
|
57
|
-
const details = this.entry.
|
|
100
|
+
const total = amountOf(this.amountElement, this.currency);
|
|
101
|
+
const details = this.entry.childrenNamed('NtryDtls').flatMap((d) => d.childrenNamed('TxDtls'));
|
|
58
102
|
if (details.length <= 1)
|
|
59
103
|
return [this.transaction(details[0], total, this.debit)];
|
|
104
|
+
// A batch is split only into details that make up its booking: each states its amount, and they add up to the
|
|
105
|
+
// booked one, in its currency. It stays one booking otherwise, without the details of any one of them, which would
|
|
106
|
+
// describe the others wrongly.
|
|
107
|
+
const booking = this.transaction(undefined, total, this.debit);
|
|
60
108
|
const amounts = details.map((detail) => detail.at(['AmtDtls', 'TxAmt', 'Amt']) ?? detail.child('Amt'));
|
|
61
|
-
// Without the amount of every detail the batch cannot be split. It stays one booking then, without the details of
|
|
62
|
-
// any one of them, which would describe the others wrongly.
|
|
63
109
|
if (amounts.includes(undefined))
|
|
64
|
-
return [
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
});
|
|
110
|
+
return [booking];
|
|
111
|
+
const split = details.map((detail, i) => this.transaction(detail, amountOf(amounts[i], this.currency),
|
|
112
|
+
// A detail may book in the other direction than the batch as a whole.
|
|
113
|
+
debitIndicator(detail.textAt(['CdtDbtInd'])) ?? this.debit));
|
|
114
|
+
const parts = split.map((t) => t.amount);
|
|
115
|
+
return addsUpTo(parts, booking.amount) ? split : [booking];
|
|
71
116
|
}
|
|
72
117
|
/** A transaction of `amount`, booked as a debit if `debit`, with what `details` tell about it. */
|
|
73
118
|
transaction(details, amount, debit) {
|
|
119
|
+
this.budget.take();
|
|
74
120
|
const parties = details?.child('RltdPties');
|
|
75
121
|
const agents = details?.child('RltdAgts');
|
|
76
122
|
// The related parties describe the original operation, which a reversal books the other way round (ISO 20022
|
|
77
123
|
// `RvslInd`: with `CRDT` the original operation was a debit, with `DBIT` a credit).
|
|
78
124
|
const originalDebit = debit !== this.reversal;
|
|
79
125
|
const counterparty = originalDebit ? 'Cdtr' : 'Dbtr';
|
|
80
|
-
const lines = (details?.
|
|
81
|
-
.map((line) => line.innerText
|
|
82
|
-
.filter((text) => text !== '');
|
|
83
|
-
|
|
84
|
-
|
|
126
|
+
const lines = (details?.child('RmtInf')?.childrenNamed('Ustrd') ?? [])
|
|
127
|
+
.map((line) => line.innerText)
|
|
128
|
+
.filter((text) => trimBlanks(text) !== '');
|
|
129
|
+
// A line of 35 characters goes on in the next one as it is, maybe in the middle of a word or before a blank; any
|
|
130
|
+
// other line ends a phrase, which the next one follows after a blank.
|
|
131
|
+
const cut = (i) => lines[i]?.length === cutLineLength;
|
|
132
|
+
const purposeParts = lines.map((line, i) => {
|
|
133
|
+
const part = cut(i) ? line : trimBlanks(line, { start: false });
|
|
134
|
+
return i === 0 || cut(i - 1) ? part : ` ${trimBlanks(part, { end: false })}`;
|
|
135
|
+
});
|
|
136
|
+
const remittance = purposeParts.join('');
|
|
137
|
+
// As long as an MT940 field: the keywords of megabytes of text would take memory without limit.
|
|
138
|
+
if (remittance.length > maxFieldLength)
|
|
139
|
+
throw new FormatError('camt remittance information too long');
|
|
85
140
|
const keywords = SepaPurpose.parseParts(purposeParts);
|
|
86
141
|
const endToEndId = providedReference(details?.textAt(['Refs', 'EndToEndId']));
|
|
87
142
|
const mandateId = details?.textAt(['Refs', 'MndtId']);
|
|
88
|
-
const creditorId = creditorIdOf(parties);
|
|
143
|
+
const creditorId = creditorIdOf(parties?.child('Cdtr'));
|
|
89
144
|
const purposeCode = details?.textAt(['Purp', 'Cd']);
|
|
90
145
|
const typeId = this.proprietaryCode[0]?.length === 4 ? this.proprietaryCode[0] : undefined;
|
|
91
|
-
const purposeCodes =
|
|
92
|
-
if (endToEndId !== undefined)
|
|
93
|
-
purposeCodes.set('EREF', endToEndId);
|
|
94
|
-
if (mandateId !== undefined)
|
|
95
|
-
purposeCodes.set('MREF', mandateId);
|
|
96
|
-
if (creditorId !== undefined)
|
|
97
|
-
purposeCodes.set('CRED', creditorId);
|
|
146
|
+
const purposeCodes = withKeywordsStatedApart(keywords, { EREF: endToEndId, MREF: mandateId, CRED: creditorId });
|
|
98
147
|
if (purposeCode !== undefined)
|
|
99
148
|
purposeCodes.set('PURP', purposeCode);
|
|
100
149
|
return new Transaction({
|
|
@@ -103,8 +152,11 @@ class CamtEntry {
|
|
|
103
152
|
valueDate: this.valueDate,
|
|
104
153
|
amount: debit ? amount.negate() : amount,
|
|
105
154
|
isReversal: this.reversal,
|
|
106
|
-
bookingText: this.
|
|
107
|
-
purpose: keywords.get('SVWZ') ??
|
|
155
|
+
bookingText: this.bookingText ?? details?.textAt(['AddtlTxInf']),
|
|
156
|
+
purpose: keywords.get('SVWZ') ??
|
|
157
|
+
nonBlank(remittance) ??
|
|
158
|
+
details?.textAt(['RmtInf', 'Strd', 'CdtrRefInf', 'Ref']) ??
|
|
159
|
+
details?.textAt(['AddtlTxInf']),
|
|
108
160
|
counterpartyName: partyName(parties?.child(counterparty)),
|
|
109
161
|
counterpartyIban: parties?.child(`${counterparty}Acct`)?.textAt(['Id', 'IBAN']),
|
|
110
162
|
counterpartyAccountNumber: parties?.child(`${counterparty}Acct`)?.textAt(['Id', 'Othr', 'Id']),
|
|
@@ -113,7 +165,7 @@ class CamtEntry {
|
|
|
113
165
|
mandateId,
|
|
114
166
|
creditorId,
|
|
115
167
|
customerReference: details?.textAt(['Refs', 'InstrId']) ?? details?.textAt(['Refs', 'PmtInfId']),
|
|
116
|
-
bankReference: details?.textAt(['Refs', 'AcctSvcrRef']) ?? this.
|
|
168
|
+
bankReference: details?.textAt(['Refs', 'AcctSvcrRef']) ?? this.bankReference,
|
|
117
169
|
transactionCode: this.proprietaryCode[1],
|
|
118
170
|
transactionTypeId: typeId,
|
|
119
171
|
primaNota: this.proprietaryCode[2],
|
|
@@ -123,8 +175,30 @@ class CamtEntry {
|
|
|
123
175
|
});
|
|
124
176
|
}
|
|
125
177
|
}
|
|
126
|
-
|
|
127
|
-
|
|
178
|
+
/**
|
|
179
|
+
* The amount `element` states, in its currency or else in `currency`; throws `FormatError` for a negative one, whose
|
|
180
|
+
* sign the credit/debit indicator would turn: the indicator alone gives the direction.
|
|
181
|
+
*/
|
|
182
|
+
function amountOf(element, currency) {
|
|
183
|
+
const amount = Amount.parseDecimal(element.innerText, element.getAttribute('Ccy') ?? currency);
|
|
184
|
+
if (amount.isNegative)
|
|
185
|
+
throw new FormatError('Negative camt amount', element.innerText);
|
|
186
|
+
return amount;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* `keywords` with the values of EREF, MREF and CRED that the bank `stated` apart, as `endToEndId`, `mandateId` and
|
|
190
|
+
* `creditorId`, in the place the text gives them, and without those it does not state: in the remittance text, which
|
|
191
|
+
* the payer or the payee writes, a creditor ID or mandate reference could be that of a creditor the app trusts.
|
|
192
|
+
*/
|
|
193
|
+
function withKeywordsStatedApart(keywords, stated) {
|
|
194
|
+
const codes = new Map(keywords);
|
|
195
|
+
for (const [keyword, value] of Object.entries(stated)) {
|
|
196
|
+
if (value === undefined)
|
|
197
|
+
codes.delete(keyword);
|
|
198
|
+
else
|
|
199
|
+
codes.set(keyword, value);
|
|
200
|
+
}
|
|
201
|
+
return codes;
|
|
128
202
|
}
|
|
129
203
|
/** `true` for `DBIT`, `false` for `CRDT`, `undefined` if `indicator` is missing; throws for any other value. */
|
|
130
204
|
function debitIndicator(indicator) {
|
|
@@ -139,8 +213,15 @@ function debitIndicator(indicator) {
|
|
|
139
213
|
throw new FormatError('camt credit/debit indicator is neither CRDT nor DBIT', indicator);
|
|
140
214
|
}
|
|
141
215
|
}
|
|
216
|
+
/**
|
|
217
|
+
* The calendar date of `e`: its date (`Dt`), or else its date and time (`DtTm`), both read by `parseIsoDate`, so that
|
|
218
|
+
* a date and time, which may be stated in UTC or another offset, counts on its German day; `undefined` if it states
|
|
219
|
+
* neither. Throws `FormatError` for one it cannot read, which would pass for a missing one otherwise, such as a value
|
|
220
|
+
* date the booking date stands in for.
|
|
221
|
+
*/
|
|
142
222
|
function dateOf(e) {
|
|
143
|
-
|
|
223
|
+
const date = e?.textAt(['Dt']) ?? e?.textAt(['DtTm']);
|
|
224
|
+
return date === undefined ? undefined : (parseIsoDate(date) ?? fail('Unreadable camt date', date));
|
|
144
225
|
}
|
|
145
226
|
function partyName(party) {
|
|
146
227
|
return party?.textAt(['Nm']) ?? party?.textAt(['Pty', 'Nm']);
|
|
@@ -148,12 +229,13 @@ function partyName(party) {
|
|
|
148
229
|
function bicOf(agent) {
|
|
149
230
|
return agent?.textAt(['FinInstnId', 'BIC']) ?? agent?.textAt(['FinInstnId', 'BICFI']);
|
|
150
231
|
}
|
|
151
|
-
/**
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
232
|
+
/**
|
|
233
|
+
* The SEPA creditor identifier of the `creditor`: its private `Othr` identification in the scheme `SEPA`. The other
|
|
234
|
+
* parties' identifications are the creditor's or the debtor's to choose, and may be in that scheme as well.
|
|
235
|
+
*/
|
|
236
|
+
function creditorIdOf(creditor) {
|
|
237
|
+
const identifications = creditor?.at(['Id', 'PrvtId']) ?? creditor?.at(['Pty', 'Id', 'PrvtId']);
|
|
238
|
+
const sepa = identifications?.childrenNamed('Othr').find((other) => other.textAt(['SchmeNm', 'Prtry']) === 'SEPA');
|
|
239
|
+
return sepa?.textAt(['Id']);
|
|
158
240
|
}
|
|
159
241
|
//# sourceMappingURL=camt.js.map
|
package/dist/formats/camt.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"camt.js","sourceRoot":"","sources":["../../src/formats/camt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAA0B,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAmB,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEnE,kEAAkE;AAClE,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC;IAChC;;;;;OAKG;IACH,iBAAiB,CAAC,GAAW,EAAE,MAA0B;QACvD,MAAM,IAAI,GAAG,QAAQ,C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