@tonder.io/ionic-lite-sdk 0.0.36-beta.1 → 0.0.38-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 (79) hide show
  1. package/README.md +427 -116
  2. package/dist/classes/BaseInlineCheckout.d.ts +47 -0
  3. package/dist/classes/liteCheckout.d.ts +25 -29
  4. package/dist/data/businessApi.d.ts +2 -0
  5. package/dist/data/cardApi.d.ts +4 -0
  6. package/dist/data/checkoutApi.d.ts +5 -0
  7. package/dist/data/customerApi.d.ts +2 -0
  8. package/dist/data/openPayApi.d.ts +1 -0
  9. package/dist/data/paymentMethodApi.d.ts +5 -0
  10. package/dist/data/skyflowApi.d.ts +1 -0
  11. package/dist/helpers/skyflow.d.ts +3 -0
  12. package/dist/helpers/utils.d.ts +8 -4
  13. package/dist/helpers/validations.d.ts +6 -0
  14. package/dist/index.d.ts +3 -1
  15. package/dist/index.js +1 -1
  16. package/dist/shared/catalog/paymentMethodsCatalog.d.ts +1 -0
  17. package/dist/shared/constants/messages.d.ts +11 -0
  18. package/dist/shared/constants/paymentMethodAPM.d.ts +62 -0
  19. package/dist/shared/constants/tonderUrl.d.ts +7 -0
  20. package/dist/types/card.d.ts +30 -0
  21. package/dist/types/checkout.d.ts +109 -0
  22. package/dist/types/commons.d.ts +42 -0
  23. package/dist/types/customer.d.ts +22 -0
  24. package/dist/types/liteInlineCheckout.d.ts +151 -0
  25. package/dist/types/paymentMethod.d.ts +22 -0
  26. package/dist/types/requests.d.ts +12 -3
  27. package/dist/types/transaction.d.ts +101 -0
  28. package/package.json +4 -1
  29. package/src/classes/BaseInlineCheckout.ts +387 -0
  30. package/src/classes/errorResponse.ts +1 -1
  31. package/src/classes/liteCheckout.ts +372 -356
  32. package/src/data/businessApi.ts +18 -0
  33. package/src/data/cardApi.ts +87 -0
  34. package/src/data/checkoutApi.ts +84 -0
  35. package/src/data/customerApi.ts +31 -0
  36. package/src/data/openPayApi.ts +12 -0
  37. package/src/data/paymentMethodApi.ts +37 -0
  38. package/src/data/skyflowApi.ts +20 -0
  39. package/src/helpers/mercadopago.ts +14 -14
  40. package/src/helpers/skyflow.ts +91 -0
  41. package/src/helpers/utils.ts +66 -266
  42. package/src/helpers/validations.ts +55 -0
  43. package/src/index.ts +9 -1
  44. package/src/shared/catalog/paymentMethodsCatalog.ts +248 -0
  45. package/src/shared/constants/messages.ts +11 -0
  46. package/src/shared/constants/paymentMethodAPM.ts +63 -0
  47. package/src/shared/constants/tonderUrl.ts +8 -0
  48. package/src/types/card.ts +35 -0
  49. package/src/types/checkout.ts +124 -0
  50. package/src/types/commons.ts +114 -67
  51. package/src/types/customer.ts +22 -0
  52. package/src/types/liteInlineCheckout.ts +216 -0
  53. package/src/types/paymentMethod.ts +24 -0
  54. package/src/types/requests.ts +12 -3
  55. package/src/types/transaction.ts +101 -0
  56. package/src/types/validations.d.ts +11 -0
  57. package/tests/classes/liteCheckout.test.ts +5 -5
  58. package/tests/methods/createOrder.test.ts +3 -4
  59. package/tests/methods/createPayment.test.ts +2 -3
  60. package/tests/methods/customerRegister.test.ts +3 -4
  61. package/tests/methods/getBusiness.test.ts +4 -5
  62. package/tests/methods/getCustomerCards.test.ts +6 -13
  63. package/tests/methods/registerCustomerCard.test.ts +2 -2
  64. package/tests/methods/startCheckoutRouter.test.ts +2 -2
  65. package/tests/methods/startCheckoutRouterFull.test.ts +2 -2
  66. package/tests/utils/defaultMock.ts +3 -2
  67. package/tests/utils/mockClasses.ts +7 -4
  68. package/types/classes/liteCheckout.d.ts +29 -0
  69. package/types/classes/liteCheckout.js +225 -0
  70. package/types/classes/liteCheckout.js.map +1 -0
  71. package/types/helpers/utils.d.ts +3 -0
  72. package/types/helpers/utils.js +27 -0
  73. package/types/helpers/utils.js.map +1 -0
  74. package/types/index.d.ts +2 -0
  75. package/types/index.js +6 -0
  76. package/types/index.js.map +1 -0
  77. package/tests/methods/getOpenpayDeviceSessionID.test.ts +0 -95
  78. package/tests/methods/getSkyflowToken.test.ts +0 -155
  79. package/tests/methods/getVaultToken.test.ts +0 -107
