@coderoftime/fints 0.1.0 → 0.2.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 +142 -1
- package/README.md +127 -37
- package/dist/client.d.ts +48 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +199 -0
- package/dist/client.js.map +1 -0
- package/dist/core/account.d.ts +35 -7
- package/dist/core/account.d.ts.map +1 -1
- package/dist/core/account.js +84 -13
- package/dist/core/account.js.map +1 -1
- package/dist/core/amount.d.ts +2 -1
- package/dist/core/amount.d.ts.map +1 -1
- package/dist/core/amount.js +4 -1
- package/dist/core/amount.js.map +1 -1
- package/dist/core/balance.d.ts +1 -0
- package/dist/core/balance.d.ts.map +1 -1
- package/dist/core/balance.js +6 -5
- package/dist/core/balance.js.map +1 -1
- package/dist/core/bank-info.d.ts +1 -1
- package/dist/core/bank-info.js +1 -1
- package/dist/core/client.d.ts +50 -15
- package/dist/core/client.d.ts.map +1 -1
- package/dist/core/config.d.ts +28 -16
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +66 -26
- package/dist/core/config.js.map +1 -1
- package/dist/core/errors.d.ts +85 -23
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +112 -47
- package/dist/core/errors.js.map +1 -1
- package/dist/core/feedback.d.ts +4 -1
- package/dist/core/feedback.d.ts.map +1 -1
- package/dist/core/feedback.js +4 -1
- package/dist/core/feedback.js.map +1 -1
- package/dist/core/transaction.d.ts +6 -1
- package/dist/core/transaction.d.ts.map +1 -1
- package/dist/core/transaction.js +9 -4
- package/dist/core/transaction.js.map +1 -1
- package/dist/core/transport.d.ts +33 -6
- package/dist/core/transport.d.ts.map +1 -1
- package/dist/core/transport.js +77 -20
- package/dist/core/transport.js.map +1 -1
- package/dist/formats/camt.d.ts +24 -4
- package/dist/formats/camt.d.ts.map +1 -1
- package/dist/formats/camt.js +124 -41
- package/dist/formats/camt.js.map +1 -1
- package/dist/formats/mt940.d.ts +15 -3
- package/dist/formats/mt940.d.ts.map +1 -1
- package/dist/formats/mt940.js +161 -82
- 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 +24 -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 +6 -0
- package/dist/formats/sepa-purpose.d.ts.map +1 -1
- package/dist/formats/sepa-purpose.js +23 -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 +7 -10
- package/dist/session/dialog-runner.d.ts.map +1 -1
- package/dist/session/dialog-runner.js +15 -16
- 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 +156 -84
- 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 +33 -25
- package/dist/session/session-setup.d.ts.map +1 -1
- package/dist/session/session-setup.js +87 -65
- package/dist/session/session-setup.js.map +1 -1
- package/dist/session/session-state.d.ts +9 -6
- package/dist/session/session-state.d.ts.map +1 -1
- package/dist/session/session-state.js +52 -17
- package/dist/session/session-state.js.map +1 -1
- package/dist/session/signed-dialog.d.ts +77 -0
- package/dist/session/signed-dialog.d.ts.map +1 -0
- package/dist/session/signed-dialog.js +170 -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 +8 -4
- package/dist/session/user-prompts.d.ts.map +1 -1
- package/dist/session/user-prompts.js +34 -14
- package/dist/session/user-prompts.js.map +1 -1
- package/dist/tan/challenge.d.ts +34 -13
- package/dist/tan/challenge.d.ts.map +1 -1
- package/dist/tan/challenge.js +25 -26
- package/dist/tan/challenge.js.map +1 -1
- package/dist/tan/flicker.d.ts +7 -1
- package/dist/tan/flicker.d.ts.map +1 -1
- package/dist/tan/flicker.js +40 -6
- package/dist/tan/flicker.js.map +1 -1
- package/dist/tan/tan-image.d.ts +3 -2
- package/dist/tan/tan-image.d.ts.map +1 -1
- package/dist/tan/tan-image.js +7 -5
- package/dist/tan/tan-image.js.map +1 -1
- package/dist/tan/tan-models.d.ts +5 -1
- package/dist/tan/tan-models.d.ts.map +1 -1
- package/dist/tan/tan-models.js +10 -5
- package/dist/tan/tan-models.js.map +1 -1
- package/dist/util/async.d.ts +0 -2
- package/dist/util/async.d.ts.map +1 -1
- package/dist/util/async.js +0 -4
- package/dist/util/async.js.map +1 -1
- package/dist/util/bytes.d.ts +2 -3
- package/dist/util/bytes.d.ts.map +1 -1
- package/dist/util/bytes.js +12 -20
- 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 +9 -16
- package/dist/util/dates.d.ts.map +1 -1
- package/dist/util/dates.js +39 -19
- package/dist/util/dates.js.map +1 -1
- package/dist/util/errors.d.ts +9 -1
- package/dist/util/errors.d.ts.map +1 -1
- package/dist/util/errors.js +12 -3
- package/dist/util/errors.js.map +1 -1
- 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 +21 -4
- package/dist/util/text.d.ts.map +1 -1
- package/dist/util/text.js +42 -13
- package/dist/util/text.js.map +1 -1
- package/dist/util/xml.d.ts +4 -3
- package/dist/util/xml.d.ts.map +1 -1
- package/dist/util/xml.js +37 -26
- 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 +34 -0
- package/dist/v3/bank-connection.d.ts.map +1 -0
- package/dist/v3/bank-connection.js +58 -0
- package/dist/v3/bank-connection.js.map +1 -0
- package/dist/v3/dialog.d.ts +80 -46
- package/dist/v3/dialog.d.ts.map +1 -1
- package/dist/v3/dialog.js +162 -59
- package/dist/v3/dialog.js.map +1 -1
- package/dist/v3/message.d.ts +17 -4
- package/dist/v3/message.d.ts.map +1 -1
- package/dist/v3/message.js +62 -18
- package/dist/v3/message.js.map +1 -1
- package/dist/v3/parameter-store.d.ts +75 -0
- package/dist/v3/parameter-store.d.ts.map +1 -0
- package/dist/v3/parameter-store.js +143 -0
- package/dist/v3/parameter-store.js.map +1 -0
- package/dist/v3/parameters.d.ts +38 -12
- package/dist/v3/parameters.d.ts.map +1 -1
- package/dist/v3/parameters.js +91 -37
- package/dist/v3/parameters.js.map +1 -1
- package/dist/v3/protocol.d.ts +43 -50
- package/dist/v3/protocol.d.ts.map +1 -1
- package/dist/v3/protocol.js +58 -208
- 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 +120 -0
- package/dist/v3/queries.js.map +1 -0
- package/dist/v3/segments.d.ts +29 -12
- package/dist/v3/segments.d.ts.map +1 -1
- package/dist/v3/segments.js +65 -23
- package/dist/v3/segments.js.map +1 -1
- package/dist/v3/syntax.d.ts +65 -14
- package/dist/v3/syntax.d.ts.map +1 -1
- package/dist/v3/syntax.js +167 -101
- package/dist/v3/syntax.js.map +1 -1
- package/package.json +10 -6
- package/src/client.ts +252 -0
- package/src/core/account.ts +86 -13
- package/src/core/amount.ts +3 -1
- package/src/core/balance.ts +6 -5
- package/src/core/bank-info.ts +1 -1
- package/src/core/client.ts +52 -15
- package/src/core/config.ts +69 -28
- package/src/core/errors.ts +122 -48
- package/src/core/feedback.ts +4 -1
- package/src/core/transaction.ts +9 -4
- package/src/core/transport.ts +98 -23
- package/src/formats/camt.ts +136 -39
- package/src/formats/mt940.ts +167 -81
- package/src/formats/readers.ts +24 -31
- package/src/formats/record-budget.ts +18 -0
- package/src/formats/sepa-purpose.ts +21 -2
- package/src/index.ts +4 -2
- package/src/session/app-approval.ts +51 -38
- package/src/session/dialog-runner.ts +31 -28
- package/src/session/login-guard.ts +174 -88
- package/src/session/sepa-accounts.ts +63 -45
- package/src/session/session-setup.ts +90 -71
- package/src/session/session-state.ts +56 -22
- package/src/session/signed-dialog.ts +192 -0
- package/src/session/tan-selection.ts +50 -39
- package/src/session/user-prompts.ts +35 -16
- package/src/tan/challenge.ts +40 -31
- package/src/tan/flicker.ts +44 -6
- package/src/tan/tan-image.ts +7 -5
- package/src/tan/tan-models.ts +10 -5
- package/src/util/async.ts +0 -5
- package/src/util/bytes.ts +13 -19
- package/src/util/call-context.ts +3 -2
- package/src/util/dates.ts +41 -24
- package/src/util/errors.ts +14 -3
- package/src/util/json.ts +16 -0
- package/src/util/text.ts +42 -12
- package/src/util/xml.ts +37 -26
- package/src/v3/account-extension.ts +7 -12
- package/src/v3/bank-connection.ts +67 -0
- package/src/v3/dialog.ts +175 -91
- package/src/v3/message.ts +69 -17
- package/src/v3/parameter-store.ts +160 -0
- package/src/v3/parameters.ts +110 -37
- package/src/v3/protocol.ts +70 -253
- package/src/v3/queries.ts +190 -0
- package/src/v3/segments.ts +65 -22
- package/src/v3/syntax.ts +153 -91
- 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/balance.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"balance.js","sourceRoot":"","sources":["../../src/core/balance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"balance.js","sourceRoot":"","sources":["../../src/core/balance.ts"],"names":[],"mappings":"AAAA,OAAO,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,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;IACtC,CAAC;IAED;;;OAGG;IACH,QAAQ;QACN,OAAO,WAAW,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;IAClF,CAAC;CACF"}
|
package/dist/core/bank-info.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export declare class BankInfo {
|
|
|
19
19
|
readonly minTimeout: number | undefined;
|
|
20
20
|
/**
|
|
21
21
|
* Time in seconds after which the bank will likely end a dialog without messages, `0` for no limit (HIBPA, Formals
|
|
22
|
-
* C.9). The client starts a new dialog for a call after that time.
|
|
22
|
+
* C.9). The client starts a new dialog for a call after that time, or after 5 minutes where the bank states none.
|
|
23
23
|
*/
|
|
24
24
|
readonly maxTimeout: number | undefined;
|
|
25
25
|
constructor(init: {
|
package/dist/core/bank-info.js
CHANGED
|
@@ -19,7 +19,7 @@ export class BankInfo {
|
|
|
19
19
|
minTimeout;
|
|
20
20
|
/**
|
|
21
21
|
* Time in seconds after which the bank will likely end a dialog without messages, `0` for no limit (HIBPA, Formals
|
|
22
|
-
* C.9). The client starts a new dialog for a call after that time.
|
|
22
|
+
* C.9). The client starts a new dialog for a call after that time, or after 5 minutes where the bank states none.
|
|
23
23
|
*/
|
|
24
24
|
maxTimeout;
|
|
25
25
|
constructor(init) {
|
package/dist/core/client.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { TanMedium, TanMethod } from '../tan/tan-models.js';
|
|
|
3
3
|
import type { Account } from './account.js';
|
|
4
4
|
import type { Balance } from './balance.js';
|
|
5
5
|
import type { BankInfo, BankMessage } from './bank-info.js';
|
|
6
|
+
import type { FinTsLoginRefusedError } from './errors.js';
|
|
6
7
|
import type { FinTsFeedback } from './feedback.js';
|
|
7
8
|
import type { Transaction, TransactionFormat } from './transaction.js';
|
|
8
9
|
import type { FinTsTransport } from './transport.js';
|
|
@@ -38,9 +39,15 @@ export interface FinTsClientOptions {
|
|
|
38
39
|
/** Receives every FinTS message with PIN and TAN masked, for diagnosis; the messages contain account data. */
|
|
39
40
|
logger?: MessageLogger;
|
|
40
41
|
/**
|
|
41
|
-
* The `FinTsClient.state` of a previous session, which skips the bank setup steps.
|
|
42
|
+
* The `FinTsClient.state` of a previous session, which skips the bank setup steps. A refused login in it keeps the
|
|
43
|
+
* client from sending the PIN (`FinTsClient.loginRefusal`).
|
|
42
44
|
*
|
|
43
|
-
* A state
|
|
45
|
+
* A state belongs to one client at a time: restore the clients of one bank user one after another, each from the
|
|
46
|
+
* state the one before saved, never two at once from the same state. The state saved last wins, and could lift a
|
|
47
|
+
* refused login the other client saved.
|
|
48
|
+
*
|
|
49
|
+
* A state saved for another user or bank is ignored, and of one saved for another server of the bank, such as before
|
|
50
|
+
* the bank moved its FinTS URL, only the refused login holds.
|
|
44
51
|
*/
|
|
45
52
|
state?: string | undefined;
|
|
46
53
|
/**
|
|
@@ -62,21 +69,31 @@ export interface TransactionQuery {
|
|
|
62
69
|
/**
|
|
63
70
|
* Read access to a bank account over FinTS.
|
|
64
71
|
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
72
|
+
* A call logs in where it needs to, which sends the PIN and may ask the callbacks for a TAN method, a TAN medium and an
|
|
73
|
+
* approval. Calls share one bank dialog while it is open, so that the approval of its login serves them all. The next
|
|
74
|
+
* call logs in anew, which may ask for another approval, once the dialog has idled longer than `BankInfo.maxTimeout`,
|
|
75
|
+
* after `selectTanMethod` and `clearLoginRefusal`, once the bank has ended the dialog, and after a message failed with
|
|
76
|
+
* another error than the bank's (`FinTsBankError`), such as a cancelled approval or a broken connection. Calls run one
|
|
77
|
+
* after another; call `close` when done.
|
|
67
78
|
*
|
|
68
79
|
* A callback in `FinTsClientOptions` must not wait for another call of its client, which would wait for the running
|
|
69
|
-
* call. On Node.js, Deno and Bun such a call fails with `FinTsStateError`; elsewhere it
|
|
70
|
-
* from anywhere.
|
|
80
|
+
* call. On Node.js, Deno 2.1 and Bun 1.2.6 or later such a call fails with `FinTsStateError`; elsewhere it waits
|
|
81
|
+
* forever. `close` works from anywhere.
|
|
71
82
|
*/
|
|
72
83
|
export interface FinTsClient {
|
|
73
84
|
/**
|
|
74
85
|
* Serialized session data: bank and user parameters, customer system ID, the TAN methods the user may use, the chosen
|
|
75
|
-
* TAN method and medium,
|
|
86
|
+
* TAN method and medium, the SEPA account list, and a refused login (`loginRefusal`).
|
|
76
87
|
*
|
|
77
|
-
* Contains no PIN or TAN, but account details, so store it encrypted.
|
|
88
|
+
* Contains no PIN or TAN, but account details, so store it encrypted. It holds what this client knows, and replaces
|
|
89
|
+
* the state it was restored from: one client at a time per state (`FinTsClientOptions.state`).
|
|
78
90
|
*/
|
|
79
91
|
readonly state: string;
|
|
92
|
+
/**
|
|
93
|
+
* The refused login that keeps the client from sending the PIN again (`FinTsLoginRefusedError`); `undefined` while
|
|
94
|
+
* there is none. It is kept in `state` until `clearLoginRefusal`.
|
|
95
|
+
*/
|
|
96
|
+
readonly loginRefusal: FinTsLoginRefusedError | undefined;
|
|
80
97
|
/** Security function code of the TAN method in use, for example `942`; `undefined` before the first login. */
|
|
81
98
|
readonly selectedTanMethod: string | undefined;
|
|
82
99
|
/** Name of the TAN medium sent to the bank, if the method needs one. */
|
|
@@ -88,9 +105,23 @@ export interface FinTsClient {
|
|
|
88
105
|
* `securityFunction`, the client picks another method at that login.
|
|
89
106
|
*/
|
|
90
107
|
selectTanMethod(securityFunction: string, tanMedium?: string): Promise<void>;
|
|
108
|
+
/**
|
|
109
|
+
* Lifts `loginRefusal` and signs with `pin` from now on. Ends the current dialog, so that the next call logs in with
|
|
110
|
+
* it, and forgets the TAN medium, which the bank may have refused, such as that of a phone the user has replaced: where
|
|
111
|
+
* the TAN method needs one, the next call looks the media up anew and asks the `tanMediumSelector`.
|
|
112
|
+
*
|
|
113
|
+
* Pass a PIN the user has entered after the refusal, never a stored one unasked: banks lock the access after a few
|
|
114
|
+
* failed logins. Rejects with `TypeError` for a PIN the client cannot send, as its constructor throws, and with the
|
|
115
|
+
* refusal where it is a `FinTsLoginDataChangedError`: only a new client with the new login data can log in.
|
|
116
|
+
*/
|
|
117
|
+
clearLoginRefusal(pin: string): Promise<void>;
|
|
91
118
|
/** General information about the bank, from the bank parameter data. */
|
|
92
119
|
getBankInfo(): Promise<BankInfo>;
|
|
93
|
-
/**
|
|
120
|
+
/**
|
|
121
|
+
* TAN procedures the bank allows for this user, which the synchronization reports. Where the session has no customer
|
|
122
|
+
* system ID yet, as without a saved state, this call logs in for it: it may ask `tanMethodSelector` where the bank
|
|
123
|
+
* refuses the one-step method, and `tanCallback` for an approval.
|
|
124
|
+
*/
|
|
94
125
|
getTanMethods(): Promise<TanMethod[]>;
|
|
95
126
|
/** TAN devices registered for this user. */
|
|
96
127
|
getTanMedia(): Promise<TanMedium[]>;
|
|
@@ -102,7 +133,8 @@ export interface FinTsClient {
|
|
|
102
133
|
* Where the user parameter data carry the complete balance (account extension), possibly from the saved `state`, it
|
|
103
134
|
* comes from there without a query; `Balance.bookedAsOf` tells the day it states.
|
|
104
135
|
*
|
|
105
|
-
*
|
|
136
|
+
* Rejects with `FinTsUnsupportedError` where the parameter data rule the query out, without sending it; the login,
|
|
137
|
+
* which delivers them, may have gone out.
|
|
106
138
|
*/
|
|
107
139
|
getBalance(account: Account): Promise<Balance>;
|
|
108
140
|
/**
|
|
@@ -110,16 +142,19 @@ export interface FinTsClient {
|
|
|
110
142
|
* the same day in the bank's order.
|
|
111
143
|
*
|
|
112
144
|
* Only the local calendar day counts, and a day in the future counts as today. Banks typically ask for a TAN when
|
|
113
|
-
* `from` is more than 90 days ago; see also `Account.dataStatus`.
|
|
114
|
-
* `to
|
|
145
|
+
* `from` is more than 90 days ago; see also `Account.dataStatus`. Rejects with `TypeError`, before it waits for other
|
|
146
|
+
* calls, if `from` or `to` is no valid `Date` or `from` lies on a day after `to`, and with `FinTsUnsupportedError`,
|
|
147
|
+
* without sending the query, where the parameter data rule it out; the login may have gone out.
|
|
115
148
|
*/
|
|
116
149
|
getTransactions(account: Account, query?: TransactionQuery): Promise<Transaction[]>;
|
|
117
150
|
/**
|
|
118
|
-
* Ends the bank dialog and
|
|
151
|
+
* Ends the bank dialog, releases the connection and forgets the PIN.
|
|
119
152
|
*
|
|
120
153
|
* A running call stops at its next step, also while it waits for a TAN, an app approval or a selection, and fails with
|
|
121
|
-
* `FinTsStateError`, as do all later calls. A request already on its way is
|
|
122
|
-
*
|
|
154
|
+
* `FinTsStateError`, as do all later calls. A request already on its way is aborted where the transport supports it,
|
|
155
|
+
* as `HttpTransport` does: the call fails with `FinTsTransportError` then, as after a broken connection, and an aborted
|
|
156
|
+
* login counts as one whose answer was lost. Another transport is awaited, at most for its timeout; after the
|
|
157
|
+
* request, the call sends nothing but the end of its dialogs.
|
|
123
158
|
*/
|
|
124
159
|
close(): Promise<void>;
|
|
125
160
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/core/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7F,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,+EAA+E;AAC/E,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,UAAU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B;;;;;;OAMG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,QAAQ,CAAC,YAAY,EAAE,sBAAsB,GAAG,SAAS,CAAC;IAE1D,8GAA8G;IAC9G,QAAQ,CAAC,iBAAiB,EAAE,MAAM,GAAG,SAAS,CAAC;IAE/C,wEAAwE;IACxE,QAAQ,CAAC,iBAAiB,EAAE,MAAM,GAAG,SAAS,CAAC;IAE/C;;;;;OAKG;IACH,eAAe,CAAC,gBAAgB,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7E;;;;;;;;OAQG;IACH,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9C,wEAAwE;IACxE,WAAW,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC;IAEjC;;;;OAIG;IACH,aAAa,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;IAEtC,4CAA4C;IAC5C,WAAW,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;IAEpC,sFAAsF;IACtF,WAAW,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAElC;;;;;;;;OAQG;IACH,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE/C;;;;;;;;OAQG;IACH,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IAEpF;;;;;;;;OAQG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB"}
|
package/dist/core/config.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* The country code FinTS gives Germany, where FinTS banks are: the ISO 3166 code of the Federal Republic before 1990,
|
|
3
|
+
* not today's `276`.
|
|
4
|
+
*/
|
|
2
5
|
export declare const defaultCountryCode = "280";
|
|
3
6
|
/** What `FinTsConfig` takes. */
|
|
4
7
|
export interface FinTsConfigInit {
|
|
5
|
-
/** The bank's FinTS PIN/TAN endpoint; must be https. */
|
|
8
|
+
/** The bank's FinTS PIN/TAN endpoint; must be https, without user name or password. */
|
|
6
9
|
url: string | URL;
|
|
7
|
-
/** German bank
|
|
10
|
+
/** Bank code: for a German bank its BLZ, eight digits. */
|
|
8
11
|
bankCode: string;
|
|
9
12
|
/** Login name (Benutzerkennung / Legitimations-ID). */
|
|
10
13
|
userId: string;
|
|
@@ -14,7 +17,7 @@ export interface FinTsConfigInit {
|
|
|
14
17
|
productId: string;
|
|
15
18
|
/** Version of the app as registered with the product; at most five characters. `1.0` by default. */
|
|
16
19
|
productVersion?: string;
|
|
17
|
-
/**
|
|
20
|
+
/** Country code of the bank, three digits: `280`, the default, for Germany. */
|
|
18
21
|
countryCode?: string;
|
|
19
22
|
/**
|
|
20
23
|
* Allows plain http for the loopback addresses `localhost`, `127.x.x.x` and `::1`, for tests against a local server.
|
|
@@ -25,9 +28,9 @@ export interface FinTsConfigInit {
|
|
|
25
28
|
}
|
|
26
29
|
/** Connection and login data for one bank user. */
|
|
27
30
|
export declare class FinTsConfig {
|
|
28
|
-
/**
|
|
31
|
+
/** The country code FinTS gives Germany, where FinTS banks are: `280`, not today's ISO 3166 code `276`. */
|
|
29
32
|
static readonly defaultCountryCode = "280";
|
|
30
|
-
readonly
|
|
33
|
+
private readonly href;
|
|
31
34
|
readonly bankCode: string;
|
|
32
35
|
readonly userId: string;
|
|
33
36
|
private readonly explicitCustomerId;
|
|
@@ -36,24 +39,33 @@ export declare class FinTsConfig {
|
|
|
36
39
|
readonly countryCode: string;
|
|
37
40
|
readonly allowInsecureUrl: boolean;
|
|
38
41
|
/**
|
|
39
|
-
* Throws `TypeError` if `url` is not a valid URL, has no host or is not https, unless
|
|
40
|
-
* `
|
|
42
|
+
* Throws `TypeError` if `url` is not a valid URL, has no host, holds a user name or password, or is not https, unless
|
|
43
|
+
* `allowInsecureUrl` is set and `url` is a loopback address. Throws as well where the bank would refuse the login: for
|
|
44
|
+
* a login or product detail that is empty, has characters FinTS 3.0 cannot send (it uses ISO 8859-1, so `€` and most
|
|
45
|
+
* non-Latin letters are not possible) or is longer than its field (30 characters for the bank code, 25 for the
|
|
46
|
+
* product ID, 5 for its version), for a country code of other than three digits, and for a German bank code of other
|
|
47
|
+
* than eight. The message leaves out the value.
|
|
48
|
+
*
|
|
49
|
+
* Drops leading and trailing blanks of the login details and the product, as FinTS sends them without (Formals
|
|
50
|
+
* B.4.1): `'alice '` is the user `alice`, also for a saved state.
|
|
41
51
|
*/
|
|
42
52
|
constructor(init: FinTsConfigInit);
|
|
53
|
+
/**
|
|
54
|
+
* The bank's FinTS PIN/TAN endpoint, as checked by the constructor. A new `URL` on each access, so that changing one
|
|
55
|
+
* cannot change where the client posts the PIN.
|
|
56
|
+
*/
|
|
57
|
+
get url(): URL;
|
|
43
58
|
/** Customer ID; defaults to `userId`. */
|
|
44
59
|
get customerId(): string;
|
|
45
60
|
}
|
|
61
|
+
/** `text`, unless it has characters FinTS 3.0 cannot send (ISO 8859-1 only); the message leaves out the value. */
|
|
62
|
+
export declare function requireLatin1(text: string, name: string): string;
|
|
46
63
|
/** The host of `url` without the brackets of an IPv6 address, as `URL` writes it. */
|
|
47
64
|
export declare function hostOf(url: URL): string;
|
|
48
65
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*/
|
|
53
|
-
export declare function requireSecureUrl(url: URL, allowInsecure?: boolean): void;
|
|
54
|
-
/**
|
|
55
|
-
* Throws `TypeError` for an empty PIN, which the bank would count as a failed attempt, and for one with leading or
|
|
56
|
-
* trailing blanks: FinTS values carry none (Formals B.4.1), so such a PIN could only go out changed.
|
|
66
|
+
* `pin`, unless FinTS 3.0 cannot send it: throws `TypeError` for an empty PIN, which the bank would count as a failed
|
|
67
|
+
* attempt, for one with leading or trailing blanks, which would go out without them since FinTS values carry none
|
|
68
|
+
* (Formals B.4.1), and for one with characters outside ISO 8859-1.
|
|
57
69
|
*
|
|
58
70
|
* The message leaves out the value.
|
|
59
71
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/core/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/core/config.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,eAAO,MAAM,kBAAkB,QAAQ,CAAC;AAOxC,gCAAgC;AAChC,MAAM,WAAW,eAAe;IAC9B,uFAAuF;IACvF,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAClB,0DAA0D;IAC1D,QAAQ,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,MAAM,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,mGAAmG;IACnG,SAAS,EAAE,MAAM,CAAC;IAClB,oGAAoG;IACpG,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,+EAA+E;IAC/E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,mDAAmD;AACnD,qBAAa,WAAW;IACtB,2GAA2G;IAC3G,MAAM,CAAC,QAAQ,CAAC,kBAAkB,SAAsB;IAExD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAqB;IACxD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IAEnC;;;;;;;;;;OAUG;gBACS,IAAI,EAAE,eAAe;IA4BjC;;;OAGG;IACH,IAAI,GAAG,IAAI,GAAG,CAEb;IAED,yCAAyC;IACzC,IAAI,UAAU,IAAI,MAAM,CAEvB;CACF;AAcD,kHAAkH;AAClH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAGhE;AAED,qFAAqF;AACrF,wBAAgB,MAAM,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CAGvC;AAeD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAI9C;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAUpG"}
|
package/dist/core/config.js
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import { invalidArgument } from '../util/errors.js';
|
|
2
|
-
|
|
2
|
+
import { isLatin1 } from '../util/text.js';
|
|
3
|
+
/**
|
|
4
|
+
* The country code FinTS gives Germany, where FinTS banks are: the ISO 3166 code of the Federal Republic before 1990,
|
|
5
|
+
* not today's `276`.
|
|
6
|
+
*/
|
|
3
7
|
export const defaultCountryCode = '280';
|
|
8
|
+
/** Longest bank code (Kreditinstitutscode), product ID (Produktbezeichnung) and product version FinTS 3.0 takes. */
|
|
9
|
+
const maxBankCodeLength = 30;
|
|
10
|
+
const maxProductIdLength = 25;
|
|
11
|
+
const maxProductVersionLength = 5;
|
|
4
12
|
/** Connection and login data for one bank user. */
|
|
5
13
|
export class FinTsConfig {
|
|
6
|
-
/**
|
|
14
|
+
/** The country code FinTS gives Germany, where FinTS banks are: `280`, not today's ISO 3166 code `276`. */
|
|
7
15
|
static defaultCountryCode = defaultCountryCode;
|
|
8
|
-
|
|
16
|
+
href;
|
|
9
17
|
bankCode;
|
|
10
18
|
userId;
|
|
11
19
|
explicitCustomerId;
|
|
@@ -14,8 +22,15 @@ export class FinTsConfig {
|
|
|
14
22
|
countryCode;
|
|
15
23
|
allowInsecureUrl;
|
|
16
24
|
/**
|
|
17
|
-
* Throws `TypeError` if `url` is not a valid URL, has no host or is not https, unless
|
|
18
|
-
* `
|
|
25
|
+
* Throws `TypeError` if `url` is not a valid URL, has no host, holds a user name or password, or is not https, unless
|
|
26
|
+
* `allowInsecureUrl` is set and `url` is a loopback address. Throws as well where the bank would refuse the login: for
|
|
27
|
+
* a login or product detail that is empty, has characters FinTS 3.0 cannot send (it uses ISO 8859-1, so `€` and most
|
|
28
|
+
* non-Latin letters are not possible) or is longer than its field (30 characters for the bank code, 25 for the
|
|
29
|
+
* product ID, 5 for its version), for a country code of other than three digits, and for a German bank code of other
|
|
30
|
+
* than eight. The message leaves out the value.
|
|
31
|
+
*
|
|
32
|
+
* Drops leading and trailing blanks of the login details and the product, as FinTS sends them without (Formals
|
|
33
|
+
* B.4.1): `'alice '` is the user `alice`, also for a saved state.
|
|
19
34
|
*/
|
|
20
35
|
constructor(init) {
|
|
21
36
|
// `URL` would read `https:bank` and `https:///bank` as the host `bank`; such a URL is a mistake, not a host.
|
|
@@ -29,31 +44,52 @@ export class FinTsConfig {
|
|
|
29
44
|
catch {
|
|
30
45
|
throw invalidArgument('Not a valid URL', 'url');
|
|
31
46
|
}
|
|
32
|
-
this.
|
|
33
|
-
this.bankCode = init.bankCode;
|
|
34
|
-
this.userId = init.userId;
|
|
35
|
-
this.explicitCustomerId = init.customerId;
|
|
36
|
-
this.productId = init.productId;
|
|
37
|
-
this.productVersion = init.productVersion ?? '1.0';
|
|
38
|
-
this.countryCode = init.countryCode ?? defaultCountryCode;
|
|
47
|
+
this.href = url.href;
|
|
39
48
|
this.allowInsecureUrl = init.allowInsecureUrl ?? false;
|
|
40
49
|
requireSecureUrl(url, this.allowInsecureUrl);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
50
|
+
this.countryCode = requireValue(init.countryCode ?? defaultCountryCode, 'countryCode');
|
|
51
|
+
if (!/^\d{3}$/.test(this.countryCode)) {
|
|
52
|
+
throw invalidArgument('Must be three digits, 280 for Germany', 'countryCode');
|
|
53
|
+
}
|
|
54
|
+
this.bankCode = requireValue(init.bankCode, 'bankCode', maxBankCodeLength);
|
|
55
|
+
if (this.countryCode === defaultCountryCode && !/^\d{8}$/.test(this.bankCode)) {
|
|
56
|
+
throw invalidArgument('A German bank code (BLZ) has eight digits', 'bankCode');
|
|
57
|
+
}
|
|
58
|
+
this.userId = requireValue(init.userId, 'userId');
|
|
59
|
+
this.explicitCustomerId = init.customerId === undefined ? undefined : requireValue(init.customerId, 'customerId');
|
|
60
|
+
this.productId = requireValue(init.productId, 'productId', maxProductIdLength);
|
|
61
|
+
this.productVersion = requireValue(init.productVersion ?? '1.0', 'productVersion', maxProductVersionLength);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* The bank's FinTS PIN/TAN endpoint, as checked by the constructor. A new `URL` on each access, so that changing one
|
|
65
|
+
* cannot change where the client posts the PIN.
|
|
66
|
+
*/
|
|
67
|
+
get url() {
|
|
68
|
+
return new URL(this.href);
|
|
48
69
|
}
|
|
49
70
|
/** Customer ID; defaults to `userId`. */
|
|
50
71
|
get customerId() {
|
|
51
72
|
return this.explicitCustomerId ?? this.userId;
|
|
52
73
|
}
|
|
53
74
|
}
|
|
54
|
-
|
|
55
|
-
|
|
75
|
+
/**
|
|
76
|
+
* `value` without leading and trailing blanks; throws `TypeError` if nothing is left, or what is left is not sendable
|
|
77
|
+
* (`requireLatin1`) or longer than `maxLength`: cut short, a value would be one the bank does not know.
|
|
78
|
+
*/
|
|
79
|
+
function requireValue(value, name, maxLength = Number.POSITIVE_INFINITY) {
|
|
80
|
+
const trimmed = value.trim();
|
|
81
|
+
if (trimmed === '')
|
|
56
82
|
throw invalidArgument('Must not be empty', name);
|
|
83
|
+
requireLatin1(trimmed, name);
|
|
84
|
+
if (trimmed.length > maxLength)
|
|
85
|
+
throw invalidArgument(`At most ${maxLength} characters in FinTS 3.0`, name);
|
|
86
|
+
return trimmed;
|
|
87
|
+
}
|
|
88
|
+
/** `text`, unless it has characters FinTS 3.0 cannot send (ISO 8859-1 only); the message leaves out the value. */
|
|
89
|
+
export function requireLatin1(text, name) {
|
|
90
|
+
if (!isLatin1(text))
|
|
91
|
+
throw invalidArgument('Contains characters FinTS 3.0 cannot send (ISO 8859-1 only)', name);
|
|
92
|
+
return text;
|
|
57
93
|
}
|
|
58
94
|
/** The host of `url` without the brackets of an IPv6 address, as `URL` writes it. */
|
|
59
95
|
export function hostOf(url) {
|
|
@@ -63,18 +99,22 @@ export function hostOf(url) {
|
|
|
63
99
|
/**
|
|
64
100
|
* Throws `TypeError` unless `url` names a host and uses https: the PIN travels with every message.
|
|
65
101
|
*
|
|
66
|
-
* With `allowInsecure`, http is accepted for loopback hosts only.
|
|
102
|
+
* With `allowInsecure`, http is accepted for loopback hosts only. Throws as well for a user name or password in `url`:
|
|
103
|
+
* `fetch` refuses such a URL, with the whole URL in its error message. The message leaves them out.
|
|
67
104
|
*/
|
|
68
|
-
|
|
105
|
+
function requireSecureUrl(url, allowInsecure = false) {
|
|
69
106
|
if (hostOf(url) === '')
|
|
70
107
|
throw invalidArgument('The URL has no host', 'url');
|
|
108
|
+
if (url.username !== '' || url.password !== '')
|
|
109
|
+
throw invalidArgument('The URL must not contain credentials', 'url');
|
|
71
110
|
const loopbackHttp = allowInsecure && url.protocol === 'http:' && isLoopback(hostOf(url));
|
|
72
111
|
if (url.protocol !== 'https:' && !loopbackHttp)
|
|
73
112
|
throw invalidArgument('PIN/TAN requires an https URL', 'url');
|
|
74
113
|
}
|
|
75
114
|
/**
|
|
76
|
-
*
|
|
77
|
-
*
|
|
115
|
+
* `pin`, unless FinTS 3.0 cannot send it: throws `TypeError` for an empty PIN, which the bank would count as a failed
|
|
116
|
+
* attempt, for one with leading or trailing blanks, which would go out without them since FinTS values carry none
|
|
117
|
+
* (Formals B.4.1), and for one with characters outside ISO 8859-1.
|
|
78
118
|
*
|
|
79
119
|
* The message leaves out the value.
|
|
80
120
|
*/
|
|
@@ -83,7 +123,7 @@ export function requirePin(pin) {
|
|
|
83
123
|
throw invalidArgument('The PIN is empty', 'pin');
|
|
84
124
|
if (pin.trim() !== pin)
|
|
85
125
|
throw invalidArgument('The PIN begins or ends with a blank', 'pin');
|
|
86
|
-
return pin;
|
|
126
|
+
return requireLatin1(pin, 'pin');
|
|
87
127
|
}
|
|
88
128
|
/**
|
|
89
129
|
* Throws `TypeError` if `pin` is shorter than `min` or longer than `max` characters, the bank's limits: the bank would
|
package/dist/core/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/core/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/core/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC;AAExC,oHAAoH;AACpH,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAC9B,MAAM,uBAAuB,GAAG,CAAC,CAAC;AA0BlC,mDAAmD;AACnD,MAAM,OAAO,WAAW;IACtB,2GAA2G;IAC3G,MAAM,CAAU,kBAAkB,GAAG,kBAAkB,CAAC;IAEvC,IAAI,CAAS;IACrB,QAAQ,CAAS;IACjB,MAAM,CAAS;IACP,kBAAkB,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CAAqC,EAAE,KAAK,CAAC,CAAC;IAC5F,OAAO,aAAa,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AACnC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAW,EAAE,GAAuB,EAAE,GAAuB;IAC5F,MAAM,QAAQ,GAAG,GAAG,KAAK,SAAS,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC;IAClE,MAAM,OAAO,GAAG,GAAG,KAAK,SAAS,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC;IACjE,IAAI,QAAQ,IAAI,OAAO,EAAE,CAAC;QACxB,MAAM,KAAK,GAAG;YACZ,GAAG,CAAC,GAAG,KAAK,SAAS,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAC5D,GAAG,CAAC,GAAG,KAAK,SAAS,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;SAC5D,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAChB,MAAM,eAAe,CAAC,0BAA0B,KAAK,aAAa,EAAE,KAAK,CAAC,CAAC;IAC7E,CAAC;AACH,CAAC;AAED,MAAM,eAAe,GAAG,+CAA+C,CAAC;AAExE;;;GAGG;AACH,SAAS,UAAU,CAAC,IAAY;IAC9B,OAAO,IAAI,KAAK,WAAW,IAAI,IAAI,KAAK,KAAK,IAAI,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC9E,CAAC"}
|
package/dist/core/errors.d.ts
CHANGED
|
@@ -1,54 +1,89 @@
|
|
|
1
1
|
import { type FinTsFeedback } from './feedback.js';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Base class of all errors the client raises about the bank and its data.
|
|
4
|
+
*
|
|
5
|
+
* Each error class states its `name`: a minifier renames classes, and `constructor.name` would show a meaningless one.
|
|
6
|
+
*/
|
|
3
7
|
export declare abstract class FinTsError extends Error {
|
|
4
|
-
|
|
8
|
+
abstract name: string;
|
|
5
9
|
}
|
|
6
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* The connection to the bank failed or returned an HTTP error.
|
|
12
|
+
*
|
|
13
|
+
* It carries no `cause`: the transport's own error may hold the message it was sending, PIN and TAN included.
|
|
14
|
+
*/
|
|
7
15
|
export declare class FinTsTransportError extends FinTsError {
|
|
8
|
-
|
|
16
|
+
name: string;
|
|
17
|
+
/**
|
|
18
|
+
* The HTTP status code of the bank's answer, `undefined` where none came, for example after a timeout; the client
|
|
19
|
+
* acts on it (`FinTsTransport.post`).
|
|
20
|
+
*/
|
|
9
21
|
readonly statusCode: number | undefined;
|
|
10
22
|
constructor(message: string, options?: {
|
|
11
23
|
statusCode?: number;
|
|
12
|
-
cause?: unknown;
|
|
13
24
|
});
|
|
14
25
|
}
|
|
15
26
|
/** The bank's response could not be understood. */
|
|
16
27
|
export declare class FinTsProtocolError extends FinTsError {
|
|
17
|
-
|
|
28
|
+
name: string;
|
|
18
29
|
}
|
|
19
30
|
/** The bank does not offer the requested business transaction. */
|
|
20
31
|
export declare class FinTsUnsupportedError extends FinTsError {
|
|
21
|
-
|
|
32
|
+
name: string;
|
|
22
33
|
}
|
|
23
34
|
/**
|
|
24
|
-
* The
|
|
35
|
+
* The client has no TAN method or medium to log in with: the method in use needs a TAN medium the client could not
|
|
36
|
+
* learn, or the bank offers the user only TAN methods the client cannot run. Pass a medium to
|
|
37
|
+
* `FinTsClient.selectTanMethod`, or choose another method.
|
|
25
38
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
39
|
+
* The client does not send a login the bank would refuse for it, but the steps before, such as the synchronization or
|
|
40
|
+
* the lookup of the TAN media, may have gone out.
|
|
28
41
|
*/
|
|
42
|
+
export declare class FinTsTanSetupError extends FinTsError {
|
|
43
|
+
name: string;
|
|
44
|
+
}
|
|
45
|
+
/** The bank rejected the request; `feedback` holds all return codes. A refused login is a `FinTsLoginRefusedError`. */
|
|
29
46
|
export declare class FinTsBankError extends FinTsError {
|
|
47
|
+
name: string;
|
|
30
48
|
/** All return codes of the response, warnings and successes included. */
|
|
31
49
|
readonly feedback: readonly FinTsFeedback[];
|
|
32
50
|
/** A rejection with the return codes in `feedback`; `message` defaults to the errors among them. */
|
|
33
|
-
constructor(feedback: readonly FinTsFeedback[], message?: string
|
|
51
|
+
constructor(feedback: readonly FinTsFeedback[], message?: string);
|
|
34
52
|
/** The return codes of `feedback`. */
|
|
35
53
|
get codes(): string[];
|
|
36
54
|
}
|
|
37
|
-
/**
|
|
38
|
-
|
|
39
|
-
|
|
55
|
+
/**
|
|
56
|
+
* The bank refused the login, so the client sends the PIN no more: every later call that would send it fails with this
|
|
57
|
+
* error without contacting the bank, also in a client restored from the saved state, until
|
|
58
|
+
* `FinTsClient.clearLoginRefusal` takes a PIN the user has entered anew; for good where the bank has changed the login
|
|
59
|
+
* data (`FinTsLoginDataChangedError`).
|
|
60
|
+
*
|
|
61
|
+
* Banks lock the access after a few failed logins, and a return code does not always tell whether the PIN was the
|
|
62
|
+
* reason, so any error in the answer to a login refuses it, also one that ends the dialog, and so does a wrong PIN
|
|
63
|
+
* wherever the bank reports it. Only where the bank names a reason the client can take care of, another TAN method or a
|
|
64
|
+
* new customer system ID, does the same call log in once more, for each reason once. The client refuses the login
|
|
65
|
+
* itself where it could not read the answers to two logins in a row, which the bank may have counted as failed
|
|
66
|
+
* attempts; `feedback` is empty then.
|
|
67
|
+
*/
|
|
68
|
+
export declare class FinTsLoginRefusedError extends FinTsBankError {
|
|
69
|
+
name: string;
|
|
70
|
+
}
|
|
71
|
+
/** Wrong or blocked PIN. */
|
|
72
|
+
export declare class FinTsPinError extends FinTsLoginRefusedError {
|
|
73
|
+
name: string;
|
|
40
74
|
}
|
|
41
75
|
/** Invalid, expired or rejected TAN, as the bank reports it in answer to a TAN or to an approval status request. */
|
|
42
76
|
export declare class FinTsTanError extends FinTsBankError {
|
|
43
|
-
|
|
77
|
+
name: string;
|
|
44
78
|
}
|
|
45
79
|
/**
|
|
46
80
|
* The bank has changed the user's login data and expects the new ones from now on (return code 3072).
|
|
47
81
|
*
|
|
48
|
-
* The client has ended the dialog,
|
|
49
|
-
* `loginName` replaces user ID and customer ID: pass it as `userId`, without a customer ID.
|
|
82
|
+
* The client has ended the dialog, where the bank opened one, and logs in with the old data no more. Create a new
|
|
83
|
+
* client with the new data; a `loginName` replaces user ID and customer ID: pass it as `userId`, without a customer ID.
|
|
50
84
|
*/
|
|
51
|
-
export declare class FinTsLoginDataChangedError extends
|
|
85
|
+
export declare class FinTsLoginDataChangedError extends FinTsLoginRefusedError {
|
|
86
|
+
name: string;
|
|
52
87
|
constructor(feedback: readonly FinTsFeedback[]);
|
|
53
88
|
/** The new user ID (Benutzerkennung); `undefined` where the bank names none. */
|
|
54
89
|
get userId(): string | undefined;
|
|
@@ -58,16 +93,24 @@ export declare class FinTsLoginDataChangedError extends FinTsBankError {
|
|
|
58
93
|
get loginName(): string | undefined;
|
|
59
94
|
private parameter;
|
|
60
95
|
}
|
|
61
|
-
/**
|
|
96
|
+
/**
|
|
97
|
+
* The bank ended the dialog, for example after a timeout; the next call logs in anew. Where the bank ends the dialog
|
|
98
|
+
* in answer to a login, the call fails with `FinTsLoginRefusedError` instead.
|
|
99
|
+
*/
|
|
62
100
|
export declare class FinTsDialogAbortedError extends FinTsBankError {
|
|
63
|
-
|
|
101
|
+
name: string;
|
|
64
102
|
}
|
|
65
103
|
/** The user cancelled the TAN entry or the approval in the banking app. */
|
|
66
104
|
export declare class FinTsTanCancelledError extends FinTsError {
|
|
105
|
+
name: string;
|
|
67
106
|
constructor();
|
|
68
107
|
}
|
|
69
|
-
/**
|
|
108
|
+
/**
|
|
109
|
+
* The user did not approve in the banking app in time: within the status requests the bank allows, 60 where it states
|
|
110
|
+
* none, and 10 minutes of polling at most.
|
|
111
|
+
*/
|
|
70
112
|
export declare class FinTsDecoupledTimeoutError extends FinTsError {
|
|
113
|
+
name: string;
|
|
71
114
|
constructor();
|
|
72
115
|
}
|
|
73
116
|
/**
|
|
@@ -76,8 +119,10 @@ export declare class FinTsDecoupledTimeoutError extends FinTsError {
|
|
|
76
119
|
* It does not extend `FinTsError`: it tells about the app's use of the client, not about the bank.
|
|
77
120
|
*/
|
|
78
121
|
export declare class FinTsStateError extends Error {
|
|
79
|
-
|
|
122
|
+
name: string;
|
|
80
123
|
}
|
|
124
|
+
/** The error of whatever a closed client is asked to do. */
|
|
125
|
+
export declare function clientClosedError(): FinTsStateError;
|
|
81
126
|
/**
|
|
82
127
|
* The most specific error for the errors in `feedback`, the answer to a message that `completesApproval` or not.
|
|
83
128
|
*
|
|
@@ -86,6 +131,23 @@ export declare class FinTsStateError extends Error {
|
|
|
86
131
|
* for a wrong TAN, after which it would send the PIN again.
|
|
87
132
|
*/
|
|
88
133
|
export declare function bankErrorFor(feedback: readonly FinTsFeedback[], completesApproval?: boolean): FinTsBankError;
|
|
89
|
-
/**
|
|
134
|
+
/**
|
|
135
|
+
* The refusal of a login whose answer carried `feedback`: `FinTsPinError` for a rejected PIN, else
|
|
136
|
+
* `FinTsLoginDataChangedError` for new login data, also next to other errors, and `FinTsLoginRefusedError` for anything
|
|
137
|
+
* else. The same for a refusal restored from the saved state, which keeps only `feedback`.
|
|
138
|
+
*
|
|
139
|
+
* New login data end the old ones for good, so the session takes care of no other reason the answer names.
|
|
140
|
+
*/
|
|
141
|
+
export declare function loginRefusalFor(feedback: readonly FinTsFeedback[]): FinTsLoginRefusedError;
|
|
142
|
+
/**
|
|
143
|
+
* Runs `parse` on data from the bank and reports malformed data as `FinTsProtocolError`, whose message leaves the data
|
|
144
|
+
* out (`FormatError`).
|
|
145
|
+
*/
|
|
90
146
|
export declare function parseBankData<T>(parse: () => T): T;
|
|
147
|
+
/**
|
|
148
|
+
* Runs `lookup`, which only completes data, such as the SEPA account list; `undefined` where the bank rejects it, so
|
|
149
|
+
* that the caller carries on without it. An aborted dialog counts as a rejection: banks end the dialog along with many.
|
|
150
|
+
* A refused login and a rejected TAN fail the call: the user must hear of them.
|
|
151
|
+
*/
|
|
152
|
+
export declare function tryLookUp<T>(lookup: () => Promise<T>): Promise<T | undefined>;
|
|
91
153
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsC,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAEvF;;;;GAIG;AACH,8BAAsB,UAAW,SAAQ,KAAK;IAC5C,SAAkB,IAAI,EAAE,MAAM,CAAC;CAChC;AAED;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ,UAAU;IACxC,IAAI,SAAyB;IAEtC;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;gBAE5B,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE;CAI/D;AAED,mDAAmD;AACnD,qBAAa,kBAAmB,SAAQ,UAAU;IACvC,IAAI,SAAwB;CACtC;AAED,kEAAkE;AAClE,qBAAa,qBAAsB,SAAQ,UAAU;IAC1C,IAAI,SAA2B;CACzC;AAED;;;;;;;GAOG;AACH,qBAAa,kBAAmB,SAAQ,UAAU;IACvC,IAAI,SAAwB;CACtC;AAED,uHAAuH;AACvH,qBAAa,cAAe,SAAQ,UAAU;IACnC,IAAI,SAAoB;IAEjC,yEAAyE;IACzE,QAAQ,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE,CAAC;IAE5C,oGAAoG;gBACxF,QAAQ,EAAE,SAAS,aAAa,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