@tillhub/schemas 6.187.0 → 6.188.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/base.js +699 -0
- package/lib/v1/carts/items/create.js +4 -690
- package/lib/v1/carts/items/index.js +1 -0
- package/lib/v1/carts/items/patch.js +128 -0
- package/lib/v1/carts/patch.js +2 -1
- package/package.json +1 -1
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
const { oneOf, anyOf } = require('../../../helpers/payload-or-null')
|
|
2
|
+
const { externalCartBase, internalCartBase, cartOfIdsBase } = require('./base')
|
|
3
|
+
|
|
4
|
+
const generatedFields = {
|
|
5
|
+
tax: { type: 'string' },
|
|
6
|
+
taxes_options: {
|
|
7
|
+
anyOf: [
|
|
8
|
+
{
|
|
9
|
+
type: 'array'
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
type: 'object'
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
type: 'null'
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
attributes: {
|
|
20
|
+
...anyOf({
|
|
21
|
+
type: 'object'
|
|
22
|
+
})
|
|
23
|
+
},
|
|
24
|
+
description: {
|
|
25
|
+
...oneOf({
|
|
26
|
+
type: 'string'
|
|
27
|
+
})
|
|
28
|
+
},
|
|
29
|
+
id: {
|
|
30
|
+
description: 'Identifier got on cart creation',
|
|
31
|
+
type: 'string'
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const externalCart = {
|
|
36
|
+
additionalProperties: false,
|
|
37
|
+
type: 'object',
|
|
38
|
+
properties: {
|
|
39
|
+
...generatedFields,
|
|
40
|
+
...externalCartBase
|
|
41
|
+
},
|
|
42
|
+
anyOf: [{
|
|
43
|
+
required: [
|
|
44
|
+
'client_id',
|
|
45
|
+
'custom_id',
|
|
46
|
+
'qty',
|
|
47
|
+
'name',
|
|
48
|
+
'currency',
|
|
49
|
+
'amount',
|
|
50
|
+
'tax'
|
|
51
|
+
]
|
|
52
|
+
}, {
|
|
53
|
+
required: [
|
|
54
|
+
'client_id',
|
|
55
|
+
'custom_id',
|
|
56
|
+
'qty',
|
|
57
|
+
'name',
|
|
58
|
+
'currency',
|
|
59
|
+
'amount',
|
|
60
|
+
'vat_rate'
|
|
61
|
+
]
|
|
62
|
+
}]
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const cartOfIds = {
|
|
66
|
+
additionalProperties: false,
|
|
67
|
+
type: 'object',
|
|
68
|
+
properties: {
|
|
69
|
+
...generatedFields,
|
|
70
|
+
...cartOfIdsBase
|
|
71
|
+
},
|
|
72
|
+
required: [
|
|
73
|
+
'client_id',
|
|
74
|
+
'product',
|
|
75
|
+
'currency',
|
|
76
|
+
'qty'
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const internalCart = {
|
|
81
|
+
additionalProperties: false,
|
|
82
|
+
type: 'object',
|
|
83
|
+
properties: {
|
|
84
|
+
...generatedFields,
|
|
85
|
+
...internalCartBase
|
|
86
|
+
},
|
|
87
|
+
anyOf: [{
|
|
88
|
+
required: [
|
|
89
|
+
'client_id',
|
|
90
|
+
'product',
|
|
91
|
+
'qty',
|
|
92
|
+
'custom_id',
|
|
93
|
+
'salesman_staff',
|
|
94
|
+
'name',
|
|
95
|
+
'discounts',
|
|
96
|
+
'amount',
|
|
97
|
+
'currency',
|
|
98
|
+
'tax'
|
|
99
|
+
]
|
|
100
|
+
}, {
|
|
101
|
+
required: [
|
|
102
|
+
'client_id',
|
|
103
|
+
'product',
|
|
104
|
+
'qty',
|
|
105
|
+
'custom_id',
|
|
106
|
+
'salesman_staff',
|
|
107
|
+
'name',
|
|
108
|
+
'discounts',
|
|
109
|
+
'amount',
|
|
110
|
+
'currency',
|
|
111
|
+
'vat_rate'
|
|
112
|
+
]
|
|
113
|
+
}]
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
module.exports = {
|
|
117
|
+
type: 'array',
|
|
118
|
+
minItems: 1,
|
|
119
|
+
maxItems: 300,
|
|
120
|
+
items: {
|
|
121
|
+
anyOf: [
|
|
122
|
+
// order is important: most specialized schema will win
|
|
123
|
+
internalCart,
|
|
124
|
+
externalCart,
|
|
125
|
+
cartOfIds
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
}
|
package/lib/v1/carts/patch.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const baseObject = require('../../common/base')
|
|
2
2
|
const commonResponse = require('../../common/response')
|
|
3
3
|
const base = require('./base')
|
|
4
|
+
const patch = require('./items').patch
|
|
4
5
|
|
|
5
6
|
module.exports = {
|
|
6
7
|
request: {
|
|
@@ -10,7 +11,7 @@ module.exports = {
|
|
|
10
11
|
additionalProperties: false,
|
|
11
12
|
required: [
|
|
12
13
|
],
|
|
13
|
-
properties: base
|
|
14
|
+
properties: { ...base, items: patch }
|
|
14
15
|
},
|
|
15
16
|
response: {
|
|
16
17
|
$id: 'https://schemas.tillhub.com/v1/carts.patch.response.schema.json',
|