e-invoice-api 0.33.0 → 0.35.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.
Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +31 -0
  3. data/LICENSE +201 -0
  4. data/README.md +18 -7
  5. data/SECURITY.md +6 -16
  6. data/lib/e_invoice_api/client.rb +16 -0
  7. data/lib/e_invoice_api/internal/transport/base_client.rb +43 -78
  8. data/lib/e_invoice_api/internal/transport/pooled_net_requester.rb +8 -8
  9. data/lib/e_invoice_api/internal/type/array_of.rb +12 -12
  10. data/lib/e_invoice_api/internal/type/base_model.rb +18 -18
  11. data/lib/e_invoice_api/internal/type/boolean.rb +6 -6
  12. data/lib/e_invoice_api/internal/type/converter.rb +24 -24
  13. data/lib/e_invoice_api/internal/type/enum.rb +6 -6
  14. data/lib/e_invoice_api/internal/type/file_input.rb +6 -6
  15. data/lib/e_invoice_api/internal/type/hash_of.rb +12 -12
  16. data/lib/e_invoice_api/internal/type/request_parameters.rb +1 -1
  17. data/lib/e_invoice_api/internal/type/union.rb +10 -10
  18. data/lib/e_invoice_api/internal/type/unknown.rb +6 -6
  19. data/lib/e_invoice_api/internal/util.rb +15 -57
  20. data/lib/e_invoice_api/models/conversion/document_create_from_pdf_task.rb +43 -0
  21. data/lib/e_invoice_api/models/conversion/pdf_create_params.rb +22 -0
  22. data/lib/e_invoice_api/models/conversion/pdf_result_params.rb +22 -0
  23. data/lib/e_invoice_api/models/conversion/pdf_retrieve_params.rb +22 -0
  24. data/lib/e_invoice_api/models/document_create.rb +203 -17
  25. data/lib/e_invoice_api/models/document_create_from_pdf_response.rb +153 -17
  26. data/lib/e_invoice_api/models/document_lifecycle_params.rb +20 -0
  27. data/lib/e_invoice_api/models/document_lifecycle_response.rb +134 -0
  28. data/lib/e_invoice_api/models/document_response.rb +161 -21
  29. data/lib/e_invoice_api/models/document_timeline_params.rb +20 -0
  30. data/lib/e_invoice_api/models/document_timeline_response.rb +71 -0
  31. data/lib/e_invoice_api/models/draft_list_params.rb +113 -0
  32. data/lib/e_invoice_api/models/inbound_email_response.rb +129 -0
  33. data/lib/e_invoice_api/models/mailbox_download_attachment_params.rb +26 -0
  34. data/lib/e_invoice_api/models/mailbox_list_params.rb +129 -0
  35. data/lib/e_invoice_api/models/mailbox_reprocess_params.rb +20 -0
  36. data/lib/e_invoice_api/models/mailbox_retrieve_params.rb +20 -0
  37. data/lib/e_invoice_api/models/me_retrieve_response.rb +8 -7
  38. data/lib/e_invoice_api/models/payment_detail_create.rb +8 -4
  39. data/lib/e_invoice_api/models/stats_retrieve_params.rb +55 -0
  40. data/lib/e_invoice_api/models/stats_retrieve_response.rb +141 -0
  41. data/lib/e_invoice_api/models/ubl_document_validation.rb +10 -1
  42. data/lib/e_invoice_api/models/unit_of_measure_code.rb +1349 -0
  43. data/lib/e_invoice_api/models/webhook_history_params.rb +20 -0
  44. data/lib/e_invoice_api/models/webhook_history_response.rb +17 -0
  45. data/lib/e_invoice_api/models/webhook_test_params.rb +37 -0
  46. data/lib/e_invoice_api/models/webhook_test_response.rb +35 -0
  47. data/lib/e_invoice_api/models.rb +24 -0
  48. data/lib/e_invoice_api/resources/conversion/pdf.rb +76 -0
  49. data/lib/e_invoice_api/resources/conversion.rb +18 -0
  50. data/lib/e_invoice_api/resources/documents/attachments.rb +11 -11
  51. data/lib/e_invoice_api/resources/documents/ubl.rb +4 -4
  52. data/lib/e_invoice_api/resources/documents.rb +130 -69
  53. data/lib/e_invoice_api/resources/drafts.rb +55 -0
  54. data/lib/e_invoice_api/resources/inbox.rb +20 -20
  55. data/lib/e_invoice_api/resources/lookup.rb +5 -5
  56. data/lib/e_invoice_api/resources/mailbox.rb +123 -0
  57. data/lib/e_invoice_api/resources/me.rb +1 -1
  58. data/lib/e_invoice_api/resources/outbox.rb +19 -19
  59. data/lib/e_invoice_api/resources/stats.rb +47 -0
  60. data/lib/e_invoice_api/resources/validate.rb +76 -56
  61. data/lib/e_invoice_api/resources/webhooks.rb +59 -14
  62. data/lib/e_invoice_api/version.rb +1 -1
  63. data/lib/e_invoice_api.rb +25 -1
  64. data/rbi/e_invoice_api/client.rbi +12 -0
  65. data/rbi/e_invoice_api/internal/transport/base_client.rbi +2 -10
  66. data/rbi/e_invoice_api/internal/util.rbi +0 -12
  67. data/rbi/e_invoice_api/models/conversion/document_create_from_pdf_task.rbi +108 -0
  68. data/rbi/e_invoice_api/models/conversion/pdf_create_params.rbi +43 -0
  69. data/rbi/e_invoice_api/models/conversion/pdf_result_params.rbi +40 -0
  70. data/rbi/e_invoice_api/models/conversion/pdf_retrieve_params.rbi +40 -0
  71. data/rbi/e_invoice_api/models/document_create.rbi +366 -15
  72. data/rbi/e_invoice_api/models/document_create_from_pdf_response.rbi +280 -15
  73. data/rbi/e_invoice_api/models/document_lifecycle_params.rbi +38 -0
  74. data/rbi/e_invoice_api/models/document_lifecycle_response.rbi +353 -0
  75. data/rbi/e_invoice_api/models/document_response.rbi +292 -19
  76. data/rbi/e_invoice_api/models/document_timeline_params.rbi +38 -0
  77. data/rbi/e_invoice_api/models/document_timeline_response.rbi +168 -0
  78. data/rbi/e_invoice_api/models/draft_list_params.rbi +194 -0
  79. data/rbi/e_invoice_api/models/inbound_email_response.rbi +189 -0
  80. data/rbi/e_invoice_api/models/mailbox_download_attachment_params.rbi +46 -0
  81. data/rbi/e_invoice_api/models/mailbox_list_params.rbi +218 -0
  82. data/rbi/e_invoice_api/models/mailbox_reprocess_params.rbi +41 -0
  83. data/rbi/e_invoice_api/models/mailbox_retrieve_params.rbi +41 -0
  84. data/rbi/e_invoice_api/models/me_retrieve_response.rbi +10 -8
  85. data/rbi/e_invoice_api/models/payment_detail_create.rbi +12 -4
  86. data/rbi/e_invoice_api/models/stats_retrieve_params.rbi +111 -0
  87. data/rbi/e_invoice_api/models/stats_retrieve_response.rbi +251 -0
  88. data/rbi/e_invoice_api/models/ubl_document_validation.rbi +11 -1
  89. data/rbi/e_invoice_api/models/unit_of_measure_code.rbi +1349 -0
  90. data/rbi/e_invoice_api/models/webhook_history_params.rbi +38 -0
  91. data/rbi/e_invoice_api/models/webhook_history_response.rbi +32 -0
  92. data/rbi/e_invoice_api/models/webhook_test_params.rbi +57 -0
  93. data/rbi/e_invoice_api/models/webhook_test_response.rbi +57 -0
  94. data/rbi/e_invoice_api/models.rbi +25 -0
  95. data/rbi/e_invoice_api/resources/conversion/pdf.rbi +44 -0
  96. data/rbi/e_invoice_api/resources/conversion.rbi +15 -0
  97. data/rbi/e_invoice_api/resources/documents.rbi +77 -5
  98. data/rbi/e_invoice_api/resources/drafts.rbi +55 -0
  99. data/rbi/e_invoice_api/resources/mailbox.rbi +93 -0
  100. data/rbi/e_invoice_api/resources/stats.rbi +38 -0
  101. data/rbi/e_invoice_api/resources/validate.rbi +52 -6
  102. data/rbi/e_invoice_api/resources/webhooks.rbi +29 -0
  103. data/sig/e_invoice_api/client.rbs +8 -0
  104. data/sig/e_invoice_api/internal/transport/base_client.rbs +1 -4
  105. data/sig/e_invoice_api/internal/util.rbs +0 -4
  106. data/sig/e_invoice_api/models/conversion/document_create_from_pdf_task.rbs +45 -0
  107. data/sig/e_invoice_api/models/conversion/pdf_create_params.rbs +26 -0
  108. data/sig/e_invoice_api/models/conversion/pdf_result_params.rbs +25 -0
  109. data/sig/e_invoice_api/models/conversion/pdf_retrieve_params.rbs +25 -0
  110. data/sig/e_invoice_api/models/document_create.rbs +139 -4
  111. data/sig/e_invoice_api/models/document_create_from_pdf_response.rbs +113 -4
  112. data/sig/e_invoice_api/models/document_lifecycle_params.rbs +23 -0
  113. data/sig/e_invoice_api/models/document_lifecycle_response.rbs +151 -0
  114. data/sig/e_invoice_api/models/document_response.rbs +113 -4
  115. data/sig/e_invoice_api/models/document_timeline_params.rbs +23 -0
  116. data/sig/e_invoice_api/models/document_timeline_response.rbs +84 -0
  117. data/sig/e_invoice_api/models/draft_list_params.rbs +112 -0
  118. data/sig/e_invoice_api/models/inbound_email_response.rbs +126 -0
  119. data/sig/e_invoice_api/models/mailbox_download_attachment_params.rbs +28 -0
  120. data/sig/e_invoice_api/models/mailbox_list_params.rbs +112 -0
  121. data/sig/e_invoice_api/models/mailbox_reprocess_params.rbs +24 -0
  122. data/sig/e_invoice_api/models/mailbox_retrieve_params.rbs +24 -0
  123. data/sig/e_invoice_api/models/stats_retrieve_params.rbs +48 -0
  124. data/sig/e_invoice_api/models/stats_retrieve_response.rbs +107 -0
  125. data/sig/e_invoice_api/models/unit_of_measure_code.rbs +2698 -0
  126. data/sig/e_invoice_api/models/webhook_history_params.rbs +23 -0
  127. data/sig/e_invoice_api/models/webhook_history_response.rbs +13 -0
  128. data/sig/e_invoice_api/models/webhook_test_params.rbs +32 -0
  129. data/sig/e_invoice_api/models/webhook_test_response.rbs +30 -0
  130. data/sig/e_invoice_api/models.rbs +24 -0
  131. data/sig/e_invoice_api/resources/conversion/pdf.rbs +24 -0
  132. data/sig/e_invoice_api/resources/conversion.rbs +9 -0
  133. data/sig/e_invoice_api/resources/documents.rbs +19 -0
  134. data/sig/e_invoice_api/resources/drafts.rbs +20 -0
  135. data/sig/e_invoice_api/resources/mailbox.rbs +36 -0
  136. data/sig/e_invoice_api/resources/stats.rbs +14 -0
  137. data/sig/e_invoice_api/resources/validate.rbs +9 -0
  138. data/sig/e_invoice_api/resources/webhooks.rbs +12 -0
  139. metadata +102 -7
