@tillhub/schemas 6.121.0 → 6.122.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.
- package/CHANGELOG.md +7 -0
- package/lib/v1/carts/base.js +182 -0
- package/lib/v1/carts/create.js +30 -0
- package/lib/v1/carts/index.js +3 -8
- package/lib/v1/carts/items/create.js +150 -227
- package/lib/v1/carts/patch.js +29 -0
- package/lib/v1/carts/read.js +54 -0
- package/package.json +1 -1
- package/test/carts/carts.v1.spec.js +46 -6
- package/lib/v1/carts/create.request.js +0 -268
- package/lib/v1/carts/patch.request.js +0 -259
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const { oneOf } = require('../../../helpers/payload-or-null')
|
|
1
|
+
const { anyOf, oneOf } = require('../../../helpers/payload-or-null')
|
|
2
2
|
const productServiceAnswerObject = require('../../transactions/components/embedded/product_service_answer/base')
|
|
3
3
|
const returnReason = require('../../transactions/components/embedded/return/return_reason')
|
|
4
4
|
const voucherObject = require('../../transactions/components/embedded/voucher/base')
|
|
@@ -6,15 +6,10 @@ const customProperties = require('../../../common/custom_properties')
|
|
|
6
6
|
|
|
7
7
|
const masterData = {
|
|
8
8
|
salesman_staff: {
|
|
9
|
-
oneOf
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
type: 'null'
|
|
16
|
-
}
|
|
17
|
-
]
|
|
9
|
+
...oneOf({
|
|
10
|
+
type: 'string',
|
|
11
|
+
format: 'uuid'
|
|
12
|
+
})
|
|
18
13
|
},
|
|
19
14
|
tax: {
|
|
20
15
|
type: 'string',
|
|
@@ -25,15 +20,10 @@ const masterData = {
|
|
|
25
20
|
format: 'uuid'
|
|
26
21
|
},
|
|
27
22
|
product_group: {
|
|
28
|
-
oneOf
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
type: 'null'
|
|
35
|
-
}
|
|
36
|
-
]
|
|
23
|
+
...oneOf({
|
|
24
|
+
type: 'string',
|
|
25
|
+
format: 'uuid'
|
|
26
|
+
})
|
|
37
27
|
}
|
|
38
28
|
}
|
|
39
29
|
|
|
@@ -88,16 +78,11 @@ const externalDiscounts = {
|
|
|
88
78
|
type: 'object',
|
|
89
79
|
properties: {
|
|
90
80
|
rate: {
|
|
91
|
-
oneOf
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
type: 'null'
|
|
99
|
-
}
|
|
100
|
-
]
|
|
81
|
+
...oneOf({
|
|
82
|
+
type: 'number',
|
|
83
|
+
minimum: 0,
|
|
84
|
+
maximum: 1
|
|
85
|
+
})
|
|
101
86
|
},
|
|
102
87
|
order_index: {
|
|
103
88
|
type: 'integer'
|
|
@@ -139,14 +124,9 @@ const externalDiscounts = {
|
|
|
139
124
|
type: 'object',
|
|
140
125
|
properties: {
|
|
141
126
|
value: {
|
|
142
|
-
oneOf
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
type: 'null'
|
|
148
|
-
}
|
|
149
|
-
]
|
|
127
|
+
...oneOf({
|
|
128
|
+
type: 'number'
|
|
129
|
+
})
|
|
150
130
|
},
|
|
151
131
|
order_index: {
|
|
152
132
|
type: 'integer'
|
|
@@ -310,26 +290,16 @@ const internalDiscounts = {
|
|
|
310
290
|
description: 'The logical group type of the discount, reflecting it\'s origin.'
|
|
311
291
|
},
|
|
312
292
|
value: {
|
|
313
|
-
oneOf
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
},
|
|
317
|
-
{
|
|
318
|
-
type: 'null'
|
|
319
|
-
}
|
|
320
|
-
]
|
|
293
|
+
...oneOf({
|
|
294
|
+
type: 'number'
|
|
295
|
+
})
|
|
321
296
|
},
|
|
322
297
|
rate: {
|
|
323
|
-
oneOf
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
},
|
|
329
|
-
{
|
|
330
|
-
type: 'null'
|
|
331
|
-
}
|
|
332
|
-
]
|
|
298
|
+
...oneOf({
|
|
299
|
+
type: 'number',
|
|
300
|
+
minimum: 0,
|
|
301
|
+
maximum: 1
|
|
302
|
+
})
|
|
333
303
|
},
|
|
334
304
|
client_id: {
|
|
335
305
|
type: 'string',
|
|
@@ -337,61 +307,41 @@ const internalDiscounts = {
|
|
|
337
307
|
},
|
|
338
308
|
external_reference_id: {
|
|
339
309
|
description: 'A caller defined custom ID for the purpose of syncing from external resources, or to use in analytics.',
|
|
340
|
-
oneOf
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
},
|
|
345
|
-
{
|
|
346
|
-
type: 'null'
|
|
347
|
-
}
|
|
348
|
-
]
|
|
310
|
+
...oneOf({
|
|
311
|
+
type: 'string',
|
|
312
|
+
maxLength: 128
|
|
313
|
+
})
|
|
349
314
|
},
|
|
350
315
|
source_id: {
|
|
351
316
|
description: 'The Tillhub discount resource (if available)',
|
|
352
|
-
oneOf
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
},
|
|
357
|
-
{
|
|
358
|
-
type: 'null'
|
|
359
|
-
}
|
|
360
|
-
]
|
|
317
|
+
...oneOf({
|
|
318
|
+
type: 'string',
|
|
319
|
+
format: 'uuid'
|
|
320
|
+
})
|
|
361
321
|
},
|
|
362
322
|
assignment_id: {
|
|
363
323
|
description: 'Identification of the process that created this discount',
|
|
364
|
-
oneOf
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
},
|
|
369
|
-
{
|
|
370
|
-
type: 'null'
|
|
371
|
-
}
|
|
372
|
-
]
|
|
324
|
+
...oneOf({
|
|
325
|
+
type: 'string',
|
|
326
|
+
maxLength: 128
|
|
327
|
+
})
|
|
373
328
|
},
|
|
374
329
|
assignment_source: {
|
|
375
330
|
description: 'Identification of the source of the process that created this discount',
|
|
376
|
-
oneOf
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
},
|
|
391
|
-
{
|
|
392
|
-
type: 'null'
|
|
393
|
-
}
|
|
394
|
-
]
|
|
331
|
+
...oneOf({
|
|
332
|
+
type: 'string',
|
|
333
|
+
enum: [
|
|
334
|
+
'customer',
|
|
335
|
+
'staff',
|
|
336
|
+
'cart',
|
|
337
|
+
'product_set',
|
|
338
|
+
'sconto',
|
|
339
|
+
'item',
|
|
340
|
+
'promotion',
|
|
341
|
+
'voucher',
|
|
342
|
+
'product_voucher'
|
|
343
|
+
]
|
|
344
|
+
})
|
|
395
345
|
},
|
|
396
346
|
name: {
|
|
397
347
|
type: 'string',
|
|
@@ -466,15 +416,10 @@ const base = {
|
|
|
466
416
|
minimum: 0
|
|
467
417
|
},
|
|
468
418
|
comments: {
|
|
469
|
-
anyOf
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
},
|
|
474
|
-
{
|
|
475
|
-
type: 'null'
|
|
476
|
-
}
|
|
477
|
-
],
|
|
419
|
+
...anyOf({
|
|
420
|
+
type: 'string',
|
|
421
|
+
maxLength: 4096
|
|
422
|
+
}),
|
|
478
423
|
default: null
|
|
479
424
|
},
|
|
480
425
|
client_id: {
|
|
@@ -502,64 +447,55 @@ const externalCart = {
|
|
|
502
447
|
properties: {
|
|
503
448
|
product: {
|
|
504
449
|
description: 'The Tillhub product unique identifier',
|
|
450
|
+
example: 'aa165950-26f1-4a59-a85a-1c6017b3cb79',
|
|
505
451
|
type: 'string',
|
|
506
|
-
format: 'uuid'
|
|
507
|
-
example: 'aa165950-26f1-4a59-a85a-1c6017b3cb79'
|
|
452
|
+
format: 'uuid'
|
|
508
453
|
},
|
|
509
454
|
custom_id: {
|
|
510
455
|
description: 'The product.custom_id as stated in https://tillhub.atlassian.net/browse/TM-5665',
|
|
456
|
+
example: '260620-727-DE',
|
|
511
457
|
type: 'string',
|
|
512
|
-
maxLength: 128
|
|
513
|
-
example: '260620-727-DE'
|
|
458
|
+
maxLength: 128
|
|
514
459
|
},
|
|
515
460
|
product_supplier_name: {
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
},
|
|
522
|
-
{
|
|
523
|
-
type: 'null'
|
|
524
|
-
}
|
|
525
|
-
]
|
|
461
|
+
description: 'Custom identifier for the product\'s supplier',
|
|
462
|
+
...oneOf({
|
|
463
|
+
type: 'string',
|
|
464
|
+
maxLength: 128
|
|
465
|
+
})
|
|
526
466
|
},
|
|
527
467
|
is_service: {
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
},
|
|
534
|
-
{
|
|
535
|
-
type: 'null'
|
|
536
|
-
}
|
|
537
|
-
]
|
|
468
|
+
description: 'If true, this item represents a service and might come with answers to service questions',
|
|
469
|
+
default: false,
|
|
470
|
+
...oneOf({
|
|
471
|
+
type: 'boolean'
|
|
472
|
+
})
|
|
538
473
|
},
|
|
539
474
|
discountable: {
|
|
540
|
-
|
|
541
|
-
oneOf
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
},
|
|
545
|
-
{
|
|
546
|
-
type: 'null'
|
|
547
|
-
}
|
|
548
|
-
]
|
|
475
|
+
description: 'Supports correct discount behavior without product lookup',
|
|
476
|
+
...oneOf({
|
|
477
|
+
type: 'boolean'
|
|
478
|
+
})
|
|
549
479
|
},
|
|
550
480
|
qty: {
|
|
481
|
+
description: 'Product quantity in the cart',
|
|
482
|
+
example: 2,
|
|
551
483
|
type: 'number'
|
|
552
484
|
},
|
|
553
485
|
currency: {
|
|
486
|
+
description: 'Currency symbol',
|
|
487
|
+
example: 'EUR',
|
|
554
488
|
type: 'string',
|
|
555
489
|
minLength: 3,
|
|
556
490
|
maxLength: 3
|
|
557
491
|
},
|
|
558
492
|
amount: {
|
|
559
|
-
|
|
560
|
-
|
|
493
|
+
description: 'The currency / amount object combination is the Tillhub Money object. In this context it is the price of 1 item. The total will price * qty.',
|
|
494
|
+
...amount
|
|
561
495
|
},
|
|
562
496
|
vat_rate: {
|
|
497
|
+
description: 'VAT rate',
|
|
498
|
+
example: 0.12,
|
|
563
499
|
type: 'number',
|
|
564
500
|
minimum: 0,
|
|
565
501
|
maximum: 1
|
|
@@ -579,28 +515,30 @@ const cartOfIds = {
|
|
|
579
515
|
type: 'object',
|
|
580
516
|
properties: {
|
|
581
517
|
position: {
|
|
518
|
+
description: 'Cart item position',
|
|
582
519
|
type: 'number',
|
|
583
520
|
minimum: 0
|
|
584
521
|
},
|
|
585
522
|
discountable: {
|
|
586
|
-
|
|
587
|
-
oneOf
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
},
|
|
591
|
-
{
|
|
592
|
-
type: 'null'
|
|
593
|
-
}
|
|
594
|
-
]
|
|
523
|
+
description: 'Supports correct discount behavior without product lookup',
|
|
524
|
+
...oneOf({
|
|
525
|
+
type: 'boolean'
|
|
526
|
+
})
|
|
595
527
|
},
|
|
596
528
|
product: {
|
|
529
|
+
description: 'Identifier of the product',
|
|
530
|
+
example: 'cd0a2886-e245-4ed9-a758-443e7e5b3a3f',
|
|
597
531
|
type: 'string'
|
|
598
532
|
// format: 'uuid'
|
|
599
533
|
},
|
|
600
534
|
qty: {
|
|
535
|
+
description: 'Product quantity in the cart',
|
|
536
|
+
example: 2,
|
|
601
537
|
type: 'number'
|
|
602
538
|
},
|
|
603
539
|
currency: {
|
|
540
|
+
description: 'Currency symbol',
|
|
541
|
+
example: 'EUR',
|
|
604
542
|
type: 'string',
|
|
605
543
|
minLength: 3,
|
|
606
544
|
maxLength: 3
|
|
@@ -631,81 +569,71 @@ const internalCart = {
|
|
|
631
569
|
],
|
|
632
570
|
properties: {
|
|
633
571
|
product: {
|
|
572
|
+
description: 'Identifier of the product',
|
|
573
|
+
example: 'cd0a2886-e245-4ed9-a758-443e7e5b3a3f',
|
|
634
574
|
type: 'string',
|
|
635
575
|
format: 'uuid'
|
|
636
576
|
},
|
|
637
577
|
product_supplier_name: {
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
{
|
|
645
|
-
type: 'null'
|
|
646
|
-
}
|
|
647
|
-
]
|
|
578
|
+
description: 'Custom identifier for the product\'s supplier',
|
|
579
|
+
example: '00555kff34323',
|
|
580
|
+
...oneOf({
|
|
581
|
+
type: 'string',
|
|
582
|
+
maxLength: 128
|
|
583
|
+
})
|
|
648
584
|
},
|
|
649
585
|
is_service: {
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
},
|
|
656
|
-
{
|
|
657
|
-
type: 'null'
|
|
658
|
-
}
|
|
659
|
-
]
|
|
586
|
+
description: 'If true, this item represents a service and might come with answers to service questions',
|
|
587
|
+
...oneOf({
|
|
588
|
+
type: 'boolean',
|
|
589
|
+
default: false
|
|
590
|
+
})
|
|
660
591
|
},
|
|
661
592
|
discountable: {
|
|
662
|
-
|
|
663
|
-
oneOf
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
},
|
|
667
|
-
{
|
|
668
|
-
type: 'null'
|
|
669
|
-
}
|
|
670
|
-
]
|
|
593
|
+
description: 'Supports correct discount behavior without product lookup',
|
|
594
|
+
...oneOf({
|
|
595
|
+
type: 'boolean'
|
|
596
|
+
})
|
|
671
597
|
},
|
|
672
598
|
qty: {
|
|
599
|
+
description: 'Product quantity in the cart',
|
|
600
|
+
example: 2,
|
|
673
601
|
type: 'number'
|
|
674
602
|
},
|
|
675
603
|
custom_id: {
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
{
|
|
682
|
-
type: 'null'
|
|
683
|
-
}
|
|
684
|
-
]
|
|
604
|
+
description: 'Custom cart item ID',
|
|
605
|
+
...oneOf({
|
|
606
|
+
type: 'string',
|
|
607
|
+
maxLength: 128
|
|
608
|
+
})
|
|
685
609
|
},
|
|
686
610
|
vat_rate: {
|
|
611
|
+
description: 'VAT rate',
|
|
612
|
+
example: 0.12,
|
|
687
613
|
type: 'number',
|
|
688
614
|
minimum: 0,
|
|
689
615
|
maximum: 1
|
|
690
616
|
},
|
|
691
|
-
vat_rate_class:
|
|
692
|
-
default: 'normal',
|
|
617
|
+
vat_rate_class: {
|
|
693
618
|
description: 'Rate class from \'taxes.rate_class\' according to international standards, used in Germany to map types for e.g. fiscalization',
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
'
|
|
697
|
-
'
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
619
|
+
default: 'normal',
|
|
620
|
+
...oneOf({
|
|
621
|
+
type: 'string',
|
|
622
|
+
'enum': [
|
|
623
|
+
'normal',
|
|
624
|
+
'reduced',
|
|
625
|
+
'super_reduced'
|
|
626
|
+
]
|
|
627
|
+
})
|
|
628
|
+
},
|
|
701
629
|
currency: {
|
|
630
|
+
description: 'Currency symbol',
|
|
631
|
+
example: 'EUR',
|
|
702
632
|
type: 'string',
|
|
703
633
|
minLength: 3,
|
|
704
634
|
maxLength: 3
|
|
705
635
|
},
|
|
706
|
-
amount
|
|
707
|
-
...amount
|
|
708
|
-
},
|
|
636
|
+
amount,
|
|
709
637
|
promotion_amount: oneOf({
|
|
710
638
|
description: 'The promotion amount on the per unit qty base of 1.',
|
|
711
639
|
type: 'number',
|
|
@@ -728,10 +656,10 @@ const internalCart = {
|
|
|
728
656
|
}
|
|
729
657
|
}),
|
|
730
658
|
is_voucher: {
|
|
659
|
+
description: 'If true, this item represents a voucher and must come with voucher information in \'voucher\'',
|
|
660
|
+
default: false,
|
|
731
661
|
...oneOf({
|
|
732
|
-
type: 'boolean'
|
|
733
|
-
default: false,
|
|
734
|
-
description: 'If true, this item represents a voucher and must come with voucher information in \'voucher\''
|
|
662
|
+
type: 'boolean'
|
|
735
663
|
})
|
|
736
664
|
},
|
|
737
665
|
voucher: {
|
|
@@ -741,45 +669,40 @@ const internalCart = {
|
|
|
741
669
|
default: null
|
|
742
670
|
},
|
|
743
671
|
is_refund: {
|
|
672
|
+
description: 'If true, the item was created by (partially) refunding a previous sale.',
|
|
744
673
|
...oneOf({
|
|
745
|
-
type: 'boolean'
|
|
746
|
-
description: 'If true, the item was created by (partially) refunding a previous sale.'
|
|
674
|
+
type: 'boolean'
|
|
747
675
|
})
|
|
748
676
|
},
|
|
749
677
|
return_reason: returnReason,
|
|
750
678
|
attributes_description: {
|
|
679
|
+
description: 'A short description of the child attributes in variant products',
|
|
680
|
+
example: 'red | big | 32',
|
|
751
681
|
...oneOf({
|
|
752
|
-
type: 'string'
|
|
753
|
-
example: 'red | big | 32',
|
|
754
|
-
description: 'A short description of the child attributes in variant products'
|
|
682
|
+
type: 'string'
|
|
755
683
|
})
|
|
756
684
|
},
|
|
757
685
|
reference_cartitem_client_id: {
|
|
686
|
+
description: 'In cases of refund or cancellation, or invoicing a delivery note or selling a saved cart: the client_id of the origin item',
|
|
687
|
+
example: '01331B44-130B-45D4-97A7-401247FD5B68',
|
|
758
688
|
...oneOf({
|
|
759
|
-
type: 'string'
|
|
760
|
-
example: '01331B44-130B-45D4-97A7-401247FD5B68',
|
|
761
|
-
description: 'In cases of refund or cancellation, or invoicing a delivery note or selling a saved cart: the client_id of the origin item'
|
|
689
|
+
type: 'string'
|
|
762
690
|
})
|
|
763
691
|
},
|
|
764
692
|
used_barcode: {
|
|
693
|
+
description: 'The barcode used to trigger putting this item into the cart (defaults to the first available barcode from the product)',
|
|
694
|
+
example: '0E9761310XF',
|
|
765
695
|
...oneOf({
|
|
766
|
-
type: 'string'
|
|
767
|
-
example: '0E9761310XF',
|
|
768
|
-
description: 'The barcode used to trigger putting this item into the cart (defaults to the first available barcode from the product)'
|
|
696
|
+
type: 'string'
|
|
769
697
|
})
|
|
770
698
|
},
|
|
771
699
|
...base,
|
|
772
700
|
discounts: internalDiscounts,
|
|
773
701
|
attributes: {
|
|
774
702
|
default: null,
|
|
775
|
-
anyOf
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
},
|
|
779
|
-
{
|
|
780
|
-
type: 'null'
|
|
781
|
-
}
|
|
782
|
-
]
|
|
703
|
+
...anyOf({
|
|
704
|
+
type: 'object'
|
|
705
|
+
})
|
|
783
706
|
}
|
|
784
707
|
}
|
|
785
708
|
}
|
|
@@ -790,7 +713,7 @@ module.exports = {
|
|
|
790
713
|
maxItems: 300,
|
|
791
714
|
items: {
|
|
792
715
|
anyOf: [
|
|
793
|
-
// order is important: most
|
|
716
|
+
// order is important: most specialized schema will win
|
|
794
717
|
internalCart,
|
|
795
718
|
externalCart,
|
|
796
719
|
cartOfIds
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const baseObject = require('../../common/base')
|
|
2
|
+
const commonResponse = require('../../common/response')
|
|
3
|
+
const base = require('./base')
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
request: {
|
|
7
|
+
$id: 'https://schemas.tillhub.com/v1/carts.patch.request.schema.json',
|
|
8
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
9
|
+
type: 'object',
|
|
10
|
+
additionalProperties: false,
|
|
11
|
+
required: [
|
|
12
|
+
],
|
|
13
|
+
properties: base
|
|
14
|
+
},
|
|
15
|
+
response: {
|
|
16
|
+
$id: 'https://schemas.tillhub.com/v1/carts.patch.response.schema.json',
|
|
17
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
18
|
+
...commonResponse({
|
|
19
|
+
resultItems: {
|
|
20
|
+
type: 'object',
|
|
21
|
+
additionalProperties: false,
|
|
22
|
+
properties: {
|
|
23
|
+
...baseObject(),
|
|
24
|
+
...base
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
const baseObject = require('../../common/base')
|
|
2
|
+
const commonResponse = require('../../common/response')
|
|
3
|
+
const { oneOf } = require('../../helpers/payload-or-null')
|
|
4
|
+
const base = require('./base')
|
|
5
|
+
|
|
6
|
+
const override = {
|
|
7
|
+
customer: {
|
|
8
|
+
description: 'Customer ID or customer data (in case when "embed=[customer]" presented query parameters) cart belongs to',
|
|
9
|
+
example: '55ec2da5-f9a4-4868-8f00-65ae0804a9d3',
|
|
10
|
+
...oneOf([{
|
|
11
|
+
type: 'string',
|
|
12
|
+
format: 'uuid'
|
|
13
|
+
}, {
|
|
14
|
+
type: 'object'
|
|
15
|
+
}])
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const extended = { ...base, ...override }
|
|
20
|
+
|
|
21
|
+
module.exports = {
|
|
22
|
+
all: {
|
|
23
|
+
response: {
|
|
24
|
+
$id: 'https://schemas.tillhub.com/v1/carts.read.all.response.schema.json',
|
|
25
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
26
|
+
...commonResponse({
|
|
27
|
+
resultItems: {
|
|
28
|
+
type: 'object',
|
|
29
|
+
additionalProperties: false,
|
|
30
|
+
properties: {
|
|
31
|
+
...baseObject(),
|
|
32
|
+
...extended
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
one: {
|
|
39
|
+
response: {
|
|
40
|
+
$id: 'https://schemas.tillhub.com/v1/carts.read.one.response.schema.json',
|
|
41
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
42
|
+
...commonResponse({
|
|
43
|
+
resultItems: {
|
|
44
|
+
type: 'object',
|
|
45
|
+
additionalProperties: false,
|
|
46
|
+
properties: {
|
|
47
|
+
...baseObject(),
|
|
48
|
+
...extended
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|