@tonder.io/ionic-lite-sdk 0.0.35-beta.8 → 0.0.37-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 (83) hide show
  1. package/.gitlab-ci.yml +28 -28
  2. package/README.md +532 -202
  3. package/dist/classes/BaseInlineCheckout.d.ts +21 -19
  4. package/dist/classes/errorResponse.d.ts +1 -1
  5. package/dist/classes/liteCheckout.d.ts +15 -43
  6. package/dist/data/api.d.ts +1 -1
  7. package/dist/data/businessApi.d.ts +1 -1
  8. package/dist/data/cardApi.d.ts +1 -1
  9. package/dist/data/checkoutApi.d.ts +2 -1
  10. package/dist/data/customerApi.d.ts +1 -1
  11. package/dist/data/paymentMethodApi.d.ts +2 -2
  12. package/dist/helpers/skyflow.d.ts +1 -1
  13. package/dist/index.d.ts +2 -1
  14. package/dist/index.js +1 -1
  15. package/dist/types/card.d.ts +1 -0
  16. package/dist/types/checkout.d.ts +7 -1
  17. package/dist/types/commons.d.ts +8 -3
  18. package/dist/types/customer.d.ts +10 -0
  19. package/{src → dist}/types/liteInlineCheckout.d.ts +33 -73
  20. package/dist/types/responses.d.ts +3 -0
  21. package/jest.config.ts +14 -14
  22. package/package.json +41 -38
  23. package/rollup.config.js +16 -16
  24. package/src/classes/3dsHandler.ts +237 -237
  25. package/src/classes/BaseInlineCheckout.ts +385 -356
  26. package/src/classes/errorResponse.ts +16 -16
  27. package/src/classes/liteCheckout.ts +588 -598
  28. package/src/data/api.ts +20 -20
  29. package/src/data/businessApi.ts +18 -18
  30. package/src/data/cardApi.ts +85 -89
  31. package/src/data/checkoutApi.ts +84 -87
  32. package/src/data/customerApi.ts +31 -31
  33. package/src/data/openPayApi.ts +12 -12
  34. package/src/data/paymentMethodApi.ts +37 -37
  35. package/src/data/skyflowApi.ts +20 -20
  36. package/src/helpers/constants.ts +63 -63
  37. package/src/helpers/mercadopago.ts +15 -15
  38. package/src/helpers/skyflow.ts +91 -91
  39. package/src/helpers/utils.ts +120 -120
  40. package/src/helpers/validations.ts +55 -55
  41. package/src/index.ts +12 -10
  42. package/src/shared/catalog/paymentMethodsCatalog.ts +247 -247
  43. package/src/shared/constants/messages.ts +10 -10
  44. package/src/shared/constants/paymentMethodAPM.ts +63 -63
  45. package/src/shared/constants/tonderUrl.ts +8 -8
  46. package/src/types/card.ts +35 -34
  47. package/src/types/checkout.ts +123 -117
  48. package/src/types/commons.ts +130 -125
  49. package/src/types/customer.ts +22 -12
  50. package/src/types/liteInlineCheckout.ts +216 -0
  51. package/src/types/paymentMethod.ts +23 -23
  52. package/src/types/requests.ts +114 -114
  53. package/src/types/responses.ts +193 -189
  54. package/src/types/skyflow.ts +17 -17
  55. package/src/types/transaction.ts +101 -101
  56. package/src/types/validations.d.ts +11 -11
  57. package/tests/classes/liteCheckout.test.ts +57 -57
  58. package/tests/methods/createOrder.test.ts +141 -142
  59. package/tests/methods/createPayment.test.ts +121 -122
  60. package/tests/methods/customerRegister.test.ts +118 -119
  61. package/tests/methods/getBusiness.test.ts +114 -115
  62. package/tests/methods/getCustomerCards.test.ts +112 -113
  63. package/tests/methods/registerCustomerCard.test.ts +117 -117
  64. package/tests/methods/startCheckoutRouter.test.ts +119 -119
  65. package/tests/methods/startCheckoutRouterFull.test.ts +138 -138
  66. package/tests/utils/defaultMock.ts +21 -21
  67. package/tests/utils/mockClasses.ts +659 -659
  68. package/tsconfig.json +18 -18
  69. package/types/classes/liteCheckout.d.ts +29 -0
  70. package/types/classes/liteCheckout.js +225 -0
  71. package/types/classes/liteCheckout.js.map +1 -0
  72. package/types/helpers/utils.d.ts +3 -0
  73. package/types/helpers/utils.js +27 -0
  74. package/types/helpers/utils.js.map +1 -0
  75. package/types/index.d.ts +2 -0
  76. package/types/index.js +6 -0
  77. package/types/index.js.map +1 -0
  78. package/.idea/aws.xml +0 -17
  79. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  80. package/.idea/prettier.xml +0 -6
  81. package/.idea/vcs.xml +0 -6
  82. package/.idea/workspace.xml +0 -133
  83. package/src/types/index.d.ts +0 -10
