@tonder.io/ionic-lite-sdk 0.0.34-beta.2 → 0.0.35-beta.0

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 (61) hide show
  1. package/.idea/aws.xml +17 -0
  2. package/.idea/inspectionProfiles/Project_Default.xml +6 -0
  3. package/.idea/vcs.xml +6 -0
  4. package/.idea/workspace.xml +74 -17
  5. package/dist/classes/BaseInlineCheckout.d.ts +48 -0
  6. package/dist/classes/liteCheckout.d.ts +60 -29
  7. package/dist/data/businessApi.d.ts +2 -0
  8. package/dist/data/cardApi.d.ts +4 -0
  9. package/dist/data/checkoutApi.d.ts +5 -0
  10. package/dist/data/customerApi.d.ts +2 -0
  11. package/dist/data/openPayApi.d.ts +1 -0
  12. package/dist/data/paymentMethodApi.d.ts +5 -0
  13. package/dist/data/skyflowApi.d.ts +1 -0
  14. package/dist/helpers/skyflow.d.ts +3 -0
  15. package/dist/helpers/utils.d.ts +8 -4
  16. package/dist/helpers/validations.d.ts +6 -0
  17. package/dist/index.js +1 -1
  18. package/dist/shared/catalog/paymentMethodsCatalog.d.ts +1 -0
  19. package/dist/shared/constants/messages.d.ts +11 -0
  20. package/dist/shared/constants/paymentMethodAPM.d.ts +62 -0
  21. package/dist/shared/constants/tonderUrl.d.ts +7 -0
  22. package/dist/types/card.d.ts +29 -0
  23. package/dist/types/checkout.d.ts +103 -0
  24. package/dist/types/commons.d.ts +27 -0
  25. package/dist/types/customer.d.ts +12 -0
  26. package/dist/types/paymentMethod.d.ts +22 -0
  27. package/dist/types/requests.d.ts +5 -3
  28. package/package.json +1 -1
  29. package/src/classes/BaseInlineCheckout.ts +318 -0
  30. package/src/classes/liteCheckout.ts +254 -280
  31. package/src/data/businessApi.ts +14 -0
  32. package/src/data/cardApi.ts +82 -0
  33. package/src/data/checkoutApi.ts +71 -0
  34. package/src/data/customerApi.ts +31 -0
  35. package/src/data/openPayApi.ts +7 -0
  36. package/src/data/paymentMethodApi.ts +34 -0
  37. package/src/data/skyflowApi.ts +16 -0
  38. package/src/helpers/skyflow.ts +85 -0
  39. package/src/helpers/utils.ts +35 -245
  40. package/src/helpers/validations.ts +55 -0
  41. package/src/shared/catalog/paymentMethodsCatalog.ts +248 -0
  42. package/src/shared/constants/messages.ts +11 -0
  43. package/src/shared/constants/paymentMethodAPM.ts +63 -0
  44. package/src/shared/constants/tonderUrl.ts +8 -0
  45. package/src/types/card.ts +34 -0
  46. package/src/types/checkout.ts +118 -0
  47. package/src/types/commons.ts +32 -0
  48. package/src/types/customer.ts +12 -0
  49. package/src/types/index.d.ts +10 -0
  50. package/src/types/liteInlineCheckout.d.ts +183 -0
  51. package/src/types/paymentMethod.ts +24 -0
  52. package/src/types/requests.ts +5 -3
  53. package/src/types/validations.d.ts +11 -0
  54. package/tests/classes/liteCheckout.test.ts +3 -3
  55. package/tests/methods/getBusiness.test.ts +2 -2
  56. package/tests/methods/getCustomerCards.test.ts +4 -8
  57. package/tests/utils/defaultMock.ts +3 -2
  58. package/tests/utils/mockClasses.ts +4 -0
  59. package/tests/methods/getOpenpayDeviceSessionID.test.ts +0 -95
  60. package/tests/methods/getSkyflowToken.test.ts +0 -155
  61. package/tests/methods/getVaultToken.test.ts +0 -107
