tonder-web-sdk 1.12.0-beta.0 → 1.12.0-beta.10

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.
@@ -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: 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,26 @@
1
+ import { ICustomer } from "./customer";
2
+
3
+ export interface IInlineCheckoutBaseOptions {
4
+ mode?: "production" | "sandbox" | "stage" | "development";
5
+ apiKey: string;
6
+ returnUrl: string;
7
+ callBack?: (response: any) => void;
8
+ }
9
+
10
+ export interface IConfigureCheckout {
11
+ customer: ICustomer;
12
+ }
13
+
14
+ export interface IApiError {
15
+ code: string;
16
+ body: Record<string, string> | string;
17
+ name: string;
18
+ message: string;
19
+ }
20
+
21
+ export interface IPublicError {
22
+ status: string;
23
+ code: number;
24
+ message: string;
25
+ detail: Record<string, any> | string;
26
+ }
@@ -0,0 +1,11 @@
1
+ export type ICustomer = {
2
+ firstName: string;
3
+ lastName: string;
4
+ country?: string;
5
+ street?: string;
6
+ city?: string;
7
+ state?: string;
8
+ postCode?: string;
9
+ email: string;
10
+ phone?: string;
11
+ };
package/types/index.d.ts CHANGED
@@ -1,14 +1,11 @@
1
- export interface InlineCheckoutOptions {
2
- mode?: string;
3
- apiKey: string;
4
- returnUrl: string;
5
- renderPaymentButton?: boolean;
6
- callBack?: (response: any) => void;
7
- styles?: Record<string, string>;
8
- }
9
-
10
- export class InlineCheckout {
11
- constructor(options: InlineCheckoutOptions);
12
- injectCheckout(): void;
13
- }
14
-
1
+ export * from './card';
2
+ export * from './checkout';
3
+ export * from './common';
4
+ export * from './customer';
5
+ export * from './transaction';
6
+ export * from './paymentMethod';
7
+ export * from './inlineCheckout';
8
+ export * from './liteInlineCheckout';
9
+
10
+
11
+
@@ -0,0 +1,22 @@
1
+ import {IConfigureCheckout, IInlineCheckoutBaseOptions} from "./common";
2
+ import {IProcessPaymentRequest, IStartCheckoutResponse} from "./checkout";
3
+ import {ITransaction} from "./transaction";
4
+
5
+ export class InlineCheckout {
6
+ constructor(options: IInlineCheckoutOptions);
7
+
8
+ configureCheckout(data: IConfigureCheckout): Promise<void>;
9
+
10
+ injectCheckout(): Promise<void>;
11
+
12
+ payment(data: IProcessPaymentRequest): Promise<IStartCheckoutResponse>;
13
+
14
+ verify3dsTransaction(): Promise<ITransaction | void>;
15
+
16
+ removeCheckout(): void;
17
+ }
18
+
19
+ export interface IInlineCheckoutOptions extends IInlineCheckoutBaseOptions{
20
+ styles?: Record<string, string>;
21
+ renderPaymentButton?: boolean;
22
+ }
@@ -0,0 +1,32 @@
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
+
7
+ export class LiteInlineCheckout {
8
+ constructor(options: IInlineLiteCheckoutOptions);
9
+
10
+ configureCheckout(data: IConfigureCheckout): void;
11
+
12
+ injectCheckout(): Promise<void>;
13
+
14
+ payment(data: IProcessPaymentRequest): Promise<IStartCheckoutResponse>;
15
+
16
+ verify3dsTransaction(): Promise<ITransaction | void>;
17
+
18
+ getCustomerCards(): Promise<ICustomerCardsResponse>;
19
+
20
+ saveCustomerCard(
21
+ card: ISaveCardRequest,
22
+ ): Promise<ISaveCardResponse>;
23
+
24
+ removeCustomerCard(
25
+ skyflowId: string,
26
+ ): Promise<void>;
27
+
28
+ getCustomerPaymentMethods(): Promise<IPaymentMethod[]>;
29
+ }
30
+
31
+
32
+ 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,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
+ }