@@ -10,21 +10,21 @@ module EInvoiceAPI
10
10
  #
11
11
  # @overload list_draft_documents(page: nil, page_size: nil, search: nil, sort_by: nil, sort_order: nil, state: nil, type: nil, request_options: {})
12
12
  #
13
- # @param page [Integer] Page number
13
+ # @param page [Integer] Page number
14
14
  #
15
- # @param page_size [Integer] Number of items per page
15
+ # @param page_size [Integer] Number of items per page
16
16
  #
17
- # @param search [String, nil] Search in invoice number, seller/buyer names
17
+ # @param search [String, nil] Search in invoice number, seller/buyer names
18
18
  #
19
- # @param sort_by [Symbol, EInvoiceAPI::Models::OutboxListDraftDocumentsParams::SortBy] Field to sort by
19
+ # @param sort_by [Symbol, EInvoiceAPI::Models::OutboxListDraftDocumentsParams::SortBy] Field to sort by
20
20
  #
21
- # @param sort_order [Symbol, EInvoiceAPI::Models::OutboxListDraftDocumentsParams::SortOrder] Sort direction (asc/desc)
21
+ # @param sort_order [Symbol, EInvoiceAPI::Models::OutboxListDraftDocumentsParams::SortOrder] Sort direction (asc/desc)
22
22
  #
