@tonder.io/ionic-lite-sdk 0.0.14 → 0.0.17-beta
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/.gitlab-ci.yml +28 -28
- package/README.md +496 -494
- package/dist/classes/liteCheckout.d.ts +2 -2
- package/dist/types/requests.d.ts +3 -15
- package/dist/types/responses.d.ts +14 -13
- package/jest.config.ts +14 -14
- package/package.json +38 -38
- package/rollup.config.js +16 -16
- package/src/classes/errorResponse.ts +16 -16
- package/src/classes/liteCheckout.ts +302 -301
- package/src/helpers/utils.ts +37 -37
- package/src/index.ts +4 -4
- package/src/types/commons.ts +61 -61
- package/src/types/requests.ts +60 -60
- package/src/types/responses.ts +185 -185
- package/src/types/skyflow.ts +17 -17
- package/tests/classes/liteCheckout.test.ts +57 -57
- package/tests/methods/createOrder.test.ts +105 -105
- package/tests/methods/createPayment.test.ts +108 -108
- package/tests/methods/customerRegister.test.ts +105 -105
- package/tests/methods/getBusiness.test.ts +102 -102
- package/tests/methods/getCustomerCards.test.ts +104 -104
- package/tests/methods/getOpenpayDeviceSessionID.test.ts +94 -94
- package/tests/methods/getSkyflowToken.test.ts +136 -136
- package/tests/methods/getVaultToken.test.ts +106 -106
- package/tests/methods/registerCustomerCard.test.ts +104 -104
- package/tests/methods/startCheckoutRouter.test.ts +106 -106
- package/tests/utils/defaultMock.ts +20 -20
- package/tests/utils/mockClasses.ts +538 -538
- package/tsconfig.json +18 -18
|
@@ -20,9 +20,9 @@ export declare class LiteCheckout implements LiteCheckoutConstructor {
|
|
|
20
20
|
getOpenpayDeviceSessionID(merchant_id: string, public_key: string): Promise<string | ErrorResponse>;
|
|
21
21
|
getBusiness(): Promise<GetBusinessResponse | ErrorResponse>;
|
|
22
22
|
customerRegister(email: string): Promise<CustomerRegisterResponse | ErrorResponse>;
|
|
23
|
-
createOrder(orderItems: CreateOrderRequest): Promise<CreateOrderResponse | ErrorResponse>;
|
|
23
|
+
createOrder(orderItems: CreateOrderRequest): Promise<CreateOrderResponse[] | ErrorResponse>;
|
|
24
24
|
createPayment(paymentItems: CreatePaymentRequest): Promise<CreatePaymentResponse | ErrorResponse>;
|
|
25
|
-
startCheckoutRouter(routerData: StartCheckoutRequest): Promise<StartCheckoutResponse | ErrorResponse>;
|
|
25
|
+
startCheckoutRouter(routerData: StartCheckoutRequest): Promise<StartCheckoutResponse[] | ErrorResponse>;
|
|
26
26
|
getSkyflowTokens({ vault_id, vault_url, data, }: TokensRequest): Promise<any | ErrorResponse>;
|
|
27
27
|
getVaultToken(): Promise<string>;
|
|
28
28
|
getFieldsPromise(data: any, collectContainer: CollectContainer): Promise<Promise<boolean>[]>;
|
package/dist/types/requests.d.ts
CHANGED
|
@@ -1,21 +1,9 @@
|
|
|
1
1
|
import { OrderItem } from "./commons";
|
|
2
2
|
import { SkyflowRecord } from "./skyflow";
|
|
3
|
-
export interface CreateOrderRequest {
|
|
4
|
-
business: string;
|
|
5
|
-
client: string;
|
|
6
|
-
billing_address_id?: string | null;
|
|
7
|
-
shipping_address_id?: string | null;
|
|
8
|
-
amount: number;
|
|
9
|
-
status: string;
|
|
10
|
-
reference: string | number;
|
|
11
|
-
is_oneclick: boolean;
|
|
12
|
-
items: OrderItem[];
|
|
3
|
+
export interface CreateOrderRequest extends OrderItem {
|
|
13
4
|
}
|
|
14
5
|
export type CreatePaymentRequest = {
|
|
15
|
-
business_pk: string
|
|
16
|
-
amount: number;
|
|
17
|
-
date: string;
|
|
18
|
-
order: string | number;
|
|
6
|
+
business_pk: string;
|
|
19
7
|
};
|
|
20
8
|
export type StartCheckoutRequest = {
|
|
21
9
|
card: any;
|
|
@@ -23,7 +11,7 @@ export type StartCheckoutRequest = {
|
|
|
23
11
|
last_name: string;
|
|
24
12
|
email_client: any;
|
|
25
13
|
phone_number: any;
|
|
26
|
-
return_url
|
|
14
|
+
return_url: string;
|
|
27
15
|
id_product: string;
|
|
28
16
|
quantity_product: number;
|
|
29
17
|
id_ship: string;
|
|
@@ -9,12 +9,12 @@ export type GetVaultTokenResponse = {
|
|
|
9
9
|
token: string;
|
|
10
10
|
};
|
|
11
11
|
export type CustomerRegisterResponse = {
|
|
12
|
-
id: number
|
|
12
|
+
id: number;
|
|
13
13
|
email: string;
|
|
14
14
|
auth_token: string;
|
|
15
15
|
};
|
|
16
16
|
export type CreateOrderResponse = {
|
|
17
|
-
id: number
|
|
17
|
+
id: number;
|
|
18
18
|
created: string;
|
|
19
19
|
amount: string;
|
|
20
20
|
status: string;
|
|
@@ -46,7 +46,7 @@ export type CreateOrderResponse = {
|
|
|
46
46
|
};
|
|
47
47
|
};
|
|
48
48
|
export type CreatePaymentResponse = {
|
|
49
|
-
pk: number
|
|
49
|
+
pk: number;
|
|
50
50
|
order?: string;
|
|
51
51
|
amount: string;
|
|
52
52
|
status: string;
|
|
@@ -159,16 +159,17 @@ export type TokensResponse = {
|
|
|
159
159
|
export type GetCustomerCardsResponse = {
|
|
160
160
|
user_id: number;
|
|
161
161
|
cards: {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
162
|
+
records: {
|
|
163
|
+
fields: {
|
|
164
|
+
card_number: string;
|
|
165
|
+
cardholder_name: string;
|
|
166
|
+
cvv: string;
|
|
167
|
+
expiration_month: string;
|
|
168
|
+
expiration_year: string;
|
|
169
|
+
skyflow_id: string;
|
|
170
|
+
};
|
|
171
|
+
}[];
|
|
172
|
+
};
|
|
172
173
|
};
|
|
173
174
|
export type RegisterCustomerCardResponse = {
|
|
174
175
|
skyflow_id: string;
|
package/jest.config.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type { JestConfigWithTsJest } from 'ts-jest'
|
|
2
|
-
|
|
3
|
-
const jestConfig: JestConfigWithTsJest = {
|
|
4
|
-
testEnvironment: "jsdom",
|
|
5
|
-
preset: 'ts-jest',
|
|
6
|
-
transform: {
|
|
7
|
-
'^.+\\.tsx?$': [
|
|
8
|
-
'ts-jest',
|
|
9
|
-
{
|
|
10
|
-
},
|
|
11
|
-
],
|
|
12
|
-
},
|
|
13
|
-
}
|
|
14
|
-
|
|
1
|
+
import type { JestConfigWithTsJest } from 'ts-jest'
|
|
2
|
+
|
|
3
|
+
const jestConfig: JestConfigWithTsJest = {
|
|
4
|
+
testEnvironment: "jsdom",
|
|
5
|
+
preset: 'ts-jest',
|
|
6
|
+
transform: {
|
|
7
|
+
'^.+\\.tsx?$': [
|
|
8
|
+
'ts-jest',
|
|
9
|
+
{
|
|
10
|
+
},
|
|
11
|
+
],
|
|
12
|
+
},
|
|
13
|
+
}
|
|
14
|
+
|
|
15
15
|
export default jestConfig
|
package/package.json
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@tonder.io/ionic-lite-sdk",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "Tonder ionic lite SDK",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"build": "tsc -noEmit && rollup --config",
|
|
9
|
-
"test": "jest",
|
|
10
|
-
"ts-coverage": "typescript-coverage-report"
|
|
11
|
-
},
|
|
12
|
-
"author": "",
|
|
13
|
-
"license": "ISC",
|
|
14
|
-
"dependencies": {
|
|
15
|
-
"skyflow-js": "^1.34.1",
|
|
16
|
-
"ts-node": "^10.9.2"
|
|
17
|
-
},
|
|
18
|
-
"publishConfig": {
|
|
19
|
-
"access": "public",
|
|
20
|
-
"registry": "https://registry.npmjs.org/"
|
|
21
|
-
},
|
|
22
|
-
"devDependencies": {
|
|
23
|
-
"@rollup/plugin-terser": "^0.4.4",
|
|
24
|
-
"@rollup/plugin-typescript": "11.1.6",
|
|
25
|
-
"@types/crypto-js": "^4.2.2",
|
|
26
|
-
"@types/jest": "^29.5.11",
|
|
27
|
-
"@types/node": "^20.11.5",
|
|
28
|
-
"jest": "^29.7.0",
|
|
29
|
-
"jest-environment-jsdom": "^29.7.0",
|
|
30
|
-
"jsdom": "^24.0.0",
|
|
31
|
-
"rollup": "4.9.6",
|
|
32
|
-
"ts-jest": "^29.1.2",
|
|
33
|
-
"ts-loader": "^9.5.1",
|
|
34
|
-
"tslib": "^2.6.2",
|
|
35
|
-
"typescript": "^5.3.3",
|
|
36
|
-
"typescript-coverage-report": "^0.8.0"
|
|
37
|
-
}
|
|
38
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@tonder.io/ionic-lite-sdk",
|
|
3
|
+
"version": "0.0.17-beta",
|
|
4
|
+
"description": "Tonder ionic lite SDK",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc -noEmit && rollup --config",
|
|
9
|
+
"test": "jest",
|
|
10
|
+
"ts-coverage": "typescript-coverage-report"
|
|
11
|
+
},
|
|
12
|
+
"author": "",
|
|
13
|
+
"license": "ISC",
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"skyflow-js": "^1.34.1",
|
|
16
|
+
"ts-node": "^10.9.2"
|
|
17
|
+
},
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public",
|
|
20
|
+
"registry": "https://registry.npmjs.org/"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
24
|
+
"@rollup/plugin-typescript": "11.1.6",
|
|
25
|
+
"@types/crypto-js": "^4.2.2",
|
|
26
|
+
"@types/jest": "^29.5.11",
|
|
27
|
+
"@types/node": "^20.11.5",
|
|
28
|
+
"jest": "^29.7.0",
|
|
29
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
30
|
+
"jsdom": "^24.0.0",
|
|
31
|
+
"rollup": "4.9.6",
|
|
32
|
+
"ts-jest": "^29.1.2",
|
|
33
|
+
"ts-loader": "^9.5.1",
|
|
34
|
+
"tslib": "^2.6.2",
|
|
35
|
+
"typescript": "^5.3.3",
|
|
36
|
+
"typescript-coverage-report": "^0.8.0"
|
|
37
|
+
}
|
|
38
|
+
}
|
package/rollup.config.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
const typescript = require('@rollup/plugin-typescript');
|
|
2
|
-
const terser = require('@rollup/plugin-terser');
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
input: './src/index.ts',
|
|
6
|
-
output: {
|
|
7
|
-
dir: 'dist',
|
|
8
|
-
format: 'es',
|
|
9
|
-
plugins: [terser()]
|
|
10
|
-
},
|
|
11
|
-
plugins: [
|
|
12
|
-
typescript({
|
|
13
|
-
exclude: ["tests/**", "jest.config.ts"]
|
|
14
|
-
})
|
|
15
|
-
],
|
|
16
|
-
external: ["skyflow-js", "crypto-js"]
|
|
1
|
+
const typescript = require('@rollup/plugin-typescript');
|
|
2
|
+
const terser = require('@rollup/plugin-terser');
|
|
3
|
+
|
|
4
|
+
module.exports = {
|
|
5
|
+
input: './src/index.ts',
|
|
6
|
+
output: {
|
|
7
|
+
dir: 'dist',
|
|
8
|
+
format: 'es',
|
|
9
|
+
plugins: [terser()]
|
|
10
|
+
},
|
|
11
|
+
plugins: [
|
|
12
|
+
typescript({
|
|
13
|
+
exclude: ["tests/**", "jest.config.ts"]
|
|
14
|
+
})
|
|
15
|
+
],
|
|
16
|
+
external: ["skyflow-js", "crypto-js"]
|
|
17
17
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { IErrorResponse } from "../types/responses";
|
|
2
|
-
|
|
3
|
-
export class ErrorResponse implements IErrorResponse {
|
|
4
|
-
code?: string | undefined;
|
|
5
|
-
body?: string | undefined;
|
|
6
|
-
name!: string;
|
|
7
|
-
message!: string;
|
|
8
|
-
stack?: string | undefined;
|
|
9
|
-
|
|
10
|
-
constructor({ code, body, name, message, stack }: IErrorResponse) {
|
|
11
|
-
this.code = code;
|
|
12
|
-
this.body = body;
|
|
13
|
-
this.name = name;
|
|
14
|
-
this.message = message;
|
|
15
|
-
this.stack = stack;
|
|
16
|
-
}
|
|
1
|
+
import { IErrorResponse } from "../types/responses";
|
|
2
|
+
|
|
3
|
+
export class ErrorResponse implements IErrorResponse {
|
|
4
|
+
code?: string | undefined;
|
|
5
|
+
body?: string | undefined;
|
|
6
|
+
name!: string;
|
|
7
|
+
message!: string;
|
|
8
|
+
stack?: string | undefined;
|
|
9
|
+
|
|
10
|
+
constructor({ code, body, name, message, stack }: IErrorResponse) {
|
|
11
|
+
this.code = code;
|
|
12
|
+
this.body = body;
|
|
13
|
+
this.name = name;
|
|
14
|
+
this.message = message;
|
|
15
|
+
this.stack = stack;
|
|
16
|
+
}
|
|
17
17
|
}
|