@tonder.io/ionic-lite-sdk 0.0.35-beta.8 → 0.0.36-beta.1

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.
Files changed (87) hide show
  1. package/.gitlab-ci.yml +28 -28
  2. package/README.md +221 -202
  3. package/dist/classes/errorResponse.d.ts +1 -1
  4. package/dist/classes/liteCheckout.d.ts +32 -56
  5. package/dist/data/api.d.ts +1 -1
  6. package/dist/helpers/utils.d.ts +4 -8
  7. package/dist/index.d.ts +1 -2
  8. package/dist/index.js +1 -1
  9. package/dist/types/commons.d.ts +0 -37
  10. package/dist/types/requests.d.ts +3 -12
  11. package/dist/types/responses.d.ts +3 -0
  12. package/jest.config.ts +14 -14
  13. package/package.json +38 -38
  14. package/rollup.config.js +16 -16
  15. package/src/classes/3dsHandler.ts +237 -237
  16. package/src/classes/errorResponse.ts +16 -16
  17. package/src/classes/liteCheckout.ts +575 -598
  18. package/src/data/api.ts +20 -20
  19. package/src/helpers/constants.ts +63 -63
  20. package/src/helpers/mercadopago.ts +15 -15
  21. package/src/helpers/utils.ts +320 -120
  22. package/src/index.ts +4 -10
  23. package/src/types/commons.ts +83 -125
  24. package/src/types/requests.ts +105 -114
  25. package/src/types/responses.ts +193 -189
  26. package/src/types/skyflow.ts +17 -17
  27. package/tests/classes/liteCheckout.test.ts +57 -57
  28. package/tests/methods/createOrder.test.ts +142 -142
  29. package/tests/methods/createPayment.test.ts +122 -122
  30. package/tests/methods/customerRegister.test.ts +119 -119
  31. package/tests/methods/getBusiness.test.ts +115 -115
  32. package/tests/methods/getCustomerCards.test.ts +119 -113
  33. package/tests/methods/getOpenpayDeviceSessionID.test.ts +95 -0
  34. package/tests/methods/getSkyflowToken.test.ts +155 -0
  35. package/tests/methods/getVaultToken.test.ts +107 -0
  36. package/tests/methods/registerCustomerCard.test.ts +117 -117
  37. package/tests/methods/startCheckoutRouter.test.ts +119 -119
  38. package/tests/methods/startCheckoutRouterFull.test.ts +138 -138
  39. package/tests/utils/defaultMock.ts +20 -21
  40. package/tests/utils/mockClasses.ts +656 -659
  41. package/tsconfig.json +18 -18
  42. package/.idea/aws.xml +0 -17
  43. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  44. package/.idea/prettier.xml +0 -6
  45. package/.idea/vcs.xml +0 -6
  46. package/.idea/workspace.xml +0 -133
  47. package/dist/classes/BaseInlineCheckout.d.ts +0 -45
  48. package/dist/data/businessApi.d.ts +0 -2
  49. package/dist/data/cardApi.d.ts +0 -4
  50. package/dist/data/checkoutApi.d.ts +0 -4
  51. package/dist/data/customerApi.d.ts +0 -2
  52. package/dist/data/openPayApi.d.ts +0 -1
  53. package/dist/data/paymentMethodApi.d.ts +0 -5
  54. package/dist/data/skyflowApi.d.ts +0 -1
  55. package/dist/helpers/skyflow.d.ts +0 -3
  56. package/dist/helpers/validations.d.ts +0 -6
  57. package/dist/shared/catalog/paymentMethodsCatalog.d.ts +0 -1
  58. package/dist/shared/constants/messages.d.ts +0 -11
  59. package/dist/shared/constants/paymentMethodAPM.d.ts +0 -62
  60. package/dist/shared/constants/tonderUrl.d.ts +0 -7
  61. package/dist/types/card.d.ts +0 -29
  62. package/dist/types/checkout.d.ts +0 -103
  63. package/dist/types/customer.d.ts +0 -12
  64. package/dist/types/paymentMethod.d.ts +0 -22
  65. package/dist/types/transaction.d.ts +0 -101
  66. package/src/classes/BaseInlineCheckout.ts +0 -356
  67. package/src/data/businessApi.ts +0 -18
  68. package/src/data/cardApi.ts +0 -89
  69. package/src/data/checkoutApi.ts +0 -87
  70. package/src/data/customerApi.ts +0 -31
  71. package/src/data/openPayApi.ts +0 -12
  72. package/src/data/paymentMethodApi.ts +0 -37
  73. package/src/data/skyflowApi.ts +0 -20
  74. package/src/helpers/skyflow.ts +0 -91
  75. package/src/helpers/validations.ts +0 -55
  76. package/src/shared/catalog/paymentMethodsCatalog.ts +0 -248
  77. package/src/shared/constants/messages.ts +0 -11
  78. package/src/shared/constants/paymentMethodAPM.ts +0 -63
  79. package/src/shared/constants/tonderUrl.ts +0 -8
  80. package/src/types/card.ts +0 -34
  81. package/src/types/checkout.ts +0 -118
  82. package/src/types/customer.ts +0 -12
  83. package/src/types/index.d.ts +0 -10
  84. package/src/types/liteInlineCheckout.d.ts +0 -191
  85. package/src/types/paymentMethod.ts +0 -24
  86. package/src/types/transaction.ts +0 -101
  87. package/src/types/validations.d.ts +0 -11
@@ -1,12 +0,0 @@
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
- address?: string;
12
- };
@@ -1,10 +0,0 @@
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
-
@@ -1,191 +0,0 @@
1
- import {IConfigureCheckout, IInlineCheckoutBaseOptions} from "./commons";
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 {}
@@ -1,24 +0,0 @@
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
- }
@@ -1,101 +0,0 @@
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,11 +0,0 @@
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;