@tillhub/schemas 6.263.0 → 6.265.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,28 @@
1
+ # [6.265.0](https://github.com/tillhub/schemas/compare/v6.264.0...v6.265.0) (2023-10-16)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **staff:** put array length validation in place, now only array of length 7 is valid ([b4ac285](https://github.com/tillhub/schemas/commit/b4ac285))
7
+ * **transactions_v1:** import of external module was not pointing to correct path ([1418414](https://github.com/tillhub/schemas/commit/1418414))
8
+
9
+
10
+ ### Features
11
+
12
+ * **configurations:** carts ([78f6819](https://github.com/tillhub/schemas/commit/78f6819))
13
+ * **configurations:** payments ([2dd438d](https://github.com/tillhub/schemas/commit/2dd438d))
14
+ * **customers:** rename price_book_id to price_book ([#881](https://github.com/tillhub/schemas/issues/881)) ([17c4f3b](https://github.com/tillhub/schemas/commit/17c4f3b))
15
+ * **encryption:** adjust ([3c8c5e4](https://github.com/tillhub/schemas/commit/3c8c5e4))
16
+ * **shift_plan:** change schema a bit, move it out of branch and treat it as stand alone entity ([3bc439f](https://github.com/tillhub/schemas/commit/3bc439f))
17
+ * **transactions:** legacy ([23a8964](https://github.com/tillhub/schemas/commit/23a8964)), closes [Security#2](https://github.com/Security/issues/2)
18
+
19
+ # [6.264.0](https://github.com/tillhub/schemas/compare/v6.263.0...v6.264.0) (2023-09-28)
20
+
21
+
22
+ ### Features
23
+
24
+ * **branches:** add schema for validating shift_plan objects that are part of branch table ([2230a83](https://github.com/tillhub/schemas/commit/2230a83))
25
+
1
26
  # [6.263.0](https://github.com/tillhub/schemas/compare/v6.262.0...v6.263.0) (2023-09-21)
2
27
 
3
28
 
@@ -426,8 +426,8 @@ module.exports = {
426
426
  format: 'uuid'
427
427
  })
428
428
  },
429
- price_book_id: {
430
- description: 'in cases where the customer is going to have personal pricebook (like for discounts in pharmacy by personal insurance number), price_book_id is required',
429
+ price_book: {
430
+ description: 'in cases where the customer is going to have personal pricebook (like for discounts in pharmacy by personal insurance number), price_book is required',
431
431
  ...oneOf({
432
432
  type: 'string',
433
433
  format: 'uuid'
package/lib/v0/index.js CHANGED
@@ -76,5 +76,6 @@ module.exports.product_addon_groups = require('./product_addon_groups')
76
76
  module.exports.configurations = require('./configurations')
77
77
  module.exports.service_categories = require('./service_categories')
78
78
  module.exports.services = require('./services')
79
+ module.exports.shift_plan = require('./shift_plan')
79
80
 
80
81
  // hygen:injection - Please, don't delete this line: when running the cli for schema resources the new routes will be automatically added here.
@@ -0,0 +1,37 @@
1
+ module.exports = {
2
+ shift_plan_enabled: {
3
+ type: 'boolean'
4
+ },
5
+ shift_plan: {
6
+ type: 'array',
7
+ items: {
8
+ type: 'object',
9
+ additionalProperties: false,
10
+ properties: {
11
+ staff_member_id: {
12
+ type: 'string',
13
+ format: 'uuid'
14
+ },
15
+ date: {
16
+ type: 'string',
17
+ format: 'date'
18
+ },
19
+ plan: {
20
+ type: 'array',
21
+ items: {
22
+ type: 'object',
23
+ additionalProperties: false,
24
+ properties: {
25
+ start: {
26
+ type: 'string'
27
+ },
28
+ end: {
29
+ type: 'string'
30
+ }
31
+ }
32
+ }
33
+ }
34
+ }
35
+ }
36
+ }
37
+ }
@@ -0,0 +1,2 @@
1
+ module.exports.update = require('./update')
2
+ module.exports.read = require('./read')
@@ -0,0 +1,19 @@
1
+ const commonResponse = require('../../common/response')
2
+ const base = require('./base')
3
+
4
+ module.exports.response = {
5
+ response: {
6
+ $id: 'https://schemas.tillhub.com/v0/branches.shift_plan.read.response.schema.json',
7
+ $schema: 'http://json-schema.org/draft-07/schema#',
8
+ additionalProperties: false,
9
+ ...commonResponse({
10
+ resultItems: {
11
+ type: 'object',
12
+ additionalProperties: false,
13
+ properties: {
14
+ ...base
15
+ }
16
+ }
17
+ })
18
+ }
19
+ }
@@ -0,0 +1,29 @@
1
+ const commonResponse = require('../../common/response')
2
+ const base = require('./base')
3
+
4
+ module.exports.request = {
5
+ $id: 'https://schemas.tillhub.com/v0/branches.shift_plan.update.request.schema.json',
6
+ $schema: 'http://json-schema.org/draft-07/schema#',
7
+ additionalProperties: false,
8
+ type: 'object',
9
+ properties: {
10
+ ...base
11
+ }
12
+ }
13
+
14
+ module.exports.response = {
15
+ response: {
16
+ $id: 'https://schemas.tillhub.com/v0/branches.shift_plan.update.response.schema.json',
17
+ $schema: 'http://json-schema.org/draft-07/schema#',
18
+ additionalProperties: false,
19
+ ...commonResponse({
20
+ resultItems: {
21
+ type: 'object',
22
+ additionalProperties: false,
23
+ properties: {
24
+ ...base
25
+ }
26
+ }
27
+ })
28
+ }
29
+ }
@@ -525,6 +525,8 @@ module.exports = {
525
525
  individual_work_plan: {
526
526
  description: 'Custom schedule for this staff member.',
527
527
  type: 'array',
528
+ minItems: 7,
529
+ maxItems: 7,
528
530
  items: {
529
531
  type: 'object',
530
532
  properties: {
@@ -45,18 +45,21 @@ module.exports = oneOf({
45
45
  description: 'In case of refund - specifies if modicications are forbidden',
46
46
  type: 'boolean',
47
47
  default: false
48
- }),
49
- items: oneOf({
50
- type: 'object',
51
- additionalProperties: false,
52
- properties: {
53
- allow_editing: oneOf({
54
- description: 'In case of refund items - specifies if quantity and price can be edited',
55
- type: 'boolean',
56
- default: false
57
- })
58
- }
59
- })
48
+ }) // ,
49
+ // *
50
+ // * ### the follwing is already defined and used from 'configurations.settings.revision_safety.allow_editing_refund_items' ###
51
+ // *
52
+ // items: oneOf({
53
+ // type: 'object',
54
+ // additionalProperties: false,
55
+ // properties: {
56
+ // allow_editing: oneOf({
57
+ // description: 'In case of refund items - specifies if quantity and price can be edited',
58
+ // type: 'boolean',
59
+ // default: false
60
+ // })
61
+ // }
62
+ // })
60
63
  }
61
64
  })
62
65
  }
@@ -40,6 +40,16 @@ module.exports = {
40
40
  description: 'If true, allows entering values for split payments that are higher than the remaining price - thus potentially handing back cash (legacy behavior).',
41
41
  default: false,
42
42
  type: 'boolean'
43
+ }),
44
+ allow_change_on_undefined: oneOf({
45
+ description: 'If true, allows entering values for split payments that are higher than the remaining price - thus potentially handing back cash (legacy behavior).',
46
+ default: false,
47
+ type: 'boolean'
48
+ }),
49
+ trigger_amount_on_undefined: oneOf({
50
+ description: 'If true, will ask for the amount on undefined payment types (rather than setting the total price of the cart).',
51
+ default: false,
52
+ type: 'boolean'
43
53
  })
44
54
  }
45
55
  }
@@ -622,140 +622,5 @@ module.exports = {
622
622
  type: 'number'
623
623
  }
624
624
  }
625
- }),
626
- external_rewards: oneOf({
627
- type: 'object',
628
- description: 'Necessary data to handle an external reward triggered by a transaction.',
629
- additionalProperties: false,
630
- properties: {
631
- coop: oneOf({
632
- type: 'object',
633
- description: 'Delta object for Swiss Coop',
634
- properties: {
635
- used_campaign_multiplier: {
636
- type: 'integer',
637
- description: 'Tillhub internal storage to calculate refunds properly.',
638
- minimum: 1,
639
- maximum: 100,
640
- default: 1
641
- },
642
- current_balance: oneOf({
643
- type: 'integer',
644
- description: 'Current balance if known via the online validation process.',
645
- minimum: 0,
646
- maximum: 120000,
647
- default: null
648
- }),
649
- supercard: {
650
- type: 'string',
651
- description: 'Supercard number, always required.',
652
- example: '762250103984932838'
653
- },
654
- app_id: oneOf({
655
- type: 'string',
656
- description: 'GS1 AppID, Null for EAN13 cards.',
657
- example: '000001'
658
- }),
659
- guid: oneOf({
660
- type: 'string',
661
- description: 'GS1 Card GUID, Null for EAN13 cards.',
662
- example: '50269DCFF3AD18A0E10080000A050151'
663
- }),
664
- client_info: {
665
- type: 'object',
666
- description: 'Info about the store / Tillhub branch.',
667
- properties: {
668
- store_eain: {
669
- type: 'string',
670
- description: 'Coop identity of this Tillhub branch.',
671
- example: '7640147960015'
672
- },
673
- store_name: {
674
- type: 'string',
675
- maxLength: 128,
676
- description: 'Name of this Tillhub branch.',
677
- example: 'Coop Supermarkt Riehen Schmiedgasse'
678
- },
679
- store_sap_number: oneOf({
680
- type: 'string',
681
- pattern: '^[0-9]{4}$',
682
- description: 'Tillhub branch SAP number if available.',
683
- example: '000001'
684
- }),
685
- terminal_id: oneOf({
686
- type: 'string',
687
- description: 'Tillhub custom register name.',
688
- example: 'Kasse 1'
689
- })
690
- }
691
- },
692
- purchase_info: {
693
- type: 'object',
694
- description: 'Info about the store / Tillhub branch.',
695
- properties: {
696
- bonus_points: oneOf({
697
- type: 'integer',
698
- description: 'Bonus Points to be booked - Free Points preferred, use NULL here untill specified otherwise (2023-07).',
699
- minimum: -12000,
700
- maximum: 12000,
701
- default: null
702
- }),
703
- free_points: {
704
- type: 'integer',
705
- description: 'Free Points - preferrably used over Bonus Points. (Current points x campaign multiplier) - refund points',
706
- minimum: -12000,
707
- maximum: 12000,
708
- default: 0
709
- },
710
- timestamp: {
711
- type: 'string',
712
- format: 'date-time',
713
- example: '2018-01-29T14:55:05.000Z',
714
- description: 'Date of the purchase = transaction date'
715
- },
716
- timestamp_end: {
717
- type: 'string',
718
- format: 'date-time',
719
- example: '2018-01-29T14:55:05.000Z',
720
- description: 'Date of the purchase = transaction date'
721
- },
722
- total_items: {
723
- type: 'integer',
724
- description: 'Number of cart items in the transaction that are not campaign products or vouchers.',
725
- minimum: 0,
726
- maximum: 99
727
- },
728
- employee_flag: {
729
- type: 'boolean',
730
- description: 'Marks a Coop employee, not yet relevantm, send \'false\'.',
731
- default: false
732
- },
733
- total_amount: {
734
- type: 'integer',
735
- description: 'Total value of the sale in Swiss Rappen including ALL cart items, including refunds, excluding tips.',
736
- minimum: -2400000,
737
- maximum: 2400000
738
- },
739
- point_base_amount: {
740
- type: 'integer',
741
- description: stripIndents`
742
- 'Total value of the sale that qualifies for superpoints (campaign items, tips and vouchers excluded)
743
-
744
- as long as net items are not supported this is identical to \'total_amount\'.
745
- `,
746
- minimum: -2400000,
747
- maximum: 2400000
748
- },
749
- bon_nr: {
750
- type: 'integer',
751
- description: 'Tillhub transaction number.',
752
- minimum: 0,
753
- maximum: 32000
754
- }
755
- }
756
- }
757
- }
758
- })
759
- }
760
625
  })
761
626
  }
@@ -1,4 +1,5 @@
1
1
  const { getEvent } = require('../../../common/webhooks')
2
+ const { oneOf } = require('../../../helpers/payload-or-null')
2
3
  const statusCreate = require('../../statuses/create.request')
3
4
  const base = require('./base')
4
5
  const response = require('./response')
@@ -33,7 +34,23 @@ module.exports.request = {
33
34
  },
34
35
  status: {
35
36
  ...statusCreate
36
- }
37
+ },
38
+ external_rewards: oneOf({
39
+ type: 'object',
40
+ description: 'Payback data that should be decrypted.',
41
+ additionalProperties: false,
42
+ properties: {
43
+ payback_data: {
44
+ type: 'string', // Base64
45
+ maxLength: 16384,
46
+ examples: [
47
+ 'MEQCIAy4P9k+7x9saDO0uRZ4El8QwN+qTgYiv1DIaJIMWRiuAiAt+saFDGjK2Yi5Cxgy7PprXQ5O0seRgx4ltdpW9REvwA==',
48
+ 'AUUwulkISDlfOMNro8Lx4aepbWinXgiHwGt9/xfb+WmyfAXnzAeBQmCfsRPheW/LKDlWVQWFUdvl7mXsh/vGx1vSLRiq6jn9qmL1fSGFRCrIos1U7X6dWxCr3VVZFXMILey6iuNw9i7HwNFSpyrpVOXFSDCdmKtYDfMMWD0JDAsKSFUTEbCay2yCtDEIOt/sELi6uiRwUoifztlTIt7wDNPdFrGxgJF17d2AJ4ah5V8kGTAzFygjGT8gCfTUbumKtGAJsvou+NqHAp4bb9K8+fTVG5rxw/OWux5GXmbtcxZQ3RX5IGurcsUv/kXFK+uGj7uUsCyEfq71uCxVs04Kig=='
49
+ ],
50
+ description: 'Payback data that should be decrypted..'
51
+ }
52
+ }
53
+ })
37
54
  }
38
55
  }
39
56
 
@@ -1,3 +1,4 @@
1
+ const { stripIndents } = require('common-tags')
1
2
  const { oneOf } = require('../../../helpers/payload-or-null')
2
3
  const dateObject = require('../../../common/date_object')
3
4
  const statusResponse = require('../../statuses/response')
@@ -59,6 +60,164 @@ module.exports = {
59
60
  },
60
61
  status: {
61
62
  ...statusResponse
63
+ },
64
+ external_rewards: {
65
+ anyOf: [
66
+ {
67
+ type: 'object',
68
+ description: 'If data can not be decrypted - they are stored here - Base64.',
69
+ additionalProperties: false,
70
+ properties: {
71
+ payback_data: {
72
+ type: 'string', // Base64
73
+ maxLength: 16384,
74
+ examples: [
75
+ 'MEQCIAy4P9k+7x9saDO0uRZ4El8QwN+qTgYiv1DIaJIMWRiuAiAt+saFDGjK2Yi5Cxgy7PprXQ5O0seRgx4ltdpW9REvwA==',
76
+ 'AUUwulkISDlfOMNro8Lx4aepbWinXgiHwGt9/xfb+WmyfAXnzAeBQmCfsRPheW/LKDlWVQWFUdvl7mXsh/vGx1vSLRiq6jn9qmL1fSGFRCrIos1U7X6dWxCr3VVZFXMILey6iuNw9i7HwNFSpyrpVOXFSDCdmKtYDfMMWD0JDAsKSFUTEbCay2yCtDEIOt/sELi6uiRwUoifztlTIt7wDNPdFrGxgJF17d2AJ4ah5V8kGTAzFygjGT8gCfTUbumKtGAJsvou+NqHAp4bb9K8+fTVG5rxw/OWux5GXmbtcxZQ3RX5IGurcsUv/kXFK+uGj7uUsCyEfq71uCxVs04Kig=='
77
+ ],
78
+ description: 'If payback data can not be decrypted - they are stored here - Base64.'
79
+ }
80
+ }
81
+ },
82
+ {
83
+ type: 'object',
84
+ description: 'Necessary data to handle an external reward triggered by a transaction.',
85
+ additionalProperties: false,
86
+ properties: {
87
+ coop: oneOf({
88
+ type: 'object',
89
+ description: 'Delta object for Swiss Coop',
90
+ properties: {
91
+ used_campaign_multiplier: {
92
+ type: 'integer',
93
+ description: 'Tillhub internal storage to calculate refunds properly.',
94
+ minimum: 1,
95
+ maximum: 100,
96
+ default: 1
97
+ },
98
+ current_balance: oneOf({
99
+ type: 'integer',
100
+ description: 'Current balance if known via the online validation process.',
101
+ minimum: 0,
102
+ maximum: 120000,
103
+ default: null
104
+ }),
105
+ supercard: {
106
+ type: 'string',
107
+ description: 'Supercard number, always required.',
108
+ example: '762250103984932838'
109
+ },
110
+ app_id: oneOf({
111
+ type: 'string',
112
+ description: 'GS1 AppID, Null for EAN13 cards.',
113
+ example: '000001'
114
+ }),
115
+ guid: oneOf({
116
+ type: 'string',
117
+ description: 'GS1 Card GUID, Null for EAN13 cards.',
118
+ example: '50269DCFF3AD18A0E10080000A050151'
119
+ }),
120
+ client_info: {
121
+ type: 'object',
122
+ description: 'Info about the store / Tillhub branch.',
123
+ properties: {
124
+ store_eain: {
125
+ type: 'string',
126
+ description: 'Coop identity of this Tillhub branch.',
127
+ example: '7640147960015'
128
+ },
129
+ store_name: {
130
+ type: 'string',
131
+ maxLength: 128,
132
+ description: 'Name of this Tillhub branch.',
133
+ example: 'Coop Supermarkt Riehen Schmiedgasse'
134
+ },
135
+ store_sap_number: oneOf({
136
+ type: 'string',
137
+ pattern: '^[0-9]{4}$',
138
+ description: 'Tillhub branch SAP number if available.',
139
+ example: '000001'
140
+ }),
141
+ terminal_id: oneOf({
142
+ type: 'string',
143
+ description: 'Tillhub custom register name.',
144
+ example: 'Kasse 1'
145
+ })
146
+ }
147
+ },
148
+ purchase_info: {
149
+ type: 'object',
150
+ description: 'Info about the store / Tillhub branch.',
151
+ properties: {
152
+ bonus_points: oneOf({
153
+ type: 'integer',
154
+ description: 'Bonus Points to be booked - Free Points preferred, use NULL here untill specified otherwise (2023-07).',
155
+ minimum: -12000,
156
+ maximum: 12000,
157
+ default: null
158
+ }),
159
+ free_points: {
160
+ type: 'integer',
161
+ description: 'Free Points - preferrably used over Bonus Points. (Current points x campaign multiplier) - refund points',
162
+ minimum: -12000,
163
+ maximum: 12000,
164
+ default: 0
165
+ },
166
+ timestamp: {
167
+ type: 'string',
168
+ format: 'date-time',
169
+ example: '2018-01-29T14:55:05.000Z',
170
+ description: 'Date of the purchase = transaction date'
171
+ },
172
+ timestamp_end: {
173
+ type: 'string',
174
+ format: 'date-time',
175
+ example: '2018-01-29T14:55:05.000Z',
176
+ description: 'Date of the purchase = transaction date'
177
+ },
178
+ total_items: {
179
+ type: 'integer',
180
+ description: 'Number of cart items in the transaction that are not campaign products or vouchers.',
181
+ minimum: 0,
182
+ maximum: 99
183
+ },
184
+ employee_flag: {
185
+ type: 'boolean',
186
+ description: 'Marks a Coop employee, not yet relevantm, send \'false\'.',
187
+ default: false
188
+ },
189
+ total_amount: {
190
+ type: 'integer',
191
+ description: 'Total value of the sale in Swiss Rappen including ALL cart items, including refunds, excluding tips.',
192
+ minimum: -2400000,
193
+ maximum: 2400000
194
+ },
195
+ point_base_amount: {
196
+ type: 'integer',
197
+ description: stripIndents`
198
+ 'Total value of the sale that qualifies for superpoints (campaign items, tips and vouchers excluded)
199
+
200
+ as long as net items are not supported this is identical to \'total_amount\'.
201
+ `,
202
+ minimum: -2400000,
203
+ maximum: 2400000
204
+ },
205
+ bon_nr: {
206
+ type: 'integer',
207
+ description: 'Tillhub transaction number.',
208
+ minimum: 0,
209
+ maximum: 32000
210
+ }
211
+ }
212
+ }
213
+ }
214
+ })
215
+ }
216
+ },
217
+ {
218
+ type: 'null'
219
+ }
220
+ ]
62
221
  }
63
222
  }
64
223
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tillhub/schemas",
3
- "version": "6.263.0",
3
+ "version": "6.265.0",
4
4
  "private": false,
5
5
  "description": "All Tillhub API OpenAPI 3 compatible JSON Schemas.",
6
6
  "main": "./lib/index.js",
@@ -0,0 +1,11 @@
1
+ const test = require('tape')
2
+ const validate = require('../helpers/validate-schema')
3
+
4
+ test('Shift Plan V0: update schema validation', function (t) {
5
+ t.plan(2)
6
+ const updateRequest = require('../../lib/v0/shift_plan').update.request
7
+ const { valid, error } = validate(updateRequest)
8
+ t.ok(valid, 'update schema is valid')
9
+ t.error(error, 'should not get any error')
10
+ t.end()
11
+ })