nordlet 0.6.6 → 0.6.8

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 (131) hide show
  1. checksums.yaml +4 -4
  2. data/lib/nordlet/account/client.rb +89 -6
  3. data/lib/nordlet/account/types/brand_get_account_request.rb +9 -0
  4. data/lib/nordlet/account/types/brand_get_account_response.rb +17 -0
  5. data/lib/nordlet/account/types/brand_update_account_request.rb +17 -0
  6. data/lib/nordlet/account/types/brand_update_account_response.rb +17 -0
  7. data/lib/nordlet/account/types/companies_create_account_response.rb +10 -0
  8. data/lib/nordlet/account/types/companies_create_account_response_vat_period.rb +17 -0
  9. data/lib/nordlet/account/types/me_account_response_companies_item.rb +10 -0
  10. data/lib/nordlet/account/types/me_account_response_companies_item_vat_period.rb +17 -0
  11. data/lib/nordlet/account/types/me_account_response_user.rb +2 -0
  12. data/lib/nordlet/bank/client.rb +183 -14
  13. data/lib/nordlet/bank/types/reconciliation_get_bank_request.rb +15 -0
  14. data/lib/nordlet/bank/types/reconciliation_get_bank_response.rb +35 -0
  15. data/lib/nordlet/bank/types/reconciliation_get_bank_response_statement_balance_source.rb +14 -0
  16. data/lib/nordlet/bank/types/reconciliation_get_bank_response_unbooked_lines_item.rb +39 -0
  17. data/lib/nordlet/bank/types/reconciliation_get_bank_response_unbooked_lines_item_status.rb +15 -0
  18. data/lib/nordlet/bank/types/transactions_ignore_bank_request.rb +13 -0
  19. data/lib/nordlet/bank/types/transactions_ignore_bank_response.rb +39 -0
  20. data/lib/nordlet/bank/types/transactions_ignore_bank_response_status.rb +15 -0
  21. data/lib/nordlet/bank/types/transactions_import_bank_request.rb +4 -0
  22. data/lib/nordlet/bank/types/transactions_import_bank_response.rb +2 -0
  23. data/lib/nordlet/bank/types/transactions_import_bank_response_duplicates_item.rb +17 -0
  24. data/lib/nordlet/bank/types/transactions_list_bank_response_rows_item.rb +2 -0
  25. data/lib/nordlet/bank/types/transactions_list_bank_response_rows_item_status.rb +1 -0
  26. data/lib/nordlet/bank/types/transactions_match_bank_request.rb +2 -0
  27. data/lib/nordlet/bank/types/transactions_match_bank_request_remainder.rb +13 -0
  28. data/lib/nordlet/bank/types/transactions_match_bank_request_remainder_treatment.rb +15 -0
  29. data/lib/nordlet/bank/types/transactions_match_bank_response.rb +2 -0
  30. data/lib/nordlet/bank/types/transactions_match_bank_response_status.rb +1 -0
  31. data/lib/nordlet/bank/types/transactions_match_many_bank_response.rb +2 -0
  32. data/lib/nordlet/bank/types/transactions_match_many_bank_response_status.rb +1 -0
  33. data/lib/nordlet/bank/types/transactions_post_bank_request.rb +25 -0
  34. data/lib/nordlet/bank/types/transactions_post_bank_response.rb +39 -0
  35. data/lib/nordlet/bank/types/transactions_post_bank_response_status.rb +15 -0
  36. data/lib/nordlet/bank/types/transactions_record_bank_response.rb +2 -0
  37. data/lib/nordlet/bank/types/transactions_record_bank_response_status.rb +1 -0
  38. data/lib/nordlet/bank/types/transactions_unignore_bank_request.rb +11 -0
  39. data/lib/nordlet/bank/types/transactions_unignore_bank_response.rb +39 -0
  40. data/lib/nordlet/bank/types/transactions_unignore_bank_response_status.rb +15 -0
  41. data/lib/nordlet/bank/types/transactions_unmatch_bank_response.rb +2 -0
  42. data/lib/nordlet/bank/types/transactions_unmatch_bank_response_status.rb +1 -0
  43. data/lib/nordlet/billing/client.rb +3 -2
  44. data/lib/nordlet/billing/types/account_get_billing_response_month_to_date.rb +0 -2
  45. data/lib/nordlet/billing/types/account_set_account_type_billing_response_month_to_date.rb +0 -2
  46. data/lib/nordlet/billing/types/account_set_auto_top_up_billing_response_month_to_date.rb +0 -2
  47. data/lib/nordlet/billing/types/account_set_overdraft_cap_billing_response_month_to_date.rb +0 -2
  48. data/lib/nordlet/billing/types/account_set_plan_billing_response_month_to_date.rb +0 -2
  49. data/lib/nordlet/billing/types/flat_rate_confirm_billing_response_month_to_date.rb +0 -2
  50. data/lib/nordlet/billing/types/free_sandbox_start_billing_response_month_to_date.rb +0 -2
  51. data/lib/nordlet/billing/types/subscription_cancel_billing_response_month_to_date.rb +0 -2
  52. data/lib/nordlet/billing/types/topup_confirm_billing_response_month_to_date.rb +0 -2
  53. data/lib/nordlet/calendar/client.rb +3 -1
  54. data/lib/nordlet/capture/client.rb +6 -188
  55. data/lib/nordlet/capture/types/documents_confirm_capture_response_invoice.rb +6 -0
  56. data/lib/nordlet/capture/types/documents_confirm_capture_response_invoice_status.rb +1 -0
  57. data/lib/nordlet/capture/types/documents_confirm_capture_response_opposite_invoice.rb +6 -0
  58. data/lib/nordlet/capture/types/documents_confirm_capture_response_opposite_invoice_status.rb +1 -0
  59. data/lib/nordlet/cash/client.rb +11 -10
  60. data/lib/nordlet/declarations/client.rb +7 -3
  61. data/lib/nordlet/declarations/types/configs_list_declarations_response_rows_item_fields_item.rb +2 -0
  62. data/lib/nordlet/declarations/types/configs_update_declarations_response_fields_item.rb +2 -0
  63. data/lib/nordlet/hr/client.rb +3 -2
  64. data/lib/nordlet/ledger/client.rb +46 -5
  65. data/lib/nordlet/ledger/types/journal_transactions_get_ledger_response.rb +2 -0
  66. data/lib/nordlet/ledger/types/journal_transactions_reverse_ledger_request.rb +15 -0
  67. data/lib/nordlet/ledger/types/journal_transactions_reverse_ledger_response.rb +27 -0
  68. data/lib/nordlet/ledger/types/journal_transactions_reverse_ledger_response_status.rb +14 -0
  69. data/lib/nordlet/ledger/types/periods_lock_ledger_response.rb +2 -0
  70. data/lib/nordlet/ledger/types/periods_lock_ledger_response_warnings_item.rb +17 -0
  71. data/lib/nordlet/ledger/types/periods_lock_ledger_response_warnings_item_code.rb +21 -0
  72. data/lib/nordlet/partners/client.rb +10 -8
  73. data/lib/nordlet/public/types/invoices_get_public_response.rb +2 -0
  74. data/lib/nordlet/purchases/client.rb +77 -20
  75. data/lib/nordlet/purchases/types/invoices_create_purchases_request.rb +6 -0
  76. data/lib/nordlet/purchases/types/invoices_create_purchases_response.rb +8 -0
  77. data/lib/nordlet/purchases/types/invoices_create_purchases_response_status.rb +1 -0
  78. data/lib/nordlet/purchases/types/invoices_create_purchases_response_warnings_item.rb +13 -0
  79. data/lib/nordlet/purchases/types/invoices_get_purchases_response.rb +6 -0
  80. data/lib/nordlet/purchases/types/invoices_get_purchases_response_status.rb +1 -0
  81. data/lib/nordlet/purchases/types/invoices_list_purchases_response_rows_item.rb +6 -0
  82. data/lib/nordlet/purchases/types/invoices_list_purchases_response_rows_item_status.rb +1 -0
  83. data/lib/nordlet/purchases/types/invoices_register_purchases_response.rb +8 -0
  84. data/lib/nordlet/purchases/types/invoices_register_purchases_response_status.rb +1 -0
  85. data/lib/nordlet/purchases/types/invoices_register_purchases_response_warnings_item.rb +13 -0
  86. data/lib/nordlet/purchases/types/invoices_reverse_purchases_request.rb +15 -0
  87. data/lib/nordlet/purchases/types/invoices_reverse_purchases_response.rb +71 -0
  88. data/lib/nordlet/purchases/types/invoices_reverse_purchases_response_lines_item.rb +53 -0
  89. data/lib/nordlet/purchases/types/invoices_reverse_purchases_response_payment_status.rb +15 -0
  90. data/lib/nordlet/purchases/types/invoices_reverse_purchases_response_status.rb +15 -0
  91. data/lib/nordlet/{capture/types/documents_upload_capture_response_extraction_document_type.rb → purchases/types/invoices_reverse_purchases_response_type.rb} +2 -2
  92. data/lib/nordlet/purchases/types/invoices_update_purchases_request.rb +6 -0
  93. data/lib/nordlet/purchases/types/invoices_update_purchases_response.rb +6 -0
  94. data/lib/nordlet/purchases/types/invoices_update_purchases_response_status.rb +1 -0
  95. data/lib/nordlet/reference/client.rb +8 -2
  96. data/lib/nordlet/reference/types/vat_resolve_reference_request.rb +2 -0
  97. data/lib/nordlet/reference/types/vat_resolve_reference_request_side.rb +14 -0
  98. data/lib/nordlet/reference/types/vat_resolve_reference_response.rb +2 -0
  99. data/lib/nordlet/reports/client.rb +42 -0
  100. data/lib/nordlet/reports/types/period_checklist_reports_request.rb +11 -0
  101. data/lib/nordlet/reports/types/period_checklist_reports_response.rb +17 -0
  102. data/lib/nordlet/reports/types/period_checklist_reports_response_items_item.rb +17 -0
  103. data/lib/nordlet/reports/types/period_checklist_reports_response_items_item_code.rb +21 -0
  104. data/lib/nordlet/sales/client.rb +19 -8
  105. data/lib/nordlet/sales/types/invoices_create_sales_response.rb +2 -0
  106. data/lib/nordlet/sales/types/invoices_create_sales_response_warnings_item.rb +13 -0
  107. data/lib/nordlet/sales/types/invoices_issue_sales_response.rb +2 -0
  108. data/lib/nordlet/sales/types/invoices_issue_sales_response_warnings_item.rb +13 -0
  109. data/lib/nordlet/sales/types/invoices_view_sales_response.rb +2 -0
  110. data/lib/nordlet/version.rb +1 -1
  111. data/lib/nordlet.rb +43 -19
  112. data/reference.md +863 -468
  113. metadata +45 -21
  114. data/lib/nordlet/capture/types/documents_upload_capture_request.rb +0 -15
  115. data/lib/nordlet/capture/types/documents_upload_capture_response.rb +0 -43
  116. data/lib/nordlet/capture/types/documents_upload_capture_response_extraction.rb +0 -33
  117. data/lib/nordlet/capture/types/documents_upload_capture_response_extraction_lines_item.rb +0 -25
  118. data/lib/nordlet/capture/types/documents_upload_capture_response_extraction_opposite_lines_item.rb +0 -25
  119. data/lib/nordlet/capture/types/documents_upload_capture_response_extraction_supplier.rb +0 -19
  120. data/lib/nordlet/capture/types/documents_upload_capture_response_status.rb +0 -16
  121. data/lib/nordlet/capture/types/inbound_email_capture_request.rb +0 -27
  122. data/lib/nordlet/capture/types/inbound_email_capture_request_attachments_item.rb +0 -21
  123. data/lib/nordlet/capture/types/inbound_email_capture_request_to.rb +0 -15
  124. data/lib/nordlet/capture/types/inbound_email_capture_request_to_full_item.rb +0 -11
  125. data/lib/nordlet/capture/types/inbound_email_capture_response.rb +0 -15
  126. data/lib/nordlet/capture/types/settings_get_capture_request.rb +0 -9
  127. data/lib/nordlet/capture/types/settings_get_capture_response.rb +0 -17
  128. data/lib/nordlet/capture/types/settings_regenerate_intake_capture_request.rb +0 -9
  129. data/lib/nordlet/capture/types/settings_regenerate_intake_capture_response.rb +0 -17
  130. data/lib/nordlet/capture/types/settings_update_capture_request.rb +0 -13
  131. data/lib/nordlet/capture/types/settings_update_capture_response.rb +0 -17
