@tillhub/schemas 6.142.0 → 6.145.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 +21 -0
- package/lib/common/response.js +63 -25
- package/lib/v0/promotions/base.js +7 -1
- package/lib/v1/customers/index.js +5 -0
- package/lib/v1/customers/read.js +23 -0
- package/lib/v1/index.js +1 -0
- package/lib/v1/transactions/components/embedded/terminal/base.js +7 -0
- package/package.json +1 -1
- package/test/customers/customers.v1.spec.js +11 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
# [6.145.0](https://github.com/tillhub/schemas/compare/v6.144.0...v6.145.0) (2022-06-22)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **promotions:** add version ([6d6dacd](https://github.com/tillhub/schemas/commit/6d6dacd))
|
|
7
|
+
|
|
8
|
+
# [6.144.0](https://github.com/tillhub/schemas/compare/v6.143.0...v6.144.0) (2022-06-08)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **transaction:** added pay id ([d260db4](https://github.com/tillhub/schemas/commit/d260db4))
|
|
14
|
+
|
|
15
|
+
# [6.143.0](https://github.com/tillhub/schemas/compare/v6.142.0...v6.143.0) (2022-06-02)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* **customers:** support customers v1 'read.all' ([470149f](https://github.com/tillhub/schemas/commit/470149f))
|
|
21
|
+
|
|
1
22
|
# [6.142.0](https://github.com/tillhub/schemas/compare/v6.141.0...v6.142.0) (2022-06-01)
|
|
2
23
|
|
|
3
24
|
|
package/lib/common/response.js
CHANGED
|
@@ -1,26 +1,48 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
const cursors = {
|
|
2
|
+
'first-self': {
|
|
3
|
+
type: 'object',
|
|
4
|
+
description: 'Optional cursor in paginated API calls. The cursor next field must be called as fully quantifiable URI in order to hit the next if available.',
|
|
5
|
+
additionalProperties: false,
|
|
6
|
+
required: ['self'],
|
|
7
|
+
properties: {
|
|
8
|
+
next: {
|
|
9
|
+
type: 'string',
|
|
10
|
+
format: 'uri',
|
|
11
|
+
description: 'The URI pointing to the next page.',
|
|
12
|
+
example: 'https://api.tillhub.com/api/v1/products/061f91a3-eba2-40b8-9a76-115189d6741e?cursor=2018-07-02T21%3A47%3A44.382Z&size=10&cursor_field=updated_at'
|
|
13
|
+
},
|
|
14
|
+
first: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
format: 'uri',
|
|
17
|
+
description: 'The URI pointing to the the first page.',
|
|
18
|
+
example: 'https://api.tillhub.com/api/v1/products/061f91a3-eba2-40b8-9a76-115189d6741e?cursor=2018-07-02T21%3A47%3A44.382Z&size=10&cursor_field=updated_at'
|
|
19
|
+
},
|
|
20
|
+
self: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
format: 'uri',
|
|
23
|
+
description: 'The URI pointing to this page.',
|
|
24
|
+
example: 'https://api.tillhub.com/api/v1/products/061f91a3-eba2-40b8-9a76-115189d6741e?cursor=2018-07-02T21%3A47%3A44.382Z&size=10&cursor_field=updated_at'
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
'current-next': {
|
|
29
|
+
type: 'object',
|
|
30
|
+
description: 'Optional cursor in paginated API calls. The cursor provides URIs in order to get near pages if available.',
|
|
31
|
+
additionalProperties: false,
|
|
32
|
+
required: ['current'],
|
|
33
|
+
properties: {
|
|
34
|
+
current: {
|
|
35
|
+
type: 'string',
|
|
36
|
+
format: 'uri',
|
|
37
|
+
description: 'The URI pointing to current page.',
|
|
38
|
+
example: 'https://api.tillhub.com/api/v1/products/061f91a3-eba2-40b8-9a76-115189d6741e?size=10&cursor=5694834'
|
|
39
|
+
},
|
|
40
|
+
next: {
|
|
41
|
+
type: 'string',
|
|
42
|
+
format: 'uri',
|
|
43
|
+
description: 'The URI pointing to the next page.',
|
|
44
|
+
example: 'https://api.tillhub.com/api/v1/products/061f91a3-eba2-40b8-9a76-115189d6741e?size=10&cursor=5694847'
|
|
45
|
+
}
|
|
24
46
|
}
|
|
25
47
|
}
|
|
26
48
|
}
|
|
@@ -30,7 +52,14 @@ const cursor = {
|
|
|
30
52
|
* @param {Object} payload
|
|
31
53
|
* @param {Object} options
|
|
32
54
|
*/
|
|
33
|
-
function commonResponse ({
|
|
55
|
+
function commonResponse ({
|
|
56
|
+
resultItems,
|
|
57
|
+
results,
|
|
58
|
+
additionals
|
|
59
|
+
} = {}, {
|
|
60
|
+
hasCursor = false,
|
|
61
|
+
cursorType = ''
|
|
62
|
+
} = {}) {
|
|
34
63
|
if (!resultItems) throw new TypeError('common response requires result items to be set')
|
|
35
64
|
|
|
36
65
|
if (!results) {
|
|
@@ -85,7 +114,16 @@ function commonResponse ({ resultItems, results, additionals } = {}, { hasCursor
|
|
|
85
114
|
}
|
|
86
115
|
}
|
|
87
116
|
|
|
88
|
-
if (hasCursor
|
|
117
|
+
if (hasCursor && !cursorType) {
|
|
118
|
+
cursorType = 'first-self'
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (cursorType) {
|
|
122
|
+
if (!cursors[cursorType]) {
|
|
123
|
+
throw new Error(`Unknown cursor type '${cursorType}'`)
|
|
124
|
+
}
|
|
125
|
+
response.properties.cursor = cursors[cursorType]
|
|
126
|
+
}
|
|
89
127
|
|
|
90
128
|
return response
|
|
91
129
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const baseObject = require('../../common/base')
|
|
2
|
+
const commonResponse = require('../../common/response')
|
|
3
|
+
const base = require('../../v0/customers/base')
|
|
4
|
+
const baseExtended = require('../../v0/customers/baseExt')
|
|
5
|
+
|
|
6
|
+
module.exports.all = {
|
|
7
|
+
response: {
|
|
8
|
+
$id: 'https://schemas.tillhub.com/v1/customers.read.all.response.schema.json',
|
|
9
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
10
|
+
additionalProperties: false,
|
|
11
|
+
...commonResponse({
|
|
12
|
+
resultItems: {
|
|
13
|
+
type: 'object',
|
|
14
|
+
additionalProperties: false,
|
|
15
|
+
properties: {
|
|
16
|
+
...baseObject(),
|
|
17
|
+
...base,
|
|
18
|
+
...baseExtended
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}, { cursorType: 'current-next' })
|
|
22
|
+
}
|
|
23
|
+
}
|
package/lib/v1/index.js
CHANGED
|
@@ -2,6 +2,7 @@ module.exports.balances = require('./balances')
|
|
|
2
2
|
module.exports.branches = require('./branches')
|
|
3
3
|
module.exports.carts = require('./carts')
|
|
4
4
|
module.exports.configurations = require('./configurations')
|
|
5
|
+
module.exports.customers = require('./customers')
|
|
5
6
|
module.exports.delivery_notes = require('./delivery_notes')
|
|
6
7
|
module.exports.discounts = require('./discounts')
|
|
7
8
|
module.exports.gastro_orders = require('./gastro_orders')
|
|
@@ -52,6 +52,13 @@ module.exports = {
|
|
|
52
52
|
maxLength: 128,
|
|
53
53
|
description: 'The detected card circuit as reposrted by the terminal (VISA, MasterCard, GiroCard etc.)'
|
|
54
54
|
},
|
|
55
|
+
card_pay_id: {
|
|
56
|
+
default: null,
|
|
57
|
+
type: 'string',
|
|
58
|
+
minLength: 3,
|
|
59
|
+
maxLength: 128,
|
|
60
|
+
description: 'Payment Provider Transaction ID (coming from the CCV / Computop terminal) for successful OPI Terminal Card Payments'
|
|
61
|
+
},
|
|
55
62
|
card_pan: {
|
|
56
63
|
default: null,
|
|
57
64
|
type: 'string',
|
package/package.json
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const test = require('tape')
|
|
2
|
+
const validate = require('../helpers/validate-schema')
|
|
3
|
+
const customers = require('../../lib/v1/customers')
|
|
4
|
+
|
|
5
|
+
test('Customers:v0: read.all schema validation', function (t) {
|
|
6
|
+
const { valid, error } = validate(customers.read.all.response)
|
|
7
|
+
t.ok(valid, 'update response schema is valid')
|
|
8
|
+
t.error(error, 'should not get any error')
|
|
9
|
+
|
|
10
|
+
t.end()
|
|
11
|
+
})
|