nordlet 0.6.3 → 0.6.4

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.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/lib/nordlet/bank/client.rb +19 -16
  3. data/lib/nordlet/billing/client.rb +3 -1
  4. data/lib/nordlet/calendar/types/create_calendar_response_submission.rb +2 -0
  5. data/lib/nordlet/calendar/types/create_calendar_response_submissions_item.rb +2 -0
  6. data/lib/nordlet/calendar/types/get_calendar_response_submission.rb +2 -0
  7. data/lib/nordlet/calendar/types/get_calendar_response_submissions_item.rb +2 -0
  8. data/lib/nordlet/calendar/types/list_calendar_response_rows_item_submission.rb +2 -0
  9. data/lib/nordlet/calendar/types/list_calendar_response_rows_item_submissions_item.rb +2 -0
  10. data/lib/nordlet/calendar/types/submit_calendar_response.rb +2 -0
  11. data/lib/nordlet/calendar/types/update_calendar_response_submission.rb +2 -0
  12. data/lib/nordlet/calendar/types/update_calendar_response_submissions_item.rb +2 -0
  13. data/lib/nordlet/capture/types/documents_confirm_capture_request_lines_item.rb +4 -0
  14. data/lib/nordlet/capture/types/documents_confirm_capture_request_opposite_lines_item.rb +4 -0
  15. data/lib/nordlet/capture/types/documents_confirm_capture_response_invoice_lines_item.rb +8 -0
  16. data/lib/nordlet/capture/types/documents_confirm_capture_response_opposite_invoice_lines_item.rb +8 -0
  17. data/lib/nordlet/cash/client.rb +7 -6
  18. data/lib/nordlet/catalog/client.rb +145 -2
  19. data/lib/nordlet/catalog/types/items_create_catalog_response.rb +2 -0
  20. data/lib/nordlet/catalog/types/items_create_catalog_response_alternative_units_item.rb +21 -0
  21. data/lib/nordlet/catalog/types/items_get_catalog_response.rb +2 -0
  22. data/lib/nordlet/catalog/types/items_get_catalog_response_alternative_units_item.rb +21 -0
  23. data/lib/nordlet/catalog/types/items_list_catalog_response_rows_item.rb +2 -0
  24. data/lib/nordlet/catalog/types/items_list_catalog_response_rows_item_alternative_units_item.rb +21 -0
  25. data/lib/nordlet/catalog/types/items_units_create_catalog_request.rb +21 -0
  26. data/lib/nordlet/catalog/types/items_units_create_catalog_response.rb +27 -0
  27. data/lib/nordlet/catalog/types/items_units_delete_catalog_request.rb +11 -0
  28. data/lib/nordlet/catalog/types/items_units_delete_catalog_response.rb +11 -0
  29. data/lib/nordlet/catalog/types/items_units_list_catalog_request.rb +11 -0
  30. data/lib/nordlet/catalog/types/items_units_list_catalog_response.rb +11 -0
  31. data/lib/nordlet/catalog/types/items_units_list_catalog_response_rows_item.rb +27 -0
  32. data/lib/nordlet/catalog/types/items_units_update_catalog_request.rb +19 -0
  33. data/lib/nordlet/catalog/types/items_units_update_catalog_response.rb +27 -0
  34. data/lib/nordlet/catalog/types/items_update_catalog_response.rb +2 -0
  35. data/lib/nordlet/catalog/types/items_update_catalog_response_alternative_units_item.rb +21 -0
  36. data/lib/nordlet/catalog/types/units_create_catalog_request.rb +2 -0
  37. data/lib/nordlet/catalog/types/units_create_catalog_response.rb +2 -0
  38. data/lib/nordlet/catalog/types/units_list_catalog_response_rows_item.rb +2 -0
  39. data/lib/nordlet/catalog/types/units_update_catalog_request.rb +2 -0
  40. data/lib/nordlet/catalog/types/units_update_catalog_response.rb +2 -0
  41. data/lib/nordlet/declarations/client.rb +46 -5
  42. data/lib/nordlet/declarations/types/lt_ivaz_amend_declarations_request.rb +2 -0
  43. data/lib/nordlet/declarations/types/lt_ivaz_amend_declarations_request_corrections_item.rb +25 -0
  44. data/lib/nordlet/declarations/types/lt_ivaz_amend_declarations_request_corrections_item_lines_item.rb +13 -0
  45. data/lib/nordlet/declarations/types/submissions_confirm_declarations_request.rb +11 -0
  46. data/lib/nordlet/declarations/types/submissions_confirm_declarations_response.rb +71 -0
  47. data/lib/nordlet/declarations/types/submissions_confirm_declarations_response_environment.rb +14 -0
  48. data/lib/nordlet/declarations/types/submissions_confirm_declarations_response_status.rb +16 -0
  49. data/lib/nordlet/declarations/types/submissions_create_declarations_response.rb +2 -0
  50. data/lib/nordlet/declarations/types/submissions_list_declarations_response_rows_item.rb +2 -0
  51. data/lib/nordlet/declarations/types/submissions_mark_declarations_response.rb +2 -0
  52. data/lib/nordlet/declarations/types/submissions_retry_declarations_response.rb +2 -0
  53. data/lib/nordlet/ecommerce/client.rb +12 -9
  54. data/lib/nordlet/fleet/client.rb +8 -4
  55. data/lib/nordlet/fleet/types/vehicles_create_fleet_request.rb +2 -0
  56. data/lib/nordlet/fleet/types/vehicles_create_fleet_response.rb +2 -0
  57. data/lib/nordlet/fleet/types/vehicles_get_fleet_response.rb +2 -0
  58. data/lib/nordlet/fleet/types/vehicles_list_fleet_response_rows_item.rb +2 -0
  59. data/lib/nordlet/fleet/types/vehicles_update_fleet_request.rb +2 -0
  60. data/lib/nordlet/fleet/types/vehicles_update_fleet_response.rb +2 -0
  61. data/lib/nordlet/inventory/client.rb +28 -23
  62. data/lib/nordlet/ledger/types/posting_rules_update_ledger_request_rules_item_key.rb +2 -0
  63. data/lib/nordlet/payroll/client.rb +16 -12
  64. data/lib/nordlet/pos/client.rb +126 -9
  65. data/lib/nordlet/pos/types/refunds_create_pos_request.rb +17 -0
  66. data/lib/nordlet/pos/types/refunds_create_pos_request_lines_item.rb +13 -0
  67. data/lib/nordlet/pos/types/refunds_create_pos_response.rb +33 -0
  68. data/lib/nordlet/pos/types/refunds_create_pos_response_lines_item.rb +23 -0
  69. data/lib/nordlet/pos/types/refunds_get_pos_request.rb +11 -0
  70. data/lib/nordlet/pos/types/refunds_get_pos_response.rb +33 -0
  71. data/lib/nordlet/pos/types/refunds_get_pos_response_lines_item.rb +23 -0
  72. data/lib/nordlet/pos/types/refunds_list_pos_request.rb +19 -0
  73. data/lib/nordlet/pos/types/refunds_list_pos_request_filter_item.rb +15 -0
  74. data/lib/nordlet/pos/types/refunds_list_pos_request_filter_item_op.rb +18 -0
  75. data/lib/nordlet/pos/types/refunds_list_pos_request_filter_item_value.rb +19 -0
  76. data/lib/nordlet/pos/types/refunds_list_pos_request_filter_item_value_three_item.rb +15 -0
  77. data/lib/nordlet/pos/types/refunds_list_pos_request_sort_item.rb +13 -0
  78. data/lib/nordlet/pos/types/refunds_list_pos_request_sort_item_dir.rb +14 -0
  79. data/lib/nordlet/pos/types/refunds_list_pos_response.rb +21 -0
  80. data/lib/nordlet/pos/types/refunds_list_pos_response_rows_item.rb +31 -0
  81. data/lib/nordlet/production/client.rb +20 -14
  82. data/lib/nordlet/production/types/maintenance_cancel_production_response.rb +2 -0
  83. data/lib/nordlet/production/types/maintenance_complete_production_request.rb +2 -0
  84. data/lib/nordlet/production/types/maintenance_complete_production_response.rb +2 -0
  85. data/lib/nordlet/production/types/maintenance_create_production_request.rb +2 -0
  86. data/lib/nordlet/production/types/maintenance_create_production_response.rb +2 -0
  87. data/lib/nordlet/production/types/maintenance_list_production_response_rows_item.rb +2 -0
  88. data/lib/nordlet/public/client.rb +6 -5
  89. data/lib/nordlet/public/types/invoices_get_public_response.rb +2 -0
  90. data/lib/nordlet/purchases/client.rb +12 -9
  91. data/lib/nordlet/purchases/types/invoices_create_purchases_request_lines_item.rb +4 -0
  92. data/lib/nordlet/purchases/types/invoices_create_purchases_response_lines_item.rb +8 -0
  93. data/lib/nordlet/purchases/types/invoices_get_purchases_response_lines_item.rb +8 -0
  94. data/lib/nordlet/purchases/types/invoices_register_purchases_response_lines_item.rb +8 -0
  95. data/lib/nordlet/purchases/types/invoices_update_purchases_request_lines_item.rb +4 -0
  96. data/lib/nordlet/purchases/types/invoices_update_purchases_response_lines_item.rb +8 -0
  97. data/lib/nordlet/purchases/types/orders_approve_purchases_response_lines_item.rb +4 -0
  98. data/lib/nordlet/purchases/types/orders_cancel_purchases_response_lines_item.rb +4 -0
  99. data/lib/nordlet/purchases/types/orders_close_purchases_response_lines_item.rb +4 -0
  100. data/lib/nordlet/purchases/types/orders_create_purchases_request_lines_item.rb +4 -0
  101. data/lib/nordlet/purchases/types/orders_create_purchases_response_lines_item.rb +4 -0
  102. data/lib/nordlet/purchases/types/orders_get_purchases_response_lines_item.rb +4 -0
  103. data/lib/nordlet/purchases/types/orders_reject_purchases_response_lines_item.rb +4 -0
  104. data/lib/nordlet/purchases/types/orders_submit_purchases_response_lines_item.rb +4 -0
  105. data/lib/nordlet/purchases/types/orders_update_purchases_request_lines_item.rb +4 -0
  106. data/lib/nordlet/purchases/types/orders_update_purchases_response_lines_item.rb +4 -0
  107. data/lib/nordlet/reports/client.rb +3 -3
  108. data/lib/nordlet/sales/client.rb +26 -19
  109. data/lib/nordlet/sales/types/acts_create_sales_response_lines_item.rb +4 -0
  110. data/lib/nordlet/sales/types/acts_get_sales_response_lines_item.rb +4 -0
  111. data/lib/nordlet/sales/types/acts_issue_sales_response_lines_item.rb +4 -0
  112. data/lib/nordlet/sales/types/acts_update_sales_response_lines_item.rb +4 -0
  113. data/lib/nordlet/sales/types/invoices_apply_advance_sales_response_lines_item.rb +4 -0
  114. data/lib/nordlet/sales/types/invoices_create_sales_response_lines_item.rb +4 -0
  115. data/lib/nordlet/sales/types/invoices_get_sales_response_lines_item.rb +4 -0
  116. data/lib/nordlet/sales/types/invoices_issue_sales_response_lines_item.rb +4 -0
  117. data/lib/nordlet/sales/types/invoices_list_sales_response_rows_item.rb +2 -0
  118. data/lib/nordlet/sales/types/invoices_lock_sales_response_lines_item.rb +4 -0
  119. data/lib/nordlet/sales/types/invoices_unlock_sales_response_lines_item.rb +4 -0
  120. data/lib/nordlet/sales/types/invoices_update_sales_response_lines_item.rb +4 -0
  121. data/lib/nordlet/sales/types/invoices_view_sales_response.rb +2 -0
  122. data/lib/nordlet/transport/types/waybills_create_transport_response_lines_item.rb +4 -0
  123. data/lib/nordlet/transport/types/waybills_get_transport_response_lines_item.rb +4 -0
  124. data/lib/nordlet/transport/types/waybills_issue_transport_response_lines_item.rb +4 -0
  125. data/lib/nordlet/transport/types/waybills_update_transport_response_lines_item.rb +4 -0
  126. data/lib/nordlet/version.rb +1 -1
  127. data/lib/nordlet.rb +35 -0
  128. data/reference.md +728 -37
  129. metadata +37 -2