@@ -1,28 +1,13 @@
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
-
1
+ import { IConfigureCheckout } 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 { CreateOrderRequest, CreatePaymentRequest, RegisterCustomerCardRequest, StartCheckoutFullRequest, StartCheckoutIdRequest, StartCheckoutRequest, TokensRequest } from "./requests";
9
+ import { CreateOrderResponse, CreatePaymentResponse, CustomerRegisterResponse, GetBusinessResponse, RegisterCustomerCardResponse, StartCheckoutResponse } from "./responses";
10
+ export interface ILiteCheckout {
26
11
  /**
27
12
  * 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
13
  * @param {import("./index").IConfigureCheckout} data - Configuration data including customer information and potentially other settings.
@@ -30,7 +15,6 @@ export class LiteCheckout {
30
15
  * @public
31
16
  */
32
17
  configureCheckout(data: IConfigureCheckout): void;
33
-
34
18
  /**
35
19
  * Initializes and prepares the checkout for use.
36
20
  * This method set up the initial environment.
@@ -39,7 +23,6 @@ export class LiteCheckout {
39
23
  * @public
40
24
  */
41
25
  injectCheckout(): Promise<void>;
42
-
43
26
  /**
44
27
  * Processes a payment.
45
28
  * @param {import("./index").IProcessPaymentRequest} data - Payment data including customer, cart, and other relevant information.
@@ -52,14 +35,12 @@ export class LiteCheckout {
52
35
  * @public
53
36
  */
54
37
  payment(data: IProcessPaymentRequest): Promise<IStartCheckoutResponse>;
55
-
56
38
  /**
57
39
  * Verifies the 3DS transaction status.
58
- * @returns {Promise<import("./index").ITransaction | void>} The result of the 3DS verification and checkout resumption.
40
+ * @returns {Promise<import("./index").ITransaction | import("./index").IStartCheckoutResponse | void>} The result of the 3DS verification and checkout resumption.
59
41
  * @public
60
42
  */
61
- verify3dsTransaction(): Promise<ITransaction | void>;
62
-
43
+ verify3dsTransaction(): Promise<ITransaction | IStartCheckoutResponse | void>;
63
44
  /**
64
45
  * Retrieves the list of cards associated with a customer.
65
46
  * @returns {Promise<import("./index").ICustomerCardsResponse>} A promise that resolves with the customer's card data.
@@ -69,7 +50,6 @@ export class LiteCheckout {
69
50
  * @public
70
51
  */
71
52
  getCustomerCards(): Promise<ICustomerCardsResponse>;
72
-
73
53
  /**
74
54
  * Saves a card to a customer's account. This method can be used to add a new card
75
55
  * or update an existing one.
@@ -80,10 +60,7 @@ export class LiteCheckout {
80
60
  *
81
61
  * @public
82
62
  */
83
- saveCustomerCard(
84
- card: ISaveCardRequest,
85
- ): Promise<ISaveCardResponse>;
86
-
63
+ saveCustomerCard(card: ISaveCardRequest): Promise<ISaveCardResponse>;
87
64
  /**
88
65
  * Removes a card from a customer's account.
89
66
  * @param {string} skyflowId - The unique identifier of the card to be deleted.
@@ -93,10 +70,7 @@ export class LiteCheckout {
93
70
  *
94
71
  * @public
95
72
  */
96
- removeCustomerCard(
97
- skyflowId: string,
98
- ): Promise<string>;
99
-
73
+ removeCustomerCard(skyflowId: string): Promise<string>;
100
74
  /**
101
75
  * Retrieves the list of available Alternative Payment Methods (APMs).
102
76
  * @returns {Promise<import("./index").IPaymentMethod[]>} A promise that resolves with the list of APMs.
@@ -106,8 +80,11 @@ export class LiteCheckout {
106
80
  * @public
107
81
  */
108
82
  getCustomerPaymentMethods(): Promise<IPaymentMethod[]>;
109
-
110
83
  /**
84
+ * @deprecated This method is deprecated and will be removed in a future release.
85
+ * It is no longer necessary to use this method, now automatically handled
86
+ * during the payment process or when using card management methods.
87
+ *
111
88
  * Retrieves the business information.
112
89
  * @returns {Promise<import("./index").GetBusinessResponse>} A promise that resolves with the business information.
113
90
  *
@@ -116,76 +93,59 @@ export class LiteCheckout {
116
93
  * @public
117
94
  */
118
95
  getBusiness(): Promise<GetBusinessResponse>;
119
-
120
-
121
- // TODO: DEPRECATED
122
96
  /**
123
97
  * @deprecated This method is deprecated and will be removed in a future release.
124
98
  * It is no longer necessary to use this method as customer registration is now automatically handled
125
99
  * during the payment process or when using card management methods.
126
100
  */
127
- customerRegister(email: string): Promise<CustomerRegisterResponse | ErrorResponse>
128
-
129
- // TODO: DEPRECATED
101
+ customerRegister(email: string): Promise<CustomerRegisterResponse | ErrorResponse>;
130
102
  /**
131
103
  * @deprecated This method is deprecated and will be removed in a future release.
132
104
  * It is no longer necessary to use this method as order creation is now automatically
133
105
  * handled when making a payment through the `payment` function.
134
106
  */
135
- createOrder(orderItems: CreateOrderRequest): Promise<CreateOrderResponse | ErrorResponse>
136
-
137
- // TODO: DEPRECATED
107
+ createOrder(orderItems: CreateOrderRequest): Promise<CreateOrderResponse | ErrorResponse>;
138
108
  /**
139
109
  * @deprecated This method is deprecated and will be removed in a future release.
140
110
  * It is no longer necessary to use this method as payment creation is now automatically
141
111
  * handled when making a payment through the `payment` function.
142
112
  */
143
- createPayment(paymentItems: CreatePaymentRequest): Promise<CreatePaymentResponse | ErrorResponse>
144
-
145
- // TODO: DEPRECATED
113
+ createPayment(paymentItems: CreatePaymentRequest): Promise<CreatePaymentResponse | ErrorResponse>;
146
114
  /**
147
115
  * @deprecated This method is deprecated and will be removed in a future release.
148
116
  * Use the {@link payment} method
149
117
  */
150
- startCheckoutRouter(routerData: StartCheckoutRequest | StartCheckoutIdRequest): Promise<StartCheckoutResponse | ErrorResponse | undefined>
151
-
152
- // TODO: DEPRECATED
118
+ startCheckoutRouter(routerData: StartCheckoutRequest | StartCheckoutIdRequest): Promise<StartCheckoutResponse | ErrorResponse | undefined>;
153
119
  /**
154
120
  * @deprecated This method is deprecated and will be removed in a future release.
155
121
  * Use the {@link payment} method
156
122
  */
157
- startCheckoutRouterFull(routerFullData: StartCheckoutFullRequest): Promise<StartCheckoutResponse | ErrorResponse | undefined>
158
-
159
- // TODO: DEPRECATED
123
+ startCheckoutRouterFull(routerFullData: StartCheckoutFullRequest): Promise<StartCheckoutResponse | ErrorResponse | undefined>;
160
124
  /**
161
125
  * @deprecated This method is deprecated and will be removed in a future release.
162
126
  * Use the {@link saveCustomerCard} method
163
127
  */
164
- registerCustomerCard(customerToken: string, data: RegisterCustomerCardRequest): Promise<RegisterCustomerCardResponse | ErrorResponse>
165
-
166
-
167
- // TODO: DEPRECATED
128
+ registerCustomerCard(secureToken: string, customerToken: string, data: RegisterCustomerCardRequest): Promise<RegisterCustomerCardResponse | ErrorResponse>;
168
129
  /**
169
130
  * @deprecated This method is deprecated and will be removed in a future release.
170
131
  * Use the {@link removeCustomerCard} method
171
132
  */
172
- deleteCustomerCard(customerToken: string, skyflowId: string): Promise<Boolean | ErrorResponse>
173
-
174
- // TODO: DEPRECATED
133
+ deleteCustomerCard(customerToken: string, skyflowId: string): Promise<Boolean | ErrorResponse>;
175
134
  /**
176
135
  * @deprecated This method is deprecated and will be removed in a future release.
177
136
  * Use the {@link getCustomerPaymentMethods} method
178
137
  */
179
138
  getActiveAPMs(): Promise<APM[]>;
180
-
181
- // TODO: DEPRECATED
182
139
  /**
183
140
  * @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
141
+ * It is no longer necessary to use this method as card registration or as checkout is now automatically handled
185
142
  * during the payment process or when using card management methods.
186
143
  */
187
- getSkyflowTokens({vault_id, vault_url, data}: TokensRequest): Promise<any | ErrorResponse>
144
+ getSkyflowTokens({ vault_id, vault_url, data, }: TokensRequest): Promise<any | ErrorResponse>;
145
+ /**
146
+ * @deprecated This method is deprecated and will be removed in a future release.
147
+ * It is no longer necessary to use this method is now automatically handled
148
+ * during the payment process.
149
+ */
150
+ getOpenpayDeviceSessionID(merchant_id: string, public_key: string, is_sandbox: boolean): Promise<string | ErrorResponse>;
188
151
  }
