lib-fints 1.3.0 → 1.3.1
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.
|
@@ -16,6 +16,27 @@ export class CustomerInteraction {
|
|
|
16
16
|
}
|
|
17
17
|
return clientResponse;
|
|
18
18
|
}
|
|
19
|
+
parseHHDUC(tanChallengeHHDUC) {
|
|
20
|
+
let offset = 0;
|
|
21
|
+
// convert the string with binary data to a byte array
|
|
22
|
+
const bytes = new Uint8Array(tanChallengeHHDUC.length);
|
|
23
|
+
for (let i = 0; i < tanChallengeHHDUC.length; i++) {
|
|
24
|
+
bytes[i] = tanChallengeHHDUC.charCodeAt(i) & 0xff;
|
|
25
|
+
}
|
|
26
|
+
const countAsString = Array.from(bytes.slice(offset, 2), (b) => String(b)).join('');
|
|
27
|
+
offset += 2;
|
|
28
|
+
const count = parseInt(countAsString);
|
|
29
|
+
const mimeTypeArray = bytes.slice(offset, offset + count);
|
|
30
|
+
const mimeType = new TextDecoder('iso-8859-1').decode(mimeTypeArray);
|
|
31
|
+
offset += count;
|
|
32
|
+
// image size is 2 bytes, little endian
|
|
33
|
+
const hi = bytes[offset];
|
|
34
|
+
const lo = bytes[offset + 1];
|
|
35
|
+
const imageSize = (hi << 8) + lo;
|
|
36
|
+
offset += 2;
|
|
37
|
+
const image = bytes.slice(offset, offset + imageSize);
|
|
38
|
+
return { mimeType, image };
|
|
39
|
+
}
|
|
19
40
|
handleBaseResponse(response) {
|
|
20
41
|
const hnhbk = response.findSegment(HNHBK.Id);
|
|
21
42
|
const dialogId = hnhbk?.dialogId ?? '';
|
|
@@ -38,6 +59,7 @@ export class CustomerInteraction {
|
|
|
38
59
|
bankAnswers.find((answer) => answer.code === 3956)?.text ??
|
|
39
60
|
bankAnswers.find((answer) => answer.code === 3957)?.text ??
|
|
40
61
|
'',
|
|
62
|
+
tanPhoto: hitan.challengeHhdUc ? this.parseHHDUC(hitan.challengeHhdUc) : undefined,
|
|
41
63
|
tanMediaName: hitan.tanMedia,
|
|
42
64
|
};
|
|
43
65
|
}
|
|
@@ -3,6 +3,10 @@ import { Dialog } from '../dialog.js';
|
|
|
3
3
|
import { FinTSConfig } from '../config.js';
|
|
4
4
|
import { Message } from '../message.js';
|
|
5
5
|
import { Segment } from '../segment.js';
|
|
6
|
+
export interface PhotoTan {
|
|
7
|
+
mimeType: string;
|
|
8
|
+
image: Uint8Array;
|
|
9
|
+
}
|
|
6
10
|
/**
|
|
7
11
|
* The response from the client after a customer interaction
|
|
8
12
|
* @property dialogId The dialog ID of the current dialog
|
|
@@ -22,6 +26,7 @@ export interface ClientResponse {
|
|
|
22
26
|
requiresTan: boolean;
|
|
23
27
|
tanReference?: string;
|
|
24
28
|
tanChallenge?: string;
|
|
29
|
+
tanPhoto?: PhotoTan;
|
|
25
30
|
tanMediaName?: string;
|
|
26
31
|
}
|
|
27
32
|
export declare abstract class CustomerInteraction {
|
|
@@ -32,6 +37,7 @@ export declare abstract class CustomerInteraction {
|
|
|
32
37
|
getClientResponse<TResponse extends ClientResponse>(message: Message): TResponse;
|
|
33
38
|
protected abstract createSegments(init: FinTSConfig): Segment[];
|
|
34
39
|
protected abstract handleResponse(response: Message, clientResponse: ClientResponse): void;
|
|
40
|
+
private parseHHDUC;
|
|
35
41
|
private handleBaseResponse;
|
|
36
42
|
}
|
|
37
43
|
export declare abstract class CustomerOrderInteraction extends CustomerInteraction {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customerInteraction.d.ts","sourceRoot":"","sources":["../../../src/interactions/customerInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AA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M,WAAW,cAAc;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,yBAAyB,EAAE,OAAO,CAAC;IACnC,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,8BAAsB,mBAAmB;IAGrB,KAAK,EAAE,MAAM;IAFhC,MAAM,CAAC,EAAE,MAAM,CAAC;gBAEG,KAAK,EAAE,MAAM;IAEhC,WAAW,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,EAAE;IAIzC,iBAAiB,CAAC,SAAS,SAAS,cAAc,EAAE,OAAO,EAAE,OAAO,GAAG,SAAS;IAUhF,SAAS,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,EAAE;IAC/D,SAAS,CAAC,QAAQ,CAAC,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,GAAG,IAAI;IAE1F,OAAO,CAAC,UAAU;IAsBlB,OAAO,CAAC,kBAAkB;CA0C1B;AAED,8BAAsB,wBAAyB,SAAQ,mBAAmB;IACvC,aAAa,EAAE,MAAM;gBAA3C,KAAK,EAAE,MAAM,EAAS,aAAa,EAAE,MAAM;CAGvD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lib-fints",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Typescript/Javascript client library for Online-Banking via the FinTS 3.0 protocol with PIN/TAN",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=18.0.0"
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
},
|
|
22
22
|
"scripts": {
|
|
23
23
|
"build": "rm -rf ./dist && tsc",
|
|
24
|
-
"pack": "
|
|
24
|
+
"pack": "pnpm run build && pnpm pack --pack-destination ~/npm-repo",
|
|
25
25
|
"test": "vitest",
|
|
26
|
-
"preprepare": "
|
|
26
|
+
"preprepare": "pnpm run build"
|
|
27
27
|
},
|
|
28
28
|
"keywords": [
|
|
29
29
|
"FinTS",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"url": "https://github.com/robocode13/lib-fints.git"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@types/node": "^20.
|
|
42
|
+
"@types/node": "^20.19.26",
|
|
43
43
|
"typescript": "^5.3.3",
|
|
44
44
|
"vitest": "^1.6.0"
|
|
45
45
|
}
|