@@ -12,11 +12,20 @@ module Nordlet
12
12
 
13
13
  # Create a draft purchase invoice or credit note (`type`) from a supplier document; it is posted with
14
14
  # `purchases/invoices/register`. Lines without a unit price take the item's supplier or purchase price, `currency`
15
- # defaults to the company's invoice currency, `documentRef` links an uploaded file, and the gross total leaves out
16
- # self-assessed VAT. `creditedInvoiceId` (credit notes only) must be an invoice of the same partner,
17
- # `purchaseOrderId` an order of the same partner that is not draft, submitted or cancelled, and `operationTypeId`
18
- # an active purchase operation type, each 422 otherwise; the same `documentNumber` for the same partner is refused
19
- # with 409.
15
+ # defaults to the company's invoice currency, `documentRef` links an uploaded file, and the gross total is the
16
+ # amount owed: it leaves out self-assessed VAT (reverse charge, intra-EU acquisitions and import VAT the buyer
17
+ # declares in its VAT return) and the value of lines whose VAT type is import VAT assessed by customs. `netTotal`,
18
+ # `vatTotal` and `grossTotal` are the totals printed on the document, with the meanings of the response fields: a
19
+ # difference of at most 0.01 from the totals of the lines is put on the line with the largest amount and the
20
+ # printed totals are stored, a larger one is refused with 422 naming both sets of totals. `creditedInvoiceId`
21
+ # (credit notes only) must be an invoice of the same partner, `purchaseOrderId` an order of the same partner that
22
+ # is not draft, submitted or cancelled, and `operationTypeId` an active purchase operation type, each 422
23
+ # otherwise; the same `documentNumber` for the same partner is refused with 409; numbers are compared without
24
+ # regard to case, and spaces, dashes, slashes, dots and underscores count as one separator. `warnings` lists what
25
+ # does not refuse the document but needs a look: `vat_type_not_valid_on_date`, `vat_type_domestic_for_eu_partner`
26
+ # and `vat_type_intra_eu_for_domestic_partner` as on `sales/invoices/create` (on the document date), and
27
+ # `possible_duplicate` when the supplier already has a document of the same type with the same document date and
28
+ # gross total.
20
29
  #
