@tonder.io/ionic-lite-sdk 0.0.35-beta.7 → 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 (85) 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 -132
  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/src/classes/BaseInlineCheckout.ts +0 -356
  66. package/src/data/businessApi.ts +0 -18
  67. package/src/data/cardApi.ts +0 -89
  68. package/src/data/checkoutApi.ts +0 -87
  69. package/src/data/customerApi.ts +0 -31
  70. package/src/data/openPayApi.ts +0 -12
  71. package/src/data/paymentMethodApi.ts +0 -37
  72. package/src/data/skyflowApi.ts +0 -20
  73. package/src/helpers/skyflow.ts +0 -91
  74. package/src/helpers/validations.ts +0 -55
  75. package/src/shared/catalog/paymentMethodsCatalog.ts +0 -248
  76. package/src/shared/constants/messages.ts +0 -11
  77. package/src/shared/constants/paymentMethodAPM.ts +0 -63
  78. package/src/shared/constants/tonderUrl.ts +0 -8
  79. package/src/types/card.ts +0 -34
  80. package/src/types/checkout.ts +0 -118
  81. package/src/types/customer.ts +0 -12
  82. package/src/types/index.d.ts +0 -10
  83. package/src/types/liteInlineCheckout.d.ts +0 -191
  84. package/src/types/paymentMethod.ts +0 -24
  85. package/src/types/validations.d.ts +0 -11
