@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,189 +1,193 @@
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
- };
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
+ };
190
+
191
+ export type GetSecureTokenResponse = {
192
+ access: string
193
+ }
@@ -1,17 +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
- }
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
+ }
@@ -1,57 +1,57 @@
1
- import "../utils/defaultMock";
2
- import { LiteCheckout } from "../../src";
3
- import { LiteCheckoutConstructor } from "../../src/classes/liteCheckout";
4
- import { constructorFields } from "../utils/defaultMock";
5
-
6
- declare global {
7
- interface Window {
8
- OpenPay: any;
9
- Skyflow: any;
10
- }
11
- }
12
-
13
- describe("LiteCheckout", () => {
14
- let checkoutConstructor: LiteCheckoutConstructor,
15
- liteCheckout: LiteCheckout,
16
- fetchSpy: jest.SpyInstance,
17
- liteCheckoutSpy: jest.SpyInstance;
18
-
19
- beforeEach(async () => {
20
- window.fetch = jest.fn();
21
-
22
- checkoutConstructor = {
23
- ...constructorFields,
24
- };
25
-
26
- liteCheckout = new LiteCheckout(constructorFields);
27
-
28
- fetchSpy = jest.spyOn(global, "fetch");
29
- });
30
-
31
- afterEach(() => {
32
- jest.restoreAllMocks();
33
- });
34
-
35
- it("Has required properties", () => {
36
- expect(checkoutConstructor).toEqual(constructorFields);
37
- });
38
-
39
- it("Can instance LiteCheckout", () => {
40
- expect(liteCheckout).toBeInstanceOf(LiteCheckout);
41
- expect(liteCheckout.apiKeyTonder).toEqual(constructorFields.apiKey);
42
- expect(liteCheckout.baseUrl).toEqual(constructorFields.baseUrl);
43
- expect(liteCheckout.abortController.signal).toEqual(constructorFields.signal);
44
- });
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
-
55
-
56
-
57
- });
1
+ import "../utils/defaultMock";
2
+ import { LiteCheckout } from "../../src";
3
+ import { LiteCheckoutConstructor } from "../../src/classes/liteCheckout";
4
+ import { constructorFields } from "../utils/defaultMock";
5
+
6
+ declare global {
7
+ interface Window {
8
+ OpenPay: any;
9
+ Skyflow: any;
10
+ }
11
+ }
12
+
13
+ describe("LiteCheckout", () => {
14
+ let checkoutConstructor: LiteCheckoutConstructor,
15
+ liteCheckout: LiteCheckout,
16
+ fetchSpy: jest.SpyInstance,
17
+ liteCheckoutSpy: jest.SpyInstance;
18
+
19
+ beforeEach(async () => {
20
+ window.fetch = jest.fn();
21
+
22
+ checkoutConstructor = {
23
+ ...constructorFields,
24
+ };
25
+
26
+ liteCheckout = new LiteCheckout(constructorFields);
27
+
28
+ fetchSpy = jest.spyOn(global, "fetch");
29
+ });
30
+
31
+ afterEach(() => {
32
+ jest.restoreAllMocks();
33
+ });
34
+
35
+ it("Has required properties", () => {
36
+ expect(checkoutConstructor).toEqual(constructorFields);
37
+ });
38
+
39
+ it("Can instance LiteCheckout", () => {
40
+ expect(liteCheckout).toBeInstanceOf(LiteCheckout);
41
+ expect(liteCheckout.publicApiKeyTonder).toEqual(constructorFields.publicApiKeyTonder);
42
+ expect(liteCheckout.baseUrlTonder).toEqual(constructorFields.baseUrlTonder);
43
+ expect(liteCheckout.signal).toEqual(constructorFields.signal);
44
+ });
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+ });