21
30
  # @param request_options [Hash]
22
31
  # @param params [Nordlet::Purchases::Types::InvoicesCreatePurchasesRequest]
@@ -85,8 +94,10 @@ module Nordlet
85
94
  end
86
95
 
87
96
  # Change a draft purchase invoice (409 once registered); only the fields sent are changed, and `lines` replace all
88
- # existing lines with the totals recomputed. `purchaseOrderId` and `operationTypeId` are checked as on
89
- # `purchases/invoices/create` (422). A `documentNumber` already used for the partner is refused with 409.
97
+ # existing lines with the totals recomputed. `netTotal`, `vatTotal` and `grossTotal` are the printed totals as on
98
+ # `purchases/invoices/create`; sent without `lines`, they are applied to the stored lines. `purchaseOrderId` and
99
+ # `operationTypeId` are checked as on `purchases/invoices/create` (422). A `documentNumber` already used for the
100
+ # partner is refused with 409, compared as on `purchases/invoices/create`.
90
101
  #
91
102
  # @param request_options [Hash]
92
103
  # @param params [Nordlet::Purchases::Types::InvoicesUpdatePurchasesRequest]
@@ -158,22 +169,27 @@ module Nordlet
158
169
  # Register a draft purchase invoice or credit note: posts the journal entry dated `registrationDate` (default the
159
170
  # document date) and sets the status to `registered`. The entry debits each line's expense account (the line's
160
171
  # `accountCode`, else the item's purchase or expense account, else the operation type's expense account, else the
