@tonder.io/ionic-lite-sdk 0.0.35-beta.5 → 0.0.35-beta.7
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/.idea/workspace.xml +3 -7
- package/dist/{src/classes → classes}/BaseInlineCheckout.d.ts +1 -1
- package/dist/{src/classes → classes}/errorResponse.d.ts +1 -1
- package/dist/{src/classes → classes}/liteCheckout.d.ts +1 -1
- package/dist/{src/data → data}/businessApi.d.ts +1 -1
- package/dist/{src/data → data}/cardApi.d.ts +1 -1
- package/dist/{src/data → data}/checkoutApi.d.ts +1 -1
- package/dist/{src/data → data}/customerApi.d.ts +1 -1
- package/dist/{src/data → data}/paymentMethodApi.d.ts +1 -1
- package/dist/{src/helpers → helpers}/skyflow.d.ts +1 -1
- package/package.json +2 -2
- package/src/classes/BaseInlineCheckout.ts +1 -1
- package/src/classes/errorResponse.ts +1 -1
- package/src/classes/liteCheckout.ts +1 -1
- package/src/data/businessApi.ts +1 -1
- package/src/data/cardApi.ts +1 -1
- package/src/data/checkoutApi.ts +1 -1
- package/src/data/customerApi.ts +1 -1
- package/src/data/paymentMethodApi.ts +1 -1
- package/src/helpers/skyflow.ts +1 -1
- package/src/helpers/utils.ts +1 -1
- package/src/types/card.ts +34 -0
- package/src/types/checkout.ts +118 -0
- package/src/types/commons.ts +125 -0
- package/src/types/customer.ts +12 -0
- package/src/types/index.d.ts +10 -0
- package/src/types/liteInlineCheckout.d.ts +191 -0
- package/src/types/paymentMethod.ts +24 -0
- package/src/types/requests.ts +115 -0
- package/src/types/responses.ts +189 -0
- package/src/types/skyflow.ts +17 -0
- package/src/types/validations.d.ts +11 -0
- package/tests/methods/createOrder.test.ts +1 -1
- package/tests/methods/createPayment.test.ts +1 -1
- package/tests/methods/customerRegister.test.ts +1 -1
- package/tests/methods/getBusiness.test.ts +1 -1
- package/tests/methods/getCustomerCards.test.ts +1 -1
- package/tests/methods/registerCustomerCard.test.ts +1 -1
- package/tests/methods/startCheckoutRouter.test.ts +1 -1
- package/tests/methods/startCheckoutRouterFull.test.ts +1 -1
- package/tests/utils/mockClasses.ts +3 -3
- /package/dist/{src/classes → classes}/3dsHandler.d.ts +0 -0
- /package/dist/{src/data → data}/api.d.ts +0 -0
- /package/dist/{src/data → data}/openPayApi.d.ts +0 -0
- /package/dist/{src/data → data}/skyflowApi.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/constants.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/mercadopago.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/utils.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/validations.d.ts +0 -0
- /package/dist/{src/index.d.ts → index.d.ts} +0 -0
- /package/dist/{src/shared → shared}/catalog/paymentMethodsCatalog.d.ts +0 -0
- /package/dist/{src/shared → shared}/constants/messages.d.ts +0 -0
- /package/dist/{src/shared → shared}/constants/paymentMethodAPM.d.ts +0 -0
- /package/dist/{src/shared → shared}/constants/tonderUrl.d.ts +0 -0
package/.idea/workspace.xml
CHANGED
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
<change afterPath="$PROJECT_DIR$/src/shared/constants/messages.ts" afterDir="false" />
|
|
25
25
|
<change afterPath="$PROJECT_DIR$/src/shared/constants/paymentMethodAPM.ts" afterDir="false" />
|
|
26
26
|
<change afterPath="$PROJECT_DIR$/src/shared/constants/tonderUrl.ts" afterDir="false" />
|
|
27
|
+
<change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
|
|
27
28
|
<change beforePath="$PROJECT_DIR$/package-lock.json" beforeDir="false" afterPath="$PROJECT_DIR$/package-lock.json" afterDir="false" />
|
|
28
29
|
<change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
|
|
29
30
|
<change beforePath="$PROJECT_DIR$/src/classes/errorResponse.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/classes/errorResponse.ts" afterDir="false" />
|
|
@@ -36,17 +37,11 @@
|
|
|
36
37
|
<change beforePath="$PROJECT_DIR$/src/types/responses.ts" beforeDir="false" />
|
|
37
38
|
<change beforePath="$PROJECT_DIR$/src/types/skyflow.ts" beforeDir="false" />
|
|
38
39
|
<change beforePath="$PROJECT_DIR$/tests/classes/liteCheckout.test.ts" beforeDir="false" afterPath="$PROJECT_DIR$/tests/classes/liteCheckout.test.ts" afterDir="false" />
|
|
39
|
-
<change beforePath="$PROJECT_DIR$/tests/methods/createOrder.test.ts" beforeDir="false" afterPath="$PROJECT_DIR$/tests/methods/createOrder.test.ts" afterDir="false" />
|
|
40
|
-
<change beforePath="$PROJECT_DIR$/tests/methods/createPayment.test.ts" beforeDir="false" afterPath="$PROJECT_DIR$/tests/methods/createPayment.test.ts" afterDir="false" />
|
|
41
|
-
<change beforePath="$PROJECT_DIR$/tests/methods/customerRegister.test.ts" beforeDir="false" afterPath="$PROJECT_DIR$/tests/methods/customerRegister.test.ts" afterDir="false" />
|
|
42
40
|
<change beforePath="$PROJECT_DIR$/tests/methods/getBusiness.test.ts" beforeDir="false" afterPath="$PROJECT_DIR$/tests/methods/getBusiness.test.ts" afterDir="false" />
|
|
43
41
|
<change beforePath="$PROJECT_DIR$/tests/methods/getCustomerCards.test.ts" beforeDir="false" afterPath="$PROJECT_DIR$/tests/methods/getCustomerCards.test.ts" afterDir="false" />
|
|
44
42
|
<change beforePath="$PROJECT_DIR$/tests/methods/getOpenpayDeviceSessionID.test.ts" beforeDir="false" />
|
|
45
43
|
<change beforePath="$PROJECT_DIR$/tests/methods/getSkyflowToken.test.ts" beforeDir="false" />
|
|
46
44
|
<change beforePath="$PROJECT_DIR$/tests/methods/getVaultToken.test.ts" beforeDir="false" />
|
|
47
|
-
<change beforePath="$PROJECT_DIR$/tests/methods/registerCustomerCard.test.ts" beforeDir="false" afterPath="$PROJECT_DIR$/tests/methods/registerCustomerCard.test.ts" afterDir="false" />
|
|
48
|
-
<change beforePath="$PROJECT_DIR$/tests/methods/startCheckoutRouter.test.ts" beforeDir="false" afterPath="$PROJECT_DIR$/tests/methods/startCheckoutRouter.test.ts" afterDir="false" />
|
|
49
|
-
<change beforePath="$PROJECT_DIR$/tests/methods/startCheckoutRouterFull.test.ts" beforeDir="false" afterPath="$PROJECT_DIR$/tests/methods/startCheckoutRouterFull.test.ts" afterDir="false" />
|
|
50
45
|
<change beforePath="$PROJECT_DIR$/tests/utils/defaultMock.ts" beforeDir="false" afterPath="$PROJECT_DIR$/tests/utils/defaultMock.ts" afterDir="false" />
|
|
51
46
|
<change beforePath="$PROJECT_DIR$/tests/utils/mockClasses.ts" beforeDir="false" afterPath="$PROJECT_DIR$/tests/utils/mockClasses.ts" afterDir="false" />
|
|
52
47
|
</list>
|
|
@@ -90,6 +85,7 @@
|
|
|
90
85
|
}]]></component>
|
|
91
86
|
<component name="RecentsManager">
|
|
92
87
|
<key name="MoveFile.RECENT_KEYS">
|
|
88
|
+
<recent name="$PROJECT_DIR$/src" />
|
|
93
89
|
<recent name="$PROJECT_DIR$" />
|
|
94
90
|
</key>
|
|
95
91
|
</component>
|
|
@@ -103,7 +99,7 @@
|
|
|
103
99
|
<updated>1724776429568</updated>
|
|
104
100
|
<workItem from="1724776430626" duration="1847000" />
|
|
105
101
|
<workItem from="1724790840744" duration="239000" />
|
|
106
|
-
<workItem from="1725305433705" duration="
|
|
102
|
+
<workItem from="1725305433705" duration="19521000" />
|
|
107
103
|
</task>
|
|
108
104
|
<servers />
|
|
109
105
|
</component>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ThreeDSHandler } from "./3dsHandler";
|
|
2
2
|
import { ErrorResponse } from "./errorResponse";
|
|
3
|
-
import { Business, ICustomer, IItem, IInlineCheckoutBaseOptions, IConfigureCheckout, IProcessPaymentRequest, IStartCheckoutResponse, StartCheckoutResponse } from "
|
|
3
|
+
import { Business, ICustomer, IItem, IInlineCheckoutBaseOptions, IConfigureCheckout, IProcessPaymentRequest, IStartCheckoutResponse, StartCheckoutResponse } from "../types";
|
|
4
4
|
export declare class BaseInlineCheckout {
|
|
5
5
|
#private;
|
|
6
6
|
baseUrl: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ErrorResponse } from "./errorResponse";
|
|
2
2
|
import { BaseInlineCheckout } from "./BaseInlineCheckout";
|
|
3
|
-
import { APM, IInlineCheckoutBaseOptions, RegisterCustomerCardResponse, ISaveCardRequest, ICustomerCardsResponse, ISaveCardResponse, IPaymentMethod, GetBusinessResponse, TokensRequest, ICardFields, CustomerRegisterResponse, StartCheckoutFullRequest, CreateOrderRequest, CreatePaymentRequest, StartCheckoutRequest, StartCheckoutResponse, StartCheckoutIdRequest, CreatePaymentResponse, CreateOrderResponse, RegisterCustomerCardRequest } from "
|
|
3
|
+
import { APM, IInlineCheckoutBaseOptions, RegisterCustomerCardResponse, ISaveCardRequest, ICustomerCardsResponse, ISaveCardResponse, IPaymentMethod, GetBusinessResponse, TokensRequest, ICardFields, CustomerRegisterResponse, StartCheckoutFullRequest, CreateOrderRequest, CreatePaymentRequest, StartCheckoutRequest, StartCheckoutResponse, StartCheckoutIdRequest, CreatePaymentResponse, CreateOrderResponse, RegisterCustomerCardRequest } from "../types";
|
|
4
4
|
declare global {
|
|
5
5
|
interface Window {
|
|
6
6
|
OpenPay: any;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { GetBusinessResponse } from "
|
|
1
|
+
import { GetBusinessResponse } from "../types";
|
|
2
2
|
export declare function fetchBusiness(baseUrl: string, apiKey: string, signal: AbortSignal): Promise<GetBusinessResponse>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICustomerCardsResponse, ISaveCardResponse, ISaveCardSkyflowRequest } from "
|
|
1
|
+
import { ICustomerCardsResponse, ISaveCardResponse, ISaveCardSkyflowRequest } from "../types";
|
|
2
2
|
export declare function fetchCustomerCards(baseUrl: string, customerToken: string, businessId: string | number, signal?: null): Promise<ICustomerCardsResponse>;
|
|
3
3
|
export declare function saveCustomerCard(baseUrl: string, customerToken: string, businessId: string | number, data: ISaveCardSkyflowRequest): Promise<ISaveCardResponse>;
|
|
4
4
|
export declare function removeCustomerCard(baseUrl: string, customerToken: string, skyflowId: string | undefined, businessId: string | number): Promise<string>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateOrderRequest, CreatePaymentRequest, IStartCheckoutIdRequest, IStartCheckoutRequest } from "
|
|
1
|
+
import { CreateOrderRequest, CreatePaymentRequest, IStartCheckoutIdRequest, IStartCheckoutRequest } from "../types";
|
|
2
2
|
export declare function createOrder(baseUrl: string, apiKey: string, orderItems: CreateOrderRequest): Promise<any>;
|
|
3
3
|
export declare function createPayment(baseUrl: string, apiKey: string, paymentItems: CreatePaymentRequest): Promise<any>;
|
|
4
4
|
export declare function startCheckoutRouter(baseUrl: string, apiKey: string, routerItems: IStartCheckoutRequest | IStartCheckoutIdRequest): Promise<any>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { CustomerRegisterResponse } from "
|
|
1
|
+
import { CustomerRegisterResponse } from "../types";
|
|
2
2
|
export declare function registerOrFetchCustomer(baseUrl: string, apiKey: string, customer: Record<string, any>, signal?: AbortSignal | null): Promise<CustomerRegisterResponse>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ErrorResponse } from "../classes/errorResponse";
|
|
2
|
-
import { TokensSkyflowRequest } from "
|
|
2
|
+
import { TokensSkyflowRequest } from "../types";
|
|
3
3
|
export declare function getSkyflowTokens({ baseUrl, apiKey, vault_id, vault_url, data, }: TokensSkyflowRequest): Promise<any | ErrorResponse>;
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tonder.io/ionic-lite-sdk",
|
|
3
|
-
"version": "0.0.35-beta.
|
|
3
|
+
"version": "0.0.35-beta.7",
|
|
4
4
|
"description": "Tonder ionic lite SDK",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
|
-
"types": "types/index.d.ts",
|
|
6
|
+
"types": "src/types/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "tsc -noEmit && rollup --config",
|
|
9
9
|
"test": "jest",
|
package/src/data/businessApi.ts
CHANGED
package/src/data/cardApi.ts
CHANGED
package/src/data/checkoutApi.ts
CHANGED
package/src/data/customerApi.ts
CHANGED
package/src/helpers/skyflow.ts
CHANGED
|
@@ -4,7 +4,7 @@ import CollectContainer from "skyflow-js/types/core/external/collect/collect-con
|
|
|
4
4
|
import {buildErrorResponseFromCatch} from "./utils";
|
|
5
5
|
import CollectElement from "skyflow-js/types/core/external/collect/collect-element";
|
|
6
6
|
import {getVaultToken} from "../data/skyflowApi";
|
|
7
|
-
import {TokensSkyflowRequest} from "
|
|
7
|
+
import {TokensSkyflowRequest} from "../types";
|
|
8
8
|
|
|
9
9
|
export async function getSkyflowTokens({
|
|
10
10
|
baseUrl,
|
package/src/helpers/utils.ts
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export interface ICard {
|
|
2
|
+
fields: ICardSkyflowFields;
|
|
3
|
+
icon?: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface ICardSkyflowFields {
|
|
7
|
+
card_number: string;
|
|
8
|
+
expiration_month: string;
|
|
9
|
+
expiration_year: string;
|
|
10
|
+
skyflow_id: string;
|
|
11
|
+
card_scheme: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface ICustomerCardsResponse {
|
|
15
|
+
user_id: number;
|
|
16
|
+
cards: ICard[];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface ISaveCardResponse {
|
|
20
|
+
skyflow_id: string;
|
|
21
|
+
user_id: number;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface ISaveCardSkyflowRequest {
|
|
25
|
+
skyflow_id: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface ISaveCardRequest {
|
|
29
|
+
card_number: string;
|
|
30
|
+
cvv: string;
|
|
31
|
+
expiration_month: string;
|
|
32
|
+
expiration_year: string;
|
|
33
|
+
cardholder_name: string;
|
|
34
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import {ICustomer} from "./customer";
|
|
2
|
+
|
|
3
|
+
export interface IStartCheckoutRequestBase {
|
|
4
|
+
name: any;
|
|
5
|
+
last_name: string;
|
|
6
|
+
email_client: any;
|
|
7
|
+
phone_number: any;
|
|
8
|
+
return_url?: string;
|
|
9
|
+
id_product: string;
|
|
10
|
+
quantity_product: number;
|
|
11
|
+
id_ship: string;
|
|
12
|
+
instance_id_ship: string;
|
|
13
|
+
amount: any;
|
|
14
|
+
title_ship: string;
|
|
15
|
+
description: string;
|
|
16
|
+
device_session_id: any;
|
|
17
|
+
token_id: string;
|
|
18
|
+
order_id: any;
|
|
19
|
+
business_id: any;
|
|
20
|
+
payment_id: any;
|
|
21
|
+
source: string;
|
|
22
|
+
browser_info?: any;
|
|
23
|
+
metadata: any;
|
|
24
|
+
currency: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type IStartCheckoutRequestWithCard = IStartCheckoutRequestBase & {
|
|
28
|
+
card: any;
|
|
29
|
+
payment_method?: never;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type IStartCheckoutRequestWithPaymentMethod =
|
|
33
|
+
IStartCheckoutRequestBase & {
|
|
34
|
+
card?: never;
|
|
35
|
+
payment_method: string;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export type IStartCheckoutRequest =
|
|
39
|
+
| IStartCheckoutRequestWithCard
|
|
40
|
+
| IStartCheckoutRequestWithPaymentMethod;
|
|
41
|
+
|
|
42
|
+
export interface IStartCheckoutIdRequest {
|
|
43
|
+
checkout_id: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface IStartCheckoutErrorResponse {
|
|
47
|
+
status: string;
|
|
48
|
+
message: string;
|
|
49
|
+
psp_response: [
|
|
50
|
+
{
|
|
51
|
+
status: number;
|
|
52
|
+
response: Object;
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
checkout_id: string;
|
|
56
|
+
is_route_finished: boolean;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface IStartCheckoutResponse {
|
|
60
|
+
status: string;
|
|
61
|
+
message: string;
|
|
62
|
+
psp_response: Record<string, any>;
|
|
63
|
+
checkout_id: string;
|
|
64
|
+
is_route_finished: Boolean;
|
|
65
|
+
transaction_status: string;
|
|
66
|
+
transaction_id: number;
|
|
67
|
+
payment_id: number;
|
|
68
|
+
provider: string;
|
|
69
|
+
next_action: {
|
|
70
|
+
redirect_to_url: {
|
|
71
|
+
url: string;
|
|
72
|
+
return_url: string;
|
|
73
|
+
verify_transaction_status_url: string;
|
|
74
|
+
};
|
|
75
|
+
iframe_resources?: {
|
|
76
|
+
iframe: string;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
actions: IStartCheckoutActionResponse[];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface IStartCheckoutActionResponse {
|
|
83
|
+
name: string;
|
|
84
|
+
url: string;
|
|
85
|
+
method: string;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
export interface IItem {
|
|
90
|
+
description: string;
|
|
91
|
+
quantity: number;
|
|
92
|
+
price_unit: number;
|
|
93
|
+
discount: number;
|
|
94
|
+
taxes: number;
|
|
95
|
+
product_reference: string | number;
|
|
96
|
+
name: string;
|
|
97
|
+
amount_total: number;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface IProcessPaymentRequest {
|
|
101
|
+
customer: ICustomer;
|
|
102
|
+
cart: {
|
|
103
|
+
total: string | number;
|
|
104
|
+
items: IItem[];
|
|
105
|
+
};
|
|
106
|
+
metadata?: Record<string, any>;
|
|
107
|
+
currency?: string;
|
|
108
|
+
payment_method?: string;
|
|
109
|
+
card?: ICardFields | string;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export interface ICardFields {
|
|
113
|
+
card_number: string;
|
|
114
|
+
cvv: string;
|
|
115
|
+
expiration_month: string;
|
|
116
|
+
expiration_year: string;
|
|
117
|
+
cardholder_name: string;
|
|
118
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import {ICustomer} from "./customer";
|
|
2
|
+
|
|
3
|
+
export type Business = {
|
|
4
|
+
business: {
|
|
5
|
+
pk: number;
|
|
6
|
+
name: string;
|
|
7
|
+
categories: {
|
|
8
|
+
pk: number;
|
|
9
|
+
name: string;
|
|
10
|
+
}[];
|
|
11
|
+
web: string;
|
|
12
|
+
logo: string;
|
|
13
|
+
full_logo_url: string;
|
|
14
|
+
background_color: string;
|
|
15
|
+
primary_color: string;
|
|
16
|
+
checkout_mode: boolean;
|
|
17
|
+
textCheckoutColor: string;
|
|
18
|
+
textDetailsColor: string;
|
|
19
|
+
checkout_logo: string;
|
|
20
|
+
};
|
|
21
|
+
openpay_keys: {
|
|
22
|
+
merchant_id: string;
|
|
23
|
+
public_key: string;
|
|
24
|
+
};
|
|
25
|
+
fintoc_keys: {
|
|
26
|
+
public_key: string;
|
|
27
|
+
};
|
|
28
|
+
mercado_pago: {
|
|
29
|
+
active: boolean;
|
|
30
|
+
};
|
|
31
|
+
vault_id: string;
|
|
32
|
+
vault_url: string;
|
|
33
|
+
reference: number;
|
|
34
|
+
is_installments_available: boolean;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export type Customer = {
|
|
38
|
+
firstName: string;
|
|
39
|
+
lastName: string;
|
|
40
|
+
country: string;
|
|
41
|
+
street: string;
|
|
42
|
+
city: string;
|
|
43
|
+
state: string;
|
|
44
|
+
postCode: string;
|
|
45
|
+
email: string;
|
|
46
|
+
phone: string;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export type OrderItem = {
|
|
50
|
+
description: string;
|
|
51
|
+
quantity: number;
|
|
52
|
+
price_unit: number;
|
|
53
|
+
discount: number;
|
|
54
|
+
taxes: number;
|
|
55
|
+
product_reference: number;
|
|
56
|
+
name: string;
|
|
57
|
+
amount_total: number;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export type PaymentData = {
|
|
61
|
+
customer: Customer;
|
|
62
|
+
currency: string;
|
|
63
|
+
cart: {
|
|
64
|
+
total: string | number;
|
|
65
|
+
items: OrderItem[];
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export type TonderAPM = {
|
|
70
|
+
pk: string;
|
|
71
|
+
payment_method: string;
|
|
72
|
+
priority: number;
|
|
73
|
+
category: string;
|
|
74
|
+
unavailable_countries: string[];
|
|
75
|
+
status: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export type APM = {
|
|
79
|
+
id: string;
|
|
80
|
+
payment_method: string;
|
|
81
|
+
priority: number;
|
|
82
|
+
category: string;
|
|
83
|
+
icon: string;
|
|
84
|
+
label: string;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
export interface IConfigureCheckout {
|
|
89
|
+
customer: ICustomer;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface IInlineCheckoutBaseOptions {
|
|
93
|
+
mode?: "production" | "sandbox" | "stage" | "development";
|
|
94
|
+
/**
|
|
95
|
+
* @deprecated This property is deprecated and will be removed in a future release.
|
|
96
|
+
* `baseUrlTonder` is no longer required.
|
|
97
|
+
*/
|
|
98
|
+
baseUrlTonder?: string;
|
|
99
|
+
/**
|
|
100
|
+
* @deprecated This property is deprecated and will be removed in a future release.
|
|
101
|
+
* Use `apiKey` instead, as `apiKeyTonder` is no longer required.
|
|
102
|
+
*/
|
|
103
|
+
apiKeyTonder?: string;
|
|
104
|
+
/**
|
|
105
|
+
* @deprecated This property is deprecated and will be removed in a future release.
|
|
106
|
+
* `signal` is no longer required.
|
|
107
|
+
*/
|
|
108
|
+
signal?: AbortSignal;
|
|
109
|
+
apiKey: string;
|
|
110
|
+
returnUrl: string;
|
|
111
|
+
callBack?: (response: any) => void;
|
|
112
|
+
}
|
|
113
|
+
export interface IApiError {
|
|
114
|
+
code: string;
|
|
115
|
+
body: Record<string, string> | string;
|
|
116
|
+
name: string;
|
|
117
|
+
message: string;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface IPublicError {
|
|
121
|
+
status: string;
|
|
122
|
+
code: number;
|
|
123
|
+
message: string;
|
|
124
|
+
detail: Record<string, any> | string;
|
|
125
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './card';
|
|
2
|
+
export * from './checkout';
|
|
3
|
+
export * from './commons';
|
|
4
|
+
export * from './customer';
|
|
5
|
+
export * from './paymentMethod';
|
|
6
|
+
export * from './liteInlineCheckout';
|
|
7
|
+
export * from './validations';
|
|
8
|
+
export * from './responses';
|
|
9
|
+
export * from './requests';
|
|
10
|
+
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import {IConfigureCheckout, IInlineCheckoutBaseOptions} from "./common";
|
|
2
|
+
import {ICustomerCardsResponse, ISaveCardRequest, ISaveCardResponse} from "./card";
|
|
3
|
+
import {IPaymentMethod} from "./paymentMethod";
|
|
4
|
+
import {IProcessPaymentRequest, IStartCheckoutResponse} from "./checkout";
|
|
5
|
+
import {ITransaction} from "./transaction";
|
|
6
|
+
import {APM} from "./commons";
|
|
7
|
+
import {ErrorResponse} from "../classes/errorResponse";
|
|
8
|
+
import {
|
|
9
|
+
CreateOrderRequest,
|
|
10
|
+
CreatePaymentRequest,
|
|
11
|
+
RegisterCustomerCardRequest,
|
|
12
|
+
StartCheckoutFullRequest,
|
|
13
|
+
StartCheckoutIdRequest,
|
|
14
|
+
StartCheckoutRequest, TokensRequest
|
|
15
|
+
} from "./requests";
|
|
16
|
+
import {
|
|
17
|
+
CreateOrderResponse,
|
|
18
|
+
CreatePaymentResponse, CustomerRegisterResponse, GetBusinessResponse,
|
|
19
|
+
RegisterCustomerCardResponse,
|
|
20
|
+
StartCheckoutResponse
|
|
21
|
+
} from "./responses";
|
|
22
|
+
|
|
23
|
+
export class LiteCheckout {
|
|
24
|
+
constructor(options: IInlineLiteCheckoutOptions);
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The configureCheckout function allows you to set initial information, such as the customer's email, which is used to retrieve a list of saved cards.
|
|
28
|
+
* @param {import("./index").IConfigureCheckout} data - Configuration data including customer information and potentially other settings.
|
|
29
|
+
* @returns {Promise<void>}.
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
32
|
+
configureCheckout(data: IConfigureCheckout): void;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Initializes and prepares the checkout for use.
|
|
36
|
+
* This method set up the initial environment.
|
|
37
|
+
* @returns {Promise<void>} A promise that resolves when the checkout has been initialized.
|
|
38
|
+
* @throws {Error} If there's any problem during the checkout initialization.
|
|
39
|
+
* @public
|
|
40
|
+
*/
|
|
41
|
+
injectCheckout(): Promise<void>;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Processes a payment.
|
|
45
|
+
* @param {import("./index").IProcessPaymentRequest} data - Payment data including customer, cart, and other relevant information.
|
|
46
|
+
* @returns {Promise<import("./index").IStartCheckoutResponse>} A promise that resolves with the payment response or 3DS redirect or is rejected with an error.
|
|
47
|
+
*
|
|
48
|
+
* @throws {Error} Throws an error if the checkout process fails. The error object contains
|
|
49
|
+
* additional `details` property with the response from the server if available.
|
|
50
|
+
* @property {import("./index").IStartCheckoutErrorResponse} error.details - The response body from the server when an error occurs.
|
|
51
|
+
*
|
|
52
|
+
* @public
|
|
53
|
+
*/
|
|
54
|
+
payment(data: IProcessPaymentRequest): Promise<IStartCheckoutResponse>;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Verifies the 3DS transaction status.
|
|
58
|
+
* @returns {Promise<import("./index").ITransaction | void>} The result of the 3DS verification and checkout resumption.
|
|
59
|
+
* @public
|
|
60
|
+
*/
|
|
61
|
+
verify3dsTransaction(): Promise<ITransaction | void>;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Retrieves the list of cards associated with a customer.
|
|
65
|
+
* @returns {Promise<import("./index").ICustomerCardsResponse>} A promise that resolves with the customer's card data.
|
|
66
|
+
*
|
|
67
|
+
* @throws {import("./index").IPublicError} Throws an error object if the operation fails.
|
|
68
|
+
*
|
|
69
|
+
* @public
|
|
70
|
+
*/
|
|
71
|
+
getCustomerCards(): Promise<ICustomerCardsResponse>;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Saves a card to a customer's account. This method can be used to add a new card
|
|
75
|
+
* or update an existing one.
|
|
76
|
+
* @param {import("./index").ISaveCardRequest} card - The card information to be saved.
|
|
77
|
+
* @returns {Promise<import("./index").ISaveCardResponse>} A promise that resolves with the saved card data.
|
|
78
|
+
*
|
|
79
|
+
* @throws {import("./index").IPublicError} Throws an error object if the operation fails.
|
|
80
|
+
*
|
|
81
|
+
* @public
|
|
82
|
+
*/
|
|
83
|
+
saveCustomerCard(
|
|
84
|
+
card: ISaveCardRequest,
|
|
85
|
+
): Promise<ISaveCardResponse>;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Removes a card from a customer's account.
|
|
89
|
+
* @param {string} skyflowId - The unique identifier of the card to be deleted.
|
|
90
|
+
* @returns {Promise<string>} A promise that resolves when the card is successfully deleted.
|
|
91
|
+
*
|
|
92
|
+
* @throws {import("./index").IPublicError} Throws an error object if the operation fails.
|
|
93
|
+
*
|
|
94
|
+
* @public
|
|
95
|
+
*/
|
|
96
|
+
removeCustomerCard(
|
|
97
|
+
skyflowId: string,
|
|
98
|
+
): Promise<string>;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Retrieves the list of available Alternative Payment Methods (APMs).
|
|
102
|
+
* @returns {Promise<import("./index").IPaymentMethod[]>} A promise that resolves with the list of APMs.
|
|
103
|
+
*
|
|
104
|
+
* @throws {import("./index").IPublicError} Throws an error object if the operation fails.
|
|
105
|
+
*
|
|
106
|
+
* @public
|
|
107
|
+
*/
|
|
108
|
+
getCustomerPaymentMethods(): Promise<IPaymentMethod[]>;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Retrieves the business information.
|
|
112
|
+
* @returns {Promise<import("./index").GetBusinessResponse>} A promise that resolves with the business information.
|
|
113
|
+
*
|
|
114
|
+
* @throws {import("./index").IPublicError} Throws an error object if the operation fails.
|
|
115
|
+
*
|
|
116
|
+
* @public
|
|
117
|
+
*/
|
|
118
|
+
getBusiness(): Promise<GetBusinessResponse>;
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
// TODO: DEPRECATED
|
|
122
|
+
/**
|
|
123
|
+
* @deprecated This method is deprecated and will be removed in a future release.
|
|
124
|
+
* It is no longer necessary to use this method as customer registration is now automatically handled
|
|
125
|
+
* during the payment process or when using card management methods.
|
|
126
|
+
*/
|
|
127
|
+
customerRegister(email: string): Promise<CustomerRegisterResponse | ErrorResponse>
|
|
128
|
+
|
|
129
|
+
// TODO: DEPRECATED
|
|
130
|
+
/**
|
|
131
|
+
* @deprecated This method is deprecated and will be removed in a future release.
|
|
132
|
+
* It is no longer necessary to use this method as order creation is now automatically
|
|
133
|
+
* handled when making a payment through the `payment` function.
|
|
134
|
+
*/
|
|
135
|
+
createOrder(orderItems: CreateOrderRequest): Promise<CreateOrderResponse | ErrorResponse>
|
|
136
|
+
|
|
137
|
+
// TODO: DEPRECATED
|
|
138
|
+
/**
|
|
139
|
+
* @deprecated This method is deprecated and will be removed in a future release.
|
|
140
|
+
* It is no longer necessary to use this method as payment creation is now automatically
|
|
141
|
+
* handled when making a payment through the `payment` function.
|
|
142
|
+
*/
|
|
143
|
+
createPayment(paymentItems: CreatePaymentRequest): Promise<CreatePaymentResponse | ErrorResponse>
|
|
144
|
+
|
|
145
|
+
// TODO: DEPRECATED
|
|
146
|
+
/**
|
|
147
|
+
* @deprecated This method is deprecated and will be removed in a future release.
|
|
148
|
+
* Use the {@link payment} method
|
|
149
|
+
*/
|
|
150
|
+
startCheckoutRouter(routerData: StartCheckoutRequest | StartCheckoutIdRequest): Promise<StartCheckoutResponse | ErrorResponse | undefined>
|
|
151
|
+
|
|
152
|
+
// TODO: DEPRECATED
|
|
153
|
+
/**
|
|
154
|
+
* @deprecated This method is deprecated and will be removed in a future release.
|
|
155
|
+
* Use the {@link payment} method
|
|
156
|
+
*/
|
|
157
|
+
startCheckoutRouterFull(routerFullData: StartCheckoutFullRequest): Promise<StartCheckoutResponse | ErrorResponse | undefined>
|
|
158
|
+
|
|
159
|
+
// TODO: DEPRECATED
|
|
160
|
+
/**
|
|
161
|
+
* @deprecated This method is deprecated and will be removed in a future release.
|
|
162
|
+
* Use the {@link saveCustomerCard} method
|
|
163
|
+
*/
|
|
164
|
+
registerCustomerCard(customerToken: string, data: RegisterCustomerCardRequest): Promise<RegisterCustomerCardResponse | ErrorResponse>
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
// TODO: DEPRECATED
|
|
168
|
+
/**
|
|
169
|
+
* @deprecated This method is deprecated and will be removed in a future release.
|
|
170
|
+
* Use the {@link removeCustomerCard} method
|
|
171
|
+
*/
|
|
172
|
+
deleteCustomerCard(customerToken: string, skyflowId: string): Promise<Boolean | ErrorResponse>
|
|
173
|
+
|
|
174
|
+
// TODO: DEPRECATED
|
|
175
|
+
/**
|
|
176
|
+
* @deprecated This method is deprecated and will be removed in a future release.
|
|
177
|
+
* Use the {@link getCustomerPaymentMethods} method
|
|
178
|
+
*/
|
|
179
|
+
getActiveAPMs(): Promise<APM[]>;
|
|
180
|
+
|
|
181
|
+
// TODO: DEPRECATED
|
|
182
|
+
/**
|
|
183
|
+
* @deprecated This method is deprecated and will be removed in a future release.
|
|
184
|
+
* It is no longer necessary to use this method as customer registration is now automatically handled
|
|
185
|
+
* during the payment process or when using card management methods.
|
|
186
|
+
*/
|
|
187
|
+
getSkyflowTokens({vault_id, vault_url, data}: TokensRequest): Promise<any | ErrorResponse>
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
export interface IInlineLiteCheckoutOptions extends IInlineCheckoutBaseOptions {}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface IPaymentMethodResponse {
|
|
2
|
+
count: number;
|
|
3
|
+
next: string | null;
|
|
4
|
+
previous: string | null;
|
|
5
|
+
results: ITonderPaymentMethod[];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface ITonderPaymentMethod {
|
|
9
|
+
pk: string;
|
|
10
|
+
payment_method: string;
|
|
11
|
+
priority: number;
|
|
12
|
+
category: string;
|
|
13
|
+
unavailable_countries: string[];
|
|
14
|
+
status: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface IPaymentMethod {
|
|
18
|
+
id: string;
|
|
19
|
+
payment_method: string;
|
|
20
|
+
priority: number;
|
|
21
|
+
category: string;
|
|
22
|
+
icon: string;
|
|
23
|
+
label: string;
|
|
24
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { SkyflowRecord } from "./skyflow";
|
|
2
|
+
import {IItem} from "./checkout";
|
|
3
|
+
|
|
4
|
+
export interface CreateOrderRequest {
|
|
5
|
+
business: string,
|
|
6
|
+
client: string,
|
|
7
|
+
billing_address_id?: number | null,
|
|
8
|
+
shipping_address_id?: number | null,
|
|
9
|
+
amount: number,
|
|
10
|
+
status?: string,
|
|
11
|
+
reference: string | number,
|
|
12
|
+
is_oneclick: boolean,
|
|
13
|
+
items: IItem[]
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type CreatePaymentRequest = {
|
|
17
|
+
business_pk?: string | number,
|
|
18
|
+
amount: number,
|
|
19
|
+
date?: string,
|
|
20
|
+
order_id?: string | number
|
|
21
|
+
client_id?: string | number
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type StartCheckoutRequestBase = {
|
|
25
|
+
name: any,
|
|
26
|
+
last_name: string,
|
|
27
|
+
email_client: any,
|
|
28
|
+
phone_number: any,
|
|
29
|
+
return_url?: string,
|
|
30
|
+
id_product: string,
|
|
31
|
+
quantity_product: number,
|
|
32
|
+
id_ship: string,
|
|
33
|
+
instance_id_ship: string,
|
|
34
|
+
amount: any,
|
|
35
|
+
title_ship: string,
|
|
36
|
+
description: string,
|
|
37
|
+
device_session_id: any,
|
|
38
|
+
token_id: string,
|
|
39
|
+
order_id: any,
|
|
40
|
+
business_id: any,
|
|
41
|
+
payment_id: any,
|
|
42
|
+
source: string,
|
|
43
|
+
browser_info?: any,
|
|
44
|
+
metadata: any,
|
|
45
|
+
currency: string,
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type StartCheckoutRequestWithCard = StartCheckoutRequestBase & {
|
|
49
|
+
card: any,
|
|
50
|
+
payment_method?: never,
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type StartCheckoutRequestWithPaymentMethod = StartCheckoutRequestBase & {
|
|
54
|
+
card?: never,
|
|
55
|
+
payment_method: string,
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export type StartCheckoutRequest = StartCheckoutRequestWithCard | StartCheckoutRequestWithPaymentMethod;
|
|
59
|
+
|
|
60
|
+
export type StartCheckoutIdRequest = {
|
|
61
|
+
checkout_id: any
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface VaultRequest extends SkyflowRecord {
|
|
65
|
+
records: SkyflowRecord[],
|
|
66
|
+
continueOnError?: boolean,
|
|
67
|
+
byot?: "DISABLE" | "ENABLE" | "ENABLE_STRICT"
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export type RegisterCustomerCardRequest = {
|
|
71
|
+
skyflow_id: string;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export type TokensSkyflowRequest = {
|
|
75
|
+
baseUrl: string;
|
|
76
|
+
apiKey: string;
|
|
77
|
+
vault_id: string,
|
|
78
|
+
vault_url: string,
|
|
79
|
+
data: {
|
|
80
|
+
[key: string]: any;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
export type TokensRequest = {
|
|
84
|
+
vault_id: string,
|
|
85
|
+
vault_url: string,
|
|
86
|
+
data: {
|
|
87
|
+
[key: string]: any;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export type StartCheckoutFullRequest = {
|
|
92
|
+
order: {
|
|
93
|
+
items: IItem[];
|
|
94
|
+
};
|
|
95
|
+
total: number;
|
|
96
|
+
customer: {
|
|
97
|
+
name: string;
|
|
98
|
+
lastname: string;
|
|
99
|
+
email: string;
|
|
100
|
+
phone: string;
|
|
101
|
+
};
|
|
102
|
+
skyflowTokens: {
|
|
103
|
+
cardholder_name: string;
|
|
104
|
+
card_number: string;
|
|
105
|
+
cvv: string;
|
|
106
|
+
expiration_year: string;
|
|
107
|
+
expiration_month: string;
|
|
108
|
+
skyflow_id: string;
|
|
109
|
+
};
|
|
110
|
+
return_url: string;
|
|
111
|
+
isSandbox: boolean;
|
|
112
|
+
metadata: any;
|
|
113
|
+
currency: string;
|
|
114
|
+
payment_method?: string;
|
|
115
|
+
}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { Business } from "./commons";
|
|
2
|
+
|
|
3
|
+
export interface IErrorResponse extends Error {
|
|
4
|
+
code?: string;
|
|
5
|
+
body?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface GetBusinessResponse extends Business { }
|
|
9
|
+
|
|
10
|
+
export type GetVaultTokenResponse = {
|
|
11
|
+
token: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type CustomerRegisterResponse = {
|
|
15
|
+
id: number | string;
|
|
16
|
+
email: string;
|
|
17
|
+
auth_token: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type CreateOrderResponse = {
|
|
21
|
+
id: number | string;
|
|
22
|
+
created: string;
|
|
23
|
+
amount: string;
|
|
24
|
+
status: string;
|
|
25
|
+
payment_method?: string;
|
|
26
|
+
reference?: string;
|
|
27
|
+
is_oneclick: boolean;
|
|
28
|
+
items: {
|
|
29
|
+
description: string;
|
|
30
|
+
product_reference: string;
|
|
31
|
+
quantity: string;
|
|
32
|
+
price_unit: string;
|
|
33
|
+
discount: string;
|
|
34
|
+
taxes: string;
|
|
35
|
+
amount_total: string;
|
|
36
|
+
}[];
|
|
37
|
+
billing_address?: string;
|
|
38
|
+
shipping_address?: string;
|
|
39
|
+
client: {
|
|
40
|
+
email: string;
|
|
41
|
+
name: string;
|
|
42
|
+
first_name: string;
|
|
43
|
+
last_name: string;
|
|
44
|
+
client_profile: {
|
|
45
|
+
gender: string;
|
|
46
|
+
date_birth?: string;
|
|
47
|
+
terms: boolean;
|
|
48
|
+
phone: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export type CreatePaymentResponse = {
|
|
54
|
+
pk: number | string;
|
|
55
|
+
order?: string;
|
|
56
|
+
amount: string;
|
|
57
|
+
status: string;
|
|
58
|
+
date: string;
|
|
59
|
+
paid_date?: string;
|
|
60
|
+
shipping_address: {
|
|
61
|
+
street: string;
|
|
62
|
+
number: string;
|
|
63
|
+
suburb: string;
|
|
64
|
+
city: {
|
|
65
|
+
name: string;
|
|
66
|
+
};
|
|
67
|
+
state: {
|
|
68
|
+
name: string;
|
|
69
|
+
country: {
|
|
70
|
+
name: string;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
zip_code: string;
|
|
74
|
+
};
|
|
75
|
+
shipping_address_id?: string;
|
|
76
|
+
billing_address: {
|
|
77
|
+
street: string;
|
|
78
|
+
number: string;
|
|
79
|
+
suburb: string;
|
|
80
|
+
city: {
|
|
81
|
+
name: string;
|
|
82
|
+
};
|
|
83
|
+
state: {
|
|
84
|
+
name: string;
|
|
85
|
+
country: {
|
|
86
|
+
name: string;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
zip_code: string;
|
|
90
|
+
};
|
|
91
|
+
billing_address_id?: string;
|
|
92
|
+
client?: string;
|
|
93
|
+
customer_order_reference?: string;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export type StartCheckoutResponse = {
|
|
97
|
+
status: number;
|
|
98
|
+
message: string;
|
|
99
|
+
psp_response: {
|
|
100
|
+
id: string;
|
|
101
|
+
authorization: number;
|
|
102
|
+
operation_type: string;
|
|
103
|
+
transaction_type: string;
|
|
104
|
+
status: string;
|
|
105
|
+
conciliated: boolean;
|
|
106
|
+
creation_date: string;
|
|
107
|
+
operation_date: string;
|
|
108
|
+
description: string;
|
|
109
|
+
error_message?: string;
|
|
110
|
+
order_id?: string;
|
|
111
|
+
card: {
|
|
112
|
+
type: string;
|
|
113
|
+
brand: string;
|
|
114
|
+
address?: string;
|
|
115
|
+
card_number: string;
|
|
116
|
+
holder_name: string;
|
|
117
|
+
expiration_year: string;
|
|
118
|
+
expiration_month: string;
|
|
119
|
+
allows_charges: boolean;
|
|
120
|
+
allows_payouts: boolean;
|
|
121
|
+
bank_name: string;
|
|
122
|
+
points_type: string;
|
|
123
|
+
points_card: boolean;
|
|
124
|
+
bank_code: number;
|
|
125
|
+
};
|
|
126
|
+
customer_id: string;
|
|
127
|
+
gateway_card_present: string;
|
|
128
|
+
amount: number;
|
|
129
|
+
fee: {
|
|
130
|
+
amount: number;
|
|
131
|
+
tax: number;
|
|
132
|
+
currency: string;
|
|
133
|
+
};
|
|
134
|
+
payment_method: {
|
|
135
|
+
type: string;
|
|
136
|
+
url: string;
|
|
137
|
+
};
|
|
138
|
+
currency: string;
|
|
139
|
+
method: string;
|
|
140
|
+
object: string;
|
|
141
|
+
};
|
|
142
|
+
is_route_finished: Boolean;
|
|
143
|
+
transaction_status: string;
|
|
144
|
+
transaction_id: number;
|
|
145
|
+
payment_id: number;
|
|
146
|
+
provider: string;
|
|
147
|
+
next_action: {
|
|
148
|
+
redirect_to_url: {
|
|
149
|
+
url: string;
|
|
150
|
+
return_url: string;
|
|
151
|
+
verify_transaction_status_url: string;
|
|
152
|
+
};
|
|
153
|
+
iframe_resources?: {
|
|
154
|
+
iframe: string;
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
actions: {
|
|
158
|
+
name: string;
|
|
159
|
+
url: string;
|
|
160
|
+
method: string;
|
|
161
|
+
}[];
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export type TokensResponse = {
|
|
165
|
+
vaultID: string;
|
|
166
|
+
responses: {
|
|
167
|
+
[key: string]: string;
|
|
168
|
+
}[];
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
export type GetCustomerCardsResponse = {
|
|
172
|
+
user_id: number;
|
|
173
|
+
cards: {
|
|
174
|
+
fields: {
|
|
175
|
+
card_scheme: string;
|
|
176
|
+
card_number: string;
|
|
177
|
+
cardholder_name: string;
|
|
178
|
+
cvv: string;
|
|
179
|
+
expiration_month: string;
|
|
180
|
+
expiration_year: string;
|
|
181
|
+
skyflow_id: string;
|
|
182
|
+
};
|
|
183
|
+
}[];
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
export type RegisterCustomerCardResponse = {
|
|
187
|
+
skyflow_id: string;
|
|
188
|
+
user_id: number;
|
|
189
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type SkyflowRecord = {
|
|
2
|
+
method: string;
|
|
3
|
+
quorum?: boolean;
|
|
4
|
+
tableName: string;
|
|
5
|
+
fields?: {
|
|
6
|
+
[key: string]: string;
|
|
7
|
+
},
|
|
8
|
+
ID?: string,
|
|
9
|
+
tokenization?: boolean,
|
|
10
|
+
batchID?: string,
|
|
11
|
+
redaction?: "DEFAULT" | "REDACTED" | "MASKED" | "PLAIN_TEXT",
|
|
12
|
+
downloadURL?: boolean,
|
|
13
|
+
upsert?: string,
|
|
14
|
+
tokens?: {
|
|
15
|
+
[key: string]: string;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare function validateCardNumber(cardNumber: string): boolean;
|
|
2
|
+
|
|
3
|
+
export declare function validateCardholderName(name: string): boolean;
|
|
4
|
+
|
|
5
|
+
export declare function validateCVV(cvv: string): boolean;
|
|
6
|
+
|
|
7
|
+
export declare function validateExpirationMonth(month: string): boolean;
|
|
8
|
+
|
|
9
|
+
export declare function validateExpirationYear(year: string): boolean;
|
|
10
|
+
|
|
11
|
+
export declare function validateExpirationDateParts(month: string, year: string): boolean;
|
|
@@ -2,7 +2,7 @@ import "../utils/defaultMock";
|
|
|
2
2
|
import { LiteCheckout } from "../../src";
|
|
3
3
|
import { ErrorResponse } from "../../src/classes/errorResponse";
|
|
4
4
|
import { LiteCheckoutConstructor } from "../../src/classes/liteCheckout";
|
|
5
|
-
import { IErrorResponse } from "../../types/responses";
|
|
5
|
+
import { IErrorResponse } from "../../src/types/responses";
|
|
6
6
|
import { constructorFields } from "../utils/defaultMock";
|
|
7
7
|
import { OrderResponseClass, OrderClass, OrderClassEmptyValues, OrderEmptyValuesResponse } from "../utils/mockClasses";
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@ import "../utils/defaultMock";
|
|
|
2
2
|
import { LiteCheckout } from "../../src";
|
|
3
3
|
import { ErrorResponse } from "../../src/classes/errorResponse";
|
|
4
4
|
import { LiteCheckoutConstructor } from "../../src/classes/liteCheckout";
|
|
5
|
-
import { IErrorResponse } from "../../types/responses";
|
|
5
|
+
import { IErrorResponse } from "../../src/types/responses";
|
|
6
6
|
import { constructorFields } from "../utils/defaultMock";
|
|
7
7
|
import { CreatePaymentResponseClass, CreatePaymentRequestClass } from "../utils/mockClasses";
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@ import "../utils/defaultMock";
|
|
|
2
2
|
import { LiteCheckout } from "../../src";
|
|
3
3
|
import { ErrorResponse } from "../../src/classes/errorResponse";
|
|
4
4
|
import { LiteCheckoutConstructor } from "../../src/classes/liteCheckout";
|
|
5
|
-
import { IErrorResponse } from "../../types/responses";
|
|
5
|
+
import { IErrorResponse } from "../../src/types/responses";
|
|
6
6
|
import { constructorFields } from "../utils/defaultMock";
|
|
7
7
|
import { BusinessClass, CustomerRegisterClass } from "../utils/mockClasses";
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@ import "../utils/defaultMock";
|
|
|
2
2
|
import { LiteCheckout } from "../../src";
|
|
3
3
|
import { ErrorResponse } from "../../src/classes/errorResponse";
|
|
4
4
|
import { LiteCheckoutConstructor } from "../../src/classes/liteCheckout";
|
|
5
|
-
import { IErrorResponse } from "../../types/responses";
|
|
5
|
+
import { IErrorResponse } from "../../src/types/responses";
|
|
6
6
|
import { constructorFields } from "../utils/defaultMock";
|
|
7
7
|
import { BusinessClass } from "../utils/mockClasses";
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@ import "../utils/defaultMock";
|
|
|
2
2
|
import { LiteCheckout } from "../../src";
|
|
3
3
|
import { ErrorResponse } from "../../src/classes/errorResponse";
|
|
4
4
|
import { LiteCheckoutConstructor } from "../../src/classes/liteCheckout";
|
|
5
|
-
import { IErrorResponse } from "../../types/responses";
|
|
5
|
+
import { IErrorResponse } from "../../src/types/responses";
|
|
6
6
|
import { constructorFields } from "../utils/defaultMock";
|
|
7
7
|
import { GetCustomerCardsResponseClass } from "../utils/mockClasses";
|
|
8
8
|
|
|
@@ -4,7 +4,7 @@ import { LiteCheckoutConstructor } from "../../src/classes/liteCheckout";
|
|
|
4
4
|
import { constructorFields } from "../utils/defaultMock";
|
|
5
5
|
import { RegisterCustomerCardRequestClass, RegisterCustomerCardResponseClass } from "../utils/mockClasses";
|
|
6
6
|
import { ErrorResponse } from "../../src/classes/errorResponse";
|
|
7
|
-
import { IErrorResponse } from "../../types/responses";
|
|
7
|
+
import { IErrorResponse } from "../../src/types/responses";
|
|
8
8
|
|
|
9
9
|
declare global {
|
|
10
10
|
interface Window {
|
|
@@ -2,7 +2,7 @@ import "../utils/defaultMock";
|
|
|
2
2
|
import { LiteCheckout } from "../../src";
|
|
3
3
|
import { ErrorResponse } from "../../src/classes/errorResponse";
|
|
4
4
|
import { LiteCheckoutConstructor } from "../../src/classes/liteCheckout";
|
|
5
|
-
import { IErrorResponse } from "../../types/responses";
|
|
5
|
+
import { IErrorResponse } from "../../src/types/responses";
|
|
6
6
|
import { constructorFields } from "../utils/defaultMock";
|
|
7
7
|
import { StartCheckoutResponseClass, StartCheckoutRequestClass, CreatePaymentRequestClass } from "../utils/mockClasses";
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@ import "../utils/defaultMock";
|
|
|
2
2
|
import { LiteCheckout } from "../../src";
|
|
3
3
|
import { ErrorResponse } from "../../src/classes/errorResponse";
|
|
4
4
|
import { LiteCheckoutConstructor } from "../../src/classes/liteCheckout";
|
|
5
|
-
import { IErrorResponse } from "../../types/responses";
|
|
5
|
+
import { IErrorResponse } from "../../src/types/responses";
|
|
6
6
|
import { constructorFields } from "../utils/defaultMock";
|
|
7
7
|
import { StartCheckoutResponseClass, StartCheckoutFullRequestClass, BusinessClass, CustomerRegisterClass, OrderResponseClass, CreatePaymentResponseClass } from "../utils/mockClasses";
|
|
8
8
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Business, OrderItem } from "../../types/commons";
|
|
1
|
+
import { Business, OrderItem } from "../../src/types/commons";
|
|
2
2
|
import {
|
|
3
3
|
CreateOrderRequest,
|
|
4
4
|
CreatePaymentRequest,
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
StartCheckoutRequest,
|
|
7
7
|
StartCheckoutFullRequest,
|
|
8
8
|
StartCheckoutRequestWithCard, TokensSkyflowRequest
|
|
9
|
-
} from "../../types/requests";
|
|
9
|
+
} from "../../src/types/requests";
|
|
10
10
|
import {
|
|
11
11
|
CreateOrderResponse,
|
|
12
12
|
CreatePaymentResponse,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
RegisterCustomerCardResponse,
|
|
16
16
|
StartCheckoutResponse,
|
|
17
17
|
CustomerRegisterResponse
|
|
18
|
-
} from "../../types/responses";
|
|
18
|
+
} from "../../src/types/responses";
|
|
19
19
|
|
|
20
20
|
export class BusinessClass implements Business {
|
|
21
21
|
business!: {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|