@@ -223,13 +223,14 @@ module Nordlet
223
223
  end
224
224
  end
225
225
 
226
- # Consume a quantity of an item from a warehouse, oldest layers first (from one lot when `lotNumber` is given),
226
+ # Consume a quantity of an item from a warehouse, first-expiring lot first (lots without an expiry date after
227
+ # those with one, then the oldest layers first; expired lots included) or from one lot when `lotNumber` is given,
227
228
  # and post a journal entry: debit the expense account (`expenseAccountCode`, default the chart's inventory expense
228
- # account), credit the stock account each consumed layer was received on (the chart's inventory account for layers
229
- # without one), or `inventoryAccountCode` for the whole cost when given. 409 when the accounting period of `date`
230
- # is locked; 422 when the stock is insufficient under the `reject` policy or in the named lot. Emits
231
- # `stock.changed` and, when the consumption takes the available quantity from above a reorder rule's minimum to at
232
- # or below it, `stock.reorder_needed`.
229
+ # account), credit the stock account each consumed layer was received on (the `inventory.stock` posting rule
230
+ # account for layers without one), or `inventoryAccountCode` for the whole cost when given. 409 when the
231
+ # accounting period of `date` is locked; 422 when the stock is insufficient under the `reject` policy or in the
232
+ # named lot. Emits `stock.changed` and, when the consumption takes the available quantity from above a reorder
233
+ # rule's minimum to at or below it, `stock.reorder_needed`.
233
234
  #