161
- # `purchases.goodsForResale` or `purchases.defaultExpense` rule account), debits VAT receivable (a company that is
162
- # not a VAT payer books the VAT into the expense instead), credits payables (the operation type's credit account
163
- # when set) and credits output VAT for self-assessed VAT; a credit note posts the reverse. Lines with
164
- # `deferralStartDate` and `deferralEndDate` are debited to the `purchases.prepaidExpenses` account instead and get
165
- # a monthly release schedule for `purchases/deferrals/post`. With `warehouseId` the product lines of an invoice
166
- # are received into stock at their base-currency cost, into the lot named by the line's `lotNumber` (an unknown
167
- # lot is created, and the line's `expiryDate` is stored on a lot that has none) (422 on an order-linked invoice,
168
- # whose goods arrive through `purchases/receipts/create`, for a line that is also deferred and for a lot- or
169
- # serial-tracked item without `lotNumber`); `returnFromStock` on a credit note that credits an invoice takes the
170
- # goods back out of stock at their FIFO cost and books the difference to the credited amount on the
172
+ # `purchases.goodsForResale` or `purchases.defaultExpense` rule account), debits VAT receivable with the
173
+ # deductible VAT (the share of the line's VAT that its VAT type allows to deduct; the rest, and all VAT of a
174
+ # company that is not a VAT payer, is booked into the expense), credits payables (the operation type's credit
175
+ # account when set) and credits output VAT for self-assessed VAT (reverse charge, intra-EU acquisitions and import
176
+ # VAT the buyer declares in its VAT return); a line whose VAT type is import VAT assessed by customs posts only
177
+ # its VAT, owed to the document's partner, and is not received into stock; a credit note posts the reverse. Lines
178
+ # with `deferralStartDate` and `deferralEndDate` are debited to the `purchases.prepaidExpenses` account instead
179
+ # and get a monthly release schedule for `purchases/deferrals/post`. With `warehouseId` the product lines of an
180
+ # invoice are received into stock at their base-currency cost, into the lot named by the line's `lotNumber` (an
181
+ # unknown lot is created, and the line's `expiryDate` is stored on a lot that has none) (422 on an order-linked
182
+ # invoice, whose goods arrive through `purchases/receipts/create`, for a line that is also deferred and for a lot-
183
+ # or serial-tracked item without `lotNumber`); `returnFromStock` on a credit note that credits an invoice takes
184
+ # the goods back out of stock at their FIFO cost and books the difference to the credited amount on the
171
185
  # `inventory.cogs` account (422 on an invoice, without `creditedInvoiceId`, or when no goods of the credited
172
186
  # invoice are in stock). A credit note that credits a registered invoice in the same currency is applied to it as
173
187
  # a payment up to the open amount. Refused with 409 when already registered or the accounting period is locked,
174
- # and with 422 when the credit notes would exceed the credited invoice, a posting account is missing or no
175
- # exchange rate exists for the date. Emits `purchase_invoice.registered`, `purchase_invoice.paid` when the
176
- # credited invoice becomes fully paid, and `stock.changed` when stock moves.
188
+ # and with 422 when the credit notes would exceed the credited invoice, the gross total differs from what the
189
+ # lines give by more than 0.01 (or the converted amounts by more than their conversion rounding), a posting
190
+ # account is missing or no exchange rate exists for the date. Emits `purchase_invoice.registered`,
191
+ # `purchase_invoice.paid` when the credited invoice becomes fully paid, and `stock.changed` when stock moves.
192
+ # `warnings` carries the VAT type warnings of `purchases/invoices/create`.
177
193
  #
178
194
  # @param request_options [Hash]
179
195
  # @param params [Nordlet::Purchases::Types::InvoicesRegisterPurchasesRequest]
@@ -318,6 +334,47 @@ module Nordlet
318
334
  end
319
335
  end
320
336
 
337
+ # Posts a journal entry dated `date` (default the registration date) that mirrors the document's entry (debits and
338
+ # credits swapped), reverses the prepaid-expense releases already posted for it, cancels its pending releases and
339
+ # sets the status to `reversed` with the reason. The reversed document leaves the VAT returns, the open items and
340
+ # payment matching, and its supplier `documentNumber` can be entered again. `date` must be in the month of the
341
+ # registration date and not before it (422; correct an earlier month with a credit note). Answers 409 when the
342
+ # document is not registered, when the accounting period of `date` is locked (naming the period), when registered
343
+ # credit notes credit it, when payments are matched to it (naming them; unmatch them first), and when it moved
344
+ # goods in or out of stock or is the source of a landed cost (post a credit note with `returnFromStock` instead).
345
+ #
346
+ # @param request_options [Hash]
347
+ # @param params [Nordlet::Purchases::Types::InvoicesReversePurchasesRequest]
348
+ # @option request_options [String] :base_url
349
+ # @option request_options [Hash{String => Object}] :additional_headers
350
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
351
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
352
+ # @option request_options [Integer] :timeout_in_seconds
353
+ #
354
+ # @return [Nordlet::Purchases::Types::InvoicesReversePurchasesResponse]
355
+ def invoices_reverse(request_options: {}, **params)
356
+ params = Nordlet::Internal::Types::Utils.normalize_keys(params)
357
+ request = Nordlet::Internal::JSON::Request.new(
358
+ base_url: request_options[:base_url],
359
+ method: "POST",
360
+ path: "v1/purchases/invoices/reverse",
361
+ body: Nordlet::Purchases::Types::InvoicesReversePurchasesRequest.new(params).to_h,
362
+ request_options: request_options
363
+ )
364
+ begin
365
+ response = @client.send(request)
366
+ rescue Net::HTTPRequestTimeout
367
+ raise Nordlet::Errors::TimeoutError
368
+ end
369
+ code = response.code.to_i
370
+ if code.between?(200, 299)
371
+ Nordlet::Purchases::Types::InvoicesReversePurchasesResponse.load(response.body)
372
+ else
373
+ error_class = Nordlet::Errors::ResponseError.subclass_for_code(code)
374
+ raise error_class.new(response.body, code: code)
375
+ end
376
+ end
377
+
321
378
  # Create a draft purchase order for a supplier. Lines without a unit price take the item's supplier or purchase
322
379
  # price; `orderNumber` comes from the `purchase_order` series with prefix PO when not given; `currency` defaults
