diff --git a/lib/v1/transactions/base.js b/lib/v1/transactions/base.js index 1b88d5549..035fc8da6 100644 --- a/lib/v1/transactions/base.js +++ b/lib/v1/transactions/base.js @@ -191,7 +191,7 @@ module.exports = { additionalProperties: false, description: 'Cashier face values.', properties: { - number: { + custom_id: { type: 'string', example: '005' }, diff --git a/lib/v1/transactions/items/base.js b/lib/v1/transactions/items/base.js index 1000939b6..702a40751 100644 --- a/lib/v1/transactions/items/base.js +++ b/lib/v1/transactions/items/base.js @@ -77,6 +77,7 @@ module.exports = { maxLength: 3 }, product: { + default: null, // in case of expenses a product makes no sense ...oneOf({ type: 'string', format: 'uuid', @@ -92,6 +93,15 @@ module.exports = { example: 'AKI-1234566' }) }, + tax: { + default: null, + ...oneOf({ + type: 'string', + format: 'uuid', + example: '9d110eb2-2245-4e14-9574-49b502f3a9b3', + description: 'If a single tax applies (normally VAT) - the applicable Tillhub tax resource with tax accounts.' + }) + }, vat_rate: { type: 'number', description: 'The VAT rate of this item. E.g. 0.19 for 19% German VAT. If no VAT applies, set to 0.', @@ -140,10 +150,12 @@ module.exports = { type: 'string', example: 'a3be1e02-7983-4cba-b7b8-94453c0536ef' }, - order_index: { + position: { description: 'Position of the specific tax.', type: 'integer', - example: '0' + minimum: 0, + maximum: 30, + example: '1' }, rate: { type: 'number', @@ -154,16 +166,21 @@ module.exports = { multipleOf: 0.001 }, // flat values here because we do not want to align another array from context - account: { - description: 'Custom number identifier.', - type: 'string', - example: '440165' + custom_id: { + default: null, + ...oneOf({ + description: 'Custom tax account number identifier.', + type: 'string', + example: '440165' + }) }, display: { - description: 'Custom description.', default: null, - type: 'string', - example: 'Another tax' + ...oneOf({ + description: 'Custom tax account description.', + type: 'string', + example: 'Another tax' + }) } } }), @@ -292,7 +309,7 @@ module.exports = { type: 'object', description: 'Account face values.', properties: { - number: { + custom_id: { description: 'Account number.', // account or expense_account fa_account_number type: 'string', example: '1776' @@ -306,12 +323,32 @@ module.exports = { }), default: null }, + tax: { + ...oneOf({ + type: 'object', + description: 'In case of a single tax (usually VAT) - the tax account face values.', + properties: { + custom_id: { + description: 'Custom number identifier.', + type: 'string', + example: '440165' + }, + display: { + description: 'Custom description.', + default: null, + type: 'string', + example: 'Another tax' + } + } + }), + default: null + }, product: { ...oneOf({ type: 'object', description: 'Product face values.', properties: { - number: { + custom_id: { type: 'string', example: '0032039845' }, @@ -328,7 +365,7 @@ module.exports = { type: 'object', description: 'Product face values.', properties: { - number: { + custom_id: { type: 'string', example: '0032039845' }, @@ -349,7 +386,7 @@ module.exports = { type: 'boolean', example: 'true' }, - number: { + custom_id: { type: 'string', example: '012' }, @@ -369,8 +406,7 @@ module.exports = { } }, required: [ - 'account', - 'product' + 'account' ] }), default: null diff --git a/lib/v1/transactions/payments/base.js b/lib/v1/transactions/payments/base.js index 7a8b8fba7..3437de8a6 100644 --- a/lib/v1/transactions/payments/base.js +++ b/lib/v1/transactions/payments/base.js @@ -48,10 +48,10 @@ module.exports = { default: null, ...oneOf({ type: 'number', - description: 'The position description of the payment item. E.g. positon 1 (2, 3 etc.) in the cart.', - example: '1', - maximum: 32767, - minimum: 0 + description: 'The position of the payment item. E.g. positon 1 (2, 3 etc.) in the transaction.', + minimum: 0, + maximum: 300, + example: '1' }) }, date: { @@ -190,7 +190,7 @@ module.exports = { additionalProperties: false, description: 'Account face values.', properties: { - number: { + custom_id: { type: 'string', example: '1009' } @@ -211,10 +211,7 @@ module.exports = { }), default: null } - }, - required: [ - 'account' - ] + } }), default: null },