23
- # @param state [Symbol, EInvoiceAPI::Models::DocumentState, nil] Filter by document state
23
+ # @param state [Symbol, EInvoiceAPI::Models::DocumentState, nil] Filter by document state
24
24
  #
25
- # @param type [Symbol, EInvoiceAPI::Models::DocumentType, nil] Filter by document type
25
+ # @param type [Symbol, EInvoiceAPI::Models::DocumentType, nil] Filter by document type
26
26
  #
27
- # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
27
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
28
28
  #
29
29
  # @return [EInvoiceAPI::Internal::DocumentsNumberPage<EInvoiceAPI::Models::DocumentResponse>]
30
30
  #
@@ -50,27 +50,27 @@ module EInvoiceAPI
50
50
  #
51
51
  # @overload list_received_documents(date_from: nil, date_to: nil, page: nil, page_size: nil, receiver: nil, search: nil, sender: nil, sort_by: nil, sort_order: nil, type: nil, request_options: {})
52
52
  #
53
- # @param date_from [Time, nil] Filter by issue date (from)
53
+ # @param date_from [Time, nil] Filter by issue date (from)
54
54
  #
55
- # @param date_to [Time, nil] Filter by issue date (to)
55
+ # @param date_to [Time, nil] Filter by issue date (to)
56
56
  #
57
- # @param page [Integer] Page number
57
+ # @param page [Integer] Page number
58
58
  #
59
- # @param page_size [Integer] Number of items per page
59
+ # @param page_size [Integer] Number of items per page
60
60
  #
61
- # @param receiver [String, nil] Filter by receiver (customer_name, customer_email, customer_tax_id, customer_com
61
+ # @param receiver [String, nil] Filter by receiver (customer_name, customer_email, customer_tax_id, customer_com
62
62
  #
63
- # @param search [String, nil] Search in invoice number, seller/buyer names
63
+ # @param search [String, nil] Search in invoice number, seller/buyer names
64
64
  #
65
- # @param sender [String, nil] (Deprecated) Filter by sender ID
65
+ # @param sender [String, nil] (Deprecated) Filter by sender ID
66
66
  #
67
- # @param sort_by [Symbol, EInvoiceAPI::Models::OutboxListReceivedDocumentsParams::SortBy] Field to sort by
67
+ # @param sort_by [Symbol, EInvoiceAPI::Models::OutboxListReceivedDocumentsParams::SortBy] Field to sort by
68
68
  #
69
- # @param sort_order [Symbol, EInvoiceAPI::Models::OutboxListReceivedDocumentsParams::SortOrder] Sort direction (asc/desc)
69
+ # @param sort_order [Symbol, EInvoiceAPI::Models::OutboxListReceivedDocumentsParams::SortOrder] Sort direction (asc/desc)
70
70
  #
71
- # @param type [Symbol, EInvoiceAPI::Models::DocumentType, nil] Filter by document type. If not provided, returns all types.
71
+ # @param type [Symbol, EInvoiceAPI::Models::DocumentType, nil] Filter by document type. If not provided, returns all types.
72
72
  #
73
- # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
73
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
74
74
  #
75
75
  # @return [EInvoiceAPI::Internal::DocumentsNumberPage<EInvoiceAPI::Models::DocumentResponse>]
76
76
  #
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EInvoiceAPI
4
+ module Resources
5
+ class Stats
6
+ # Some parameter documentations has been truncated, see
7
+ # {EInvoiceAPI::Models::StatsRetrieveParams} for more details.
8
+ #
9
+ # Retrieve usage statistics for billing purposes. Returns statistics for document
10
+ # sent and document received actions, grouped by aggregation period
11
+ # (day/week/month). If no date parameters are provided, returns daily stats for
12
+ # all available data.
13
+ #
14
+ # @overload retrieve(aggregation: nil, end_date: nil, start_date: nil, request_options: {})
15
+ #
16
+ # @param aggregation [Symbol, EInvoiceAPI::Models::StatsRetrieveParams::Aggregation, nil] Aggregation type: DAY, WEEK, or MONTH. Defaults to DAY.
17
+ #
18
+ # @param end_date [Date, nil] End date in yyyy-mm-dd format. If not provided, queries to latest available data
19
+ #
20
+ # @param start_date [Date, nil] Start date in yyyy-mm-dd format. If not provided, queries from earliest availabl
21
+ #
22
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
23
+ #
24
+ # @return [EInvoiceAPI::Models::StatsRetrieveResponse]
25
+ #
26
+ # @see EInvoiceAPI::Models::StatsRetrieveParams
27
+ def retrieve(params = {})
28
+ parsed, options = EInvoiceAPI::StatsRetrieveParams.dump_request(params)
29
+ query = EInvoiceAPI::Internal::Util.encode_query_params(parsed)
30
+ @client.request(
31
+ method: :get,
32
+ path: "api/stats",
33
+ query: query,
34
+ model: EInvoiceAPI::Models::StatsRetrieveResponse,
35
+ options: options
36
+ )
37
+ end
38
+
39
+ # @api private
40
+ #
41
+ # @param client [EInvoiceAPI::Client]
42
+ def initialize(client:)
43
+ @client = client
44
+ end
45
+ end
46
+ end
47
+ end
@@ -6,109 +6,129 @@ module EInvoiceAPI
6
6
  # Some parameter documentations has been truncated, see