323
380
  # to the company's invoice currency; `documentRef` links an uploaded file to the order. A number already in use is
@@ -37,6 +37,12 @@ module Nordlet
37
37
  field :document_ref, -> { String }, optional: true, nullable: false, api_name: "documentRef"
38
38
 
39
39
  field :lines, -> { Internal::Types::Array[Nordlet::Purchases::Types::InvoicesCreatePurchasesRequestLinesItem] }, optional: false, nullable: false
40
+
41
+ field :net_total, -> { String }, optional: true, nullable: false, api_name: "netTotal"
42
+
43
+ field :vat_total, -> { String }, optional: true, nullable: false, api_name: "vatTotal"
44
+
45
+ field :gross_total, -> { String }, optional: true, nullable: false, api_name: "grossTotal"
40
46
  end
41
47
  end
42
48
  end
@@ -34,6 +34,12 @@ module Nordlet
34
34
 
35
35
  field :journal_transaction_id, -> { String }, optional: false, nullable: true, api_name: "journalTransactionId"
36
36
 
37
+ field :reversed_at, -> { String }, optional: false, nullable: true, api_name: "reversedAt"
38
+
39
+ field :reversal_journal_transaction_id, -> { String }, optional: false, nullable: true, api_name: "reversalJournalTransactionId"
40
+
41
+ field :reversal_reason, -> { String }, optional: false, nullable: true, api_name: "reversalReason"
42
+
37
43
  field :credited_invoice_id, -> { String }, optional: false, nullable: true, api_name: "creditedInvoiceId"
38
44
 
39
45
  field :purchase_order_id, -> { String }, optional: false, nullable: true, api_name: "purchaseOrderId"
@@ -59,6 +65,8 @@ module Nordlet
59
65
  field :updated_at, -> { String }, optional: false, nullable: false, api_name: "updatedAt"
60
66
 
61
67
  field :lines, -> { Internal::Types::Array[Nordlet::Purchases::Types::InvoicesCreatePurchasesResponseLinesItem] }, optional: false, nullable: false
68
+
69
+ field :warnings, -> { Internal::Types::Array[Nordlet::Purchases::Types::InvoicesCreatePurchasesResponseWarningsItem] }, optional: false, nullable: false
62
70
  end
63
71
  end
64
72
  end
@@ -8,6 +8,7 @@ module Nordlet
8
8
 
9
9
  DRAFT = "draft"
10
10
  REGISTERED = "registered"
11
+ REVERSED = "reversed"
11
12
  end
12
13
  end
13
14
  end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Purchases
5
+ module Types
6
+ class InvoicesCreatePurchasesResponseWarningsItem < Internal::Types::Model
7
+ field :code, -> { String }, optional: false, nullable: false
8
+
9
+ field :message, -> { String }, optional: false, nullable: false
10
+ end
11
+ end
12
+ end
13
+ end
@@ -34,6 +34,12 @@ module Nordlet
34
34
 
35
35
  field :journal_transaction_id, -> { String }, optional: false, nullable: true, api_name: "journalTransactionId"
36
36
 
37
+ field :reversed_at, -> { String }, optional: false, nullable: true, api_name: "reversedAt"
38
+
39
+ field :reversal_journal_transaction_id, -> { String }, optional: false, nullable: true, api_name: "reversalJournalTransactionId"
40
+
41
+ field :reversal_reason, -> { String }, optional: false, nullable: true, api_name: "reversalReason"
42
+
37
43
  field :credited_invoice_id, -> { String }, optional: false, nullable: true, api_name: "creditedInvoiceId"
38
44
 
39
45
  field :purchase_order_id, -> { String }, optional: false, nullable: true, api_name: "purchaseOrderId"
@@ -8,6 +8,7 @@ module Nordlet
8
8
 
9
9
  DRAFT = "draft"
10
10
  REGISTERED = "registered"
11
+ REVERSED = "reversed"
11
12
  end
12
13
  end
13
14
  end
@@ -34,6 +34,12 @@ module Nordlet
34
34
 
35
35
  field :journal_transaction_id, -> { String }, optional: false, nullable: true, api_name: "journalTransactionId"
36
36
 
37
+ field :reversed_at, -> { String }, optional: false, nullable: true, api_name: "reversedAt"
38
+
39
+ field :reversal_journal_transaction_id, -> { String }, optional: false, nullable: true, api_name: "reversalJournalTransactionId"
40
+
41
+ field :reversal_reason, -> { String }, optional: false, nullable: true, api_name: "reversalReason"
42
+
37
43
  field :credited_invoice_id, -> { String }, optional: false, nullable: true, api_name: "creditedInvoiceId"
38
44
 
39
45
  field :purchase_order_id, -> { String }, optional: false, nullable: true, api_name: "purchaseOrderId"
@@ -8,6 +8,7 @@ module Nordlet
8
8
 
9
9
  DRAFT = "draft"
10
10
  REGISTERED = "registered"
11
+ REVERSED = "reversed"
11
12
  end
12
13
  end
13
14
  end
@@ -34,6 +34,12 @@ module Nordlet
34
34
 
35
35
  field :journal_transaction_id, -> { String }, optional: false, nullable: true, api_name: "journalTransactionId"
36
36
 
37
+ field :reversed_at, -> { String }, optional: false, nullable: true, api_name: "reversedAt"
38
+
39
+ field :reversal_journal_transaction_id, -> { String }, optional: false, nullable: true, api_name: "reversalJournalTransactionId"
40
+
41
+ field :reversal_reason, -> { String }, optional: false, nullable: true, api_name: "reversalReason"
42
+
37
43
  field :credited_invoice_id, -> { String }, optional: false, nullable: true, api_name: "creditedInvoiceId"
38
44
 
