@finteqhub/sdk-js 0.2.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/README.md +2 -2
- package/dist/src/processing.d.ts +2 -2
- package/dist/src/processing.js +2 -2
- package/dist/src/typings.d.ts +13 -2
- package/package.json +9 -3
package/README.md
CHANGED
|
@@ -8,11 +8,11 @@ const processing = new FinteqHubProcessing('api-url', 'fingerprint-visitor-id',
|
|
|
8
8
|
|
|
9
9
|
## processing.submitForm(data)
|
|
10
10
|
|
|
11
|
-
Use `processing.submitForm` to submit transaction. When called, `processing.submitForm` will attempt to complete any required actions to process transaction. This method returns a
|
|
11
|
+
Use `processing.submitForm` to submit transaction. When called, `processing.submitForm` will attempt to complete any required actions to process transaction. This method returns a promise which resolves with response (`{ "type": "redirect", "redirectUrl": string}`) or error that describes the failure.
|
|
12
12
|
|
|
13
13
|
```
|
|
14
14
|
processing
|
|
15
15
|
.submitForm(data)
|
|
16
|
-
.then(
|
|
16
|
+
.then(result => console.log(result))
|
|
17
17
|
.catch(error => console.warn(error));
|
|
18
18
|
```
|
package/dist/src/processing.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { SubmitData } from "./typings";
|
|
1
|
+
import { ProcessOperationRedirectResponse, SubmitData } from "./typings";
|
|
2
2
|
export declare class FinteqHubProcessing {
|
|
3
3
|
private apiUrl;
|
|
4
4
|
private fingerprintVisitorId;
|
|
5
5
|
private merchantId;
|
|
6
6
|
private sessionId;
|
|
7
7
|
constructor(apiUrl: string, fingerprintVisitorId: string, merchantId: string, sessionId: string);
|
|
8
|
-
submitForm(data: SubmitData): Promise<
|
|
8
|
+
submitForm(data: SubmitData): Promise<ProcessOperationRedirectResponse>;
|
|
9
9
|
private processOperation;
|
|
10
10
|
private sendPost;
|
|
11
11
|
}
|
package/dist/src/processing.js
CHANGED
|
@@ -37,7 +37,7 @@ export class FinteqHubProcessing {
|
|
|
37
37
|
if (response.status === 200) {
|
|
38
38
|
response.json().then((result) => {
|
|
39
39
|
if (result.type === "redirect") {
|
|
40
|
-
resolve(result
|
|
40
|
+
resolve(result);
|
|
41
41
|
}
|
|
42
42
|
else if (result.type === "submitForm") {
|
|
43
43
|
let iframe = document.createElement("iframe");
|
|
@@ -57,7 +57,7 @@ export class FinteqHubProcessing {
|
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
-
else
|
|
60
|
+
else {
|
|
61
61
|
response
|
|
62
62
|
.json()
|
|
63
63
|
.then((result) => reject(new Error(result.error)))
|
package/dist/src/typings.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export declare type Card = {
|
|
|
4
4
|
expiryMonth: number;
|
|
5
5
|
expiryYear: number;
|
|
6
6
|
CVV: string;
|
|
7
|
+
tokenize: boolean;
|
|
7
8
|
};
|
|
8
9
|
export declare type Payer = {
|
|
9
10
|
firstName: string;
|
|
@@ -12,14 +13,14 @@ export declare type Payer = {
|
|
|
12
13
|
country: string;
|
|
13
14
|
birthDate: string;
|
|
14
15
|
phoneNumber: string;
|
|
15
|
-
|
|
16
|
+
phoneCountryCode: string;
|
|
16
17
|
};
|
|
17
18
|
export declare type BillingAddress = {
|
|
18
19
|
address: string;
|
|
19
20
|
city: string;
|
|
20
21
|
state: string;
|
|
21
22
|
country: string;
|
|
22
|
-
|
|
23
|
+
postalCode: string;
|
|
23
24
|
};
|
|
24
25
|
export declare type SubmitData = {
|
|
25
26
|
type: string;
|
|
@@ -27,3 +28,13 @@ export declare type SubmitData = {
|
|
|
27
28
|
billingAddress: BillingAddress;
|
|
28
29
|
payer: Payer;
|
|
29
30
|
};
|
|
31
|
+
export declare type ProcessOperationRedirectResponse = {
|
|
32
|
+
type: "redirect";
|
|
33
|
+
redirectUrl: string;
|
|
34
|
+
metadata: unknown;
|
|
35
|
+
};
|
|
36
|
+
export declare type ProcessOperationResponse = {
|
|
37
|
+
type: "submitForm";
|
|
38
|
+
formUrl: string;
|
|
39
|
+
metadata: unknown;
|
|
40
|
+
} | ProcessOperationRedirectResponse;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finteqhub/sdk-js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "SDK for interacting with FinteqHub processing API",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"typings": "./dist/index.d.ts",
|
|
@@ -9,10 +9,16 @@
|
|
|
9
9
|
],
|
|
10
10
|
"author": "FinteqHub",
|
|
11
11
|
"devDependencies": {
|
|
12
|
-
"
|
|
12
|
+
"@types/jest": "^29.1.1",
|
|
13
|
+
"jest": "^29.1.2",
|
|
14
|
+
"jest-environment-jsdom": "^29.1.2",
|
|
15
|
+
"ts-jest": "^29.0.3",
|
|
16
|
+
"typescript": "^4.8.3",
|
|
17
|
+
"whatwg-fetch": "^3.6.2"
|
|
13
18
|
},
|
|
14
19
|
"scripts": {
|
|
15
|
-
"build": "tsc"
|
|
20
|
+
"build": "tsc",
|
|
21
|
+
"test": "jest"
|
|
16
22
|
},
|
|
17
23
|
"publishConfig": {
|
|
18
24
|
"registry": "https://registry.npmjs.org"
|