@finteqhub/sdk-js 0.8.0 → 0.10.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/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/src/consts.d.ts +4 -0
- package/dist/src/consts.js +4 -0
- package/dist/src/processing.d.ts +2 -1
- package/dist/src/processing.js +8 -4
- package/dist/src/typings.d.ts +2 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/src/processing.d.ts
CHANGED
|
@@ -5,7 +5,8 @@ export declare class FinteqHubProcessing {
|
|
|
5
5
|
private merchantId;
|
|
6
6
|
private sessionId;
|
|
7
7
|
private projectId;
|
|
8
|
-
|
|
8
|
+
private isSecure;
|
|
9
|
+
constructor(apiUrl: string, fingerprintVisitorId: string, merchantId: string, sessionId: string, isSecure?: boolean);
|
|
9
10
|
getSession(): Promise<SessionResponse>;
|
|
10
11
|
submitForm(data: SubmitData): Promise<ProcessOperationRedirectResponse>;
|
|
11
12
|
private processOperation;
|
package/dist/src/processing.js
CHANGED
|
@@ -9,17 +9,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { getDeviceData, uuid } from "./utils";
|
|
11
11
|
export class FinteqHubProcessing {
|
|
12
|
-
constructor(apiUrl, fingerprintVisitorId, merchantId, sessionId) {
|
|
12
|
+
constructor(apiUrl, fingerprintVisitorId, merchantId, sessionId, isSecure = false) {
|
|
13
13
|
this.apiUrl = apiUrl;
|
|
14
14
|
this.fingerprintVisitorId = fingerprintVisitorId;
|
|
15
15
|
this.merchantId = merchantId;
|
|
16
16
|
this.sessionId = sessionId;
|
|
17
|
+
this.isSecure = isSecure;
|
|
17
18
|
}
|
|
18
19
|
getSession() {
|
|
19
20
|
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
20
21
|
var _a;
|
|
21
22
|
try {
|
|
22
|
-
const
|
|
23
|
+
const url = this.isSecure ? `${this.apiUrl}/v1/secure/sessions/${this.sessionId}` : `${this.apiUrl}/v1/sessions/${this.sessionId}`;
|
|
24
|
+
const response = yield fetch(url, {
|
|
23
25
|
method: "GET",
|
|
24
26
|
headers: {
|
|
25
27
|
"Content-Type": "application/json;charset=UTF-8",
|
|
@@ -44,13 +46,15 @@ export class FinteqHubProcessing {
|
|
|
44
46
|
submitForm(data) {
|
|
45
47
|
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
46
48
|
try {
|
|
47
|
-
const
|
|
49
|
+
const url = this.isSecure ? `${this.apiUrl}/v1/secure/transactions/submit-form` : `${this.apiUrl}/v1/transactions/submit-form`;
|
|
50
|
+
const response = yield this.sendPost(url, Object.assign({ session: Object.assign({ fingerprint: this.fingerprintVisitorId }, getDeviceData()) }, data));
|
|
48
51
|
const result = yield response.json();
|
|
49
52
|
if (result.error || response.status !== 200) {
|
|
50
53
|
reject(new Error(result.error));
|
|
51
54
|
}
|
|
52
55
|
else {
|
|
53
|
-
this.
|
|
56
|
+
const url = this.isSecure ? `${this.apiUrl}/v1/secure/operations/${result.operationId}` : `${this.apiUrl}/v1/operations/${result.operationId}`;
|
|
57
|
+
this.processOperation(url, resolve, reject);
|
|
54
58
|
}
|
|
55
59
|
}
|
|
56
60
|
catch (e) {
|
package/dist/src/typings.d.ts
CHANGED
|
@@ -118,6 +118,7 @@ export declare type SubmitData = {
|
|
|
118
118
|
payer: Payer;
|
|
119
119
|
};
|
|
120
120
|
paymentMethod: string;
|
|
121
|
+
transactionType: string;
|
|
121
122
|
} | {
|
|
122
123
|
credentials: {
|
|
123
124
|
billingAddress: Address;
|
|
@@ -128,6 +129,7 @@ export declare type SubmitData = {
|
|
|
128
129
|
} | {
|
|
129
130
|
credentials: Record<string, string>;
|
|
130
131
|
paymentMethod: string;
|
|
132
|
+
transactionType: string;
|
|
131
133
|
};
|
|
132
134
|
export declare type ProcessOperationRedirectResponse = {
|
|
133
135
|
type: "redirect";
|