7
7
  # {EInvoiceAPI::Models::ValidateValidateJsonParams} for more details.
8
8
  #
9
- # Validate if the JSON document can be converted to a valid UBL document
9
+ # Validate if the JSON document can be converted to a valid UBL document. The
10
+ # generated UBL is returned in ubl_document also when is_valid is false, so you
11
+ # can inspect it.
10
12
  #
11
- # @overload validate_json(allowances: nil, amount_due: nil, attachments: nil, billing_address: nil, billing_address_recipient: nil, charges: nil, currency: nil, customer_address: nil, customer_address_recipient: nil, customer_company_id: nil, customer_email: nil, customer_id: nil, customer_name: nil, customer_peppol_id: nil, customer_tax_id: nil, direction: nil, document_type: nil, due_date: nil, invoice_date: nil, invoice_id: nil, invoice_total: nil, items: nil, note: nil, payment_details: nil, payment_term: nil, previous_unpaid_balance: nil, purchase_order: nil, remittance_address: nil, remittance_address_recipient: nil, service_address: nil, service_address_recipient: nil, service_end_date: nil, service_start_date: nil, shipping_address: nil, shipping_address_recipient: nil, state: nil, subtotal: nil, tax_code: nil, tax_details: nil, total_discount: nil, total_tax: nil, vatex: nil, vatex_note: nil, vendor_address: nil, vendor_address_recipient: nil, vendor_company_id: nil, vendor_email: nil, vendor_name: nil, vendor_tax_id: nil, request_options: {})
13
+ # @overload validate_json(allowances: nil, amount_due: nil, attachments: nil, billing_address: nil, billing_address_recipient: nil, buyer_reference: nil, charges: nil, currency: nil, customer_address: nil, customer_address_recipient: nil, customer_company_id: nil, customer_email: nil, customer_id: nil, customer_name: nil, customer_peppol_id: nil, customer_phone: nil, customer_tax_id: nil, direction: nil, document_type: nil, due_date: nil, invoice_date: nil, invoice_id: nil, invoice_total: nil, items: nil, note: nil, payment_details: nil, payment_term: nil, preceding_invoice_date: nil, preceding_invoice_id: nil, previous_unpaid_balance: nil, purchase_order: nil, remittance_address: nil, remittance_address_recipient: nil, rounding_amount: nil, sales_order: nil, service_address: nil, service_address_recipient: nil, service_end_date: nil, service_start_date: nil, shipping_address: nil, shipping_address_recipient: nil, state: nil, subtotal: nil, tax_code: nil, tax_currency: nil, tax_details: nil, total_discount: nil, total_tax: nil, total_tax_in_tax_currency: nil, vatex: nil, vatex_note: nil, vendor_address: nil, vendor_address_recipient: nil, vendor_company_id: nil, vendor_email: nil, vendor_name: nil, vendor_phone: nil, vendor_tax_id: nil, request_options: {})
12
14
  #
13
- # @param allowances [Array<EInvoiceAPI::Models::DocumentCreate::Allowance>, nil]
15
+ # @param allowances [Array<EInvoiceAPI::Models::DocumentCreate::Allowance>, nil]
14
16
  #
15
- # @param amount_due [Float, String, nil] The amount due for payment. Must be positive and rounded to maximum 2 decimals
17
+ # @param amount_due [Float, String, nil] The amount due for payment. Must be positive and rounded to maximum 2 decimals
16
18
  #
17
- # @param attachments [Array<EInvoiceAPI::Models::DocumentAttachmentCreate>, nil]
19
+ # @param attachments [Array<EInvoiceAPI::Models::DocumentAttachmentCreate>, nil]
18
20
  #
19
- # @param billing_address [String, nil] The billing address (if different from customer address)
21
+ # @param billing_address [String, nil] The billing address (if different from customer address)
20
22
  #
21
- # @param billing_address_recipient [String, nil] The recipient name at the billing address
23
+ # @param billing_address_recipient [String, nil] The recipient name at the billing address
22
24
  #
23
- # @param charges [Array<EInvoiceAPI::Models::DocumentCreate::Charge>, nil]
25
+ # @param buyer_reference [String, nil] The buyer reference (BT-10), e.g. a cost centre or accounting reference requeste
24
26
  #
25
- # @param currency [Symbol, EInvoiceAPI::Models::CurrencyCode] Currency of the invoice (ISO 4217 currency code)
27
+ # @param charges [Array<EInvoiceAPI::Models::DocumentCreate::Charge>, nil]
26
28
  #
27
- # @param customer_address [String, nil] The address of the customer/buyer
29
+ # @param currency [Symbol, EInvoiceAPI::Models::CurrencyCode] Currency of the invoice (ISO 4217 currency code)
28
30
  #
29
- # @param customer_address_recipient [String, nil] The recipient name at the customer address
31
+ # @param customer_address [String, nil] The address of the customer/buyer
30
32
  #
31
- # @param customer_company_id [String, nil] Customer company ID. For Belgium this is the CBE number or their EUID (European
33
+ # @param customer_address_recipient [String, nil] The recipient name at the customer address. Also the customer contact name (BT-5
32
34
  #
33
- # @param customer_email [String, nil] The email address of the customer
35
+ # @param customer_company_id [String, nil] Customer company ID. For Belgium this is the CBE number or their EUID (European
34
36
  #
35
- # @param customer_id [String, nil] The unique identifier for the customer in your system
37
+ # @param customer_email [String, nil] The email address of the customer
36
38
  #
