@tillhub/schemas 6.458.0 → 6.460.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.
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
module.exports.request = {
|
|
2
|
+
$id: 'https://schemas.tillhub.com/v0/analytics.reports.payment_options.get.all.query.schema.json',
|
|
3
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
4
|
+
type: 'object',
|
|
5
|
+
additionalProperties: true,
|
|
6
|
+
required: [],
|
|
7
|
+
properties: {
|
|
8
|
+
cursor_field: {
|
|
9
|
+
type: 'string',
|
|
10
|
+
description: 'which column to cursor on. To indicate the sorting order, add a `+` or `-` for asc/desc order'
|
|
11
|
+
},
|
|
12
|
+
legacy: {
|
|
13
|
+
type: 'boolean',
|
|
14
|
+
desciption: 'flags to us legacy table fr_transaction_payment'
|
|
15
|
+
},
|
|
16
|
+
format: {
|
|
17
|
+
type: 'string',
|
|
18
|
+
description: 'to get data in any other format then JSON straight away, you can set `format=csv`'
|
|
19
|
+
},
|
|
20
|
+
context_locations: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
description: 'context locations id as a filter for transactions'
|
|
23
|
+
},
|
|
24
|
+
branch_number: {
|
|
25
|
+
oneOf: [
|
|
26
|
+
{
|
|
27
|
+
type: 'integer',
|
|
28
|
+
description: 'Filter by branch number if legacy parameter set or filter by branch UUID otherwise'
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: 'string',
|
|
32
|
+
format: 'uuid',
|
|
33
|
+
example: '9d110eb2-2245-4e14-9574-49b502f3a9b3'
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
branch_group: {
|
|
38
|
+
oneOf: [
|
|
39
|
+
{
|
|
40
|
+
type: 'string',
|
|
41
|
+
description: 'filter by branches within branch group. Not applied if branch_number parameter received'
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
type: 'array',
|
|
45
|
+
items: {
|
|
46
|
+
type: 'string'
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
staff_id: {
|
|
52
|
+
type: 'string',
|
|
53
|
+
format: 'uuid',
|
|
54
|
+
description: 'filter by staff id',
|
|
55
|
+
example: '9d110eb2-2245-4e14-9574-49b502f3a9b3'
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -1010,7 +1010,7 @@ module.exports = {
|
|
|
1010
1010
|
required: ['shop_name']
|
|
1011
1011
|
},
|
|
1012
1012
|
payment_links: {
|
|
1013
|
-
description: 'Payment link creation defaults.',
|
|
1013
|
+
description: 'Payment link creation defaults and merchant notifications.',
|
|
1014
1014
|
type: 'object',
|
|
1015
1015
|
additionalProperties: false,
|
|
1016
1016
|
properties: {
|
|
@@ -1023,7 +1023,24 @@ module.exports = {
|
|
|
1023
1023
|
description: 'Default usage mode for LinkPay payment links.',
|
|
1024
1024
|
type: 'string',
|
|
1025
1025
|
enum: ['single_use', 'multi_use']
|
|
1026
|
-
}
|
|
1026
|
+
},
|
|
1027
|
+
merchant_notification: oneOf({
|
|
1028
|
+
description: 'Merchant email notifications for successful payment link authorizations and captures.',
|
|
1029
|
+
type: 'object',
|
|
1030
|
+
additionalProperties: false,
|
|
1031
|
+
required: ['enabled', 'email'],
|
|
1032
|
+
properties: {
|
|
1033
|
+
enabled: {
|
|
1034
|
+
description: 'Enable merchant payment notification emails.',
|
|
1035
|
+
type: 'boolean'
|
|
1036
|
+
},
|
|
1037
|
+
email: {
|
|
1038
|
+
description: 'Recipient email address for merchant payment notifications.',
|
|
1039
|
+
type: 'string',
|
|
1040
|
+
format: 'email'
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
})
|
|
1027
1044
|
}
|
|
1028
1045
|
},
|
|
1029
1046
|
hide_empty_fields: oneOf({
|
package/package.json
CHANGED
|
@@ -34,6 +34,70 @@ test('Configurations: patch schema validation', function (t) {
|
|
|
34
34
|
t.end()
|
|
35
35
|
})
|
|
36
36
|
|
|
37
|
+
;['create', 'update', 'patch'].forEach(function (operation) {
|
|
38
|
+
const request = require('../../lib/v1/configurations')[operation].request
|
|
39
|
+
const validatePayload = ajv.compile(request)
|
|
40
|
+
const payload = function (paymentLinks) {
|
|
41
|
+
return {
|
|
42
|
+
...(operation === 'create' ? { name: 'Payment link configuration', owner: 'self' } : {}),
|
|
43
|
+
settings: { payment_links: paymentLinks }
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
test(`Configurations: ${operation} accepts merchant notification settings`, function (t) {
|
|
48
|
+
const cases = [
|
|
49
|
+
['configured notifications with existing defaults', {
|
|
50
|
+
default_expiry_days: 7,
|
|
51
|
+
default_usage_mode: 'single_use',
|
|
52
|
+
merchant_notification: { enabled: true, email: 'merchant@example.com' }
|
|
53
|
+
}],
|
|
54
|
+
['omitted notifications with existing defaults', {
|
|
55
|
+
default_expiry_days: 14,
|
|
56
|
+
default_usage_mode: 'multi_use'
|
|
57
|
+
}],
|
|
58
|
+
['omitted notifications and defaults', {}],
|
|
59
|
+
['null notifications', { merchant_notification: null }],
|
|
60
|
+
['disabled notifications with an email', {
|
|
61
|
+
merchant_notification: { enabled: false, email: 'merchant@example.com' }
|
|
62
|
+
}]
|
|
63
|
+
]
|
|
64
|
+
t.plan(cases.length)
|
|
65
|
+
cases.forEach(function ([description, paymentLinks]) {
|
|
66
|
+
const valid = validatePayload(payload(paymentLinks))
|
|
67
|
+
t.ok(valid, `${description}: ${ajv.errorsText(validatePayload.errors)}`)
|
|
68
|
+
})
|
|
69
|
+
t.end()
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
test(`Configurations: ${operation} rejects invalid merchant notification settings`, function (t) {
|
|
73
|
+
const cases = [
|
|
74
|
+
['enabled-only notifications', { enabled: true }],
|
|
75
|
+
['disabled notifications without an email', { enabled: false }],
|
|
76
|
+
['email-only notifications', { email: 'merchant@example.com' }],
|
|
77
|
+
['empty notifications', {}],
|
|
78
|
+
['a string enabled flag', { enabled: 'true', email: 'merchant@example.com' }],
|
|
79
|
+
['a null enabled flag', { enabled: null, email: 'merchant@example.com' }],
|
|
80
|
+
['a null email', { enabled: true, email: null }],
|
|
81
|
+
['a malformed email', { enabled: true, email: 'not-an-email' }],
|
|
82
|
+
['a numeric email', { enabled: true, email: 123 }],
|
|
83
|
+
['a boolean email', { enabled: true, email: false }],
|
|
84
|
+
['an object email', { enabled: true, email: {} }],
|
|
85
|
+
['an array email', { enabled: true, email: ['merchant@example.com'] }],
|
|
86
|
+
['an unknown notification property', {
|
|
87
|
+
enabled: true,
|
|
88
|
+
email: 'merchant@example.com',
|
|
89
|
+
recipient: 'merchant@example.com'
|
|
90
|
+
}],
|
|
91
|
+
['a non-object notification block', 'enabled']
|
|
92
|
+
]
|
|
93
|
+
t.plan(cases.length)
|
|
94
|
+
cases.forEach(function ([description, merchantNotification]) {
|
|
95
|
+
t.notOk(validatePayload(payload({ merchant_notification: merchantNotification })), description)
|
|
96
|
+
})
|
|
97
|
+
t.end()
|
|
98
|
+
})
|
|
99
|
+
})
|
|
100
|
+
|
|
37
101
|
test('Configurations: opening_hours_exceptions accepts Open all-day, Open hours, and Closed full-day', function (t) {
|
|
38
102
|
t.plan(1)
|
|
39
103
|
const valid = validateUpdatePayload({
|