189
-
190
-
191
- export interface IInlineLiteCheckoutOptions extends IInlineCheckoutBaseOptions {}
@@ -178,3 +178,6 @@ export type RegisterCustomerCardResponse = {
178
178
  skyflow_id: string;
179
179
  user_id: number;
180
180
  };
181
+ export type GetSecureTokenResponse = {
182
+ access: string;
183
+ };
package/jest.config.ts CHANGED
@@ -1,15 +1,15 @@
1
- import type { JestConfigWithTsJest } from 'ts-jest'
2
-
3
- const jestConfig: JestConfigWithTsJest = {
4
- testEnvironment: "jsdom",
5
- preset: 'ts-jest',
6
- transform: {
7
- '^.+\\.tsx?$': [
8
- 'ts-jest',
9
- {
10
- },
11
- ],
12
- },
13
- }
14
-
1
+ import type { JestConfigWithTsJest } from 'ts-jest'
2
+
3
+ const jestConfig: JestConfigWithTsJest = {
4
+ testEnvironment: "jsdom",
5
+ preset: 'ts-jest',
6
+ transform: {
7
+ '^.+\\.tsx?$': [
8
+ 'ts-jest',
9
+ {
10
+ },
11
+ ],
12
+ },
13
+ }
14
+
15
15
  export default jestConfig