37
- # @param customer_name [String, nil] The company name of the customer/buyer
39
+ # @param customer_id [String, nil] The unique identifier for the customer in your system
38
40
  #
39
- # @param customer_peppol_id [String, nil] Customer Peppol ID
41
+ # @param customer_name [String, nil] The company name of the customer/buyer
40
42
  #
41
- # @param customer_tax_id [String, nil] Customer tax ID. For Belgium this is the VAT number. Must include the country pr
43
+ # @param customer_peppol_id [String, nil] Customer Peppol ID
42
44
  #
43
- # @param direction [Symbol, EInvoiceAPI::Models::DocumentDirection] The direction of the document: INBOUND (purchases) or OUTBOUND (sales)
45
+ # @param customer_phone [String, nil] The telephone number of the customer contact (BT-57)
44
46
  #
45
- # @param document_type [Symbol, EInvoiceAPI::Models::DocumentType] The type of document: INVOICE, CREDIT_NOTE, or DEBIT_NOTE
47
+ # @param customer_tax_id [String, nil] Customer tax ID. For Belgium this is the VAT number. Must include the country pr
46
48
  #
47
- # @param due_date [Date, nil] The date when payment is due
49
+ # @param direction [Symbol, EInvoiceAPI::Models::DocumentDirection] The direction of the document: INBOUND (purchases) or OUTBOUND (sales)
48
50
  #
49
- # @param invoice_date [Date, nil] The date when the invoice was issued
51
+ # @param document_type [Symbol, EInvoiceAPI::Models::DocumentType] The type of document: INVOICE, CREDIT_NOTE, or DEBIT_NOTE
50
52
  #
51
- # @param invoice_id [String, nil] The unique invoice identifier/number
53
+ # @param due_date [Date, nil] The date when payment is due
52
54
  #
53
- # @param invoice_total [Float, String, nil] The total amount of the invoice including tax (invoice*total = subtotal + total*
55
+ # @param invoice_date [Date, nil] The date when the invoice was issued
54
56
  #
55
- # @param items [Array<EInvoiceAPI::Models::DocumentCreate::Item>] At least one line item is required
57
+ # @param invoice_id [String, nil] The unique invoice identifier/number
56
58
  #
57
- # @param note [String, nil] Additional notes or comments for the invoice
59
+ # @param invoice_total [Float, String, nil] The total amount of the invoice including tax (invoice*total = subtotal + total*
58
60
  #
59
- # @param payment_details [Array<EInvoiceAPI::Models::PaymentDetailCreate>, nil]
61
+ # @param items [Array<EInvoiceAPI::Models::DocumentCreate::Item>] At least one line item is required
60
62
  #
61
- # @param payment_term [String, nil] The payment terms (e.g., 'Net 30', 'Due on receipt', '2/10 Net 30')
63
+ # @param note [String, nil] Additional notes or comments for the invoice
62
64
  #
63
- # @param previous_unpaid_balance [Float, String, nil] The previous unpaid balance from prior invoices, if any. Must be positive and ro
65
+ # @param payment_details [Array<EInvoiceAPI::Models::PaymentDetailCreate>, nil]
64
66
  #
65
- # @param purchase_order [String, nil] The purchase order reference number
67
+ # @param payment_term [String, nil] The payment terms (e.g., 'Net 30', 'Due on receipt', '2/10 Net 30')
66
68
  #
67
- # @param remittance_address [String, nil] The address where payment should be sent or remitted to
69
+ # @param preceding_invoice_date [Date, nil] The preceding invoice issue date (BT-26)
68
70
  #
69
- # @param remittance_address_recipient [String, nil] The recipient name at the remittance address
71
+ # @param preceding_invoice_id [String, nil] The preceding invoice reference (BT-25): the number of the invoice this document
70
72
  #
71
- # @param service_address [String, nil] The address where services were performed or goods were delivered
73
+ # @param previous_unpaid_balance [Float, String, nil] The previous unpaid balance from prior invoices, if any. Must be positive and ro
72
74
  #
73
- # @param service_address_recipient [String, nil] The recipient name at the service address
75
+ # @param purchase_order [String, nil] The purchase order reference number (BT-13)
74
76
  #
75
- # @param service_end_date [Date, nil] The end date of the service period or delivery period
77
+ # @param remittance_address [String, nil] The address where payment should be sent or remitted to
76
78
  #
77
- # @param service_start_date [Date, nil] The start date of the service period or delivery period
79
+ # @param remittance_address_recipient [String, nil] The recipient name at the remittance address
78
80
  #
79
- # @param shipping_address [String, nil] The shipping/delivery address
81
+ # @param rounding_amount [Float, String, nil] The amount added to the invoice total to round the amount for payment (BT-114),
80
82
  #
81
- # @param shipping_address_recipient [String, nil] The recipient name at the shipping address
83
+ # @param sales_order [String, nil] The sales order reference (BT-14) assigned by the seller
82
84
  #
83
- # @param state [Symbol, EInvoiceAPI::Models::DocumentState] The current state of the document: DRAFT, TRANSIT, FAILED, SENT, or RECEIVED
85
+ # @param service_address [String, nil] The address where services were performed or goods were delivered
84
86
  #
85
- # @param subtotal [Float, String, nil] The taxable base of the invoice. Should be the sum of all line items - allowance
87
+ # @param service_address_recipient [String, nil] The recipient name at the service address
86
88
  #
87
- # @param tax_code [Symbol, EInvoiceAPI::Models::DocumentCreate::TaxCode] Tax category code of the invoice (e.g., S for standard rate, Z for zero rate, E
89
+ # @param service_end_date [Date, nil] The end date of the service period or delivery period
88
90
  #
89
- # @param tax_details [Array<EInvoiceAPI::Models::DocumentCreate::TaxDetail>, nil]
91
+ # @param service_start_date [Date, nil] The start date of the service period or delivery period
90
92
  #