@@ -1,659 +1,656 @@
1
- import { Business, OrderItem } from "../../src/types/commons";
2
- import {
3
- CreateOrderRequest,
4
- CreatePaymentRequest,
5
- RegisterCustomerCardRequest,
6
- StartCheckoutRequest,
7
- StartCheckoutFullRequest,
8
- StartCheckoutRequestWithCard, TokensSkyflowRequest
9
- } from "../../src/types/requests";
10
- import {
11
- CreateOrderResponse,
12
- CreatePaymentResponse,
13
- GetBusinessResponse,
14
- GetCustomerCardsResponse,
15
- RegisterCustomerCardResponse,
16
- StartCheckoutResponse,
17
- CustomerRegisterResponse
18
- } from "../../src/types/responses";
19
-
20
- export class BusinessClass implements Business {
21
- business!: {
22
- pk: number;
23
- name: string;
24
- categories: [{ pk: number; name: string }];
25
- web: string;
26
- logo: string;
27
- full_logo_url: string;
28
- background_color: string;
29
- primary_color: string;
30
- checkout_mode: boolean;
31
- textCheckoutColor: string;
32
- textDetailsColor: string;
33
- checkout_logo: string;
34
- };
35
- openpay_keys!: { merchant_id: string; public_key: string };
36
- fintoc_keys!: { public_key: string };
37
- vault_id!: string;
38
- vault_url!: string;
39
- reference!: number;
40
- is_installments_available!: boolean;
41
- mercado_pago!: { active: boolean}
42
-
43
- get mockObject(): GetBusinessResponse {
44
- return {
45
- business: {
46
- pk: 1234, // Número de ejemplo
47
- name: 'Mock Business Name',
48
- categories: [
49
- { pk: 5678, name: 'Mock Category 1' },
50
- { pk: 9012, name: 'Mock Category 2' }
51
- ],
52
- web: 'https://www.mockbusiness.com',
53
- logo: 'assets/images/mock-logo.png',
54
- full_logo_url: 'https://www.mockbusiness.com/logo.png',
55
- background_color: '#f5f5f5',
56
- primary_color: '#007bff',
57
- checkout_mode: true,
58
- textCheckoutColor: '#333333',
59
- textDetailsColor: '#666666',
60
- checkout_logo: 'assets/images/checkout-logo.png',
61
- },
62
- mercado_pago: {
63
- active: false
64
- },
65
- vault_id: 'mock-vault-id-123',
66
- vault_url: 'https://mock-vault.com',
67
- reference: 987654,
68
- is_installments_available: true,
69
- openpay_keys: { merchant_id: "", public_key: "" },
70
- fintoc_keys: { public_key: "" }
71
- }
72
- }
73
- }
74
-
75
- export class OrderClass implements CreateOrderRequest {
76
- business!: string;
77
- client!: string;
78
- billing_address_id!: number | null;
79
- shipping_address_id!: number | null;
80
- amount!: number;
81
- status!: string;
82
- reference!: string;
83
- is_oneclick!: boolean;
84
- items!: OrderItem[];
85
-
86
- get mockObject(): CreateOrderRequest {
87
- return {
88
- business: "The business pk",
89
- client: "Client auth token",
90
- billing_address_id: null,
91
- shipping_address_id: null,
92
- amount: 25,
93
- status: "PENDING",
94
- reference: "XXXXXXX",
95
- is_oneclick: false,
96
- items: [
97
- { ...new OrderItemClass() }
98
- ]
99
- }
100
-
101
- }
102
- }
103
-
104
- export class OrderClassEmptyValues implements CreateOrderRequest {
105
- business!: string;
106
- client!: string;
107
- billing_address_id!: number | null;
108
- shipping_address_id!: number | null;
109
- amount!: number;
110
- status!: string;
111
- reference!: string;
112
- is_oneclick!: boolean;
113
- items!: OrderItem[];
114
-
115
- get mockObject(): CreateOrderRequest {
116
- return {
117
- business: "",
118
- client: "Client auth token",
119
- billing_address_id: 1,
120
- shipping_address_id: 2,
121
- amount: 25,
122
- status: "PENDING",
123
- reference: "",
124
- is_oneclick: false,
125
- items: [
126
- { ...new OrderItemClass() }
127
- ]
128
- }
129
-
130
- }
131
- }
132
-
133
- export class OrderItemClass implements OrderItem {
134
- description!: string;
135
- quantity!: number;
136
- price_unit!: number;
137
- discount!: number;
138
- taxes!: number;
139
- product_reference!: number;
140
- name!: string;
141
- amount_total!: number;
142
-
143
- get mockObject(): OrderItem {
144
- return {
145
- description: "string",
146
- quantity: 0,
147
- price_unit: 0,
148
- discount: 0,
149
- taxes: 0,
150
- product_reference: 0,
151
- name: "string",
152
- amount_total: 0,
153
- }
154
-
155
- }
156
- }
157
-
158
- export class OrderResponseClass implements CreateOrderResponse {
159
- id!: number;
160
- created!: string;
161
- amount!: string;
162
- status!: string;
163
- payment_method?: string | undefined;
164
- reference?: string | undefined;
165
- is_oneclick!: boolean;
166
- items!: [
167
- {
168
- description: string;
169
- product_reference: string;
170
- quantity: string;
171
- price_unit: string;
172
- discount: string;
173
- taxes: string;
174
- amount_total: string;
175
- }
176
- ];
177
- billing_address?: string | undefined;
178
- shipping_address?: string | undefined;
179
- client!: {
180
- email: string;
181
- name: string;
182
- first_name: string;
183
- last_name: string;
184
- client_profile: {
185
- gender: string;
186
- date_birth?: string | undefined;
187
- terms: boolean;
188
- phone: string;
189
- };
190
- };
191
-
192
- get mockObject(): CreateOrderResponse {
193
- return {
194
- id: 12345,
195
- created: '2024-02-01T10:42:00Z',
196
- amount: '123.45',
197
- status: 'APPROVED',
198
- payment_method: 'CREDIT_CARD',
199
- reference: 'PAYMENT_REF_12345',
200
- is_oneclick: true,
201
- items: [
202
- {
203
- description: 'Mock Item 1',
204
- product_reference: 'PRD-123',
205
- quantity: '2',
206
- price_unit: '50.00',
207
- discount: '5.00',
208
- taxes: '10.90',
209
- amount_total: '105.90',
210
- },
211
- {
212
- description: 'Mock Item 2',
213
- product_reference: 'PRD-456',
214
- quantity: '1',
215
- price_unit: '73.45',
216
- discount: '0.00',
217
- taxes: '6.55',
218
- amount_total: '79.00',
219
- },
220
- ],
221
- billing_address: 'Mock Street 123, Mock City',
222
- shipping_address: 'Mock Avenue 456, Mock Town',
223
- client: {
224
- email: 'mockuser@example.com',
225
- name: 'Mock User',
226
- first_name: 'Mock',
227
- last_name: 'User',
228
- client_profile: {
229
- gender: 'M',
230
- date_birth: '1990-01-01',
231
- terms: true,
232
- phone: '+1234567890',
233
- },
234
- },
235
- }
236
- }
237
- }
238
-
239
- export class CreatePaymentRequestClass implements CreatePaymentRequest {
240
- business_pk!: string;
241
- amount!: number;
242
- date!: string;
243
- order_id!: string;
244
- client_id!: number;
245
-
246
- get mockObject(): CreatePaymentRequest {
247
- const now = new Date();
248
- const dateString = now.toISOString();
249
- return {
250
- business_pk: "NNNNNNNNNN",
251
- amount: 25,
252
- date: dateString,
253
- order_id: "XXXXX",
254
- client_id: 1
255
- };
256
- }
257
- }
258
-
259
- export class CreatePaymentResponseClass implements CreatePaymentResponse {
260
- pk!: number;
261
- order?: string | undefined;
262
- amount!: string;
263
- status!: string;
264
- date!: string;
265
- paid_date?: string | undefined;
266
- shipping_address!: {
267
- street: string;
268
- number: string;
269
- suburb: string;
270
- city: { name: string };
271
- state: { name: string; country: { name: string } };
272
- zip_code: string;
273
- };
274
- shipping_address_id?: string | undefined;
275
- billing_address!: {
276
- street: string;
277
- number: string;
278
- suburb: string;
279
- city: { name: string };
280
- state: { name: string; country: { name: string } };
281
- zip_code: string;
282
- };
283
- billing_address_id?: string | undefined;
284
- client?: string | undefined;
285
- customer_order_reference?: string | undefined;
286
-
287
- get mockObject(): CreatePaymentResponse {
288
- return {
289
- pk: 45678,
290
- order: "ORDER-98765",
291
- amount: "250.00",
292
- status: "PENDING",
293
- date: "2024-02-01T14:29:05Z",
294
- paid_date: "",
295
- shipping_address: {
296
- street: "Mock Street 123",
297
- number: "10",
298
- suburb: "Mock Suburb",
299
- city: { name: "Mock City" },
300
- state: { name: "Mock State", country: { name: "Mock Country" } },
301
- zip_code: "12345",
302
- },
303
- shipping_address_id: "",
304
- billing_address: {
305
- street: "Mock Street 456",
306
- number: "20",
307
- suburb: "Mock Suburb 2",
308
- city: { name: "Mock City 2" },
309
- state: { name: "Mock State 2", country: { name: "Mock Country 2" } },
310
- zip_code: "54321",
311
- },
312
- billing_address_id: "",
313
- client: "CLIENT-123",
314
- customer_order_reference: "REF-ABC123",
315
- };
316
- }
317
- }
318
-
319
- export class StartCheckoutRequestClass implements StartCheckoutRequestWithCard {
320
- card: any;
321
- name: any;
322
- last_name!: string;
323
- email_client: any;
324
- phone_number: any;
325
- return_url!: string;
326
- id_product!: string;
327
- quantity_product!: number;
328
- id_ship!: string;
329
- instance_id_ship!: string;
330
- amount: any;
331
- title_ship!: string;
332
- description!: string;
333
- device_session_id: any;
334
- token_id!: string;
335
- order_id: any;
336
- business_id: any;
337
- payment_id: any;
338
- source!: string;
339
- currency!: string;
340
- metadata!: string;
341
-
342
- get mockObject(): StartCheckoutRequest {
343
- return {
344
- card: " any",
345
- name: " any",
346
- last_name: " string",
347
- email_client: " any",
348
- phone_number: " any",
349
- return_url: " string",
350
- id_product: " string",
351
- quantity_product: 0,
352
- id_ship: " string",
353
- instance_id_ship: " string",
354
- amount: " any",
355
- title_ship: " string",
356
- description: " string",
357
- device_session_id: " any",
358
- token_id: " string",
359
- order_id: " any",
360
- business_id: " any",
361
- payment_id: " any",
362
- source: " string",
363
- currency: "string",
364
- metadata: "string"
365
- };
366
- }
367
- }
368
-
369
- export class StartCheckoutResponseClass implements StartCheckoutResponse {
370
- status!: number;
371
- message!: string;
372
- is_route_finished!: Boolean;
373
- psp_response!: {
374
- id: string;
375
- authorization: number;
376
- operation_type: string;
377
- transaction_type: string;
378
- status: string;
379
- conciliated: boolean;
380
- creation_date: string;
381
- operation_date: string;
382
- description: string;
383
- error_message?: string;
384
- order_id?: string;
385
- card: {
386
- type: string;
387
- brand: string;
388
- address?: string;
389
- card_number: string;
390
- holder_name: string;
391
- expiration_year: string;
392
- expiration_month: string;
393
- allows_charges: boolean;
394
- allows_payouts: boolean;
395
- bank_name: string;
396
- points_type: string;
397
- points_card: boolean;
398
- bank_code: number;
399
- };
400
- customer_id: string;
401
- gateway_card_present: string;
402
- amount: number;
403
- fee: {
404
- amount: number;
405
- tax: number;
406
- currency: string;
407
- };
408
- payment_method: {
409
- type: string;
410
- url: string;
411
- };
412
- currency: string;
413
- method: string;
414
- object: string;
415
- };
416
- transaction_status!: string;
417
- transaction_id!: number;
418
- payment_id!: number;
419
- provider!: string;
420
- next_action!: {
421
- redirect_to_url: {
422
- url: string;
423
- return_url: string;
424
- verify_transaction_status_url: string;
425
- };
426
- };
427
- actions!: {
428
- name: string;
429
- url: string;
430
- method: string;
431
- }[];
432
-
433
- get mockObject(): StartCheckoutResponse {
434
- return {
435
- status: 200, // Representa un estado exitoso
436
- message: "Payment processing initiated",
437
- is_route_finished: false,
438
- transaction_status: "PENDING",
439
- transaction_id: 1234567890,
440
- payment_id: 9876543210,
441
- provider: "STRIPE",
442
- next_action: {
443
- redirect_to_url: {
444
- url: "https://www.mock-payment-provider.com/checkout",
445
- return_url: "https://your-app.com/payment-confirmation",
446
- verify_transaction_status_url:
447
- "https://api.mock-payment-provider.com/transactions/1234567890/status",
448
- },
449
- },
450
- psp_response: {
451
- id: " string",
452
- authorization: 0,
453
- operation_type: " string",
454
- transaction_type: " string",
455
- status: " string",
456
- conciliated: false,
457
- creation_date: " string",
458
- operation_date: " string",
459
- description: " string",
460
- error_message: " string",
461
- order_id: " string",
462
- card: {
463
- type: " string",
464
- brand: " string",
465
- address: " string",
466
- card_number: " string",
467
- holder_name: " string",
468
- expiration_year: " string",
469
- expiration_month: " string",
470
- allows_charges: false,
471
- allows_payouts: false,
472
- bank_name: " string",
473
- points_type: " string",
474
- points_card: false,
475
- bank_code: 0,
476
- },
477
- customer_id: " string",
478
- gateway_card_present: " string",
479
- amount: 0,
480
- fee: {
481
- amount: 0,
482
- tax: 0,
483
- currency: " string",
484
- },
485
- payment_method: {
486
- type: " string",
487
- url: " string",
488
- },
489
- currency: " string",
490
- method: " string",
491
- object: " string",
492
- },
493
- actions: [
494
- {
495
- name: "Check status",
496
- url: "https://api.mock-payment-provider.com/transactions/1234567890/status",
497
- method: "GET",
498
- },
499
- {
500
- name: "Cancel payment",
501
- url: "https://api.mock-payment-provider.com/transactions/1234567890/cancel",
502
- method: "POST",
503
- },
504
- ],
505
- };
506
- }
507
- }
508
-
509
- export class StartCheckoutFullRequestClass implements StartCheckoutFullRequest {
510
- order!: { items: OrderItem[]; };
511
- return_url!: string;
512
- total!: number;
513
- skyflowTokens!: { cardholder_name: string; card_number: string; cvv: string; expiration_year: string; expiration_month: string; skyflow_id: string; };
514
- customer!: { name: string; lastname: string; email: string; phone: string; };
515
- isSandbox!: boolean;
516
- currency!: string;
517
- metadata!: any;
518
-
519
- get mockObject(): StartCheckoutFullRequest {
520
- return {
521
- order: {
522
- items: [
523
- {
524
- description: "string",
525
- quantity: 25,
526
- price_unit: 25,
527
- discount: 0,
528
- taxes: 0,
529
- product_reference: 25,
530
- name: "Product text",
531
- amount_total: 25
532
- }
533
- ]
534
- },
535
- return_url: "string",
536
- total: 25,
537
- skyflowTokens: {
538
- cardholder_name: "string",
539
- card_number: "string",
540
- cvv: "string",
541
- expiration_year: "string",
542
- expiration_month: "string",
543
- skyflow_id: "string",
544
- },
545
- customer: {
546
- name: "string",
547
- lastname: "string",
548
- email: "string",
549
- phone: "string",
550
- },
551
- isSandbox: true,
552
- currency: "MXN",
553
- metadata: null
554
- };
555
- }
556
- }
557
-
558
- export class TokensRequestClass implements TokensSkyflowRequest {
559
- baseUrl!: string;
560
- apiKey!: string;
561
- vault_id!: string;
562
- vault_url!: string;
563
- data: { [key: string]: any } = {};
564
-
565
- get mockObject(): TokensSkyflowRequest {
566
- return {
567
- baseUrl: "",
568
- apiKey: "",
569
- vault_id: "string",
570
- vault_url: "string",
571
- data: {
572
- fields: [],
573
- },
574
- };
575
- }
576
- }
577
-
578
- export class RegisterCustomerCardResponseClass
579
- implements RegisterCustomerCardResponse {
580
- skyflow_id!: string;
581
- user_id!: number;
582
-
583
- get mockObject(): RegisterCustomerCardResponse {
584
- return {
585
- skyflow_id: "string",
586
- user_id: 0,
587
- };
588
- }
589
- }
590
-
591
- export class RegisterCustomerCardRequestClass
592
- implements RegisterCustomerCardRequest {
593
- skyflow_id!: string;
594
-
595
- get mockObject(): RegisterCustomerCardRequest {
596
- return {
597
- skyflow_id: "",
598
- };
599
- }
600
- }
601
-
602
- export class GetCustomerCardsResponseClass implements GetCustomerCardsResponse {
603
- user_id!: number;
604
- cards!: {
605
- fields: {
606
- card_scheme: string;
607
- card_number: string;
608
- cardholder_name: string;
609
- cvv: string;
610
- expiration_month: string;
611
- expiration_year: string;
612
- skyflow_id: string;
613
- };
614
- }[];
615
-
616
- get mockObject(): GetCustomerCardsResponse {
617
- return {
618
- user_id: 0,
619
- cards: [
620
- {
621
- fields: {
622
- card_scheme: "string",
623
- card_number: "string",
624
- cardholder_name: "string",
625
- cvv: "string",
626
- expiration_month: "string",
627
- expiration_year: "string",
628
- skyflow_id: "string",
629
- },
630
- },
631
- ],
632
- };
633
- }
634
- }
635
-
636
- export const OrderEmptyValuesResponse = {
637
- "business": [
638
- "This field may not be blank."
639
- ],
640
- "reference": [
641
- "This field may not be null."
642
- ]
643
- }
644
-
645
- export class CustomerRegisterClass implements CustomerRegisterResponse {
646
- id!: number;
647
- email!: string;
648
- auth_token!: string;
649
- first_name!: string;
650
- last_name!: string;
651
-
652
- get mockObject(): CustomerRegisterResponse {
653
- return {
654
- id: 10,
655
- email: "email@gmail.com",
656
- auth_token: "string"
657
- };
658
- }
659
- }
1
+ import { Business, OrderItem } from "../../src/types/commons";
2
+ import {
3
+ CreateOrderRequest,
4
+ CreatePaymentRequest,
5
+ RegisterCustomerCardRequest,
6
+ StartCheckoutRequest,
7
+ TokensRequest,
8
+ StartCheckoutFullRequest,
9
+ StartCheckoutRequestWithCard
10
+ } from "../../src/types/requests";
11
+ import {
12
+ CreateOrderResponse,
13
+ CreatePaymentResponse,
14
+ GetBusinessResponse,
15
+ GetCustomerCardsResponse,
16
+ RegisterCustomerCardResponse,
17
+ StartCheckoutResponse,
18
+ CustomerRegisterResponse
19
+ } from "../../src/types/responses";
20
+
21
+ export class BusinessClass implements Business {
22
+ business!: {
23
+ pk: number;
24
+ name: string;
25
+ categories: [{ pk: number; name: string }];
26
+ web: string;
27
+ logo: string;
28
+ full_logo_url: string;
29
+ background_color: string;
30
+ primary_color: string;
31
+ checkout_mode: boolean;
32
+ textCheckoutColor: string;
33
+ textDetailsColor: string;
34
+ checkout_logo: string;
35
+ };
36
+ openpay_keys!: { merchant_id: string; public_key: string };
37
+ fintoc_keys!: { public_key: string };
38
+ vault_id!: string;
39
+ vault_url!: string;
40
+ reference!: number;
41
+ is_installments_available!: boolean;
42
+ mercado_pago!: { active: boolean}
43
+
44
+ get mockObject(): GetBusinessResponse {
45
+ return {
46
+ business: {
47
+ pk: 1234, // Número de ejemplo
48
+ name: 'Mock Business Name',
49
+ categories: [
50
+ { pk: 5678, name: 'Mock Category 1' },
51
+ { pk: 9012, name: 'Mock Category 2' }
52
+ ],
53
+ web: 'https://www.mockbusiness.com',
54
+ logo: 'assets/images/mock-logo.png',
55
+ full_logo_url: 'https://www.mockbusiness.com/logo.png',
56
+ background_color: '#f5f5f5',
57
+ primary_color: '#007bff',
58
+ checkout_mode: true,
59
+ textCheckoutColor: '#333333',
60
+ textDetailsColor: '#666666',
61
+ checkout_logo: 'assets/images/checkout-logo.png',
62
+ },
63
+ mercado_pago: {
64
+ active: false
65
+ },
66
+ vault_id: 'mock-vault-id-123',
67
+ vault_url: 'https://mock-vault.com',
68
+ reference: 987654,
69
+ is_installments_available: true,
70
+ openpay_keys: { merchant_id: "", public_key: "" },
71
+ fintoc_keys: { public_key: "" }
72
+ }
73
+ }
74
+ }
75
+
76
+ export class OrderClass implements CreateOrderRequest {
77
+ business!: string;
78
+ client!: string;
79
+ billing_address_id!: number | null;
80
+ shipping_address_id!: number | null;
81
+ amount!: number;
82
+ status!: string;
83
+ reference!: string;
84
+ is_oneclick!: boolean;
85
+ items!: OrderItem[];
86
+
87
+ get mockObject(): CreateOrderRequest {
88
+ return {
89
+ business: "The business pk",
90
+ client: "Client auth token",
91
+ billing_address_id: null,
92
+ shipping_address_id: null,
93
+ amount: 25,
94
+ status: "PENDING",
95
+ reference: "XXXXXXX",
96
+ is_oneclick: false,
97
+ items: [
98
+ { ...new OrderItemClass() }
99
+ ]
100
+ }
101
+
102
+ }
103
+ }
104
+
105
+ export class OrderClassEmptyValues implements CreateOrderRequest {
106
+ business!: string;
107
+ client!: string;
108
+ billing_address_id!: number | null;
109
+ shipping_address_id!: number | null;
110
+ amount!: number;
111
+ status!: string;
112
+ reference!: string;
113
+ is_oneclick!: boolean;
114
+ items!: OrderItem[];
115
+
116
+ get mockObject(): CreateOrderRequest {
117
+ return {
118
+ business: "",
119
+ client: "Client auth token",
120
+ billing_address_id: 1,
121
+ shipping_address_id: 2,
122
+ amount: 25,
123
+ status: "PENDING",
124
+ reference: "",
125
+ is_oneclick: false,
126
+ items: [
127
+ { ...new OrderItemClass() }
128
+ ]
129
+ }
130
+
131
+ }
132
+ }
133
+
134
+ export class OrderItemClass implements OrderItem {
135
+ description!: string;
136
+ quantity!: number;
137
+ price_unit!: number;
138
+ discount!: number;
139
+ taxes!: number;
140
+ product_reference!: number;
141
+ name!: string;
142
+ amount_total!: number;
143
+
144
+ get mockObject(): OrderItem {
145
+ return {
146
+ description: "string",
147
+ quantity: 0,
148
+ price_unit: 0,
149
+ discount: 0,
150
+ taxes: 0,
151
+ product_reference: 0,
152
+ name: "string",
153
+ amount_total: 0,
154
+ }
155
+
156
+ }
157
+ }
158
+
159
+ export class OrderResponseClass implements CreateOrderResponse {
160
+ id!: number;
161
+ created!: string;
162
+ amount!: string;
163
+ status!: string;
164
+ payment_method?: string | undefined;
165
+ reference?: string | undefined;
166
+ is_oneclick!: boolean;
167
+ items!: [
168
+ {
169
+ description: string;
170
+ product_reference: string;
171
+ quantity: string;
172
+ price_unit: string;
173
+ discount: string;
174
+ taxes: string;
175
+ amount_total: string;
176
+ }
177
+ ];
178
+ billing_address?: string | undefined;
179
+ shipping_address?: string | undefined;
180
+ client!: {
181
+ email: string;
182
+ name: string;
183
+ first_name: string;
184
+ last_name: string;
185
+ client_profile: {
186
+ gender: string;
187
+ date_birth?: string | undefined;
188
+ terms: boolean;
189
+ phone: string;
190
+ };
191
+ };
192
+
193
+ get mockObject(): CreateOrderResponse {
194
+ return {
195
+ id: 12345,
196
+ created: '2024-02-01T10:42:00Z',
197
+ amount: '123.45',
198
+ status: 'APPROVED',
199
+ payment_method: 'CREDIT_CARD',
200
+ reference: 'PAYMENT_REF_12345',
201
+ is_oneclick: true,
202
+ items: [
203
+ {
204
+ description: 'Mock Item 1',
205
+ product_reference: 'PRD-123',
206
+ quantity: '2',
207
+ price_unit: '50.00',
208
+ discount: '5.00',
209
+ taxes: '10.90',
210
+ amount_total: '105.90',
211
+ },
212
+ {
213
+ description: 'Mock Item 2',
214
+ product_reference: 'PRD-456',
215
+ quantity: '1',
216
+ price_unit: '73.45',
217
+ discount: '0.00',
218
+ taxes: '6.55',
219
+ amount_total: '79.00',
220
+ },
221
+ ],
222
+ billing_address: 'Mock Street 123, Mock City',
223
+ shipping_address: 'Mock Avenue 456, Mock Town',
224
+ client: {
225
+ email: 'mockuser@example.com',
226
+ name: 'Mock User',
227
+ first_name: 'Mock',
228
+ last_name: 'User',
229
+ client_profile: {
230
+ gender: 'M',
231
+ date_birth: '1990-01-01',
232
+ terms: true,
233
+ phone: '+1234567890',
234
+ },
235
+ },
236
+ }
237
+ }
238
+ }
239
+
240
+ export class CreatePaymentRequestClass implements CreatePaymentRequest {
241
+ business_pk!: string;
242
+ amount!: number;
243
+ date!: string;
244
+ order_id!: string;
245
+ client_id!: number;
246
+
247
+ get mockObject(): CreatePaymentRequest {
248
+ const now = new Date();
249
+ const dateString = now.toISOString();
250
+ return {
251
+ business_pk: "NNNNNNNNNN",
252
+ amount: 25,
253
+ date: dateString,
254
+ order_id: "XXXXX",
255
+ client_id: 1
256
+ };
257
+ }
258
+ }
259
+
260
+ export class CreatePaymentResponseClass implements CreatePaymentResponse {
261
+ pk!: number;
262
+ order?: string | undefined;
263
+ amount!: string;
264
+ status!: string;
265
+ date!: string;
266
+ paid_date?: string | undefined;
267
+ shipping_address!: {
268
+ street: string;
269
+ number: string;
270
+ suburb: string;
271
+ city: { name: string };
272
+ state: { name: string; country: { name: string } };
273
+ zip_code: string;
274
+ };
275
+ shipping_address_id?: string | undefined;
276
+ billing_address!: {
277
+ street: string;
278
+ number: string;
279
+ suburb: string;
280
+ city: { name: string };
281
+ state: { name: string; country: { name: string } };
282
+ zip_code: string;
283
+ };
284
+ billing_address_id?: string | undefined;
285
+ client?: string | undefined;
286
+ customer_order_reference?: string | undefined;
287
+
288
+ get mockObject(): CreatePaymentResponse {
289
+ return {
290
+ pk: 45678,
291
+ order: "ORDER-98765",
292
+ amount: "250.00",
293
+ status: "PENDING",
294
+ date: "2024-02-01T14:29:05Z",
295
+ paid_date: "",
296
+ shipping_address: {
297
+ street: "Mock Street 123",
298
+ number: "10",
299
+ suburb: "Mock Suburb",
300
+ city: { name: "Mock City" },
301
+ state: { name: "Mock State", country: { name: "Mock Country" } },
302
+ zip_code: "12345",
303
+ },
304
+ shipping_address_id: "",
305
+ billing_address: {
306
+ street: "Mock Street 456",
307
+ number: "20",
308
+ suburb: "Mock Suburb 2",
309
+ city: { name: "Mock City 2" },
310
+ state: { name: "Mock State 2", country: { name: "Mock Country 2" } },
311
+ zip_code: "54321",
312
+ },
313
+ billing_address_id: "",
314
+ client: "CLIENT-123",
315
+ customer_order_reference: "REF-ABC123",
316
+ };
317
+ }
318
+ }
319
+
320
+ export class StartCheckoutRequestClass implements StartCheckoutRequestWithCard {
321
+ card: any;
322
+ name: any;
323
+ last_name!: string;
324
+ email_client: any;
325
+ phone_number: any;
326
+ return_url!: string;
327
+ id_product!: string;
328
+ quantity_product!: number;
329
+ id_ship!: string;
330
+ instance_id_ship!: string;
331
+ amount: any;
332
+ title_ship!: string;
333
+ description!: string;
334
+ device_session_id: any;
335
+ token_id!: string;
336
+ order_id: any;
337
+ business_id: any;
338
+ payment_id: any;
339
+ source!: string;
340
+ currency!: string;
341
+ metadata!: string;
342
+
343
+ get mockObject(): StartCheckoutRequest {
344
+ return {
345
+ card: " any",
346
+ name: " any",
347
+ last_name: " string",
348
+ email_client: " any",
349
+ phone_number: " any",
350
+ return_url: " string",
351
+ id_product: " string",
352
+ quantity_product: 0,
353
+ id_ship: " string",
354
+ instance_id_ship: " string",
355
+ amount: " any",
356
+ title_ship: " string",
357
+ description: " string",
358
+ device_session_id: " any",
359
+ token_id: " string",
360
+ order_id: " any",
361
+ business_id: " any",
362
+ payment_id: " any",
363
+ source: " string",
364
+ currency: "string",
365
+ metadata: "string"
366
+ };
367
+ }
368
+ }
369
+
370
+ export class StartCheckoutResponseClass implements StartCheckoutResponse {
371
+ status!: number;
372
+ message!: string;
373
+ is_route_finished!: Boolean;
374
+ psp_response!: {
375
+ id: string;
376
+ authorization: number;
377
+ operation_type: string;
378
+ transaction_type: string;
379
+ status: string;
380
+ conciliated: boolean;
381
+ creation_date: string;
382
+ operation_date: string;
383
+ description: string;
384
+ error_message?: string;
385
+ order_id?: string;
386
+ card: {
387
+ type: string;
388
+ brand: string;
389
+ address?: string;
390
+ card_number: string;
391
+ holder_name: string;
392
+ expiration_year: string;
393
+ expiration_month: string;
394
+ allows_charges: boolean;
395
+ allows_payouts: boolean;
396
+ bank_name: string;
397
+ points_type: string;
398
+ points_card: boolean;
399
+ bank_code: number;
400
+ };
401
+ customer_id: string;
402
+ gateway_card_present: string;
403
+ amount: number;
404
+ fee: {
405
+ amount: number;
406
+ tax: number;
407
+ currency: string;
408
+ };
409
+ payment_method: {
410
+ type: string;
411
+ url: string;
412
+ };
413
+ currency: string;
414
+ method: string;
415
+ object: string;
416
+ };
417
+ transaction_status!: string;
418
+ transaction_id!: number;
419
+ payment_id!: number;
420
+ provider!: string;
421
+ next_action!: {
422
+ redirect_to_url: {
423
+ url: string;
424
+ return_url: string;
425
+ verify_transaction_status_url: string;
426
+ };
427
+ };
428
+ actions!: {
429
+ name: string;
430
+ url: string;
431
+ method: string;
432
+ }[];
433
+
434
+ get mockObject(): StartCheckoutResponse {
435
+ return {
436
+ status: 200, // Representa un estado exitoso
437
+ message: "Payment processing initiated",
438
+ is_route_finished: false,
439
+ transaction_status: "PENDING",
440
+ transaction_id: 1234567890,
441
+ payment_id: 9876543210,
442
+ provider: "STRIPE",
443
+ next_action: {
444
+ redirect_to_url: {
445
+ url: "https://www.mock-payment-provider.com/checkout",
446
+ return_url: "https://your-app.com/payment-confirmation",
447
+ verify_transaction_status_url:
448
+ "https://api.mock-payment-provider.com/transactions/1234567890/status",
449
+ },
450
+ },
451
+ psp_response: {
452
+ id: " string",
453
+ authorization: 0,
454
+ operation_type: " string",
455
+ transaction_type: " string",
456
+ status: " string",
457
+ conciliated: false,
458
+ creation_date: " string",
459
+ operation_date: " string",
460
+ description: " string",
461
+ error_message: " string",
462
+ order_id: " string",
463
+ card: {
464
+ type: " string",
465
+ brand: " string",
466
+ address: " string",
467
+ card_number: " string",
468
+ holder_name: " string",
469
+ expiration_year: " string",
470
+ expiration_month: " string",
471
+ allows_charges: false,
472
+ allows_payouts: false,
473
+ bank_name: " string",
474
+ points_type: " string",
475
+ points_card: false,
476
+ bank_code: 0,
477
+ },
478
+ customer_id: " string",
479
+ gateway_card_present: " string",
480
+ amount: 0,
481
+ fee: {
482
+ amount: 0,
483
+ tax: 0,
484
+ currency: " string",
485
+ },
486
+ payment_method: {
487
+ type: " string",
488
+ url: " string",
489
+ },
490
+ currency: " string",
491
+ method: " string",
492
+ object: " string",
493
+ },
494
+ actions: [
495
+ {
496
+ name: "Check status",
497
+ url: "https://api.mock-payment-provider.com/transactions/1234567890/status",
498
+ method: "GET",
499
+ },
500
+ {
501
+ name: "Cancel payment",
502
+ url: "https://api.mock-payment-provider.com/transactions/1234567890/cancel",
503
+ method: "POST",
504
+ },
505
+ ],
506
+ };
507
+ }
508
+ }
509
+
510
+ export class StartCheckoutFullRequestClass implements StartCheckoutFullRequest {
511
+ order!: { items: OrderItem[]; };
512
+ return_url!: string;
513
+ total!: number;
514
+ skyflowTokens!: { cardholder_name: string; card_number: string; cvv: string; expiration_year: string; expiration_month: string; skyflow_id: string; };
515
+ customer!: { name: string; lastname: string; email: string; phone: string; };
516
+ isSandbox!: boolean;
517
+ currency!: string;
518
+ metadata!: any;
519
+
520
+ get mockObject(): StartCheckoutFullRequest {
521
+ return {
522
+ order: {
523
+ items: [
524
+ {
525
+ description: "string",
526
+ quantity: 25,
527
+ price_unit: 25,
528
+ discount: 0,
529
+ taxes: 0,
530
+ product_reference: 25,
531
+ name: "Product text",
532
+ amount_total: 25
533
+ }
534
+ ]
535
+ },
536
+ return_url: "string",
537
+ total: 25,
538
+ skyflowTokens: {
539
+ cardholder_name: "string",
540
+ card_number: "string",
541
+ cvv: "string",
542
+ expiration_year: "string",
543
+ expiration_month: "string",
544
+ skyflow_id: "string",
545
+ },
546
+ customer: {
547
+ name: "string",
548
+ lastname: "string",
549
+ email: "string",
550
+ phone: "string",
551
+ },
552
+ isSandbox: true,
553
+ currency: "MXN",
554
+ metadata: null
555
+ };
556
+ }
557
+ }
558
+
559
+ export class TokensRequestClass implements TokensRequest {
560
+ vault_id!: string;
561
+ vault_url!: string;
562
+ data: { [key: string]: any } = {};
563
+
564
+ get mockObject(): TokensRequest {
565
+ return {
566
+ vault_id: "string",
567
+ vault_url: "string",
568
+ data: {
569
+ fields: [],
570
+ },
571
+ };
572
+ }
573
+ }
574
+
575
+ export class RegisterCustomerCardResponseClass
576
+ implements RegisterCustomerCardResponse {
577
+ skyflow_id!: string;
578
+ user_id!: number;
579
+
580
+ get mockObject(): RegisterCustomerCardResponse {
581
+ return {
582
+ skyflow_id: "string",
583
+ user_id: 0,
584
+ };
585
+ }
586
+ }
587
+
588
+ export class RegisterCustomerCardRequestClass
589
+ implements RegisterCustomerCardRequest {
590
+ skyflow_id!: string;
591
+
592
+ get mockObject(): RegisterCustomerCardRequest {
593
+ return {
594
+ skyflow_id: "",
595
+ };
596
+ }
597
+ }
598
+
599
+ export class GetCustomerCardsResponseClass implements GetCustomerCardsResponse {
600
+ user_id!: number;
601
+ cards!: {
602
+ fields: {
603
+ card_scheme: string;
604
+ card_number: string;
605
+ cardholder_name: string;
606
+ cvv: string;
607
+ expiration_month: string;
608
+ expiration_year: string;
609
+ skyflow_id: string;
610
+ };
611
+ }[];
612
+
613
+ get mockObject(): GetCustomerCardsResponse {
614
+ return {
615
+ user_id: 0,
616
+ cards: [
617
+ {
618
+ fields: {
619
+ card_scheme: "string",
620
+ card_number: "string",
621
+ cardholder_name: "string",
622
+ cvv: "string",
623
+ expiration_month: "string",
624
+ expiration_year: "string",
625
+ skyflow_id: "string",
626
+ },
627
+ },
628
+ ],
629
+ };
630
+ }
631
+ }
632
+
633
+ export const OrderEmptyValuesResponse = {
634
+ "business": [
635
+ "This field may not be blank."
636
+ ],
637
+ "reference": [
638
+ "This field may not be null."
639
+ ]
640
+ }
641
+
642
+ export class CustomerRegisterClass implements CustomerRegisterResponse {
643
+ id!: number;
644
+ email!: string;
645
+ auth_token!: string;
646
+ first_name!: string;
647
+ last_name!: string;
648
+
649
+ get mockObject(): CustomerRegisterResponse {
650
+ return {
651
+ id: 10,
652
+ email: "email@gmail.com",
653
+ auth_token: "string"
654
+ };
655
+ }
656
+ }