@tillhub/schemas 6.147.0 → 6.148.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,21 @@
1
+ # [6.148.0](https://github.com/tillhub/schemas/compare/v6.147.0...v6.148.0) (2022-07-13)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **configurations:** financials ([8585621](https://github.com/tillhub/schemas/commit/8585621))
7
+
8
+
9
+ ### Features
10
+
11
+ * **balances:** reduce signature types ([099404a](https://github.com/tillhub/schemas/commit/099404a))
12
+ * **balances:** status ([44c727e](https://github.com/tillhub/schemas/commit/44c727e))
13
+ * **configurations:** discounts ([118f48e](https://github.com/tillhub/schemas/commit/118f48e))
14
+ * **financials:** adds price_change_reason_enabled property to financials ([2d0f387](https://github.com/tillhub/schemas/commit/2d0f387))
15
+ * **financials:** adds price_change_reason_required property to financials ([39dcf9f](https://github.com/tillhub/schemas/commit/39dcf9f))
16
+ * **priceChangeReason:** add price_change_reason object ([e7b3b8a](https://github.com/tillhub/schemas/commit/e7b3b8a))
17
+ * **transactions_v1_legacy:** add account and balance links ([57c212a](https://github.com/tillhub/schemas/commit/57c212a))
18
+
1
19
  # [6.147.0](https://github.com/tillhub/schemas/compare/v6.146.0...v6.147.0) (2022-07-08)
2
20
 
3
21
 
@@ -26,4 +26,13 @@ module.exports.get = {
26
26
  }
27
27
  }
28
28
 
29
- module.exports.legacy = require('./legacy')
29
+ module.exports.legacy = {
30
+ create: {
31
+ request: require('./legacy/create.request'),
32
+ response: {
33
+ $id: 'https://schemas.tillhub.com/v1/balances.legacy.post.response.schema.json',
34
+ $schema: 'http://json-schema.org/draft-07/schema#',
35
+ ...commonResponse({ resultItems: require('./legacy/response') })
36
+ }
37
+ }
38
+ }
@@ -1,4 +1,6 @@
1
1
  const base = require('./base')
2
+ const statusCreate = require('../../statuses/create.request')
3
+ const { oneOf } = require('../../../helpers/payload-or-null')
2
4
 
3
5
  module.exports = {
4
6
  $id: 'https://schemas.tillhub.com/v1/balances.legacy.create.request.schema.json',
@@ -9,6 +11,9 @@ module.exports = {
9
11
  'date'
10
12
  ],
11
13
  properties: {
12
- ...base
14
+ ...base,
15
+ status: oneOf({
16
+ ...statusCreate
17
+ })
13
18
  }
14
19
  }
@@ -1,5 +1,6 @@
1
1
  const { oneOf } = require('../../../helpers/payload-or-null')
2
2
  const base = require('./base')
3
+ const statusResponse = require('../../statuses/response')
3
4
 
4
5
  module.exports = {
5
6
  type: 'object',
@@ -35,6 +36,9 @@ module.exports = {
35
36
  description: 'Temporary hack for id-functionality (which is Int)'
36
37
  })
37
38
  },
39
+ status: {
40
+ ...statusResponse
41
+ },
38
42
  ...base
39
43
  }
40
44
  }
@@ -26,7 +26,7 @@ module.exports = {
26
26
  type: 'object',
27
27
  additionalProperties: false,
28
28
  properties: {
29
- value_distribution: {
29
+ value_distribution: oneOf({
30
30
  description: 'Defines the distribution for absolute value discounts applied to more than one cart item.',
31
31
  type: 'string',
32
32
  enum: [
@@ -34,90 +34,79 @@ module.exports = {
34
34
  'proportional' // item will get an amount proportional to it's current total with respect to the cart total (~ target * item / total)
35
35
  ],
36
36
  default: 'proportional'
37
- },
38
- display: {
37
+ }),
38
+ display: oneOf({
39
39
  type: 'object',
40
40
  additionalProperties: false,
41
41
  properties: {
42
- show_inactive: {
43
- default: false,
42
+ show_inactive: oneOf({
43
+ type: 'boolean',
44
44
  description: 'If true, non-active discounts will be still displayed (greyed out)',
45
- oneOf: [
46
- {
47
- type: 'null'
48
- },
49
- {
50
- type: 'boolean'
51
- }
52
- ]
53
- }
45
+ default: false
46
+ })
54
47
  }
55
- },
56
- limits: {
48
+ }),
49
+ limits: oneOf({
57
50
  type: 'object',
58
51
  description: 'Global limits for effective discount values',
59
52
  additionalProperties: false,
60
53
  properties: {
61
- cart_item: {
54
+ cart_item: oneOf({
62
55
  type: 'object',
63
56
  description: 'Global limits for effective discount values on single cart items (affects current cart via multi-assignment)',
64
57
  additionalProperties: false,
65
58
  properties: {
66
- variable: {
59
+ variable: oneOf({
67
60
  type: 'object',
68
61
  description: '0-discounts (Frank) that let the cashier enter a value, limits e.g. to 30% AND $2.00',
69
62
  additionalProperties: false,
70
63
  properties: {
71
64
  ...discountOptions,
72
- can_exceed_cart_item_total: {
65
+ can_exceed_cart_item_total: oneOf({
73
66
  description: 'If true, negative outcomes are alowed (via stacking value discounts) or having rates > 1.0',
74
67
  type: 'boolean',
75
68
  default: false
76
- }
69
+ })
77
70
  }
78
- },
79
- fixed: {
71
+ }),
72
+ fixed: oneOf({
80
73
  type: 'object',
81
74
  description: 'Standard-discounts (have 5% or $3.00 already) - limit creation values in the Dashboard',
82
75
  additionalProperties: false,
83
76
  properties: {
84
77
  ...discountOptions,
85
- can_exceed_cart_item_total: {
78
+ can_exceed_cart_item_total: oneOf({
86
79
  description: 'If true, negative outcomes are alowed (via stacking value discounts) or having rates > 1.0',
87
80
  type: 'boolean',
88
81
  default: false
89
- }
82
+ })
90
83
  }
91
- }
84
+ }),
85
+ price_and_quantity_edit_condition: oneOf({
86
+ description: 'In case of discounted items - specifies if quantity and price can still be edited',
87
+ type: 'string',
88
+ enum: [
89
+ 'none',
90
+ 'no_value_discounts',
91
+ 'no_discounts'
92
+ ],
93
+ default: 'no_value_discounts'
94
+ })
92
95
  }
93
- },
94
- cart: {
96
+ }),
97
+ cart: oneOf({
95
98
  type: 'object',
96
99
  description: 'Global limits for effective discount values on the whole cart (must additionally respect values for items)',
97
100
  additionalProperties: false,
98
101
  properties: {
99
102
  ...discountOptions
100
103
  }
101
- },
102
- stacked_on_product: {
104
+ }),
105
+ stacked_on_product: oneOf({
103
106
  type: 'boolean',
104
107
  default: true
105
- }
108
+ })
106
109
  }
107
- },
108
- fixed: {
109
- description: 'DEPRECATED: DO NOT USE',
110
- oneOf: [
111
- {
112
- type: 'null'
113
- },
114
- {
115
- type: 'object'
116
- },
117
- {
118
- type: 'array'
119
- }
120
- ]
121
- }
110
+ })
122
111
  }
123
112
  }
@@ -4,46 +4,63 @@ const currencyAmounts = require('../../../common/currency_amounts')
4
4
  module.exports = {
5
5
  type: 'object',
6
6
  properties: {
7
- expense_note_required: {
7
+ expense_note_required: oneOf({
8
8
  type: 'boolean',
9
9
  default: false
10
- },
11
- deposit_note_required: {
10
+ }),
11
+ deposit_note_required: oneOf({
12
12
  type: 'boolean',
13
13
  default: false
14
- },
15
- bank_note_required: {
14
+ }),
15
+ bank_note_required: oneOf({
16
16
  type: 'boolean',
17
17
  default: false
18
- },
19
- safe_note_required: {
18
+ }),
19
+ safe_note_required: oneOf({
20
20
  type: 'boolean',
21
21
  default: false
22
- },
23
- expense_reason_required: {
22
+ }),
23
+ expense_reason_required: oneOf({
24
24
  type: 'boolean',
25
25
  description: 'Defines whether selecting a predefined reason is required when booking an expense',
26
26
  default: false
27
- },
28
- deposit_reason_required: {
27
+ }),
28
+ deposit_reason_required: oneOf({
29
29
  type: 'boolean',
30
30
  description: 'Defines whether selecting a predefined reason is required when booking a deposit',
31
31
  default: false
32
- },
33
- price_change_note_required: {
32
+ }),
33
+ price_change_note_required: oneOf({
34
34
  description: 'Defines if a note is mandatory on price changes on the register ',
35
35
  type: 'boolean',
36
36
  default: false
37
- },
38
- tips_expense_note_required: {
37
+ }),
38
+ price_change_reason: oneOf({
39
+ type: 'object',
40
+ description: 'Defines configurations for price change reason ',
41
+ additionalProperties: false,
42
+ properties: {
43
+ enabled: oneOf({
44
+ type: 'boolean',
45
+ description: 'Defines whether asking for a reason for a price change is enabled on the register',
46
+ default: false
47
+ }),
48
+ required: oneOf({
49
+ type: 'boolean',
50
+ description: 'Defines if a reason is mandatory on price changes on the register',
51
+ default: false
52
+ })
53
+ }
54
+ }),
55
+ tips_expense_note_required: oneOf({
39
56
  type: 'boolean',
40
57
  default: false
41
- },
42
- sale_cancellation_note_required: {
58
+ }),
59
+ sale_cancellation_note_required: oneOf({
43
60
  description: 'Defines if a note is mandatory for sale cancellation',
44
61
  type: 'boolean',
45
62
  default: false
46
- },
63
+ }),
47
64
  safe_deposit_limit: {
48
65
  description: 'How much cash per currency can be taken from a safe, regardless of it\'s state',
49
66
  ...oneOf({
@@ -77,59 +94,57 @@ module.exports = {
77
94
  ],
78
95
  default: 'items'
79
96
  }),
80
- roundings: {
81
- ...oneOf({
82
- description: 'Defines the fractional rounding behavior of currencies (e.g. to 0.05 CHF)',
83
- type: 'array',
84
- items: {
85
- type: 'object',
86
- additionalProperties: false,
87
- properties: {
88
- currency: {
89
- type: 'string',
90
- description: 'The three letter [ISO currency](https://en.wikipedia.org/wiki/ISO_4217) of this item.',
91
- example: '',
92
- minLength: 3,
93
- maxLength: 3
94
- },
95
- enabled: {
96
- description: 'States if rounding information should be used for this currency',
97
- type: 'boolean',
98
- default: true
99
- },
100
- fraction: {
101
- ...oneOf({
102
- description: 'The smallest fraction to round to when source equals \'fixed\'.',
103
- type: 'number',
104
- minimum: 0.01,
105
- maximum: 10000,
106
- multipleOf: 0.01
107
- }),
108
- default: null
109
- },
110
- mode: {
111
- description: 'The desired rounding mode',
112
- type: 'string',
113
- 'enum': [
114
- 'up',
115
- 'down',
116
- 'bankers'
117
- ],
118
- default: 'bankers'
119
- },
120
- source: {
121
- description: 'The source for defining the fraction',
122
- type: 'string',
123
- 'enum': [
124
- 'cash_units', // lowest cash unit will be used instead of fraction
125
- 'fraction' // fraction must be present and will be used
126
- ],
127
- default: 'cash_units'
128
- }
97
+ roundings: oneOf({
98
+ description: 'Defines the fractional rounding behavior of currencies (e.g. to 0.05 CHF)',
99
+ type: 'array',
100
+ items: {
101
+ type: 'object',
102
+ additionalProperties: false,
103
+ properties: {
104
+ currency: {
105
+ type: 'string',
106
+ description: 'The three letter [ISO currency](https://en.wikipedia.org/wiki/ISO_4217) of this item.',
107
+ example: '',
108
+ minLength: 3,
109
+ maxLength: 3
110
+ },
111
+ enabled: {
112
+ description: 'States if rounding information should be used for this currency',
113
+ type: 'boolean',
114
+ default: true
115
+ },
116
+ fraction: {
117
+ ...oneOf({
118
+ description: 'The smallest fraction to round to when source equals \'fixed\'.',
119
+ type: 'number',
120
+ minimum: 0.01,
121
+ maximum: 10000,
122
+ multipleOf: 0.01
123
+ }),
124
+ default: null
125
+ },
126
+ mode: {
127
+ description: 'The desired rounding mode',
128
+ type: 'string',
129
+ 'enum': [
130
+ 'up',
131
+ 'down',
132
+ 'bankers'
133
+ ],
134
+ default: 'bankers'
135
+ },
136
+ source: {
137
+ description: 'The source for defining the fraction',
138
+ type: 'string',
139
+ 'enum': [
140
+ 'cash_units', // lowest cash unit will be used instead of fraction
141
+ 'fraction' // fraction must be present and will be used
142
+ ],
143
+ default: 'cash_units'
129
144
  }
130
145
  }
131
- })
132
- },
146
+ }
147
+ }),
133
148
  fa_transit_account: oneOf({
134
149
  description: 'Used to be "settings_old.fa_transit_account"',
135
150
  type: 'string'
@@ -248,6 +248,12 @@ module.exports = {
248
248
  ...oneOf({
249
249
  type: 'object',
250
250
  properties: {
251
+ expense_account: {
252
+ type: 'string',
253
+ format: 'uuid',
254
+ example: '09a9a469-c16b-4b54-835d-692d05d218f9',
255
+ description: 'The Tillhub expense account resource'
256
+ },
251
257
  expense_account_name: {
252
258
  type: 'string',
253
259
  example: '2 Testausgabe',
@@ -270,6 +276,12 @@ module.exports = {
270
276
  example: '1338',
271
277
  description: 'Custom id of the used expense account'
272
278
  },
279
+ balance_client_id: {
280
+ type: 'string',
281
+ example: 'c1265a62-62e9-46de-9df7-4d3009c46068',
282
+ maxLength: 128,
283
+ description: 'The client_id of the balance this expense is part of.'
284
+ },
273
285
  safe_id: {
274
286
  type: 'string',
275
287
  format: 'uuid',
@@ -404,6 +416,12 @@ module.exports = {
404
416
  This is is commonly refered to as 'transaction number' plus possibly any extension as string.
405
417
  `
406
418
  }),
419
+ _balance_client_id: oneOf({
420
+ type: 'string',
421
+ example: 'c1265a62-62e9-46de-9df7-4d3009c46068',
422
+ maxLength: 128,
423
+ description: 'The client_id of the balance this transaction is part of.'
424
+ }),
407
425
  _staff: oneOf({
408
426
  type: 'string',
409
427
  format: 'uuid',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tillhub/schemas",
3
- "version": "6.147.0",
3
+ "version": "6.148.0",
4
4
  "private": false,
5
5
  "description": "All Tillhub API OpenAPI 3 compatible JSON Schemas.",
6
6
  "main": "./lib/index.js",
@@ -1,7 +1,7 @@
1
1
  const test = require('tape')
2
2
  const validate = require('../helpers/validate-schema')
3
3
 
4
- test('Balances: create schema validation', function (t) {
4
+ test('Balances: v1: create schema validation', function (t) {
5
5
  t.plan(2)
6
6
  const createRequest = require('../../lib/v1/balances').create.request
7
7
  const { valid, error } = validate(createRequest)
@@ -9,3 +9,30 @@ test('Balances: create schema validation', function (t) {
9
9
  t.error(error, 'should not get any error')
10
10
  t.end()
11
11
  })
12
+
13
+ test('Balances: v1: create response schema', function (t) {
14
+ t.plan(2)
15
+ const createResponse = require('../../lib/v1/balances').create.response
16
+ const { valid, error } = validate(createResponse)
17
+ t.ok(valid, 'response schema is valid')
18
+ t.error(error, 'should not get any error')
19
+ t.end()
20
+ })
21
+
22
+ test('Balances: v1: legacy: create request schema', function (t) {
23
+ t.plan(2)
24
+ const createRequest = require('../../lib/v1/balances').legacy.create.request
25
+ const { valid, error } = validate(createRequest)
26
+ t.ok(valid, 'create schema is valid')
27
+ t.error(error, 'should not get any error')
28
+ t.end()
29
+ })
30
+
31
+ test('Balances: v1: legacy: create response schema', function (t) {
32
+ t.plan(2)
33
+ const createResponse = require('../../lib/v1/balances').legacy.create.response
34
+ const { valid, error } = validate(createResponse)
35
+ t.ok(valid, 'response schema is valid')
36
+ t.error(error, 'should not get any error')
37
+ t.end()
38
+ })