91
- # @param total_discount [Float, String, nil] The net financial discount/charge of the invoice (non-VAT charges minus non-VAT
93
+ # @param shipping_address [String, nil] The shipping/delivery address
92
94
  #
93
- # @param total_tax [Float, String, nil] The total tax amount of the invoice. Must be positive and rounded to maximum 2 d
95
+ # @param shipping_address_recipient [String, nil] The name of the deliver-to party (BT-70)
94
96
  #
95
- # @param vatex [Symbol, EInvoiceAPI::Models::DocumentCreate::Vatex, nil] VATEX code list for VAT exemption reasons
97
+ # @param state [Symbol, EInvoiceAPI::Models::DocumentState] The current state of the document: DRAFT, TRANSIT, FAILED, SENT, or RECEIVED
96
98
  #
97
- # @param vatex_note [String, nil] Textual explanation for VAT exemption
99
+ # @param subtotal [Float, String, nil] The taxable base of the invoice. Should be the sum of all line items - allowance
98
100
  #
99
- # @param vendor_address [String, nil] The address of the vendor/seller
101
+ # @param tax_code [Symbol, EInvoiceAPI::Models::DocumentCreate::TaxCode] Tax category code of the invoice (e.g., S for standard rate, Z for zero rate, E
100
102
  #
101
- # @param vendor_address_recipient [String, nil] The recipient name at the vendor address
103
+ # @param tax_currency [String, nil] The VAT accounting currency (BT-6, ISO 4217 currency code), when VAT is accounte
102
104
  #
103
- # @param vendor_company_id [String, nil] Vendor company ID. For Belgium this is the CBE number or their EUID (European Un
105
+ # @param tax_details [Array<EInvoiceAPI::Models::DocumentCreate::TaxDetail>, nil]
104
106
  #
105
- # @param vendor_email [String, nil] The email address of the vendor
107
+ # @param total_discount [Float, String, nil] The net financial discount/charge of the invoice (non-VAT charges minus non-VAT
106
108
  #
107
- # @param vendor_name [String, nil] The name of the vendor/seller/supplier
109
+ # @param total_tax [Float, String, nil] The total tax amount of the invoice. Must be positive and rounded to maximum 2 d
108
110
  #
109
- # @param vendor_tax_id [String, nil] Vendor tax ID. For Belgium this is the VAT number. Must include the country pref
111
+ # @param total_tax_in_tax_currency [Float, String, nil] The total VAT amount in the VAT accounting currency tax_currency (BT-111). Does
110
112
  #
111
- # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
113
+ # @param vatex [Symbol, EInvoiceAPI::Models::DocumentCreate::Vatex, nil] VATEX code list for VAT exemption reasons
114
+ #
115
+ # @param vatex_note [String, nil] VAT exemption reason text (BT-120). An exemption reason (vatex or vatex_note) is
116
+ #
117
+ # @param vendor_address [String, nil] The address of the vendor/seller
118
+ #
119
+ # @param vendor_address_recipient [String, nil] The recipient name at the vendor address. Also the vendor contact name (BT-41) i
120
+ #
121
+ # @param vendor_company_id [String, nil] Vendor company ID. For Belgium this is the CBE number or their EUID (European Un
122
+ #
123
+ # @param vendor_email [String, nil] The email address of the vendor
124
+ #
125
+ # @param vendor_name [String, nil] The name of the vendor/seller/supplier
126
+ #
127
+ # @param vendor_phone [String, nil] The telephone number of the vendor contact (BT-42). Required when vendor and cus
128
+ #
129
+ # @param vendor_tax_id [String, nil] Vendor tax ID. For Belgium this is the VAT number. Must include the country pref
130
+ #
131
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
112
132
  #
113
133
  # @return [EInvoiceAPI::Models::UblDocumentValidation]
114
134
  #
@@ -136,9 +156,9 @@ module EInvoiceAPI
136
156
  #
137
157
  # @overload validate_peppol_id(peppol_id:, request_options: {})
138
158
  #
139
- # @param peppol_id [String] Peppol ID in the format `<scheme>:<id>`. Example: `0208:1018265814` for a Belgia
159
+ # @param peppol_id [String] Peppol ID in the format `<scheme>:<id>`. Example: `0208:1018265814` for a Belgia
140
160
  #
141
- # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
161
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
142
162
  #
143
163
  # @return [EInvoiceAPI::Models::ValidateValidatePeppolIDResponse]
144
164
  #
@@ -159,8 +179,8 @@ module EInvoiceAPI
159
179
  #
160
180
  # @overload validate_ubl(file:, request_options: {})
161
181
  #
162
- # @param file [Pathname, StringIO, IO, String, EInvoiceAPI::FilePart]
163
- # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
182
+ # @param file [Pathname, StringIO, IO, String, EInvoiceAPI::FilePart]
183
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
164
184
  #
165
185
  # @return [EInvoiceAPI::Models::UblDocumentValidation]
166
186
  #
@@ -7,10 +7,10 @@ module EInvoiceAPI
7
7
  #
8
8
  # @overload create(events:, url:, enabled: nil, request_options: {})
9
9
  #
10
- # @param events [Array<String>]
11
- # @param url [String]
12
- # @param enabled [Boolean]
13
- # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
10
+ # @param events [Array<String>]
11
+ # @param url [String]
12
+ # @param enabled [Boolean]
13
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
14
14
  #
15
15
  # @return [EInvoiceAPI::Models::WebhookResponse]
16
16
  #
@@ -30,8 +30,8 @@ module EInvoiceAPI
30
30
  #
31
31
  # @overload retrieve(webhook_id, request_options: {})
32
32
  #
33
- # @param webhook_id [String]
34
- # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
33
+ # @param webhook_id [String]
34
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
35
35
  #
36
36
  # @return [EInvoiceAPI::Models::WebhookResponse]
37
37
  #
@@ -49,11 +49,11 @@ module EInvoiceAPI
49
49
  #
50
50
  # @overload update(webhook_id, enabled: nil, events: nil, url: nil, request_options: {})
