@tonder.io/ionic-lite-sdk 0.0.35-beta.3 → 0.0.35-beta.30
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 +425 -114
- package/dist/classes/BaseInlineCheckout.d.ts +19 -18
- package/dist/classes/errorResponse.d.ts +1 -1
- package/dist/classes/liteCheckout.d.ts +11 -42
- package/dist/data/businessApi.d.ts +1 -1
- package/dist/data/cardApi.d.ts +1 -1
- package/dist/data/checkoutApi.d.ts +2 -1
- package/dist/data/customerApi.d.ts +1 -1
- package/dist/data/paymentMethodApi.d.ts +2 -2
- package/dist/helpers/skyflow.d.ts +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -1
- package/dist/types/card.d.ts +1 -0
- package/dist/types/checkout.d.ts +2 -1
- package/dist/types/commons.d.ts +8 -3
- package/dist/types/customer.d.ts +10 -0
- package/dist/types/liteInlineCheckout.d.ts +151 -0
- package/dist/types/transaction.d.ts +101 -0
- package/package.json +3 -1
- package/src/classes/BaseInlineCheckout.ts +67 -41
- package/src/classes/errorResponse.ts +1 -1
- package/src/classes/liteCheckout.ts +49 -87
- package/src/data/businessApi.ts +1 -1
- package/src/data/cardApi.ts +1 -5
- package/src/data/checkoutApi.ts +3 -6
- package/src/data/customerApi.ts +1 -1
- package/src/data/paymentMethodApi.ts +2 -2
- package/src/helpers/skyflow.ts +1 -1
- package/src/helpers/utils.ts +1 -1
- package/src/index.ts +9 -1
- package/src/types/card.ts +1 -0
- package/src/types/checkout.ts +2 -1
- package/src/types/commons.ts +104 -99
- package/src/types/customer.ts +10 -0
- package/src/types/liteInlineCheckout.ts +215 -0
- package/src/types/transaction.ts +101 -0
- package/tests/classes/liteCheckout.test.ts +2 -2
- package/tests/methods/createOrder.test.ts +3 -4
- package/tests/methods/createPayment.test.ts +2 -3
- package/tests/methods/customerRegister.test.ts +3 -4
- package/tests/methods/getBusiness.test.ts +2 -3
- package/tests/methods/getCustomerCards.test.ts +2 -3
- package/tests/methods/registerCustomerCard.test.ts +2 -2
- package/tests/methods/startCheckoutRouter.test.ts +2 -2
- package/tests/methods/startCheckoutRouterFull.test.ts +2 -2
- package/.idea/aws.xml +0 -17
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/prettier.xml +0 -6
- package/.idea/vcs.xml +0 -6
- package/.idea/workspace.xml +0 -128
- package/src/types/index.d.ts +0 -10
- package/src/types/liteInlineCheckout.d.ts +0 -191
package/src/types/checkout.ts
CHANGED
|
@@ -67,7 +67,7 @@ export interface IStartCheckoutResponse {
|
|
|
67
67
|
payment_id: number;
|
|
68
68
|
provider: string;
|
|
69
69
|
next_action: {
|
|
70
|
-
redirect_to_url
|
|
70
|
+
redirect_to_url?: {
|
|
71
71
|
url: string;
|
|
72
72
|
return_url: string;
|
|
73
73
|
verify_transaction_status_url: string;
|
|
@@ -107,6 +107,7 @@ export interface IProcessPaymentRequest {
|
|
|
107
107
|
currency?: string;
|
|
108
108
|
payment_method?: string;
|
|
109
109
|
card?: ICardFields | string;
|
|
110
|
+
isSandbox?: boolean;
|
|
110
111
|
}
|
|
111
112
|
|
|
112
113
|
export interface ICardFields {
|
package/src/types/commons.ts
CHANGED
|
@@ -1,125 +1,130 @@
|
|
|
1
|
-
import {ICustomer} from "./customer";
|
|
1
|
+
import { ICustomer } from "./customer";
|
|
2
|
+
import {IStartCheckoutResponse} from "./checkout";
|
|
2
3
|
|
|
3
4
|
export type Business = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
5
|
+
business: {
|
|
6
|
+
pk: number;
|
|
7
|
+
name: string;
|
|
8
|
+
categories: {
|
|
9
|
+
pk: number;
|
|
10
|
+
name: string;
|
|
11
|
+
}[];
|
|
12
|
+
web: string;
|
|
13
|
+
logo: string;
|
|
14
|
+
full_logo_url: string;
|
|
15
|
+
background_color: string;
|
|
16
|
+
primary_color: string;
|
|
17
|
+
checkout_mode: boolean;
|
|
18
|
+
textCheckoutColor: string;
|
|
19
|
+
textDetailsColor: string;
|
|
20
|
+
checkout_logo: string;
|
|
21
|
+
};
|
|
22
|
+
openpay_keys: {
|
|
23
|
+
merchant_id: string;
|
|
24
|
+
public_key: string;
|
|
25
|
+
};
|
|
26
|
+
fintoc_keys: {
|
|
27
|
+
public_key: string;
|
|
28
|
+
};
|
|
29
|
+
mercado_pago: {
|
|
30
|
+
active: boolean;
|
|
31
|
+
};
|
|
32
|
+
vault_id: string;
|
|
33
|
+
vault_url: string;
|
|
34
|
+
reference: number;
|
|
35
|
+
is_installments_available: boolean;
|
|
35
36
|
};
|
|
36
37
|
|
|
37
38
|
export type Customer = {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
39
|
+
firstName: string;
|
|
40
|
+
lastName: string;
|
|
41
|
+
country: string;
|
|
42
|
+
street: string;
|
|
43
|
+
city: string;
|
|
44
|
+
state: string;
|
|
45
|
+
postCode: string;
|
|
46
|
+
email: string;
|
|
47
|
+
phone: string;
|
|
47
48
|
};
|
|
48
49
|
|
|
49
50
|
export type OrderItem = {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
description: string;
|
|
52
|
+
quantity: number;
|
|
53
|
+
price_unit: number;
|
|
54
|
+
discount: number;
|
|
55
|
+
taxes: number;
|
|
56
|
+
product_reference: number;
|
|
57
|
+
name: string;
|
|
58
|
+
amount_total: number;
|
|
58
59
|
};
|
|
59
60
|
|
|
60
61
|
export type PaymentData = {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
customer: Customer;
|
|
63
|
+
currency: string;
|
|
64
|
+
cart: {
|
|
65
|
+
total: string | number;
|
|
66
|
+
items: OrderItem[];
|
|
67
|
+
};
|
|
67
68
|
};
|
|
68
69
|
|
|
69
70
|
export type TonderAPM = {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
71
|
+
pk: string;
|
|
72
|
+
payment_method: string;
|
|
73
|
+
priority: number;
|
|
74
|
+
category: string;
|
|
75
|
+
unavailable_countries: string[];
|
|
76
|
+
status: string;
|
|
77
|
+
};
|
|
77
78
|
|
|
78
79
|
export type APM = {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
|
|
80
|
+
id: string;
|
|
81
|
+
payment_method: string;
|
|
82
|
+
priority: number;
|
|
83
|
+
category: string;
|
|
84
|
+
icon: string;
|
|
85
|
+
label: string;
|
|
86
|
+
};
|
|
87
87
|
|
|
88
88
|
export interface IConfigureCheckout {
|
|
89
|
-
|
|
89
|
+
customer: ICustomer | { email: string };
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
export interface IInlineCheckoutBaseOptions {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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: IStartCheckoutResponse | Record<string, any>) => void;
|
|
112
112
|
}
|
|
113
|
+
|
|
114
|
+
export interface IInlineLiteCheckoutOptions
|
|
115
|
+
extends IInlineCheckoutBaseOptions {}
|
|
116
|
+
|
|
117
|
+
|
|
113
118
|
export interface IApiError {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
119
|
+
code: string;
|
|
120
|
+
body: Record<string, string> | string;
|
|
121
|
+
name: string;
|
|
122
|
+
message: string;
|
|
118
123
|
}
|
|
119
124
|
|
|
120
125
|
export interface IPublicError {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
+
status: string;
|
|
127
|
+
code: number;
|
|
128
|
+
message: string;
|
|
129
|
+
detail: Record<string, any> | string;
|
|
130
|
+
}
|
package/src/types/customer.ts
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
export type ICustomer = {
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated This property is deprecated and will be removed in a future release.
|
|
4
|
+
* Use `firstName` instead, as `name` is no longer required.
|
|
5
|
+
*/
|
|
6
|
+
name?: string;
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated This property is deprecated and will be removed in a future release.
|
|
9
|
+
* Use `lastName` instead, as `lastname` is no longer required.
|
|
10
|
+
*/
|
|
11
|
+
lastname?: string;
|
|
2
12
|
firstName: string;
|
|
3
13
|
lastName: string;
|
|
4
14
|
country?: string;
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { IConfigureCheckout, IInlineCheckoutBaseOptions } from "./commons";
|
|
2
|
+
import {
|
|
3
|
+
ICustomerCardsResponse,
|
|
4
|
+
ISaveCardRequest,
|
|
5
|
+
ISaveCardResponse,
|
|
6
|
+
} from "./card";
|
|
7
|
+
import { IPaymentMethod } from "./paymentMethod";
|
|
8
|
+
import { IProcessPaymentRequest, IStartCheckoutResponse } from "./checkout";
|
|
9
|
+
import { ITransaction } from "./transaction";
|
|
10
|
+
import { APM } from "./commons";
|
|
11
|
+
import { ErrorResponse } from "../classes/errorResponse";
|
|
12
|
+
import {
|
|
13
|
+
CreateOrderRequest,
|
|
14
|
+
CreatePaymentRequest,
|
|
15
|
+
RegisterCustomerCardRequest,
|
|
16
|
+
StartCheckoutFullRequest,
|
|
17
|
+
StartCheckoutIdRequest,
|
|
18
|
+
StartCheckoutRequest,
|
|
19
|
+
TokensRequest,
|
|
20
|
+
} from "./requests";
|
|
21
|
+
import {
|
|
22
|
+
CreateOrderResponse,
|
|
23
|
+
CreatePaymentResponse,
|
|
24
|
+
CustomerRegisterResponse,
|
|
25
|
+
GetBusinessResponse,
|
|
26
|
+
RegisterCustomerCardResponse,
|
|
27
|
+
StartCheckoutResponse,
|
|
28
|
+
} from "./responses";
|
|
29
|
+
|
|
30
|
+
export interface ILiteCheckout {
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* 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.
|
|
34
|
+
* @param {import("./index").IConfigureCheckout} data - Configuration data including customer information and potentially other settings.
|
|
35
|
+
* @returns {Promise<void>}.
|
|
36
|
+
* @public
|
|
37
|
+
*/
|
|
38
|
+
configureCheckout(data: IConfigureCheckout): void;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Initializes and prepares the checkout for use.
|
|
42
|
+
* This method set up the initial environment.
|
|
43
|
+
* @returns {Promise<void>} A promise that resolves when the checkout has been initialized.
|
|
44
|
+
* @throws {Error} If there's any problem during the checkout initialization.
|
|
45
|
+
* @public
|
|
46
|
+
*/
|
|
47
|
+
injectCheckout(): Promise<void>;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Processes a payment.
|
|
51
|
+
* @param {import("./index").IProcessPaymentRequest} data - Payment data including customer, cart, and other relevant information.
|
|
52
|
+
* @returns {Promise<import("./index").IStartCheckoutResponse>} A promise that resolves with the payment response or 3DS redirect or is rejected with an error.
|
|
53
|
+
*
|
|
54
|
+
* @throws {Error} Throws an error if the checkout process fails. The error object contains
|
|
55
|
+
* additional `details` property with the response from the server if available.
|
|
56
|
+
* @property {import("./index").IStartCheckoutErrorResponse} error.details - The response body from the server when an error occurs.
|
|
57
|
+
*
|
|
58
|
+
* @public
|
|
59
|
+
*/
|
|
60
|
+
payment(data: IProcessPaymentRequest): Promise<IStartCheckoutResponse>;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Verifies the 3DS transaction status.
|
|
64
|
+
* @returns {Promise<import("./index").ITransaction | import("./index").IStartCheckoutResponse | void>} The result of the 3DS verification and checkout resumption.
|
|
65
|
+
* @public
|
|
66
|
+
*/
|
|
67
|
+
verify3dsTransaction(): Promise<ITransaction | IStartCheckoutResponse | void>;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Retrieves the list of cards associated with a customer.
|
|
71
|
+
* @returns {Promise<import("./index").ICustomerCardsResponse>} A promise that resolves with the customer's card data.
|
|
72
|
+
*
|
|
73
|
+
* @throws {import("./index").IPublicError} Throws an error object if the operation fails.
|
|
74
|
+
*
|
|
75
|
+
* @public
|
|
76
|
+
*/
|
|
77
|
+
getCustomerCards(): Promise<ICustomerCardsResponse>;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Saves a card to a customer's account. This method can be used to add a new card
|
|
81
|
+
* or update an existing one.
|
|
82
|
+
* @param {import("./index").ISaveCardRequest} card - The card information to be saved.
|
|
83
|
+
* @returns {Promise<import("./index").ISaveCardResponse>} A promise that resolves with the saved card data.
|
|
84
|
+
*
|
|
85
|
+
* @throws {import("./index").IPublicError} Throws an error object if the operation fails.
|
|
86
|
+
*
|
|
87
|
+
* @public
|
|
88
|
+
*/
|
|
89
|
+
saveCustomerCard(card: ISaveCardRequest): Promise<ISaveCardResponse>;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Removes a card from a customer's account.
|
|
93
|
+
* @param {string} skyflowId - The unique identifier of the card to be deleted.
|
|
94
|
+
* @returns {Promise<string>} A promise that resolves when the card is successfully deleted.
|
|
95
|
+
*
|
|
96
|
+
* @throws {import("./index").IPublicError} Throws an error object if the operation fails.
|
|
97
|
+
*
|
|
98
|
+
* @public
|
|
99
|
+
*/
|
|
100
|
+
removeCustomerCard(skyflowId: string): Promise<string>;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Retrieves the list of available Alternative Payment Methods (APMs).
|
|
104
|
+
* @returns {Promise<import("./index").IPaymentMethod[]>} A promise that resolves with the list of APMs.
|
|
105
|
+
*
|
|
106
|
+
* @throws {import("./index").IPublicError} Throws an error object if the operation fails.
|
|
107
|
+
*
|
|
108
|
+
* @public
|
|
109
|
+
*/
|
|
110
|
+
getCustomerPaymentMethods(): Promise<IPaymentMethod[]>;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* @deprecated This method is deprecated and will be removed in a future release.
|
|
114
|
+
* It is no longer necessary to use this method, now automatically handled
|
|
115
|
+
* during the payment process or when using card management methods.
|
|
116
|
+
*
|
|
117
|
+
* Retrieves the business information.
|
|
118
|
+
* @returns {Promise<import("./index").GetBusinessResponse>} A promise that resolves with the business information.
|
|
119
|
+
*
|
|
120
|
+
* @throws {import("./index").IPublicError} Throws an error object if the operation fails.
|
|
121
|
+
*
|
|
122
|
+
* @public
|
|
123
|
+
*/
|
|
124
|
+
getBusiness(): Promise<GetBusinessResponse>;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* @deprecated This method is deprecated and will be removed in a future release.
|
|
128
|
+
* It is no longer necessary to use this method as customer registration is now automatically handled
|
|
129
|
+
* during the payment process or when using card management methods.
|
|
130
|
+
*/
|
|
131
|
+
customerRegister(
|
|
132
|
+
email: string,
|
|
133
|
+
): Promise<CustomerRegisterResponse | ErrorResponse>;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* @deprecated This method is deprecated and will be removed in a future release.
|
|
137
|
+
* It is no longer necessary to use this method as order creation is now automatically
|
|
138
|
+
* handled when making a payment through the `payment` function.
|
|
139
|
+
*/
|
|
140
|
+
createOrder(
|
|
141
|
+
orderItems: CreateOrderRequest,
|
|
142
|
+
): Promise<CreateOrderResponse | ErrorResponse>;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* @deprecated This method is deprecated and will be removed in a future release.
|
|
146
|
+
* It is no longer necessary to use this method as payment creation is now automatically
|
|
147
|
+
* handled when making a payment through the `payment` function.
|
|
148
|
+
*/
|
|
149
|
+
createPayment(
|
|
150
|
+
paymentItems: CreatePaymentRequest,
|
|
151
|
+
): Promise<CreatePaymentResponse | ErrorResponse>;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* @deprecated This method is deprecated and will be removed in a future release.
|
|
155
|
+
* Use the {@link payment} method
|
|
156
|
+
*/
|
|
157
|
+
startCheckoutRouter(
|
|
158
|
+
routerData: StartCheckoutRequest | StartCheckoutIdRequest,
|
|
159
|
+
): Promise<StartCheckoutResponse | ErrorResponse | undefined>;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* @deprecated This method is deprecated and will be removed in a future release.
|
|
163
|
+
* Use the {@link payment} method
|
|
164
|
+
*/
|
|
165
|
+
startCheckoutRouterFull(
|
|
166
|
+
routerFullData: StartCheckoutFullRequest,
|
|
167
|
+
): Promise<StartCheckoutResponse | ErrorResponse | undefined>;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* @deprecated This method is deprecated and will be removed in a future release.
|
|
171
|
+
* Use the {@link saveCustomerCard} method
|
|
172
|
+
*/
|
|
173
|
+
registerCustomerCard(
|
|
174
|
+
customerToken: string,
|
|
175
|
+
data: RegisterCustomerCardRequest,
|
|
176
|
+
): Promise<RegisterCustomerCardResponse | ErrorResponse>;
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* @deprecated This method is deprecated and will be removed in a future release.
|
|
180
|
+
* Use the {@link removeCustomerCard} method
|
|
181
|
+
*/
|
|
182
|
+
deleteCustomerCard(
|
|
183
|
+
customerToken: string,
|
|
184
|
+
skyflowId: string,
|
|
185
|
+
): Promise<Boolean | ErrorResponse>;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* @deprecated This method is deprecated and will be removed in a future release.
|
|
189
|
+
* Use the {@link getCustomerPaymentMethods} method
|
|
190
|
+
*/
|
|
191
|
+
getActiveAPMs(): Promise<APM[]>;
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* @deprecated This method is deprecated and will be removed in a future release.
|
|
195
|
+
* It is no longer necessary to use this method as card registration or as checkout is now automatically handled
|
|
196
|
+
* during the payment process or when using card management methods.
|
|
197
|
+
*/
|
|
198
|
+
getSkyflowTokens({
|
|
199
|
+
vault_id,
|
|
200
|
+
vault_url,
|
|
201
|
+
data,
|
|
202
|
+
}: TokensRequest): Promise<any | ErrorResponse>;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* @deprecated This method is deprecated and will be removed in a future release.
|
|
206
|
+
* It is no longer necessary to use this method is now automatically handled
|
|
207
|
+
* during the payment process.
|
|
208
|
+
*/
|
|
209
|
+
getOpenpayDeviceSessionID(
|
|
210
|
+
merchant_id: string,
|
|
211
|
+
public_key: string,
|
|
212
|
+
is_sandbox: boolean,
|
|
213
|
+
): Promise<string | ErrorResponse>;
|
|
214
|
+
}
|
|
215
|
+
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
export interface ITransaction {
|
|
2
|
+
id: number;
|
|
3
|
+
provider: string;
|
|
4
|
+
country: string;
|
|
5
|
+
currency_code: string;
|
|
6
|
+
transaction_status: string;
|
|
7
|
+
created: string;
|
|
8
|
+
modified: string;
|
|
9
|
+
operation_date: string;
|
|
10
|
+
transaction_reference: string;
|
|
11
|
+
transaction_type: string;
|
|
12
|
+
status: string;
|
|
13
|
+
amount: string;
|
|
14
|
+
related_transaction_reference?: null | string;
|
|
15
|
+
reason?: null | string;
|
|
16
|
+
is_refunded?: null | boolean;
|
|
17
|
+
is_disputed?: null | boolean;
|
|
18
|
+
number_of_payment_attempts: number;
|
|
19
|
+
card_brand?: null | string;
|
|
20
|
+
number_of_installments: number;
|
|
21
|
+
payment?: {
|
|
22
|
+
id: number;
|
|
23
|
+
created: string;
|
|
24
|
+
modified: string;
|
|
25
|
+
amount: string;
|
|
26
|
+
status: string;
|
|
27
|
+
date: string;
|
|
28
|
+
paid_date: null | string;
|
|
29
|
+
source: null | string;
|
|
30
|
+
customer_order_reference: null | string;
|
|
31
|
+
client: number;
|
|
32
|
+
business: number;
|
|
33
|
+
shipping_address?: null | string;
|
|
34
|
+
billing_address?: null | string;
|
|
35
|
+
order: number;
|
|
36
|
+
};
|
|
37
|
+
checkout: {
|
|
38
|
+
id: string;
|
|
39
|
+
created: string;
|
|
40
|
+
modified: string;
|
|
41
|
+
checkout_data: {
|
|
42
|
+
name: string;
|
|
43
|
+
amount: number;
|
|
44
|
+
source: string;
|
|
45
|
+
id_ship: string;
|
|
46
|
+
currency: string;
|
|
47
|
+
order_id: number;
|
|
48
|
+
token_id: string;
|
|
49
|
+
last_name: string;
|
|
50
|
+
id_product: string;
|
|
51
|
+
ip_address: string;
|
|
52
|
+
payment_id: number;
|
|
53
|
+
return_url: string;
|
|
54
|
+
title_ship: string;
|
|
55
|
+
business_id: number;
|
|
56
|
+
checkout_id: string;
|
|
57
|
+
description: string;
|
|
58
|
+
browser_info: {
|
|
59
|
+
language: string;
|
|
60
|
+
time_zone: number;
|
|
61
|
+
user_agent: string;
|
|
62
|
+
color_depth: number;
|
|
63
|
+
screen_width: number;
|
|
64
|
+
screen_height: number;
|
|
65
|
+
javascript_enabled: boolean;
|
|
66
|
+
};
|
|
67
|
+
email_client: string;
|
|
68
|
+
phone_number: string;
|
|
69
|
+
instance_id_ship: string;
|
|
70
|
+
quantity_product: number;
|
|
71
|
+
device_session_id: null | string;
|
|
72
|
+
number_of_payment_attempts: number;
|
|
73
|
+
};
|
|
74
|
+
number_of_payment_attempts: number;
|
|
75
|
+
tried_psps: string[];
|
|
76
|
+
rejected_transactions: string[];
|
|
77
|
+
routing_step: number;
|
|
78
|
+
route_length: number;
|
|
79
|
+
last_status: string;
|
|
80
|
+
ip_address: string;
|
|
81
|
+
is_dynamic_routing: boolean;
|
|
82
|
+
is_route_finished: boolean;
|
|
83
|
+
business: number;
|
|
84
|
+
payment: number;
|
|
85
|
+
};
|
|
86
|
+
currency: {
|
|
87
|
+
id: number;
|
|
88
|
+
name: string;
|
|
89
|
+
code: string;
|
|
90
|
+
symbol: string;
|
|
91
|
+
country: null | string;
|
|
92
|
+
};
|
|
93
|
+
payment_method?: null | {
|
|
94
|
+
id: number;
|
|
95
|
+
name: string;
|
|
96
|
+
display_name: string;
|
|
97
|
+
category: string;
|
|
98
|
+
is_apm: boolean;
|
|
99
|
+
};
|
|
100
|
+
issuing_country?: null | string;
|
|
101
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../utils/defaultMock";
|
|
2
2
|
import { LiteCheckout } from "../../src";
|
|
3
|
-
import { LiteCheckoutConstructor } from "../../src/classes/liteCheckout";
|
|
4
3
|
import { constructorFields } from "../utils/defaultMock";
|
|
4
|
+
import {IInlineLiteCheckoutOptions} from "../../src/types/commons";
|
|
5
5
|
|
|
6
6
|
declare global {
|
|
7
7
|
interface Window {
|
|
@@ -11,7 +11,7 @@ declare global {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
describe("LiteCheckout", () => {
|
|
14
|
-
let checkoutConstructor:
|
|
14
|
+
let checkoutConstructor: IInlineLiteCheckoutOptions,
|
|
15
15
|
liteCheckout: LiteCheckout,
|
|
16
16
|
fetchSpy: jest.SpyInstance,
|
|
17
17
|
liteCheckoutSpy: jest.SpyInstance;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import "../utils/defaultMock";
|
|
2
2
|
import { LiteCheckout } from "../../src";
|
|
3
3
|
import { ErrorResponse } from "../../src/classes/errorResponse";
|
|
4
|
-
import { LiteCheckoutConstructor } from "../../src/classes/liteCheckout";
|
|
5
|
-
import { IErrorResponse } from "../../src/types/responses";
|
|
6
4
|
import { constructorFields } from "../utils/defaultMock";
|
|
7
|
-
import { OrderResponseClass, OrderClass,
|
|
5
|
+
import { OrderResponseClass, OrderClass, OrderEmptyValuesResponse } from "../utils/mockClasses";
|
|
6
|
+
import {IInlineLiteCheckoutOptions} from "../../src/types/commons";
|
|
8
7
|
|
|
9
8
|
declare global {
|
|
10
9
|
interface Window {
|
|
@@ -14,7 +13,7 @@ declare global {
|
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
describe("createOrder", () => {
|
|
17
|
-
let checkoutConstructor:
|
|
16
|
+
let checkoutConstructor: IInlineLiteCheckoutOptions,
|
|
18
17
|
liteCheckout: LiteCheckout,
|
|
19
18
|
fetchSpy: jest.SpyInstance,
|
|
20
19
|
liteCheckoutSpy: jest.SpyInstance;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import "../utils/defaultMock";
|
|
2
2
|
import { LiteCheckout } from "../../src";
|
|
3
3
|
import { ErrorResponse } from "../../src/classes/errorResponse";
|
|
4
|
-
import { LiteCheckoutConstructor } from "../../src/classes/liteCheckout";
|
|
5
|
-
import { IErrorResponse } from "../../src/types/responses";
|
|
6
4
|
import { constructorFields } from "../utils/defaultMock";
|
|
7
5
|
import { CreatePaymentResponseClass, CreatePaymentRequestClass } from "../utils/mockClasses";
|
|
6
|
+
import {IInlineLiteCheckoutOptions} from "../../src/types/commons";
|
|
8
7
|
|
|
9
8
|
|
|
10
9
|
declare global {
|
|
@@ -15,7 +14,7 @@ declare global {
|
|
|
15
14
|
}
|
|
16
15
|
|
|
17
16
|
describe("createPayment", () => {
|
|
18
|
-
let checkoutConstructor:
|
|
17
|
+
let checkoutConstructor: IInlineLiteCheckoutOptions,
|
|
19
18
|
liteCheckout: LiteCheckout,
|
|
20
19
|
fetchSpy: jest.SpyInstance,
|
|
21
20
|
liteCheckoutSpy: jest.SpyInstance;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import "../utils/defaultMock";
|
|
2
2
|
import { LiteCheckout } from "../../src";
|
|
3
3
|
import { ErrorResponse } from "../../src/classes/errorResponse";
|
|
4
|
-
import { LiteCheckoutConstructor } from "../../src/classes/liteCheckout";
|
|
5
|
-
import { IErrorResponse } from "../../src/types/responses";
|
|
6
4
|
import { constructorFields } from "../utils/defaultMock";
|
|
7
|
-
import {
|
|
5
|
+
import { CustomerRegisterClass } from "../utils/mockClasses";
|
|
6
|
+
import {IInlineLiteCheckoutOptions} from "../../src/types/commons";
|
|
8
7
|
|
|
9
8
|
|
|
10
9
|
declare global {
|
|
@@ -15,7 +14,7 @@ declare global {
|
|
|
15
14
|
}
|
|
16
15
|
|
|
17
16
|
describe("customerRegister", () => {
|
|
18
|
-
let checkoutConstructor:
|
|
17
|
+
let checkoutConstructor: IInlineLiteCheckoutOptions,
|
|
19
18
|
liteCheckout: LiteCheckout,
|
|
20
19
|
fetchSpy: jest.SpyInstance,
|
|
21
20
|
liteCheckoutSpy: jest.SpyInstance;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import "../utils/defaultMock";
|
|
2
2
|
import { LiteCheckout } from "../../src";
|
|
3
3
|
import { ErrorResponse } from "../../src/classes/errorResponse";
|
|
4
|
-
import { LiteCheckoutConstructor } from "../../src/classes/liteCheckout";
|
|
5
|
-
import { IErrorResponse } from "../../src/types/responses";
|
|
6
4
|
import { constructorFields } from "../utils/defaultMock";
|
|
7
5
|
import { BusinessClass } from "../utils/mockClasses";
|
|
6
|
+
import {IInlineLiteCheckoutOptions} from "../../src/types/commons";
|
|
8
7
|
|
|
9
8
|
declare global {
|
|
10
9
|
interface Window {
|
|
@@ -14,7 +13,7 @@ declare global {
|
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
describe("getBusiness", () => {
|
|
17
|
-
let checkoutConstructor:
|
|
16
|
+
let checkoutConstructor: IInlineLiteCheckoutOptions,
|
|
18
17
|
liteCheckout: LiteCheckout,
|
|
19
18
|
fetchSpy: jest.SpyInstance,
|
|
20
19
|
liteCheckoutSpy: jest.SpyInstance;
|