39
45
  field :purchase_order_id, -> { String }, optional: false, nullable: true, api_name: "purchaseOrderId"
@@ -59,6 +65,8 @@ module Nordlet
59
65
  field :updated_at, -> { String }, optional: false, nullable: false, api_name: "updatedAt"
60
66
 
61
67
  field :lines, -> { Internal::Types::Array[Nordlet::Purchases::Types::InvoicesRegisterPurchasesResponseLinesItem] }, optional: false, nullable: false
68
+
69
+ field :warnings, -> { Internal::Types::Array[Nordlet::Purchases::Types::InvoicesRegisterPurchasesResponseWarningsItem] }, optional: false, nullable: false
62
70
  end
63
71
  end
64
72
  end
@@ -8,6 +8,7 @@ module Nordlet
8
8
 
9
9
  DRAFT = "draft"
10
10
  REGISTERED = "registered"
11
+ REVERSED = "reversed"
11
12
  end
12
13
  end
13
14
  end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Purchases
5
+ module Types
6
+ class InvoicesRegisterPurchasesResponseWarningsItem < Internal::Types::Model
7
+ field :code, -> { String }, optional: false, nullable: false
8
+
9
+ field :message, -> { String }, optional: false, nullable: false
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Purchases
5
+ module Types
6
+ class InvoicesReversePurchasesRequest < Internal::Types::Model
7
+ field :id, -> { String }, optional: false, nullable: false
8
+
9
+ field :reason, -> { String }, optional: false, nullable: false
10
+
11
+ field :date, -> { String }, optional: true, nullable: false
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Purchases
5
+ module Types
6
+ class InvoicesReversePurchasesResponse < Internal::Types::Model
7
+ field :id, -> { String }, optional: false, nullable: false
8
+
9
+ field :partner_id, -> { String }, optional: false, nullable: false, api_name: "partnerId"
10
+
11
+ field :type, -> { Nordlet::Purchases::Types::InvoicesReversePurchasesResponseType }, optional: false, nullable: false
12
+
13
+ field :status, -> { Nordlet::Purchases::Types::InvoicesReversePurchasesResponseStatus }, optional: false, nullable: false
14
+
15
+ field :payment_status, -> { Nordlet::Purchases::Types::InvoicesReversePurchasesResponsePaymentStatus }, optional: false, nullable: false, api_name: "paymentStatus"
16
+
17
+ field :document_number, -> { String }, optional: false, nullable: false, api_name: "documentNumber"
18
+
19
+ field :document_date, -> { String }, optional: false, nullable: false, api_name: "documentDate"
20
+
21
+ field :due_date, -> { String }, optional: false, nullable: true, api_name: "dueDate"
22
+
23
+ field :registration_date, -> { String }, optional: false, nullable: true, api_name: "registrationDate"
24
+
25
+ field :currency, -> { String }, optional: false, nullable: false
26
+
27
+ field :net_total, -> { String }, optional: false, nullable: false, api_name: "netTotal"
28
+
29
+ field :vat_total, -> { String }, optional: false, nullable: false, api_name: "vatTotal"
30
+
31
+ field :gross_total, -> { String }, optional: false, nullable: false, api_name: "grossTotal"
32
+
33
+ field :paid_amount, -> { String }, optional: false, nullable: false, api_name: "paidAmount"
34
+
35
+ field :journal_transaction_id, -> { String }, optional: false, nullable: true, api_name: "journalTransactionId"
36
+
37
+ field :reversed_at, -> { String }, optional: false, nullable: true, api_name: "reversedAt"
38
+
39
+ field :reversal_journal_transaction_id, -> { String }, optional: false, nullable: true, api_name: "reversalJournalTransactionId"
40
+
41
+ field :reversal_reason, -> { String }, optional: false, nullable: true, api_name: "reversalReason"
42
+
43
+ field :credited_invoice_id, -> { String }, optional: false, nullable: true, api_name: "creditedInvoiceId"
44
+
45
+ field :purchase_order_id, -> { String }, optional: false, nullable: true, api_name: "purchaseOrderId"
46
+
47
+ field :operation_type_id, -> { String }, optional: false, nullable: true, api_name: "operationTypeId"
48
+
49
+ field :notes, -> { String }, optional: false, nullable: true
50
+
51
+ field :intrastat_transport_mode, -> { String }, optional: false, nullable: true, api_name: "intrastatTransportMode"
52
+
53
+ field :intrastat_delivery_terms, -> { String }, optional: false, nullable: true, api_name: "intrastatDeliveryTerms"
54
+
55
+ field :intrastat_region, -> { String }, optional: false, nullable: true, api_name: "intrastatRegion"
56
+
57
+ field :intrastat_nature_of_transaction, -> { String }, optional: false, nullable: true, api_name: "intrastatNatureOfTransaction"
58
+
59
+ field :einvoice_number, -> { String }, optional: false, nullable: true, api_name: "einvoiceNumber"
60
+
61
+ field :document_ref, -> { String }, optional: false, nullable: true, api_name: "documentRef"
62
+
63
+ field :created_at, -> { String }, optional: false, nullable: false, api_name: "createdAt"
64
+
65
+ field :updated_at, -> { String }, optional: false, nullable: false, api_name: "updatedAt"
66
+
67
+ field :lines, -> { Internal::Types::Array[Nordlet::Purchases::Types::InvoicesReversePurchasesResponseLinesItem] }, optional: false, nullable: false
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Purchases
5
+ module Types
6
+ class InvoicesReversePurchasesResponseLinesItem < Internal::Types::Model
7
+ field :id, -> { String }, optional: false, nullable: false
8
+
9
+ field :item_id, -> { String }, optional: false, nullable: true, api_name: "itemId"
10
+
11
+ field :description, -> { String }, optional: false, nullable: false
12
+
13
+ field :unit, -> { String }, optional: false, nullable: false
14
+
15
+ field :quantity, -> { String }, optional: false, nullable: false
16
+
17
+ field :unit_factor, -> { String }, optional: false, nullable: false, api_name: "unitFactor"
18
+
19
+ field :base_quantity, -> { String }, optional: false, nullable: false, api_name: "baseQuantity"
20
+
21
+ field :unit_price_excl_vat, -> { String }, optional: false, nullable: true, api_name: "unitPriceExclVat"
22
+
23
+ field :unit_price_incl_vat, -> { String }, optional: false, nullable: true, api_name: "unitPriceInclVat"
24
+
25
+ field :vat_rate_percent, -> { String }, optional: false, nullable: false, api_name: "vatRatePercent"
26
+
27
+ field :vat_classifier_code, -> { String }, optional: false, nullable: true, api_name: "vatClassifierCode"
28
+
29
+ field :cost_center_id, -> { String }, optional: false, nullable: true, api_name: "costCenterId"
30
+
31
+ field :project_id, -> { String }, optional: false, nullable: true, api_name: "projectId"
32
+
33
+ field :account_code, -> { String }, optional: false, nullable: true, api_name: "accountCode"
34
+
35
+ field :deferral_start_date, -> { String }, optional: false, nullable: true, api_name: "deferralStartDate"
36
+
37
+ field :deferral_end_date, -> { String }, optional: false, nullable: true, api_name: "deferralEndDate"
38
+
39
+ field :lot_number, -> { String }, optional: false, nullable: true, api_name: "lotNumber"
40
+
41
+ field :expiry_date, -> { String }, optional: false, nullable: true, api_name: "expiryDate"
42
+
43
+ field :line_net, -> { String }, optional: false, nullable: false, api_name: "lineNet"
44
+
45
+ field :line_vat, -> { String }, optional: false, nullable: false, api_name: "lineVat"
46
+
47
+ field :line_gross, -> { String }, optional: false, nullable: false, api_name: "lineGross"
48
+
49
+ field :sort_order, -> { Integer }, optional: false, nullable: false, api_name: "sortOrder"
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Purchases
5
+ module Types
6
+ module InvoicesReversePurchasesResponsePaymentStatus
7
+ extend Nordlet::Internal::Types::Enum
8
+
9
+ UNPAID = "unpaid"
10
+ PARTIAL = "partial"
11
+ PAID = "paid"
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Purchases
5
+ module Types
6
+ module InvoicesReversePurchasesResponseStatus
7
+ extend Nordlet::Internal::Types::Enum
8
+
9
+ DRAFT = "draft"
10
+ REGISTERED = "registered"
11
+ REVERSED = "reversed"
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Nordlet
4
- module Capture
4
+ module Purchases
5
5
  module Types