@@ -0,0 +1,248 @@
1
+ import {clearSpace} from "../../helpers/utils";
2
+ import {PAYMENT_METHOD_APM} from "../constants/paymentMethodAPM";
3
+
4
+ const PAYMENT_METHODS_CATALOG = {
5
+ [PAYMENT_METHOD_APM.SORIANA]: {
6
+ label: "Soriana",
7
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/soriana.png",
8
+ },
9
+ [PAYMENT_METHOD_APM.OXXO]: {
10
+ label: "Oxxo",
11
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/oxxo.png",
12
+ },
13
+ [PAYMENT_METHOD_APM.CODI]: {
14
+ label: "CoDi",
15
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/codi.png",
16
+ },
17
+ [PAYMENT_METHOD_APM.SPEI]: {
18
+ label: "SPEI",
19
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/spei.png",
20
+ },
21
+ [PAYMENT_METHOD_APM.PAYPAL]: {
22
+ label: "Paypal",
23
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/paypal.png",
24
+ },
25
+ [PAYMENT_METHOD_APM.COMERCIALMEXICANA]: {
26
+ label: "Comercial Mexicana",
27
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/comercial_exicana.png",
28
+ },
29
+ [PAYMENT_METHOD_APM.BANCOMER]: {
30
+ label: "Bancomer",
31
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/bancomer.png",
32
+ },
33
+ [PAYMENT_METHOD_APM.WALMART]: {
34
+ label: "Walmart",
35
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/walmart.png",
36
+ },
37
+ [PAYMENT_METHOD_APM.BODEGA]: {
38
+ label: "Bodega Aurrera",
39
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/bodega_aurrera.png",
40
+ },
41
+ [PAYMENT_METHOD_APM.SAMSCLUB]: {
42
+ label: "Sam´s Club",
43
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/sams_club.png",
44
+ },
45
+ [PAYMENT_METHOD_APM.SUPERAMA]: {
46
+ label: "Superama",
47
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/superama.png",
48
+ },
49
+ [PAYMENT_METHOD_APM.CALIMAX]: {
50
+ label: "Calimax",
51
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/calimax.png",
52
+ },
53
+ [PAYMENT_METHOD_APM.EXTRA]: {
54
+ label: "Tiendas Extra",
55
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/tiendas_extra.png",
56
+ },
57
+ [PAYMENT_METHOD_APM.CIRCULOK]: {
58
+ label: "Círculo K",
59
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/circulo_k.png",
60
+ },
61
+ [PAYMENT_METHOD_APM.SEVEN11]: {
62
+ label: "7 Eleven",
63
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/7_eleven.png",
64
+ },
65
+ [PAYMENT_METHOD_APM.TELECOMM]: {
66
+ label: "Telecomm",
67
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/telecomm.png",
68
+ },
69
+ [PAYMENT_METHOD_APM.BANORTE]: {
70
+ label: "Banorte",
71
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/banorte.png",
72
+ },
73
+ [PAYMENT_METHOD_APM.BENAVIDES]: {
74
+ label: "Farmacias Benavides",
75
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/farmacias_benavides.png",
76
+ },
77
+ [PAYMENT_METHOD_APM.DELAHORRO]: {
78
+ label: "Farmacias del Ahorro",
79
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/farmacias_ahorro.png",
80
+ },
81
+ [PAYMENT_METHOD_APM.ELASTURIANO]: {
82
+ label: "El Asturiano",
83
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/asturiano.png",
84
+ },
85
+ [PAYMENT_METHOD_APM.WALDOS]: {
86
+ label: "Waldos",
87
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/waldos.png",
88
+ },
89
+ [PAYMENT_METHOD_APM.ALSUPER]: {
90
+ label: "Alsuper",
91
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/al_super.png",
92
+ },
93
+ [PAYMENT_METHOD_APM.KIOSKO]: {
94
+ label: "Kiosko",
95
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/kiosko.png",
96
+ },
97
+ [PAYMENT_METHOD_APM.STAMARIA]: {
98
+ label: "Farmacias Santa María",
99
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/farmacias_santa_maria.png",
100
+ },
101
+ [PAYMENT_METHOD_APM.LAMASBARATA]: {
102
+ label: "Farmacias la más barata",
103
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/farmacias_barata.png",
104
+ },
105
+ [PAYMENT_METHOD_APM.FARMROMA]: {
106
+ label: "Farmacias Roma",
107
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/farmacias_roma.png",
108
+ },
109
+ [PAYMENT_METHOD_APM.FARMUNION]: {
110
+ label: "Pago en Farmacias Unión",
111
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/farmacias_union.png",
112
+ },
113
+ [PAYMENT_METHOD_APM.FARMATODO]: {
114
+ label: "Pago en Farmacias Farmatodo",
115
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/farmacias_farmatodo.png ",
116
+ },
117
+ [PAYMENT_METHOD_APM.SFDEASIS]: {
118
+ label: "Pago en Farmacias San Francisco de Asís",
119
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/farmacias_san_francisco.png",
120
+ },
121
+ [PAYMENT_METHOD_APM.FARM911]: {
122
+ label: "Farmacias 911",
123
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
124
+ },
125
+ [PAYMENT_METHOD_APM.FARMECONOMICAS]: {
126
+ label: "Farmacias Economicas",
127
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
128
+ },
129
+ [PAYMENT_METHOD_APM.FARMMEDICITY]: {
130
+ label: "Farmacias Medicity",
131
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
132
+ },
133
+ [PAYMENT_METHOD_APM.RIANXEIRA]: {
134
+ label: "Rianxeira",
135
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
136
+ },
137
+ [PAYMENT_METHOD_APM.WESTERNUNION]: {
138
+ label: "Western Union",
139
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
140
+ },
141
+ [PAYMENT_METHOD_APM.ZONAPAGO]: {
142
+ label: "Zona Pago",
143
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
144
+ },
145
+ [PAYMENT_METHOD_APM.CAJALOSANDES]: {
146
+ label: "Caja Los Andes",
147
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
148
+ },
149
+ [PAYMENT_METHOD_APM.CAJAPAITA]: {
150
+ label: "Caja Paita",
151
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
152
+ },
153
+ [PAYMENT_METHOD_APM.CAJASANTA]: {
154
+ label: "Caja Santa",
155
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
156
+ },
157
+ [PAYMENT_METHOD_APM.CAJASULLANA]: {
158
+ label: "Caja Sullana",
159
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
160
+ },
161
+ [PAYMENT_METHOD_APM.CAJATRUJILLO]: {
162
+ label: "Caja Trujillo",
163
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
164
+ },
165
+ [PAYMENT_METHOD_APM.EDPYME]: {
166
+ label: "Edpyme",
167
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
168
+ },
169
+ [PAYMENT_METHOD_APM.KASNET]: {
170
+ label: "KasNet",
171
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
172
+ },
173
+ [PAYMENT_METHOD_APM.NORANDINO]: {
174
+ label: "Norandino",
175
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
176
+ },
177
+ [PAYMENT_METHOD_APM.QAPAQ]: {
178
+ label: "Qapaq",
179
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
180
+ },
181
+ [PAYMENT_METHOD_APM.RAIZ]: {
182
+ label: "Raiz",
183
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
184
+ },
185
+ [PAYMENT_METHOD_APM.PAYSER]: {
186
+ label: "Paysera",
187
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
188
+ },
189
+ [PAYMENT_METHOD_APM.WUNION]: {
190
+ label: "Western Union",
191
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
192
+ },
193
+ [PAYMENT_METHOD_APM.BANCOCONTINENTAL]: {
194
+ label: "Banco Continental",
195
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
196
+ },
197
+ [PAYMENT_METHOD_APM.GMONEY]: {
198
+ label: "Go money",
199
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
200
+ },
201
+ [PAYMENT_METHOD_APM.GOPAY]: {
202
+ label: "Go pay",
203
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
204
+ },
205
+ [PAYMENT_METHOD_APM.WU]: {
206
+ label: "Western Union",
207
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
208
+ },
209
+ [PAYMENT_METHOD_APM.PUNTOSHEY]: {
210
+ label: "Puntoshey",
211
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
212
+ },
213
+ [PAYMENT_METHOD_APM.AMPM]: {
214
+ label: "Ampm",
215
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
216
+ },
217
+ [PAYMENT_METHOD_APM.JUMBOMARKET]: {
218
+ label: "Jumbomarket",
219
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
220
+ },
221
+ [PAYMENT_METHOD_APM.SMELPUEBLO]: {
222
+ label: "Smelpueblo",
223
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
224
+ },
225
+ [PAYMENT_METHOD_APM.BAM]: {
226
+ label: "Bam",
227
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
228
+ },
229
+ [PAYMENT_METHOD_APM.REFACIL]: {
230
+ label: "Refacil",
231
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
232
+ },
233
+ [PAYMENT_METHOD_APM.ACYVALORES]: {
234
+ label: "Acyvalores",
235
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
236
+ },
237
+ };
238
+
239
+
240
+ export const getPaymentMethodDetails = (scheme_data: string) => {
241
+ const scheme: string = clearSpace(scheme_data.toUpperCase());
242
+ const _default = {
243
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
244
+ label: "",
245
+ };
246
+ // @ts-ignore
247
+ return PAYMENT_METHODS_CATALOG[scheme] || _default;
248
+ };
@@ -0,0 +1,11 @@
1
+ export const MESSAGES = Object.freeze({
2
+ saveCardError: "Ha ocurrido un error guardando la tarjeta. Inténtalo nuevamente.",
3
+ removeCardError: "Ha ocurrido un error eliminado la tarjeta. Inténtalo nuevamente.",
4
+ getCardsError: "Ha ocurrido un error obteniendo las tarjetas del customer. Inténtalo nuevamente.",
5
+ cardExist: "La tarjeta fue registrada previamente.",
6
+ removedCard: "Card deleted successfully",
7
+ errorCheckout: "No se ha podido procesar el pago",
8
+ cardSaved: "Tarjeta registrada con éxito.",
9
+ getPaymentMethodsError: "Ha ocurrido un error obteniendo las métodos de pago del customer. Inténtalo nuevamente.",
10
+ getBusinessError: "Ha ocurrido un error obteniendo los datos del comercio. Inténtalo nuevamente."
11
+ })
@@ -0,0 +1,63 @@
1
+ const PAYMENT_METHOD_APM = Object.freeze({
2
+ SORIANA: "SORIANA",
3
+ OXXO: "OXXO",
4
+ SPEI: "SPEI",
5
+ CODI: "CODI",
6
+ MERCADOPAGO: "MERCADOPAGO",
7
+ PAYPAL: "PAYPAL",
8
+ COMERCIALMEXICANA: "COMERCIALMEXICANA",
9
+ BANCOMER: "BANCOMER",
10
+ WALMART: "WALMART",
11
+ BODEGA: "BODEGA",
12
+ SAMSCLUB: "SAMSCLUB",
13
+ SUPERAMA: "SUPERAMA",
14
+ CALIMAX: "CALIMAX",
15
+ EXTRA: "EXTRA",
16
+ CIRCULOK: "CIRCULOK",
17
+ SEVEN11: "7ELEVEN",
18
+ TELECOMM: "TELECOMM",
19
+ BANORTE: "BANORTE",
20
+ BENAVIDES: "BENAVIDES",
21
+ DELAHORRO: "DELAHORRO",
22
+ ELASTURIANO: "ELASTURIANO",
23
+ WALDOS: "WALDOS",
24
+ ALSUPER: "ALSUPER",
25
+ KIOSKO: "KIOSKO",
26
+ STAMARIA: "STAMARIA",
27
+ LAMASBARATA: "LAMASBARATA",
28
+ FARMROMA: "FARMROMA",
29
+ FARMUNION: "FARMUNION",
30
+ FARMATODO: "FARMATODO",
31
+ SFDEASIS: "SFDEASIS",
32
+ FARM911: "FARM911",
33
+ FARMECONOMICAS: "FARMECONOMICAS",
34
+ FARMMEDICITY: "FARMMEDICITY",
35
+ RIANXEIRA: "RIANXEIRA",
36
+ WESTERNUNION: "WESTERNUNION",
37
+ ZONAPAGO: "ZONAPAGO",
38
+ CAJALOSANDES: "CAJALOSANDES",
39
+ CAJAPAITA: "CAJAPAITA",
40
+ CAJASANTA: "CAJASANTA",
41
+ CAJASULLANA: "CAJASULLANA",
42
+ CAJATRUJILLO: "CAJATRUJILLO",
43
+ EDPYME: "EDPYME",
44
+ KASNET: "KASNET",
45
+ NORANDINO: "NORANDINO",
46
+ QAPAQ: "QAPAQ",
47
+ RAIZ: "RAIZ",
48
+ PAYSER: "PAYSER",
49
+ WUNION: "WUNION",
50
+ BANCOCONTINENTAL: "BANCOCONTINENTAL",
51
+ GMONEY: "GMONEY",
52
+ GOPAY: "GOPAY",
53
+ WU: "WU",
54
+ PUNTOSHEY: "PUNTOSHEY",
55
+ AMPM: "AMPM",
56
+ JUMBOMARKET: "JUMBOMARKET",
57
+ SMELPUEBLO: "SMELPUEBLO",
58
+ BAM: "BAM",
59
+ REFACIL: "REFACIL",
60
+ ACYVALORES: "ACYVALORES",
61
+ });
62
+
63
+ export { PAYMENT_METHOD_APM };
@@ -0,0 +1,8 @@
1
+ const TONDER_URL_BY_MODE = Object.freeze({
2
+ production: "https://app.tonder.io",
3
+ sandbox: "https://sandbox.tonder.io",
4
+ stage: "https://stage.tonder.io",
5
+ development: "http://localhost:8000",
6
+ });
7
+
8
+ export { TONDER_URL_BY_MODE };
@@ -0,0 +1,35 @@
1
+ export interface ICard {
2
+ fields: ICardSkyflowFields;
3
+ icon?: string;
4
+ }
5
+
6
+ export interface ICardSkyflowFields {
7
+ card_number: string;
8
+ expiration_month: string;
9
+ expiration_year: string;
10
+ skyflow_id: string;
11
+ card_scheme: string;
12
+ cardholder_name: string;
13
+ }
14
+
15
+ export interface ICustomerCardsResponse {
16
+ user_id: number;
17
+ cards: ICard[];
18
+ }
19
+
20
+ export interface ISaveCardResponse {
21
+ skyflow_id: string;
22
+ user_id: number;
23
+ }
24
+
25
+ export interface ISaveCardSkyflowRequest {
26
+ skyflow_id: string;
27
+ }
28
+
29
+ export interface ISaveCardRequest {
30
+ card_number: string;
31
+ cvv: string;
32
+ expiration_month: string;
33
+ expiration_year: string;
34
+ cardholder_name: string;
35
+ }
@@ -0,0 +1,124 @@
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: string | 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
+ isSandbox?: boolean;
111
+ /**
112
+ * @deprecated This property is deprecated and will be removed in a future release.
113
+ * Use the `returnUrl` field when creating the instance of LiteCheckout or InlineCheckout.
114
+ */
115
+ returnUrl?: string;
116
+ }
117
+
118
+ export interface ICardFields {
119
+ card_number: string;
120
+ cvv: string;
121
+ expiration_month: string;
122
+ expiration_year: string;
123
+ cardholder_name: string;
124
+ }
@@ -1,83 +1,130 @@
1
+ import { ICustomer } from "./customer";
2
+ import {IStartCheckoutResponse} from "./checkout";
3
+
1
4
  export type Business = {
2
- business: {
3
- pk: number;
4
- name: string;
5
- categories: {
6
- pk: number;
7
- name: string;
8
- }[];
9
- web: string;
10
- logo: string;
11
- full_logo_url: string;
12
- background_color: string;
13
- primary_color: string;
14
- checkout_mode: boolean;
15
- textCheckoutColor: string;
16
- textDetailsColor: string;
17
- checkout_logo: string;
18
- };
19
- openpay_keys: {
20
- merchant_id: string;
21
- public_key: string;
22
- };
23
- fintoc_keys: {
24
- public_key: string;
25
- };
26
- mercado_pago: {
27
- active: boolean;
28
- };
29
- vault_id: string;
30
- vault_url: string;
31
- reference: number;
32
- is_installments_available: boolean;
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;
33
36
  };
