@finteqhub/sdk-js 0.10.1 → 0.11.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/README.md +27 -1
- package/dist/src/processing.js +3 -0
- package/dist/src/version.d.ts +3 -0
- package/dist/src/version.js +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
# processing-sdk
|
|
2
2
|
|
|
3
|
-
Use `new FinteqHubProcessing(apiUrl: string, fingerprintVisitorId: string, merchantId: string, sessionId: string)` to create an instance of the FinteqHubProcessing object. The FinteqHubProcessing object is your entrypoint to FinteqHub processing SDK.
|
|
3
|
+
Use `new FinteqHubProcessing(apiUrl: string, fingerprintVisitorId: string, merchantId: string, sessionId: string, isSecure?: boolean)` to create an instance of the FinteqHubProcessing object. The FinteqHubProcessing object is your entrypoint to FinteqHub processing SDK.
|
|
4
4
|
|
|
5
5
|
```
|
|
6
6
|
const processing = new FinteqHubProcessing('api-url', 'fingerprint-visitor-id', 'merchant-id', 'session-id');
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
+
## SDK identification header
|
|
10
|
+
|
|
11
|
+
Every request the SDK makes carries an extra header:
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
X-Finteqhub-SDK: sdk-js/<version>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The value contains the SDK name and version (kept in sync with `package.json` by a test) — for example `sdk-js/0.11.0`. FinteqHub uses this header to identify traffic coming from the official SDK integration — for example to notify affected merchants when a security fix is released. It does not affect authentication or request routing.
|
|
18
|
+
|
|
19
|
+
The header is added automatically to every request and cannot be disabled.
|
|
20
|
+
|
|
9
21
|
## API
|
|
10
22
|
|
|
11
23
|
### processing.getSession()
|
|
@@ -49,3 +61,17 @@ processing
|
|
|
49
61
|
.then(result => console.log(result))
|
|
50
62
|
.catch(error => console.warn(error));
|
|
51
63
|
```
|
|
64
|
+
|
|
65
|
+
## Releasing
|
|
66
|
+
|
|
67
|
+
On every version bump update **both** `package.json` `version` and `SDK_VERSION` in `src/version.ts` — they must stay in sync so the `X-Finteqhub-SDK` header reports the right version. `src/version.test.ts` fails CI if they drift.
|
|
68
|
+
|
|
69
|
+
### Beta releases
|
|
70
|
+
|
|
71
|
+
To try changes before bumping the version, run the `publish-beta` workflow (GitHub → Actions → publish-beta → Run workflow, pick your branch). It publishes `<current version>-beta.<run number>` to npm under the `beta` dist-tag — `latest` and the version in the repo stay untouched. Install it with:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
npm i @finteqhub/sdk-js@beta
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
or pin the exact version printed in the workflow summary.
|
package/dist/src/processing.js
CHANGED
|
@@ -8,6 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { getDeviceData, uuid } from "./utils";
|
|
11
|
+
import { SDK_HEADER_NAME, SDK_HEADER_VALUE } from "./version";
|
|
11
12
|
export class FinteqHubProcessing {
|
|
12
13
|
constructor(apiUrl, fingerprintVisitorId, merchantId, sessionId, isSecure = false) {
|
|
13
14
|
this.apiUrl = apiUrl;
|
|
@@ -27,6 +28,7 @@ export class FinteqHubProcessing {
|
|
|
27
28
|
"Content-Type": "application/json;charset=UTF-8",
|
|
28
29
|
"x-merchant-id": this.merchantId,
|
|
29
30
|
"x-request-id": uuid(),
|
|
31
|
+
[SDK_HEADER_NAME]: SDK_HEADER_VALUE,
|
|
30
32
|
},
|
|
31
33
|
});
|
|
32
34
|
const result = yield response.json();
|
|
@@ -112,6 +114,7 @@ export class FinteqHubProcessing {
|
|
|
112
114
|
"x-fingerprint": this.fingerprintVisitorId,
|
|
113
115
|
"x-session-id": this.sessionId,
|
|
114
116
|
"x-project-id": this.projectId,
|
|
117
|
+
[SDK_HEADER_NAME]: SDK_HEADER_VALUE,
|
|
115
118
|
},
|
|
116
119
|
body: JSON.stringify(data),
|
|
117
120
|
});
|