package/package.json CHANGED
@@ -1,38 +1,41 @@
1
- {
2
- "name": "@tonder.io/ionic-lite-sdk",
3
- "version": "0.0.35-beta.8",
4
- "description": "Tonder ionic lite SDK",
5
- "main": "dist/index.js",
6
- "types": "src/types/index.d.ts",
7
- "scripts": {
8
- "build": "tsc -noEmit && rollup --config",
9
- "test": "jest",
10
- "ts-coverage": "typescript-coverage-report"
11
- },
12
- "author": "",
13
- "license": "ISC",
14
- "dependencies": {
15
- "skyflow-js": "^1.34.1",
16
- "ts-node": "^10.9.2"
17
- },
18
- "publishConfig": {
19
- "access": "public",
20
- "registry": "https://registry.npmjs.org/"
21
- },
22
- "devDependencies": {
23
- "@rollup/plugin-terser": "^0.4.4",
24
- "@rollup/plugin-typescript": "11.1.6",
25
- "@types/crypto-js": "^4.2.2",
26
- "@types/jest": "^29.5.11",
27
- "@types/node": "^20.11.5",
28
- "jest": "^29.7.0",
29
- "jest-environment-jsdom": "^29.7.0",
30
- "jsdom": "^24.0.0",
31
- "rollup": "4.9.6",
32
- "ts-jest": "^29.1.2",
33
- "ts-loader": "^9.5.1",
34
- "tslib": "^2.6.2",
35
- "typescript": "^5.3.3",
36
- "typescript-coverage-report": "^0.8.0"
37
- }
38
- }
1
+ {
2
+ "name": "@tonder.io/ionic-lite-sdk",
3
+ "version": "0.0.37-beta.1",
4
+ "description": "Tonder ionic lite SDK",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsc -noEmit && rollup --config",
9
+ "test": "jest",
10
+ "ts-coverage": "typescript-coverage-report"
11
+ },
12
+ "author": "",
13
+ "license": "ISC",
14
+ "dependencies": {
15
+ "lodash.get": "^4.4.2",
16
+ "skyflow-js": "^1.34.1",
17
+ "ts-node": "^10.9.2"
18
+ },
19
+ "publishConfig": {
20
+ "access": "public",
21
+ "registry": "https://registry.npmjs.org/"
22
+ },
23
+ "devDependencies": {
24
+ "@rollup/plugin-terser": "^0.4.4",
25
+ "@rollup/plugin-typescript": "11.1.6",
26
+ "@types/crypto-js": "^4.2.2",
27
+ "@types/jest": "^29.5.11",
28
+ "@types/lodash": "^4.17.10",
29
+ "@types/lodash.get": "^4.4.9",
30
+ "@types/node": "^20.11.5",
31
+ "jest": "^29.7.0",
32
+ "jest-environment-jsdom": "^29.7.0",
33
+ "jsdom": "^24.0.0",
34
+ "rollup": "4.9.6",
35
+ "ts-jest": "^29.1.2",
36
+ "ts-loader": "^9.5.1",
37
+ "tslib": "^2.6.2",
38
+ "typescript": "^5.3.3",
39
+ "typescript-coverage-report": "^0.8.0"
40
+ }
41
+ }
package/rollup.config.js CHANGED
@@ -1,17 +1,17 @@
1
- const typescript = require('@rollup/plugin-typescript');
2
- const terser = require('@rollup/plugin-terser');
3
-
4
- module.exports = {
5
- input: './src/index.ts',
6
- output: {
7
- dir: 'dist',
8
- format: 'es',
9
- plugins: [terser()]
10
- },
11
- plugins: [
12
- typescript({
13
- exclude: ["tests/**", "jest.config.ts"]
14
- })
15
- ],
16
- external: ["skyflow-js", "crypto-js"]
1
+ const typescript = require('@rollup/plugin-typescript');
2
+ const terser = require('@rollup/plugin-terser');
3
+
4
+ module.exports = {
5
+ input: './src/index.ts',
6
+ output: {
7
+ dir: 'dist',
8
+ format: 'es',
9
+ plugins: [terser()]
10
+ },
11
+ plugins: [
12
+ typescript({
13
+ exclude: ["tests/**", "jest.config.ts"]
14
+ })
15
+ ],
16
+ external: ["skyflow-js", "crypto-js"]
17
17
  };