234
235
  # @param request_options [Hash]
235
236
  # @param params [Nordlet::Inventory::Types::StockWriteOffInventoryRequest]
@@ -263,9 +264,10 @@ module Nordlet
263
264
  end
264
265
  end
265
266
 
266
- # Move a quantity of an item from one warehouse to another: the source layers are consumed oldest first (from one
267
- # lot when `lotNumber` is given) and received in the target with the same quantities, costs, lots and stock
268
- # accounts (document type `warehouse_transfer`). 422 when both warehouses are the same or the source stock is
267
+ # Move a quantity of an item from one warehouse to another: the source layers are consumed as
268
+ # `inventory/stock/write-off` consumes them, except that expired lots are left out unless `lotNumber` names one,
269
+ # and received in the target with the same quantities, costs, lots and stock accounts, one receipt per lot and
270
+ # stock account (document type `warehouse_transfer`). 422 when both warehouses are the same or the source stock is
269
271
  # insufficient under the `reject` policy. `inMovementId` is the first receipt when the consumption spans several
270
272
  # lots or stock accounts. Emits `stock.changed` for both warehouses and `stock.reorder_needed` as
271
273
  # `inventory/stock/write-off` does.
@@ -303,14 +305,15 @@ module Nordlet
303
305
  end
304
306
 
305
307
  # Post a stock count for a warehouse. Each line names an item by `itemId` or `barcode` with its `countedQty`; the