6
- module DocumentsUploadCaptureResponseExtractionDocumentType
6
+ module InvoicesReversePurchasesResponseType
7
7
  extend Nordlet::Internal::Types::Enum
8
8
 
9
9
  INVOICE = "invoice"
@@ -33,6 +33,12 @@ module Nordlet
33
33
  field :einvoice_number, -> { String }, optional: true, nullable: false, api_name: "einvoiceNumber"
34
34
 
35
35
  field :lines, -> { Internal::Types::Array[Nordlet::Purchases::Types::InvoicesUpdatePurchasesRequestLinesItem] }, optional: true, nullable: false
36
+
37
+ field :net_total, -> { String }, optional: true, nullable: false, api_name: "netTotal"
38
+
39
+ field :vat_total, -> { String }, optional: true, nullable: false, api_name: "vatTotal"
40
+
41
+ field :gross_total, -> { String }, optional: true, nullable: false, api_name: "grossTotal"
36
42
  end
37
43
  end
38
44
  end
@@ -34,6 +34,12 @@ module Nordlet
34
34
 
35
35
  field :journal_transaction_id, -> { String }, optional: false, nullable: true, api_name: "journalTransactionId"
36
36
 
37
+ field :reversed_at, -> { String }, optional: false, nullable: true, api_name: "reversedAt"
38
+
39
+ field :reversal_journal_transaction_id, -> { String }, optional: false, nullable: true, api_name: "reversalJournalTransactionId"
40
+
41
+ field :reversal_reason, -> { String }, optional: false, nullable: true, api_name: "reversalReason"
42
+
37
43
  field :credited_invoice_id, -> { String }, optional: false, nullable: true, api_name: "creditedInvoiceId"
38
44
 
39
45
  field :purchase_order_id, -> { String }, optional: false, nullable: true, api_name: "purchaseOrderId"
@@ -8,6 +8,7 @@ module Nordlet
8
8
 
9
9
  DRAFT = "draft"
10
10
  REGISTERED = "registered"
11
+ REVERSED = "reversed"
11
12
  end
12
13
  end
13
14
  end
@@ -469,7 +469,8 @@ module Nordlet
469
469
  # (422). `side` says whether the type is for sale lines, purchase lines or both, `scheme` is its VAT scheme and
470
470
  # `nameEn` its English name; both are null for a type the company added itself. A type without a rate takes the
471
471
  # line's `vatRatePercent` on the sides where `rateFromLine` is true, and 0% elsewhere. Filterable by `code`,
472
- # `countryCode` and `ratePercent`; sortable by `code` and `ratePercent`.
472
+ # `countryCode`, `ratePercent`, `side` and `scheme`; `side` and `scheme` take `eq`, `ne` and `in`, and `side`
473
+ # `sale` or `purchase` also matches the types for both sides. Sortable by `code` and `ratePercent`.
473
474
  #