51
51
  #
52
- # @param webhook_id [String]
53
- # @param enabled [Boolean, nil]
54
- # @param events [Array<String>, nil]
55
- # @param url [String, nil]
56
- # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
52
+ # @param webhook_id [String]
53
+ # @param enabled [Boolean, nil]
54
+ # @param events [Array<String>, nil]
55
+ # @param url [String, nil]
56
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
57
57
  #
58
58
  # @return [EInvoiceAPI::Models::WebhookResponse]
59
59
  #
@@ -73,7 +73,7 @@ module EInvoiceAPI
73
73
  #
74
74
  # @overload list(request_options: {})
75
75
  #
76
- # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
76
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
77
77
  #
78
78
  # @return [Array<EInvoiceAPI::Models::WebhookResponse>]
79
79
  #
@@ -91,8 +91,8 @@ module EInvoiceAPI
91
91
  #
92
92
  # @overload delete(webhook_id, request_options: {})
93
93
  #
94
- # @param webhook_id [String]
95
- # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
94
+ # @param webhook_id [String]
95
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
96
96
  #
97
97
  # @return [EInvoiceAPI::Models::WebhookDeleteResponse]
98
98
  #
@@ -106,6 +106,51 @@ module EInvoiceAPI
106
106
  )
107
107
  end
108
108
 
109
+ # Get the history of a webhook
110
+ #
111
+ # @overload history(webhook_id, request_options: {})
112
+ #
113
+ # @param webhook_id [String]
114
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
115
+ #
116
+ # @return [EInvoiceAPI::Models::WebhookHistoryResponse]
117
+ #
118
+ # @see EInvoiceAPI::Models::WebhookHistoryParams
119
+ def history(webhook_id, params = {})
120
+ @client.request(
121
+ method: :get,
122
+ path: ["api/webhooks/%1$s/history", webhook_id],
123
+ model: EInvoiceAPI::Models::WebhookHistoryResponse,
124
+ options: params[:request_options]
125
+ )
126
+ end
127
+
128
+ # Send a test event to a webhook for testing and debugging purposes
129
+ #
130
+ # @overload test_(webhook_id, data:, event_type:, request_options: {})
131
+ #
132
+ # @param webhook_id [String]
133
+ #
134
+ # @param data [Hash{Symbol=>Object}] Custom event data payload
135
+ #
136
+ # @param event_type [String] Must be valid WebhookEventType
137
+ #
138
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
139
+ #
140
+ # @return [EInvoiceAPI::Models::WebhookTestResponse]
141
+ #
142
+ # @see EInvoiceAPI::Models::WebhookTestParams
143
+ def test_(webhook_id, params)
144
+ parsed, options = EInvoiceAPI::WebhookTestParams.dump_request(params)
145
+ @client.request(
146
+ method: :post,
147
+ path: ["api/webhooks/%1$s/test", webhook_id],
148
+ body: parsed,
149
+ model: EInvoiceAPI::Models::WebhookTestResponse,
150
+ options: options
151
+ )
152
+ end
153
+
109
154
  # @api private
110
155
  #
111
156
  # @param client [EInvoiceAPI::Client]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EInvoiceAPI
4
- VERSION = "0.33.0"
4
+ VERSION = "0.35.0"
5
5
  end
data/lib/e_invoice_api.rb CHANGED
@@ -3,7 +3,6 @@
3
3
  # Standard libraries.
4
4
  # rubocop:disable Lint/RedundantRequireStatement
5
5
  require "English"
6
- require "base64"
7
6
  require "cgi"
8
7
  require "date"
9
8
  require "erb"
@@ -57,6 +56,10 @@ require_relative "e_invoice_api/models/document_create"
57
56
  require_relative "e_invoice_api/models/allowance"
58
57
  require_relative "e_invoice_api/models/certificate"
59
58
  require_relative "e_invoice_api/models/charge"
59
+ require_relative "e_invoice_api/models/conversion/document_create_from_pdf_task"
60
+ require_relative "e_invoice_api/models/conversion/pdf_create_params"
61
+ require_relative "e_invoice_api/models/conversion/pdf_result_params"
62
+ require_relative "e_invoice_api/models/conversion/pdf_retrieve_params"
60
63
  require_relative "e_invoice_api/models/currency_code"
61
64
  require_relative "e_invoice_api/models/document_attachment_create"
62
65
  require_relative "e_invoice_api/models/document_create_from_pdf_params"
@@ -65,6 +68,8 @@ require_relative "e_invoice_api/models/document_create_params"
65
68
  require_relative "e_invoice_api/models/document_delete_params"
66
69
  require_relative "e_invoice_api/models/document_delete_response"
67
70
  require_relative "e_invoice_api/models/document_direction"
71
+ require_relative "e_invoice_api/models/document_lifecycle_params"
72
+ require_relative "e_invoice_api/models/document_lifecycle_response"
68
73
  require_relative "e_invoice_api/models/document_response"
69
74
  require_relative "e_invoice_api/models/document_retrieve_params"
70
75
  require_relative "e_invoice_api/models/documents/attachment_add_params"
@@ -79,8 +84,12 @@ require_relative "e_invoice_api/models/documents/ubl_get_params"
79
84
  require_relative "e_invoice_api/models/documents/ubl_get_response"
80
85
  require_relative "e_invoice_api/models/document_send_params"
81
86
  require_relative "e_invoice_api/models/document_state"
87
+ require_relative "e_invoice_api/models/document_timeline_params"
88
+ require_relative "e_invoice_api/models/document_timeline_response"
82
89
  require_relative "e_invoice_api/models/document_type"
83
90
  require_relative "e_invoice_api/models/document_validate_params"
91
+ require_relative "e_invoice_api/models/draft_list_params"
92
+ require_relative "e_invoice_api/models/inbound_email_response"
84
93
  require_relative "e_invoice_api/models/inbox_list_credit_notes_params"