306
- # difference to the quantity on hand in the warehouse (all lots together) is written off oldest layers first or
307
- # received as a surplus at `unitCost` (the item's purchase price when omitted; 422 when neither is set), with
308
- # document type `stock_take`, and a surplus of a lot- or serial-tracked item needs `lotNumber` (422). The shortage
309
- # cost less the surplus cost is posted in one journal entry between the expense account (`expenseAccountCode`,
310
- # default the chart's inventory expense account) and the stock accounts (`inventoryAccountCode` for everything
311
- # when given, else the accounts of the consumed layers and the chart's inventory account for the surpluses);
312
- # nothing is posted and `journalTransactionId` is null when the net is zero. 409 when the accounting period of
313
- # `date` is locked. Emits `stock.changed` per adjusted item.
308
+ # difference to the quantity on hand in the warehouse (all lots together) is written off as
309
+ # `inventory/stock/write-off` consumes stock or received as a surplus at `unitCost` (the item's purchase price
310
+ # when omitted; 422 when neither is set), with document type `stock_take`, and a surplus of a lot- or
311
+ # serial-tracked item needs `lotNumber` (422). The shortage cost less the surplus cost is posted in one journal
312
+ # entry between the expense account (`expenseAccountCode`, default the chart's inventory expense account) and the
313
+ # stock accounts (`inventoryAccountCode` for everything when given, else the accounts of the consumed layers and
314
+ # the `inventory.stock` posting rule account for the surpluses); nothing is posted and `journalTransactionId` is
315
+ # null when the net is zero. 409 when the accounting period of `date` is locked. Emits `stock.changed` per
316
+ # adjusted item.
314
317
  #
315
318
  # @param request_options [Hash]
316
319
  # @param params [Nordlet::Inventory::Types::StockTakeInventoryRequest]
@@ -449,7 +452,8 @@ module Nordlet
449
452
  end
450
453
  end
451
454
 
452
- # Return a lot with its quantity on hand and its movements in date order.
455
+ # Return a lot with its quantity on hand and its movements in date order, the outgoing movement before the
456
+ # incoming one when one posting made both (a transfer).
453
457
  #
454
458
  # @param request_options [Hash]
455
459
  # @param params [Nordlet::Inventory::Types::LotsGetInventoryRequest]
@@ -521,11 +525,12 @@ module Nordlet
521
525
  # `movementIds` or taken from the lines of a goods receipt (`goodsReceiptId`; 422 when the receipt has no stock
522
526
  # movements), in proportion to their cost (`by_value`) or quantity (`by_quantity`), largest remainder to the cent.
523
527
  # The part of each share that belongs to the quantity still on hand raises the movement's remaining cost and
524
- # recomputes its unit cost; the part that belongs to quantity already consumed is posted in a journal entry dated
525
- # `date` debiting `inventory.cogs` and crediting the movement's stock account (`inventory.stock` when it has
526
- # none), 409 when that period is locked. 422 when a movement is not incoming or the weights sum to zero.
527
- # `sourceInvoiceId` records the purchase invoice the cost came from. Goods receipts come from
528
- # `purchases/receipts/create`.
528
+ # recomputes its unit cost; the part that belongs to quantity moved to another warehouse by
529
+ # `inventory/stock/transfer` follows it to the receipts the transfer made there and is allocated on them the same
530
+ # way; the part that belongs to quantity already consumed is posted in a journal entry dated `date` debiting
531
+ # `inventory.cogs` and crediting the movement's stock account (`inventory.stock` when it has none), 409 when that
532
+ # period is locked. 422 when a movement is not incoming or the weights sum to zero. `sourceInvoiceId` records the
533
+ # purchase invoice the cost came from. Goods receipts come from `purchases/receipts/create`.
529
534
  #
530
535
  # @param request_options [Hash]
531
536
  # @param params [Nordlet::Inventory::Types::LandedCostsCreateInventoryRequest]
@@ -20,6 +20,8 @@ module Nordlet
20
20
  INVENTORY_STOCK = "inventory.stock"
21
21
  PRODUCTION_LABOR_APPLIED = "production.laborApplied"
22
22
  PRODUCTION_SCRAP = "production.scrap"
23
+ POS_CASH_SHORTAGE = "pos.cashShortage"
24
+ POS_CASH_SURPLUS = "pos.cashSurplus"
23
25
  BANK_FX_GAIN = "bank.fxGain"
24
26
  BANK_FX_LOSS = "bank.fxLoss"
25
27
  BANK_FEES = "bank.fees"
@@ -224,15 +224,16 @@ module Nordlet
224
224
 
225
225
  # Creates a draft payroll run for a month, computing each line with the company country's payroll engine, the
226
226
  # employee's approved runs of the year so far and of the two previous years, the month's timesheet and `payDate`
227
- # (default the last day of the month). Without `lines`, every active employee whose contract covers the month gets
228
- # a line: the gross is the contract's monthly salary reduced to the paid working days of the contract and the
229
- # timesheet, unless `grossOverrides` sets it; the per diems of approved business trips ending in the month are
230
- # added untaxed and the trips linked to the run; for a Lithuanian company the car benefit in kind
231
- # (`includeNatura`) and the compensation for unused leave of a contract ending in the month are added. With
232
- # `lines`, only the given employees are computed with their gross, additions and deductions; a taxable addition
233
- # may carry a `paymentType` from `payroll/payment-types/list` and `hours`. Answers 422 when the country has no
234
- # engine, an employee is given twice, has two contracts in the month, has no contract and no gross, or is paid by
235
- # the hour or day without a gross; 409 when a run for the month already exists or the accounting period is locked.
227
+ # (default the last day of the month). Without `lines`, every employee whose contract overlaps the month gets a
228
+ # line, whatever the employee's status: the gross is the contract's monthly salary reduced to the paid working
229
+ # days of the contract and the timesheet, unless `grossOverrides` sets it; the per diems of approved business
230
+ # trips ending in the month are added untaxed and the trips linked to the run; for a Lithuanian company the car
231
+ # benefit in kind (`includeNatura`) and the compensation for unused leave of a contract ending in the month are
232
+ # added. With `lines`, only the given employees are computed with their gross, additions and deductions; a taxable
233
+ # addition may carry a `paymentType` from `payroll/payment-types/list` and `hours`. Answers 422 when the country
234
+ # has no engine, an employee is given twice, has two contracts in the month, has no contract and no gross, or is
235
+ # paid by the hour or day without a gross; 409 when a run for the month already exists or the accounting period is
236
+ # locked.
236
237
  #
