@tillhub/schemas 6.122.0 → 6.123.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/items/create.js +65 -30
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [6.123.0](https://github.com/tillhub/schemas/compare/v6.122.0...v6.123.0) (2022-02-25)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **carts:** make 'tax' and 'vat_rate' conditional required, add 'acc… ([#674](https://github.com/tillhub/schemas/issues/674)) ([d4e00b6](https://github.com/tillhub/schemas/commit/d4e00b6)), closes [#API-1373](https://github.com/tillhub/schemas/issues/API-1373)
|
|
7
|
+
|
|
1
8
|
# [6.122.0](https://github.com/tillhub/schemas/compare/v6.121.0...v6.122.0) (2022-02-22)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -6,20 +6,30 @@ const customProperties = require('../../../common/custom_properties')
|
|
|
6
6
|
|
|
7
7
|
const masterData = {
|
|
8
8
|
salesman_staff: {
|
|
9
|
+
description: 'Staff person ID',
|
|
9
10
|
...oneOf({
|
|
10
11
|
type: 'string',
|
|
11
12
|
format: 'uuid'
|
|
12
13
|
})
|
|
13
14
|
},
|
|
14
15
|
tax: {
|
|
16
|
+
description: 'Tax rate ID',
|
|
15
17
|
type: 'string',
|
|
16
18
|
format: 'uuid'
|
|
17
19
|
},
|
|
18
20
|
account: {
|
|
21
|
+
description: 'Account ID',
|
|
19
22
|
type: 'string',
|
|
20
23
|
format: 'uuid'
|
|
21
24
|
},
|
|
25
|
+
account_number: {
|
|
26
|
+
description: 'Account number',
|
|
27
|
+
...oneOf({
|
|
28
|
+
type: 'string'
|
|
29
|
+
})
|
|
30
|
+
},
|
|
22
31
|
product_group: {
|
|
32
|
+
description: 'Product group ID',
|
|
23
33
|
...oneOf({
|
|
24
34
|
type: 'string',
|
|
25
35
|
format: 'uuid'
|
|
@@ -407,15 +417,18 @@ const internalDiscounts = {
|
|
|
407
417
|
|
|
408
418
|
const base = {
|
|
409
419
|
name: {
|
|
420
|
+
description: 'Cart item display name',
|
|
410
421
|
type: 'string',
|
|
411
422
|
minLength: 1,
|
|
412
423
|
maxLength: 128
|
|
413
424
|
},
|
|
414
425
|
position: {
|
|
426
|
+
description: 'Cart item position',
|
|
415
427
|
type: 'number',
|
|
416
428
|
minimum: 0
|
|
417
429
|
},
|
|
418
430
|
comments: {
|
|
431
|
+
description: 'Additional comments',
|
|
419
432
|
...anyOf({
|
|
420
433
|
type: 'string',
|
|
421
434
|
maxLength: 4096
|
|
@@ -435,15 +448,6 @@ const base = {
|
|
|
435
448
|
const externalCart = {
|
|
436
449
|
additionalProperties: false,
|
|
437
450
|
type: 'object',
|
|
438
|
-
required: [
|
|
439
|
-
'custom_id',
|
|
440
|
-
'qty',
|
|
441
|
-
'name',
|
|
442
|
-
'currency',
|
|
443
|
-
'amount',
|
|
444
|
-
'tax',
|
|
445
|
-
'account'
|
|
446
|
-
],
|
|
447
451
|
properties: {
|
|
448
452
|
product: {
|
|
449
453
|
description: 'The Tillhub product unique identifier',
|
|
@@ -502,15 +506,29 @@ const externalCart = {
|
|
|
502
506
|
},
|
|
503
507
|
discounts: externalDiscounts,
|
|
504
508
|
...base
|
|
505
|
-
}
|
|
509
|
+
},
|
|
510
|
+
anyOf: [{
|
|
511
|
+
required: [
|
|
512
|
+
'custom_id',
|
|
513
|
+
'qty',
|
|
514
|
+
'name',
|
|
515
|
+
'currency',
|
|
516
|
+
'amount',
|
|
517
|
+
'tax'
|
|
518
|
+
]
|
|
519
|
+
}, {
|
|
520
|
+
required: [
|
|
521
|
+
'custom_id',
|
|
522
|
+
'qty',
|
|
523
|
+
'name',
|
|
524
|
+
'currency',
|
|
525
|
+
'amount',
|
|
526
|
+
'vat_rate'
|
|
527
|
+
]
|
|
528
|
+
}]
|
|
506
529
|
}
|
|
507
530
|
|
|
508
531
|
const cartOfIds = {
|
|
509
|
-
required: [
|
|
510
|
-
'product',
|
|
511
|
-
'currency',
|
|
512
|
-
'qty'
|
|
513
|
-
],
|
|
514
532
|
additionalProperties: false,
|
|
515
533
|
type: 'object',
|
|
516
534
|
properties: {
|
|
@@ -548,25 +566,17 @@ const cartOfIds = {
|
|
|
548
566
|
maxLength: 128
|
|
549
567
|
},
|
|
550
568
|
discounts: externalDiscounts
|
|
551
|
-
}
|
|
569
|
+
},
|
|
570
|
+
required: [
|
|
571
|
+
'product',
|
|
572
|
+
'currency',
|
|
573
|
+
'qty'
|
|
574
|
+
]
|
|
552
575
|
}
|
|
553
576
|
|
|
554
577
|
const internalCart = {
|
|
555
578
|
additionalProperties: false,
|
|
556
579
|
type: 'object',
|
|
557
|
-
required: [
|
|
558
|
-
'product',
|
|
559
|
-
'qty',
|
|
560
|
-
'custom_id',
|
|
561
|
-
'vat_rate',
|
|
562
|
-
'salesman_staff',
|
|
563
|
-
'tax',
|
|
564
|
-
'account',
|
|
565
|
-
'name',
|
|
566
|
-
'discounts',
|
|
567
|
-
'amount',
|
|
568
|
-
'currency'
|
|
569
|
-
],
|
|
570
580
|
properties: {
|
|
571
581
|
product: {
|
|
572
582
|
description: 'Identifier of the product',
|
|
@@ -704,7 +714,32 @@ const internalCart = {
|
|
|
704
714
|
type: 'object'
|
|
705
715
|
})
|
|
706
716
|
}
|
|
707
|
-
}
|
|
717
|
+
},
|
|
718
|
+
anyOf: [{
|
|
719
|
+
required: [
|
|
720
|
+
'product',
|
|
721
|
+
'qty',
|
|
722
|
+
'custom_id',
|
|
723
|
+
'salesman_staff',
|
|
724
|
+
'name',
|
|
725
|
+
'discounts',
|
|
726
|
+
'amount',
|
|
727
|
+
'currency',
|
|
728
|
+
'tax'
|
|
729
|
+
]
|
|
730
|
+
}, {
|
|
731
|
+
required: [
|
|
732
|
+
'product',
|
|
733
|
+
'qty',
|
|
734
|
+
'custom_id',
|
|
735
|
+
'salesman_staff',
|
|
736
|
+
'name',
|
|
737
|
+
'discounts',
|
|
738
|
+
'amount',
|
|
739
|
+
'currency',
|
|
740
|
+
'vat_rate'
|
|
741
|
+
]
|
|
742
|
+
}]
|
|
708
743
|
}
|
|
709
744
|
|
|
710
745
|
module.exports = {
|