474
475
  # @param request_options [Hash]
475
476
  # @param params [Nordlet::Reference::Types::VatClassifiersListReferenceRequest]
@@ -615,7 +616,12 @@ module Nordlet
615
616
  # from the partner's address or VAT number, business status from the VAT number) or from `customerCountryCode` and
616
617
  # `customerIsBusiness`; `date` defaults to the company's current date; when `belowDistanceSalesThreshold` is not
617
618
  # given, the distance-sales threshold is tracked from the company's ledger. Answers 422 when the partner has
618
- # neither an address country nor a VAT code.
619
+ # neither an address country nor a VAT code. `vatTypeCodes` lists the codes of the VAT types of the company's
620
+ # country that fit the treatment and are valid on `date` (for `vatClassifierCode` on a line), empty when none is
621
+ # known; when they all belong to one of the schemes `intra_eu_b2b` and `reverse_charge`, `scheme` is that scheme.
622
+ # With `side` `purchase` the partner (or `customerCountryCode` and `customerIsBusiness`) is the supplier, the
623
+ # treatment is that of the supplier's supply to this company, `vatTypeCodes` are purchase types, and the
624
+ # marketplace, platform-service and special-goods fields are not used.
619
625
  #
620
626
  # @param request_options [Hash]
621
627
  # @param params [Nordlet::Reference::Types::VatResolveReferenceRequest]
@@ -12,6 +12,8 @@ module Nordlet
12
12
 
13
13
  field :supply_type, -> { Nordlet::Reference::Types::VatResolveReferenceRequestSupplyType }, optional: true, nullable: false, api_name: "supplyType"
14
14
 
15
+ field :side, -> { Nordlet::Reference::Types::VatResolveReferenceRequestSide }, optional: true, nullable: false
16
+
15
17
  field :date, -> { String }, optional: true, nullable: false
16
18
 
17
19
  field :below_distance_sales_threshold, -> { Internal::Types::Boolean }, optional: true, nullable: false, api_name: "belowDistanceSalesThreshold"
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Reference
5
+ module Types
6
+ module VatResolveReferenceRequestSide
7
+ extend Nordlet::Internal::Types::Enum
8
+
9
+ SALE = "sale"
10
+ PURCHASE = "purchase"
11
+ end
12
+ end
13
+ end
14
+ end
@@ -19,6 +19,8 @@ module Nordlet
19
19
  field :legal_basis, -> { String }, optional: false, nullable: false, api_name: "legalBasis"
20
20
 
21
21
  field :notes, -> { Internal::Types::Array[String] }, optional: false, nullable: false
22
+
23
+ field :vat_type_codes, -> { Internal::Types::Array[String] }, optional: false, nullable: false, api_name: "vatTypeCodes"
22
24
  end
23
25
  end
24
26
  end
@@ -626,6 +626,48 @@ module Nordlet
626
626
  end
627
627
  end
628
628
 
629
+ # Lists what is still open for `period`: a month (`YYYY-MM`) or the fiscal year that ends in `YYYY`. Items: draft
630
+ # sale documents (invoices, credit notes and advance invoices with an issue date in the period) and draft purchase
631
+ # documents dated in the period, bank lines dated in the period with status `new`, assets with depreciation months
632
+ # not posted up to the period end, expense deferral rows due by the period end and not posted, active recurring
633
+ # invoices whose next run date is on or before the period end, payroll runs of the period's months still in draft,
634
+ # and for a fiscal year the issued sale and registered purchase documents in a currency other than the base
635
+ # currency still open at the year end. Each item carries the `count` and the `ids` of the documents, rows, assets,
636
+ # recurring invoices or runs; an item with nothing open is left out. `ledger/periods/lock` returns the same items
637
+ # as `warnings`.
638
+ #
639
+ # @param request_options [Hash]
640
+ # @param params [Nordlet::Reports::Types::PeriodChecklistReportsRequest]
641
+ # @option request_options [String] :base_url
642
+ # @option request_options [Hash{String => Object}] :additional_headers
643
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
644
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
645
+ # @option request_options [Integer] :timeout_in_seconds
646
+ #
647
+ # @return [Nordlet::Reports::Types::PeriodChecklistReportsResponse]
648
+ def period_checklist(request_options: {}, **params)
649
+ params = Nordlet::Internal::Types::Utils.normalize_keys(params)
650
+ request = Nordlet::Internal::JSON::Request.new(
651
+ base_url: request_options[:base_url],
652
+ method: "POST",
653
+ path: "v1/reports/period-checklist",
654
+ body: Nordlet::Reports::Types::PeriodChecklistReportsRequest.new(params).to_h,
655
+ request_options: request_options
656
+ )
657
+ begin
658
+ response = @client.send(request)
659
+ rescue Net::HTTPRequestTimeout
660
+ raise Nordlet::Errors::TimeoutError
661
+ end
662
+ code = response.code.to_i
663
+ if code.between?(200, 299)
664
+ Nordlet::Reports::Types::PeriodChecklistReportsResponse.load(response.body)
665
+ else
666
+ error_class = Nordlet::Errors::ResponseError.subclass_for_code(code)
667
+ raise error_class.new(response.body, code: code)
668
+ end
669
+ end
670
+
629
671
  # Registered purchase invoices of a period (by registration date) from partners in another EU country, summed per
630
672
  # partner country and VAT rate: net and VAT in the base currency and the number of documents, credit notes
631
673
  # counting negative. The partner's country is the country code of its address, else the first two characters of
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Reports
5
+ module Types
6
+ class PeriodChecklistReportsRequest < Internal::Types::Model
7
+ field :period, -> { String }, optional: false, nullable: false
8
+ end
9
+ end
10
+ end
11
+ end