237
238
  # @param request_options [Hash]
238
239
  # @param params [Nordlet::Payroll::Types::RunsCreatePayrollRequest]
@@ -377,8 +378,10 @@ module Nordlet
377
378
  # accounts of the company's chart template; each can be given per call. Answers 409 when the run is not a draft or
378
379
  # the accounting period is locked, 422 when the run has no lines or nothing to post, and emits
379
380
  # `payroll_run.approved`. For an Irish company with the automation of the `ie-payroll-withholding` deadline
380
- # switched on, the month's payroll submission is sent at once and a failure is added to the run's `warnings`. Undo
381
- # with `payroll/runs/reverse`, pay with `payroll/payments/export`.
381
+ # switched on, the month's payroll submission is sent at once and a failure is added to the run's `warnings`. For
382
+ # a Lithuanian company the unused leave days a line paid as compensation, recorded per balance year when the run
383
+ # was created, are added to the used days of the leave balances. Undo with `payroll/runs/reverse`, pay with
384
+ # `payroll/payments/export`.
382
385
  #
383
386
  # @param request_options [Hash]
384
387
  # @param params [Nordlet::Payroll::Types::RunsApprovePayrollRequest]
@@ -414,7 +417,8 @@ module Nordlet
414
417
 
415
418
  # Posts a journal entry dated the last day of the month that mirrors the run's entry (debits and credits swapped),
416
419
  # sets the status to `reversed` with the reason, and releases the business trips the run paid so the next run
417
- # picks them up again. Answers 409 when the run is not approved, when part of it is matched to bank payments
420
+ # picks them up again; the leave days the run marked used as compensation for unused leave are given back to the
421
+ # leave balances. Answers 409 when the run is not approved, when part of it is matched to bank payments
418
422
  # (`paidAmount`, unmatch them first) or when the accounting period is locked. Emits `payroll_run.reversed`.
419
423
  #
420
424
  # @param request_options [Hash]
@@ -116,12 +116,14 @@ module Nordlet
116
116
 
117
117
  # Record a daily cash register report (Z-report) and post it to the ledger in one journal entry: the cash and card
118
118
  # takings are debited to `cashAccountCode` and `cardAccountCode`, the net of the `vatLines` is credited to
119
- # `revenueAccountCode` and their VAT to `vatAccountCode`. `itemLines` write the sold products off `warehouseId`
120
- # FIFO (a set is expanded to its product components) and add the cost of goods sold, debited to `cogsAccountCode`
121
- # against the stock accounts. Account codes default to the company's chart. Refused with 422 when cash plus card
122
- # differs from the gross total, the item lines have no warehouse or the device is inactive, with 409 when the
123
- # accounting period is locked or the `reportNumber` already exists. Emits `pos_report.created` and, per item line,
124
- # `stock.changed`.
119
+ # `revenueAccountCode` and their VAT to `vatAccountCode`. `itemLines` write the sold products off `warehouseId`,
120
+ # the first-expiring lot first (lots without an expiry date after those with one, then the oldest layers first),
121
+ # leaving out expired lots (a set is expanded to its product components) and add the cost of goods sold, debited
122
+ # to `cogsAccountCode` against the stock accounts. `cogsAccountCode` and `inventoryAccountCode` default to the
123
+ # posting rules `inventory.cogs` and `inventory.stock`, the other account codes to the company's chart. Refused
124
+ # with 422 when cash plus card differs from the gross total, the item lines have no warehouse or the device is
125
+ # inactive, with 409 when the accounting period is locked or the `reportNumber` already exists. Emits
126
+ # `pos_report.created` and, per item line, `stock.changed`.
125
127
  #
126
128
  # @param request_options [Hash]
127
129
  # @param params [Nordlet::Pos::Types::ReportsCreatePosRequest]
@@ -433,12 +435,127 @@ module Nordlet
433
435
  end
434
436
  end
435
437
 