@@ -0,0 +1,55 @@
1
+ export function validateCardNumber(cardNumber: string) {
2
+ const regex = /^\d{12,19}$/;
3
+ return regex.test(cardNumber) && luhnCheck(cardNumber);
4
+ }
5
+
6
+ export function validateCardholderName(name: string) {
7
+ const regex = /^([a-zA-Z\\ \\,\\.\\-\\']{2,})$/;
8
+ return regex.test(name);
9
+ }
10
+
11
+ export function validateCVV(cvv: string) {
12
+ const regex = /^\d{3,4}$/;
13
+ return regex.test(cvv);
14
+ }
15
+
16
+ export function validateExpirationDate(expirationDate: string) {
17
+ const regex = /^(0[1-9]|1[0-2])\/\d{2}$/;
18
+ if (!regex.test(expirationDate)) {
19
+ return false;
20
+ }
21
+ const [month, year] = expirationDate.split('/');
22
+ const currentDate = new Date();
23
+ // @ts-ignore
24
+ const expiration = new Date(`20${year}`, month - 1);
25
+ return expiration >= currentDate;
26
+ }
27
+
28
+ export function validateExpirationMonth(month: string) {
29
+ const regex = /^(0[1-9]|1[0-2])$/;
30
+ return regex.test(month);
31
+ }
32
+
33
+ export function validateExpirationYear(year: string) {
34
+ const regex = /^\d{2}$/;
35
+ if (!regex.test(year)) {
36
+ return false;
37
+ }
38
+ const currentYear = new Date().getFullYear() % 100;
39
+ return parseInt(year, 10) >= currentYear;
40
+ }
41
+
42
+ const luhnCheck = (num: number | string) => {
43
+ const arr = `${num}`
44
+ .split('')
45
+ .reverse()
46
+ .map(x => Number.parseInt(x));
47
+ const lastDigit = arr.shift();
48
+ let sum = arr.reduce(
49
+ (acc, val, i) =>
50
+ i % 2 !== 0 ? acc + val : acc + ((val *= 2) > 9 ? val - 9 : val),
51
+ 0
52
+ );
53
+ sum += lastDigit!;
54
+ return sum % 10 === 0;
55
+ };
@@ -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,34 @@
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
+ }
13
+
14
+ export interface ICustomerCardsResponse {
15
+ user_id: number;
16
+ cards: ICard[];
17
+ }
18
+
19
+ export interface ISaveCardResponse {
20
+ skyflow_id: string;
21
+ user_id: number;
22
+ }
23
+
24
+ export interface ISaveCardSkyflowRequest {
25
+ skyflow_id: string;
26
+ }
27
+
28
+ export interface ISaveCardRequest {
29
+ card_number: string;
30
+ cvv: string;
31
+ expiration_month: string;
32
+ expiration_year: string;
33
+ cardholder_name: string;
34
+ }
@@ -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: 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
+ }
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
+ }
@@ -1,3 +1,5 @@
1
+ import {ICustomer} from "./customer";
2
+
1
3
  export type Business = {
2
4
  business: {
3
5
  pk: number;
@@ -81,3 +83,33 @@ export type APM = {
81
83
  icon: string;
82
84
  label: string;
83
85
  }
86
+
87
+
88
+ export interface IConfigureCheckout {
89
+ customer: ICustomer;
90
+ }
91
+
92
+ export interface IInlineCheckoutBaseOptions {
93
+ mode?: "production" | "sandbox" | "stage" | "development";
94
+ apiKey: string;
95
+ /**
96
+ * @deprecated This property is deprecated and will be removed in a future release.
97
+ * Use `apiKey` instead, as `apiKeyTonder` is no longer required.
98
+ */
99
+ apiKeyTonder?: string;
100
+ returnUrl: string;
101
+ callBack?: (response: any) => void;
102
+ }
103
+ export interface IApiError {
104
+ code: string;
105
+ body: Record<string, string> | string;
106
+ name: string;
107
+ message: string;
108
+ }
109
+
110
+ export interface IPublicError {
111
+ status: string;
112
+ code: number;
113
+ message: string;
114
+ detail: Record<string, any> | string;
115
+ }
@@ -0,0 +1,12 @@
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
+ };
@@ -0,0 +1,10 @@
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
+