85
94
  require_relative "e_invoice_api/models/inbox_list_invoices_params"
86
95
  require_relative "e_invoice_api/models/inbox_list_params"
@@ -88,12 +97,18 @@ require_relative "e_invoice_api/models/lookup_retrieve_params"
88
97
  require_relative "e_invoice_api/models/lookup_retrieve_participants_params"
89
98
  require_relative "e_invoice_api/models/lookup_retrieve_participants_response"
90
99
  require_relative "e_invoice_api/models/lookup_retrieve_response"
100
+ require_relative "e_invoice_api/models/mailbox_download_attachment_params"
101
+ require_relative "e_invoice_api/models/mailbox_list_params"
102
+ require_relative "e_invoice_api/models/mailbox_reprocess_params"
103
+ require_relative "e_invoice_api/models/mailbox_retrieve_params"
91
104
  require_relative "e_invoice_api/models/me_retrieve_params"
92
105
  require_relative "e_invoice_api/models/me_retrieve_response"
93
106
  require_relative "e_invoice_api/models/outbox_list_draft_documents_params"
94
107
  require_relative "e_invoice_api/models/outbox_list_received_documents_params"
95
108
  require_relative "e_invoice_api/models/paginated_document_response"
96
109
  require_relative "e_invoice_api/models/payment_detail_create"
110
+ require_relative "e_invoice_api/models/stats_retrieve_params"
111
+ require_relative "e_invoice_api/models/stats_retrieve_response"
97
112
  require_relative "e_invoice_api/models/ubl_document_validation"
98
113
  require_relative "e_invoice_api/models/unit_of_measure_code"
99
114
  require_relative "e_invoice_api/models/validate_validate_json_params"
@@ -103,18 +118,27 @@ require_relative "e_invoice_api/models/validate_validate_ubl_params"
103
118
  require_relative "e_invoice_api/models/webhook_create_params"
104
119
  require_relative "e_invoice_api/models/webhook_delete_params"
105
120
  require_relative "e_invoice_api/models/webhook_delete_response"
121
+ require_relative "e_invoice_api/models/webhook_history_params"
122
+ require_relative "e_invoice_api/models/webhook_history_response"
106
123
  require_relative "e_invoice_api/models/webhook_list_params"
107
124
  require_relative "e_invoice_api/models/webhook_list_response"
108
125
  require_relative "e_invoice_api/models/webhook_response"
109
126
  require_relative "e_invoice_api/models/webhook_retrieve_params"
127
+ require_relative "e_invoice_api/models/webhook_test_params"
128
+ require_relative "e_invoice_api/models/webhook_test_response"
110
129
  require_relative "e_invoice_api/models/webhook_update_params"
111
130
  require_relative "e_invoice_api/models"
131
+ require_relative "e_invoice_api/resources/conversion"
132
+ require_relative "e_invoice_api/resources/conversion/pdf"
112
133
  require_relative "e_invoice_api/resources/documents"
113
134
  require_relative "e_invoice_api/resources/documents/attachments"
114
135
  require_relative "e_invoice_api/resources/documents/ubl"
136
+ require_relative "e_invoice_api/resources/drafts"
115
137
  require_relative "e_invoice_api/resources/inbox"
116
138
  require_relative "e_invoice_api/resources/lookup"
139
+ require_relative "e_invoice_api/resources/mailbox"
117
140
  require_relative "e_invoice_api/resources/me"
118
141
  require_relative "e_invoice_api/resources/outbox"
142
+ require_relative "e_invoice_api/resources/stats"
119
143
  require_relative "e_invoice_api/resources/validate"
120
144
  require_relative "e_invoice_api/resources/webhooks"
@@ -34,6 +34,18 @@ module EInvoiceAPI
34
34
  sig { returns(EInvoiceAPI::Resources::Webhooks) }
35
35
  attr_reader :webhooks
36
36
 
37
+ sig { returns(EInvoiceAPI::Resources::Drafts) }
38
+ attr_reader :drafts
39
+
40
+ sig { returns(EInvoiceAPI::Resources::Conversion) }
41
+ attr_reader :conversion
42
+
43
+ sig { returns(EInvoiceAPI::Resources::Stats) }
44
+ attr_reader :stats
45
+
46
+ sig { returns(EInvoiceAPI::Resources::Mailbox) }
47
+ attr_reader :mailbox
48
+
37
49
  # @api private
38
50
  sig { override.returns(T::Hash[String, String]) }
39
51
  private def auth_headers
@@ -70,8 +70,6 @@ module EInvoiceAPI
70
70
  # from whatwg fetch spec
71
71
  MAX_REDIRECTS = 20
72
72
 
73
- PLATFORM_HEADERS = T::Hash[String, String]
74
-
75
73
  class << self
76
74
  # @api private
77
75
  sig do
@@ -218,16 +216,10 @@ module EInvoiceAPI
218
216
  params(
219
217
  request: EInvoiceAPI::Internal::Transport::BaseClient::RequestInput,
220
218
  redirect_count: Integer,
221
- retry_count: Integer,
222
- send_retry_header: T::Boolean
219
+ retry_count: Integer
223
220
  ).returns([Integer, Net::HTTPResponse, T::Enumerable[String]])
224
221
  end
225
- def send_request(
226
- request,
227
- redirect_count:,
228
- retry_count:,
229
- send_retry_header:
230
- )
222
+ def send_request(request, redirect_count:, retry_count:)
231
223
  end
232
224
 
233
225
  # Execute the request specified by `req`. This is the method that all resource
@@ -20,18 +20,6 @@ module EInvoiceAPI
20
20
  def self.walk_namespaces(ns)
21
21
  end
22
22
 
23
- class << self
24
- # @api private
25
- sig { returns(String) }
26
- def arch
27
- end
28
-
29
- # @api private
30
- sig { returns(String) }
31
- def os
32
- end
33
- end
34
-
35
23
  class << self
36
24
  # @api private
37
25
  sig { params(input: T.anything).returns(T::Boolean) }