438
+ # Refund `quantity` of lines of a receipt, paid in cash out of the open shift `shiftId`, on `date` (default: the
439
+ # company's today). A line refunded in part is priced from its VAT-inclusive unit price, the rest of a line at
440
+ # what is left of its amounts. One journal entry debits the chart's POS revenue and VAT accounts with the net and
441
+ # VAT and credits the chart's cash account with the gross. When the receipt's shift is closed, the stock lines go
442
+ # back into the warehouse at the cost they left it on that shift's report, debited to their stock accounts
443
+ # (`inventory.stock` for layers without one) against `inventory.cogs`; when it is still open, the refunded
444
+ # quantities are left out of the stock write-off at its close. A receipt of another open shift is refused with
445
+ # 422, as are a line not on the receipt, a line named twice, a zero quantity and a quantity above what is left to
446
+ # refund; 409 when the shift is closed or the accounting period is locked.
447
+ #
448
+ # @param request_options [Hash]
449
+ # @param params [Nordlet::Pos::Types::RefundsCreatePosRequest]
450
+ # @option request_options [String] :base_url
451
+ # @option request_options [Hash{String => Object}] :additional_headers
452
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
453
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
454
+ # @option request_options [Integer] :timeout_in_seconds
455
+ #
456
+ # @return [Nordlet::Pos::Types::RefundsCreatePosResponse]
457
+ def refunds_create(request_options: {}, **params)
458
+ params = Nordlet::Internal::Types::Utils.normalize_keys(params)
459
+ request = Nordlet::Internal::JSON::Request.new(
460
+ base_url: request_options[:base_url],
461
+ method: "POST",
462
+ path: "v1/pos/refunds/create",
463
+ body: Nordlet::Pos::Types::RefundsCreatePosRequest.new(params).to_h,
464
+ request_options: request_options
465
+ )
466
+ begin
467
+ response = @client.send(request)
468
+ rescue Net::HTTPRequestTimeout
469
+ raise Nordlet::Errors::TimeoutError
470
+ end
471
+ code = response.code.to_i
472
+ if code.between?(200, 299)
473
+ Nordlet::Pos::Types::RefundsCreatePosResponse.load(response.body)
474
+ else
475
+ error_class = Nordlet::Errors::ResponseError.subclass_for_code(code)
476
+ raise error_class.new(response.body, code: code)
477
+ end
478
+ end
479
+
480
+ # Read one POS refund with its lines.
481
+ #
482
+ # @param request_options [Hash]
483
+ # @param params [Nordlet::Pos::Types::RefundsGetPosRequest]
484
+ # @option request_options [String] :base_url
485
+ # @option request_options [Hash{String => Object}] :additional_headers
486
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
487
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
488
+ # @option request_options [Integer] :timeout_in_seconds
489
+ #
490
+ # @return [Nordlet::Pos::Types::RefundsGetPosResponse]
491
+ def refunds_get(request_options: {}, **params)
492
+ params = Nordlet::Internal::Types::Utils.normalize_keys(params)
493
+ request = Nordlet::Internal::JSON::Request.new(
494
+ base_url: request_options[:base_url],
495
+ method: "POST",
496
+ path: "v1/pos/refunds/get",
497
+ body: Nordlet::Pos::Types::RefundsGetPosRequest.new(params).to_h,
498
+ request_options: request_options
499
+ )
500
+ begin
501
+ response = @client.send(request)
502
+ rescue Net::HTTPRequestTimeout
503
+ raise Nordlet::Errors::TimeoutError
504
+ end
505
+ code = response.code.to_i
506
+ if code.between?(200, 299)
507
+ Nordlet::Pos::Types::RefundsGetPosResponse.load(response.body)
508
+ else
509
+ error_class = Nordlet::Errors::ResponseError.subclass_for_code(code)
510
+ raise error_class.new(response.body, code: code)
511
+ end
512
+ end
513
+
514
+ # List POS refunds without their lines. Filterable by `shiftId` and `receiptId`; sortable by `date` and
515
+ # `createdAt`.
516
+ #
517
+ # @param request_options [Hash]
518
+ # @param params [Nordlet::Pos::Types::RefundsListPosRequest]
519
+ # @option request_options [String] :base_url
520
+ # @option request_options [Hash{String => Object}] :additional_headers
521
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
522
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
523
+ # @option request_options [Integer] :timeout_in_seconds
524
+ #
525
+ # @return [Nordlet::Pos::Types::RefundsListPosResponse]
526
+ def refunds_list(request_options: {}, **params)
527
+ params = Nordlet::Internal::Types::Utils.normalize_keys(params)
528
+ request = Nordlet::Internal::JSON::Request.new(
529
+ base_url: request_options[:base_url],
530
+ method: "POST",
531
+ path: "v1/pos/refunds/list",
532
+ body: Nordlet::Pos::Types::RefundsListPosRequest.new(params).to_h,
533
+ request_options: request_options
534
+ )
535
+ begin
536
+ response = @client.send(request)
537
+ rescue Net::HTTPRequestTimeout
538
+ raise Nordlet::Errors::TimeoutError
539
+ end
540
+ code = response.code.to_i
541
+ if code.between?(200, 299)
542
+ Nordlet::Pos::Types::RefundsListPosResponse.load(response.body)
543
+ else
544
+ error_class = Nordlet::Errors::ResponseError.subclass_for_code(code)
545
+ raise error_class.new(response.body, code: code)
546
+ end
547
+ end
548
+
436
549
  # Close an open shift: its receipts are summed by VAT rate and by product into one POS report, created as by
437
550
  # `pos/reports/create` with number `reportNumber` (default `Z-<device serial>-<n>`, n being the device's closed
438
551
  # shifts plus one) on `date` (default: the company's today), which posts the takings and the stock write-off to
439
- # the ledger and emits `pos_report.created`. The response adds `expectedCash` (opening cash plus the cash
440
- # receipts) and `cashDifference` (`countedCash` less expected). A shift without receipts is refused with 422, a
441
- # closed one with 409.
552
+ # the ledger and emits `pos_report.created`. Quantities refunded from the shift's receipts by `pos/refunds/create`
553
+ # are left out of the stock write-off. The response adds `expectedCash` (opening cash plus the cash receipts less
554
+ # the cash refunds paid out of the shift) and `cashDifference` (`countedCash` less expected). A difference is
555
+ # posted in its own journal entry on `date` (document type `pos_shift`): a shortage debits the `pos.cashShortage`
556
+ # rule account and credits the chart's cash account, a surplus debits the cash account and credits
557
+ # `pos.cashSurplus`; 422 when the company's chart lacks the account. A shift without receipts is refused with 422,
558
+ # a closed one with 409.
442
559
  #