34
37
 
35
38
  export type Customer = {
36
- firstName: string;
37
- lastName: string;
38
- country: string;
39
- street: string;
40
- city: string;
41
- state: string;
42
- postCode: string;
43
- email: string;
44
- phone: string;
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;
45
48
  };
46
49
 
47
50
  export type OrderItem = {
48
- description: string;
49
- quantity: number;
50
- price_unit: number;
51
- discount: number;
52
- taxes: number;
53
- product_reference: number;
54
- name: string;
55
- amount_total: number;
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;
56
59
  };
57
60
 
58
61
  export type PaymentData = {
59
- customer: Customer;
60
- currency: string;
61
- cart: {
62
- total: string | number;
63
- items: OrderItem[];
64
- };
62
+ customer: Customer;
63
+ currency: string;
64
+ cart: {
65
+ total: string | number;
66
+ items: OrderItem[];
67
+ };
65
68
  };
66
69
 
67
70
  export type TonderAPM = {
68
- pk: string;
69
- payment_method: string;
70
- priority: number;
71
- category: string;
72
- unavailable_countries: string[];
73
- status: string;
74
- }
71
+ pk: string;
72
+ payment_method: string;
73
+ priority: number;
74
+ category: string;
75
+ unavailable_countries: string[];
76
+ status: string;
77
+ };
75
78
 
76
79
  export type APM = {
77
- id: string;
78
- payment_method: string;
79
- priority: number;
80
- category: string;
81
- icon: string;
82
- label: string;
80
+ id: string;
81
+ payment_method: string;
82
+ priority: number;
83
+ category: string;
84
+ icon: string;
85
+ label: string;
86
+ };
87
+
88
+ export interface IConfigureCheckout {
89
+ customer: ICustomer | { email: string };
90
+ }
91
+
92
+ export interface IInlineCheckoutBaseOptions {
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
+ }
113
+
114
+ export interface IInlineLiteCheckoutOptions
115
+ extends IInlineCheckoutBaseOptions {}
116
+
117
+
118
+ export interface IApiError {
119
+ code: string;
120
+ body: Record<string, string> | string;
121
+ name: string;
122
+ message: string;
123
+ }
124
+
125
+ export interface IPublicError {
126
+ status: string;
127
+ code: number;
128
+ message: string;
129
+ detail: Record<string, any> | string;
83
130
  }