@tillhub/schemas 6.319.0 → 6.321.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 CHANGED
@@ -1,3 +1,18 @@
1
+ # [6.321.0](https://github.com/tillhub/schemas/compare/v6.320.0...v6.321.0) (2024-06-20)
2
+
3
+
4
+ ### Features
5
+
6
+ * **promotions:** rename compiled js field ([60eaeba](https://github.com/tillhub/schemas/commit/60eaeba))
7
+ * **transactions:** promotions ([1505e0b](https://github.com/tillhub/schemas/commit/1505e0b))
8
+
9
+ # [6.320.0](https://github.com/tillhub/schemas/compare/v6.319.0...v6.320.0) (2024-06-20)
10
+
11
+
12
+ ### Features
13
+
14
+ * **promotion:** add new promotion type ([#968](https://github.com/tillhub/schemas/issues/968)) ([8ed6a0a](https://github.com/tillhub/schemas/commit/8ed6a0a))
15
+
1
16
  # [6.319.0](https://github.com/tillhub/schemas/compare/v6.318.0...v6.319.0) (2024-06-17)
2
17
 
3
18
 
@@ -26,6 +26,13 @@ module.exports = {
26
26
  example: '5ad2351d-9a67-45f9-ad4f-0abcbefa9037',
27
27
  description: 'The payment_option ressource id'
28
28
  },
29
+ payment_option_id: {
30
+ ...oneOf({
31
+ type: 'integer',
32
+ example: 131,
33
+ description: 'Legacy id of the payment option'
34
+ })
35
+ },
29
36
  payment_option_name: {
30
37
  ...oneOf({
31
38
  type: 'string',
@@ -88,6 +95,13 @@ module.exports = {
88
95
  example: 1850,
89
96
  description: 'The daily discrepancy between calculated and counted amounts, POS: counted - calculated, not available anymore for non-cash types (e.g. terminal) (in cent-format: 1267 == 12.67€)'
90
97
  })
98
+ },
99
+ exchangeRate: {
100
+ ...oneOf({
101
+ type: 'number',
102
+ example: 1.403,
103
+ description: 'Exchange rate of the payment option, not used.'
104
+ })
91
105
  }
92
106
  }
93
107
  }
@@ -17,14 +17,71 @@ module.exports = {
17
17
  ]
18
18
  },
19
19
  inputs: {
20
- oneOf: [
21
- {
22
- type: 'object'
20
+ type: 'object',
21
+ required: [
22
+ 'repeatable_promotable',
23
+ 'promotable_product',
24
+ 'bundle_junctions',
25
+ 'output'
26
+ ],
27
+ properties: {
28
+ repeatable_promotable: {
29
+ type: 'boolean'
30
+ },
31
+ promotable_product: {
32
+ required: ['property', 'value', 'qty'],
33
+ properties: {
34
+ property: {
35
+ type: 'string'
36
+ },
37
+ value: {
38
+ type: 'string'
39
+ },
40
+ qty: {
41
+ type: 'number'
42
+ }
43
+ }
23
44
  },
24
- {
25
- type: 'null'
45
+ bundle_junctions: {
46
+ type: 'array',
47
+ uniqueItems: true,
48
+ additionalItems: false,
49
+ minItems: 2,
50
+ maxItems: 2,
51
+ items: {
52
+ required: ['type', 'property', 'value'],
53
+ properties: {
54
+ property: { // its only assumed that the property is id
55
+ type: 'string'
56
+ },
57
+ value: {
58
+ type: 'array'
59
+ },
60
+ qty: { // only needs for type = product
61
+ type: 'number'
62
+ },
63
+ type: {
64
+ type: 'string',
65
+ enum: ['product', 'product_group']
66
+ }
67
+ }
68
+ }
69
+ },
70
+ output: {
71
+ type: 'object',
72
+ required: ['property', 'value'],
73
+ properties: {
74
+ property: {
75
+ type: 'string',
76
+ enum: ['amount_total_gross', 'percentage_discount', 'amount_discount']
77
+
78
+ },
79
+ value: {
80
+ type: 'number'
81
+ }
82
+ }
26
83
  }
27
- ]
84
+ }
28
85
  }
29
86
  }
30
87
  },
@@ -43,14 +100,71 @@ module.exports = {
43
100
  ]
44
101
  },
45
102
  inputs: {
46
- oneOf: [
47
- {
48
- type: 'object'
103
+ type: 'object',
104
+ required: [
105
+ 'repeatable_promotable',
106
+ 'promotable_product',
107
+ 'bundle_junctions',
108
+ 'output'
109
+ ],
110
+ properties: {
111
+ repeatable_promotable: {
112
+ type: 'boolean'
113
+ },
114
+ promotable_product: {
115
+ required: ['property', 'value', 'qty'],
116
+ properties: {
117
+ property: {
118
+ type: 'string'
119
+ },
120
+ value: {
121
+ type: 'string'
122
+ },
123
+ qty: {
124
+ type: 'number'
125
+ }
126
+ }
127
+ },
128
+ bundle_junctions: {
129
+ type: 'array',
130
+ maxItems: 1,
131
+ minItems: 1,
132
+ uniqueItems: true,
133
+ additionalItems: false,
134
+ items: {
135
+ required: ['type', 'property', 'value', 'qty'],
136
+ properties: {
137
+ property: {
138
+ type: 'string'
139
+ },
140
+ value: {
141
+ type: 'string'
142
+ },
143
+ qty: {
144
+ type: 'number'
145
+ },
146
+ type: {
147
+ type: 'string',
148
+ enum: ['product']
149
+ }
150
+ }
151
+ }
49
152
  },
50
- {
51
- type: 'null'
153
+ output: {
154
+ type: 'object',
155
+ required: ['property', 'value'],
156
+ properties: {
157
+ property: {
158
+ type: 'string',
159
+ enum: ['amount_total_gross', 'percentage_discount', 'amount_discount']
160
+
161
+ },
162
+ value: {
163
+ type: 'number'
164
+ }
165
+ }
52
166
  }
53
- ]
167
+ }
54
168
  }
55
169
  }
56
170
  },
@@ -71,39 +185,37 @@ module.exports = {
71
185
  inputs: {
72
186
  type: 'object',
73
187
  required: [
74
- 'promotable_products',
75
- 'promotable_product_groups',
188
+ 'promotable_product',
189
+ 'required_amount',
190
+ 'promotable_product_group',
76
191
  'output'
77
192
  ],
78
193
  properties: {
79
- promotable_products: {
80
- type: 'array',
81
- items: {
82
- required: ['property', 'value'],
83
- properties: {
84
- property: {
85
- type: 'string'
86
- },
87
- value: {
88
- type: 'string'
89
- }
194
+ promotable_product: {
195
+ required: ['property', 'value'],
196
+ properties: {
197
+ property: {
198
+ type: 'string'
199
+ },
200
+ value: {
201
+ type: 'array'
90
202
  }
91
203
  }
92
204
  },
93
- promotable_product_groups: {
94
- type: 'array',
95
- items: {
96
- required: ['property', 'value'],
97
- properties: {
98
- property: {
99
- type: 'string'
100
- },
101
- value: {
102
- type: 'string'
103
- }
205
+ promotable_product_group: {
206
+ required: ['property', 'value'],
207
+ properties: {
208
+ property: {
209
+ type: 'string'
210
+ },
211
+ value: {
212
+ type: 'array'
104
213
  }
105
214
  }
106
215
  },
216
+ required_amount: {
217
+ type: 'number'
218
+ },
107
219
  output: {
108
220
  type: 'object',
109
221
  required: ['property', 'value'],
@@ -114,7 +226,7 @@ module.exports = {
114
226
 
115
227
  },
116
228
  value: {
117
- type: 'string'
229
+ type: 'number'
118
230
  }
119
231
  }
120
232
  }
@@ -0,0 +1,26 @@
1
+ const { oneOf } = require('../../../../../helpers/payload-or-null')
2
+
3
+ module.exports = {
4
+ description: 'Promotion details applied on a transaction',
5
+ additionalProperties: false,
6
+ type: 'object',
7
+ properties: {
8
+ id: {
9
+ type: 'string',
10
+ format: 'uuid',
11
+ example: 'AB3847a66-97dc-4ac2-8e8a-c44920e1f22f',
12
+ description: 'Identifier of the promotion used.'
13
+ },
14
+ name: oneOf({
15
+ type: 'string',
16
+ example: 'Summer Sale',
17
+ maxLength: 128,
18
+ description: 'Name of the promotion.'
19
+ }),
20
+ compiled: {
21
+ type: 'string',
22
+ example: 'IWZ1bmN0aW9uKHQpe2lmKCJvYmplY3QiPT10eXBlb2YgZXhwb3J0cyYmInVuZGVmaW5lZCIhPXR5cGVvZiBtb2R1bGUpbW9kdWxlLmV4cG9ydHM9dCgpO2Vsc2UgaWYoImZ1bmN0aW9uIj09dHlwZW9mIGRlZmluZSYmZGVmaW5lLmFtZClkZWZpbmUoW10sdCk7ZWxzZXsoInVuZGVmaW5lZCIhPXR5cGVvZiB3aW5kb3c/d2luZG93OiJ1bmRlZmluZWQiIT10eXBlb2YgZ2xvYmFsP2dsb2JhbDoidW5kZWZpbmVkIiE9dHlwZW9mIHNlbGY/c2VsZjp0aGlzKS5tYWluPXQoKX19KGZ1bmN0aW9uKCl7cmV0dXJuIGZ1bmN0aW9uKCl7cmV0dXJuIGZ1bmN0aW9uIHQoZSxvLHIpe2Z1bmN0aW9uIG4odSxpKXtpZighb1t1XSl7aWYoIWVbdV0pe3ZhciBzPSJmdW5jdGlvbiI9PXR5cGVvZiByZXF1aXJlJiZyZXF1aXJlO2lmKCFpJiZzKXJldHVybiBzKHUsITApO2l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LmZsb29yKG4vMikpKXJldHVybiBvO2xldCBsPTA7Zm9yKGxldCB0IG9mIGUpe2NvbnN0IGU9dC5xdHk7aWYoIShNYXRoLmNlaWwoKGwrdC5xdHkpLzEpPD1zKSl7aWYobHx8cyl7Y29uc3Qgcj0xKnMtbCxuPXIqZix1PShlLXIpKih0LmFtb3VudF90b3RhbF9ncm9zcy9lKTt0LnByb21vdGVkX3RvdGFsX2dyb3NzPWEobit1LDIpLHQucHJvbW90YWJsZV9xdHk9cixkZWxldGUgdC5hbW91bnRfdG90YWxfZ3Jvc3Msby5wdXNoKHQpLHM9MH1icmVha31zLT1NYXRoLmZsb29yKChsK2UpLzEpLGw9KGwrZSklMSx0LnByb21vdGVkX3RvdGFsX2dyb3NzPWEoZSpmLDIpLHQucHJvbW90YWJsZV9xdHk9ZSxkZWxldGUgdC5hbW91bnRfdG90YWxfZ3Jvc3Msby5wdXNoKHQpfXJldHVybiBvO2Z1bmN0aW9uIGEodCxlKXtyZXR1cm4gTnVtYmVyKE1hdGgucm91bmQodCsiZSIrZSkrImUtIitlKX19fSx7fV19LHt9LFsxXSkoMSl9KTs=',
23
+ description: 'Base64 of the promotion function'
24
+ }
25
+ }
26
+ }
@@ -6,6 +6,7 @@ const relatedObject = require('../components/embedded/reference/related')
6
6
  const dependsObject = require('../components/embedded/reference/depends')
7
7
  const originObject = require('../components/embedded/reference/origin')
8
8
  const gastroOrderOrigin = require('../../../common/gastro_order_origin')
9
+ const promotionObject = require('../components/embedded/promotions/base')
9
10
 
10
11
  module.exports = {
11
12
  dev_uuid: {
@@ -372,6 +373,17 @@ module.exports = {
372
373
  default: false,
373
374
  description: 'If true, the transaction contains items modified by the promotion engine'
374
375
  }),
376
+ applied_promotions: oneOf({
377
+ type: 'array',
378
+ description: stripIndents`
379
+ A list of Tillhub promotion details applied to this transaction.
380
+
381
+ V3 promotions will have only 1 entry as they are restricted by a barcode match.
382
+ `,
383
+ items: {
384
+ ...promotionObject
385
+ }
386
+ }),
375
387
  branch: oneOf({
376
388
  type: 'string',
377
389
  format: 'uuid',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tillhub/schemas",
3
- "version": "6.319.0",
3
+ "version": "6.321.0",
4
4
  "private": false,
5
5
  "description": "All Tillhub API OpenAPI 3 compatible JSON Schemas.",
6
6
  "main": "./lib/index.js",