443
560
  # @param request_options [Hash]
444
561
  # @param params [Nordlet::Pos::Types::ShiftsClosePosRequest]
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Pos
5
+ module Types
6
+ class RefundsCreatePosRequest < Internal::Types::Model
7
+ field :shift_id, -> { String }, optional: false, nullable: false, api_name: "shiftId"
8
+
9
+ field :receipt_id, -> { String }, optional: false, nullable: false, api_name: "receiptId"
10
+
11
+ field :date, -> { String }, optional: true, nullable: false
12
+
13
+ field :lines, -> { Internal::Types::Array[Nordlet::Pos::Types::RefundsCreatePosRequestLinesItem] }, optional: false, nullable: false
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Pos
5
+ module Types
6
+ class RefundsCreatePosRequestLinesItem < Internal::Types::Model
7
+ field :receipt_line_id, -> { String }, optional: false, nullable: false, api_name: "receiptLineId"
8
+
9
+ field :quantity, -> { String }, optional: false, nullable: false
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Pos
5
+ module Types
6
+ class RefundsCreatePosResponse < Internal::Types::Model
7
+ field :id, -> { String }, optional: false, nullable: false
8
+
9
+ field :shift_id, -> { String }, optional: false, nullable: false, api_name: "shiftId"
10
+
11
+ field :receipt_id, -> { String }, optional: false, nullable: false, api_name: "receiptId"
12
+
13
+ field :date, -> { String }, optional: false, nullable: false
14
+
15
+ field :net_total, -> { String }, optional: false, nullable: false, api_name: "netTotal"
16
+
17
+ field :vat_total, -> { String }, optional: false, nullable: false, api_name: "vatTotal"
18
+
19
+ field :gross_total, -> { String }, optional: false, nullable: false, api_name: "grossTotal"
20
+
21
+ field :cash_amount, -> { String }, optional: false, nullable: false, api_name: "cashAmount"
22
+
23
+ field :cogs_total, -> { String }, optional: false, nullable: true, api_name: "cogsTotal"
24
+
25
+ field :journal_transaction_id, -> { String }, optional: false, nullable: true, api_name: "journalTransactionId"
26
+
27
+ field :created_at, -> { String }, optional: false, nullable: false, api_name: "createdAt"
28
+
29
+ field :lines, -> { Internal::Types::Array[Nordlet::Pos::Types::RefundsCreatePosResponseLinesItem] }, optional: false, nullable: false
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Pos
5
+ module Types
6
+ class RefundsCreatePosResponseLinesItem < Internal::Types::Model
7
+ field :id, -> { String }, optional: false, nullable: false
8
+
9
+ field :receipt_line_id, -> { String }, optional: false, nullable: false, api_name: "receiptLineId"
10
+
11
+ field :item_id, -> { String }, optional: false, nullable: true, api_name: "itemId"
12
+
13
+ field :quantity, -> { String }, optional: false, nullable: false
14
+
15
+ field :net_amount, -> { String }, optional: false, nullable: false, api_name: "netAmount"
16
+
17
+ field :vat_amount, -> { String }, optional: false, nullable: false, api_name: "vatAmount"
18
+
19
+ field :gross_amount, -> { String }, optional: false, nullable: false, api_name: "grossAmount"
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Pos
5
+ module Types
6
+ class RefundsGetPosRequest < Internal::Types::Model
7
+ field :id, -> { String }, optional: false, nullable: false
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Pos
5
+ module Types
6
+ class RefundsGetPosResponse < Internal::Types::Model
7
+ field :id, -> { String }, optional: false, nullable: false
8
+
9
+ field :shift_id, -> { String }, optional: false, nullable: false, api_name: "shiftId"
10
+
11
+ field :receipt_id, -> { String }, optional: false, nullable: false, api_name: "receiptId"
12
+
13
+ field :date, -> { String }, optional: false, nullable: false
14
+
15
+ field :net_total, -> { String }, optional: false, nullable: false, api_name: "netTotal"
16
+
17
+ field :vat_total, -> { String }, optional: false, nullable: false, api_name: "vatTotal"
18
+
19
+ field :gross_total, -> { String }, optional: false, nullable: false, api_name: "grossTotal"
20
+
21
+ field :cash_amount, -> { String }, optional: false, nullable: false, api_name: "cashAmount"
22
+
23
+ field :cogs_total, -> { String }, optional: false, nullable: true, api_name: "cogsTotal"
24
+
25
+ field :journal_transaction_id, -> { String }, optional: false, nullable: true, api_name: "journalTransactionId"
26
+
27
+ field :created_at, -> { String }, optional: false, nullable: false, api_name: "createdAt"
28
+
29
+ field :lines, -> { Internal::Types::Array[Nordlet::Pos::Types::RefundsGetPosResponseLinesItem] }, optional: false, nullable: false
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Pos
5
+ module Types
6
+ class RefundsGetPosResponseLinesItem < Internal::Types::Model
7
+ field :id, -> { String }, optional: false, nullable: false
8
+
9
+ field :receipt_line_id, -> { String }, optional: false, nullable: false, api_name: "receiptLineId"
10
+
11
+ field :item_id, -> { String }, optional: false, nullable: true, api_name: "itemId"
12
+
13
+ field :quantity, -> { String }, optional: false, nullable: false
14
+
15
+ field :net_amount, -> { String }, optional: false, nullable: false, api_name: "netAmount"
16
+
17
+ field :vat_amount, -> { String }, optional: false, nullable: false, api_name: "vatAmount"
18
+
19
+ field :gross_amount, -> { String }, optional: false, nullable: false, api_name: "grossAmount"
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Pos
5
+ module Types
6
+ class RefundsListPosRequest < Internal::Types::Model
7
+ field :page, -> { Integer }, optional: true, nullable: false
8
+
9
+ field :page_size, -> { Integer }, optional: true, nullable: false, api_name: "pageSize"
10
+
11
+ field :sort, -> { Internal::Types::Array[Nordlet::Pos::Types::RefundsListPosRequestSortItem] }, optional: true, nullable: false
12
+
13
+ field :filter, -> { Internal::Types::Array[Nordlet::Pos::Types::RefundsListPosRequestFilterItem] }, optional: true, nullable: false
14
+
15
+ field :totals, -> { Internal::Types::Array[String] }, optional: true, nullable: false
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Pos
5
+ module Types
6
+ class RefundsListPosRequestFilterItem < Internal::Types::Model
7
+ field :field, -> { String }, optional: false, nullable: false
8
+
9
+ field :op, -> { Nordlet::Pos::Types::RefundsListPosRequestFilterItemOp }, optional: false, nullable: false
10
+
11
+ field :value, -> { Nordlet::Pos::Types::RefundsListPosRequestFilterItemValue }, optional: false, nullable: false
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Pos
5
+ module Types
6
+ module RefundsListPosRequestFilterItemOp
7
+ extend Nordlet::Internal::Types::Enum
8
+
9
+ EQ = "eq"
10
+ NE = "ne"
11
+ CONTAINS = "contains"
12
+ GTE = "gte"
13
+ LTE = "lte"
14
+ IN = "in"
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Pos
5
+ module Types
6
+ class RefundsListPosRequestFilterItemValue < Internal::Types::Model
7
+ extend Nordlet::Internal::Types::Union
8
+
9
+ member -> { String }
10
+
11
+ member -> { Integer }
12
+
13
+ member -> { Internal::Types::Boolean }
14
+
15
+ member -> { Internal::Types::Array[Nordlet::Pos::Types::RefundsListPosRequestFilterItemValueThreeItem] }
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Pos
5
+ module Types
6
+ class RefundsListPosRequestFilterItemValueThreeItem < Internal::Types::Model
7
+ extend Nordlet::Internal::Types::Union
8
+
9
+ member -> { String }
10
+
11
+ member -> { Integer }
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Pos
5
+ module Types
6
+ class RefundsListPosRequestSortItem < Internal::Types::Model
7
+ field :field, -> { String }, optional: false, nullable: false
8
+
9
+ field :dir, -> { Nordlet::Pos::Types::RefundsListPosRequestSortItemDir }, optional: true, nullable: false
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Pos
5
+ module Types
6
+ module RefundsListPosRequestSortItemDir
7
+ extend Nordlet::Internal::Types::Enum
8
+
9
+ ASC = "asc"
10
+ DESC = "desc"
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Pos
5
+ module Types
6
+ class RefundsListPosResponse < Internal::Types::Model
7
+ field :rows, -> { Internal::Types::Array[Nordlet::Pos::Types::RefundsListPosResponseRowsItem] }, optional: false, nullable: false
8
+
9
+ field :page, -> { Integer }, optional: false, nullable: false
10
+
11
+ field :page_size, -> { Integer }, optional: false, nullable: false, api_name: "pageSize"
12
+
13
+ field :total, -> { Integer }, optional: false, nullable: false
14
+
15
+ field :totals, -> { Internal::Types::Hash[String, String] }, optional: true, nullable: false
16
+
17
+ field :totals_by_currency, -> { Internal::Types::Hash[String, Internal::Types::Hash[String, String]] }, optional: true, nullable: false, api_name: "totalsByCurrency"
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Pos
5
+ module Types
6
+ class RefundsListPosResponseRowsItem < Internal::Types::Model
7
+ field :id, -> { String }, optional: false, nullable: false
8
+
9
+ field :shift_id, -> { String }, optional: false, nullable: false, api_name: "shiftId"
10
+
11
+ field :receipt_id, -> { String }, optional: false, nullable: false, api_name: "receiptId"
12
+
13
+ field :date, -> { String }, optional: false, nullable: false
14
+
15
+ field :net_total, -> { String }, optional: false, nullable: false, api_name: "netTotal"
16
+
17
+ field :vat_total, -> { String }, optional: false, nullable: false, api_name: "vatTotal"
18
+
19
+ field :gross_total, -> { String }, optional: false, nullable: false, api_name: "grossTotal"
20
+
21
+ field :cash_amount, -> { String }, optional: false, nullable: false, api_name: "cashAmount"
22
+
23
+ field :cogs_total, -> { String }, optional: false, nullable: true, api_name: "cogsTotal"
24
+
25
+ field :journal_transaction_id, -> { String }, optional: false, nullable: true, api_name: "journalTransactionId"
26
+
27
+ field :created_at, -> { String }, optional: false, nullable: false, api_name: "createdAt"
28
+ end
29
+ end
30
+ end
31
+ end