e-invoice-api 0.32.0 → 0.34.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 (111) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/README.md +1 -1
  4. data/lib/e_invoice_api/client.rb +16 -0
  5. data/lib/e_invoice_api/models/conversion/document_create_from_pdf_task.rb +43 -0
  6. data/lib/e_invoice_api/models/conversion/pdf_create_params.rb +22 -0
  7. data/lib/e_invoice_api/models/conversion/pdf_result_params.rb +22 -0
  8. data/lib/e_invoice_api/models/conversion/pdf_retrieve_params.rb +22 -0
  9. data/lib/e_invoice_api/models/document_create.rb +158 -5
  10. data/lib/e_invoice_api/models/document_create_from_pdf_response.rb +108 -5
  11. data/lib/e_invoice_api/models/document_lifecycle_params.rb +20 -0
  12. data/lib/e_invoice_api/models/document_lifecycle_response.rb +134 -0
  13. data/lib/e_invoice_api/models/document_response.rb +112 -7
  14. data/lib/e_invoice_api/models/document_timeline_params.rb +20 -0
  15. data/lib/e_invoice_api/models/document_timeline_response.rb +71 -0
  16. data/lib/e_invoice_api/models/draft_list_params.rb +113 -0
  17. data/lib/e_invoice_api/models/inbound_email_response.rb +129 -0
  18. data/lib/e_invoice_api/models/mailbox_download_attachment_params.rb +26 -0
  19. data/lib/e_invoice_api/models/mailbox_list_params.rb +129 -0
  20. data/lib/e_invoice_api/models/mailbox_reprocess_params.rb +20 -0
  21. data/lib/e_invoice_api/models/mailbox_retrieve_params.rb +20 -0
  22. data/lib/e_invoice_api/models/me_retrieve_response.rb +8 -7
  23. data/lib/e_invoice_api/models/payment_detail_create.rb +4 -2
  24. data/lib/e_invoice_api/models/stats_retrieve_params.rb +55 -0
  25. data/lib/e_invoice_api/models/stats_retrieve_response.rb +141 -0
  26. data/lib/e_invoice_api/models/ubl_document_validation.rb +10 -1
  27. data/lib/e_invoice_api/models/webhook_history_params.rb +20 -0
  28. data/lib/e_invoice_api/models/webhook_history_response.rb +17 -0
  29. data/lib/e_invoice_api/models/webhook_test_params.rb +37 -0
  30. data/lib/e_invoice_api/models/webhook_test_response.rb +35 -0
  31. data/lib/e_invoice_api/models.rb +24 -0
  32. data/lib/e_invoice_api/resources/conversion/pdf.rb +76 -0
  33. data/lib/e_invoice_api/resources/conversion.rb +18 -0
  34. data/lib/e_invoice_api/resources/documents.rb +62 -1
  35. data/lib/e_invoice_api/resources/drafts.rb +55 -0
  36. data/lib/e_invoice_api/resources/mailbox.rb +123 -0
  37. data/lib/e_invoice_api/resources/stats.rb +47 -0
  38. data/lib/e_invoice_api/resources/validate.rb +22 -2
  39. data/lib/e_invoice_api/resources/webhooks.rb +45 -0
  40. data/lib/e_invoice_api/version.rb +1 -1
  41. data/lib/e_invoice_api.rb +25 -0
  42. data/rbi/e_invoice_api/client.rbi +12 -0
  43. data/rbi/e_invoice_api/models/conversion/document_create_from_pdf_task.rbi +108 -0
  44. data/rbi/e_invoice_api/models/conversion/pdf_create_params.rbi +43 -0
  45. data/rbi/e_invoice_api/models/conversion/pdf_result_params.rbi +40 -0
  46. data/rbi/e_invoice_api/models/conversion/pdf_retrieve_params.rbi +40 -0
  47. data/rbi/e_invoice_api/models/document_create.rbi +210 -3
  48. data/rbi/e_invoice_api/models/document_create_from_pdf_response.rbi +124 -3
  49. data/rbi/e_invoice_api/models/document_lifecycle_params.rbi +38 -0
  50. data/rbi/e_invoice_api/models/document_lifecycle_response.rbi +353 -0
  51. data/rbi/e_invoice_api/models/document_response.rbi +130 -5
  52. data/rbi/e_invoice_api/models/document_timeline_params.rbi +38 -0
  53. data/rbi/e_invoice_api/models/document_timeline_response.rbi +168 -0
  54. data/rbi/e_invoice_api/models/draft_list_params.rbi +194 -0
  55. data/rbi/e_invoice_api/models/inbound_email_response.rbi +189 -0
  56. data/rbi/e_invoice_api/models/mailbox_download_attachment_params.rbi +46 -0
  57. data/rbi/e_invoice_api/models/mailbox_list_params.rbi +218 -0
  58. data/rbi/e_invoice_api/models/mailbox_reprocess_params.rbi +41 -0
  59. data/rbi/e_invoice_api/models/mailbox_retrieve_params.rbi +41 -0
  60. data/rbi/e_invoice_api/models/me_retrieve_response.rbi +10 -8
  61. data/rbi/e_invoice_api/models/payment_detail_create.rbi +6 -2
  62. data/rbi/e_invoice_api/models/stats_retrieve_params.rbi +111 -0
  63. data/rbi/e_invoice_api/models/stats_retrieve_response.rbi +251 -0
  64. data/rbi/e_invoice_api/models/ubl_document_validation.rbi +11 -1
  65. data/rbi/e_invoice_api/models/webhook_history_params.rbi +38 -0
  66. data/rbi/e_invoice_api/models/webhook_history_response.rbi +32 -0
  67. data/rbi/e_invoice_api/models/webhook_test_params.rbi +57 -0
  68. data/rbi/e_invoice_api/models/webhook_test_response.rbi +57 -0
  69. data/rbi/e_invoice_api/models.rbi +25 -0
  70. data/rbi/e_invoice_api/resources/conversion/pdf.rbi +44 -0
  71. data/rbi/e_invoice_api/resources/conversion.rbi +15 -0
  72. data/rbi/e_invoice_api/resources/documents.rbi +67 -0
  73. data/rbi/e_invoice_api/resources/drafts.rbi +55 -0
  74. data/rbi/e_invoice_api/resources/mailbox.rbi +93 -0
  75. data/rbi/e_invoice_api/resources/stats.rbi +38 -0
  76. data/rbi/e_invoice_api/resources/validate.rbi +44 -1
  77. data/rbi/e_invoice_api/resources/webhooks.rbi +29 -0
  78. data/sig/e_invoice_api/client.rbs +8 -0
  79. data/sig/e_invoice_api/models/conversion/document_create_from_pdf_task.rbs +45 -0
  80. data/sig/e_invoice_api/models/conversion/pdf_create_params.rbs +26 -0
  81. data/sig/e_invoice_api/models/conversion/pdf_result_params.rbs +25 -0
  82. data/sig/e_invoice_api/models/conversion/pdf_retrieve_params.rbs +25 -0
  83. data/sig/e_invoice_api/models/document_create.rbs +87 -4
  84. data/sig/e_invoice_api/models/document_create_from_pdf_response.rbs +61 -4
  85. data/sig/e_invoice_api/models/document_lifecycle_params.rbs +23 -0
  86. data/sig/e_invoice_api/models/document_lifecycle_response.rbs +151 -0
  87. data/sig/e_invoice_api/models/document_response.rbs +61 -4
  88. data/sig/e_invoice_api/models/document_timeline_params.rbs +23 -0
  89. data/sig/e_invoice_api/models/document_timeline_response.rbs +84 -0
  90. data/sig/e_invoice_api/models/draft_list_params.rbs +112 -0
  91. data/sig/e_invoice_api/models/inbound_email_response.rbs +126 -0
  92. data/sig/e_invoice_api/models/mailbox_download_attachment_params.rbs +28 -0
  93. data/sig/e_invoice_api/models/mailbox_list_params.rbs +112 -0
  94. data/sig/e_invoice_api/models/mailbox_reprocess_params.rbs +24 -0
  95. data/sig/e_invoice_api/models/mailbox_retrieve_params.rbs +24 -0
  96. data/sig/e_invoice_api/models/stats_retrieve_params.rbs +48 -0
  97. data/sig/e_invoice_api/models/stats_retrieve_response.rbs +107 -0
  98. data/sig/e_invoice_api/models/webhook_history_params.rbs +23 -0
  99. data/sig/e_invoice_api/models/webhook_history_response.rbs +13 -0
  100. data/sig/e_invoice_api/models/webhook_test_params.rbs +32 -0
  101. data/sig/e_invoice_api/models/webhook_test_response.rbs +30 -0
  102. data/sig/e_invoice_api/models.rbs +24 -0
  103. data/sig/e_invoice_api/resources/conversion/pdf.rbs +24 -0
  104. data/sig/e_invoice_api/resources/conversion.rbs +9 -0
  105. data/sig/e_invoice_api/resources/documents.rbs +19 -0
  106. data/sig/e_invoice_api/resources/drafts.rbs +20 -0
  107. data/sig/e_invoice_api/resources/mailbox.rbs +36 -0
  108. data/sig/e_invoice_api/resources/stats.rbs +14 -0
  109. data/sig/e_invoice_api/resources/validate.rbs +9 -0
  110. data/sig/e_invoice_api/resources/webhooks.rbs +12 -0
  111. metadata +77 -2
@@ -0,0 +1,123 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EInvoiceAPI
4
+ module Resources
5
+ class Mailbox
6
+ # Some parameter documentations has been truncated, see
7
+ # {EInvoiceAPI::Models::MailboxListParams} for more details.
8
+ #
9
+ # Retrieve a paginated list of received inbound emails with filtering, search, and
10
+ # sorting options.
11
+ #
12
+ # @overload list(page: nil, page_size: nil, processed: nil, received_from: nil, received_to: nil, search: nil, sort_by: nil, sort_order: nil, status: nil, request_options: {})
13
+ #
14
+ # @param page [Integer] Page number
15
+ #
16
+ # @param page_size [Integer] Number of items per page
17
+ #
18
+ # @param processed [Boolean, nil] Filter by processing status. If not provided, returns all. Ignored when `status`
19
+ #
20
+ # @param received_from [Time, nil] Inclusive lower bound on received date (falls back to created_at when received_a
21
+ #
22
+ # @param received_to [Time, nil] Inclusive upper bound on received date (falls back to created_at when received_a
23
+ #
24
+ # @param search [String, nil] Case-insensitive search across sender email, subject, message ID, and attachment
25
+ #
26
+ # @param sort_by [Symbol, EInvoiceAPI::Models::MailboxListParams::SortBy] Field to sort by
27
+ #
28
+ # @param sort_order [Symbol, EInvoiceAPI::Models::MailboxListParams::SortOrder] Sort direction (asc/desc)
29
+ #
30
+ # @param status [Symbol, EInvoiceAPI::Models::MailboxListParams::Status, nil] Filter by status: pending, success, or failed. Takes precedence over `processed`
31
+ #
32
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
33
+ #
34
+ # @return [EInvoiceAPI::Internal::DocumentsNumberPage<EInvoiceAPI::Models::InboundEmailResponse>]
35
+ #
36
+ # @see EInvoiceAPI::Models::MailboxListParams
37
+ def list(params = {})
38
+ parsed, options = EInvoiceAPI::MailboxListParams.dump_request(params)
39
+ query = EInvoiceAPI::Internal::Util.encode_query_params(parsed)
40
+ @client.request(
41
+ method: :get,
42
+ path: "api/mailbox/",
43
+ query: query,
44
+ page: EInvoiceAPI::Internal::DocumentsNumberPage,
45
+ model: EInvoiceAPI::InboundEmailResponse,
46
+ options: options
47
+ )
48
+ end
49
+
50
+ # Retrieve a single inbound email by ID, scoped to the caller's tenant.
51
+ #
52
+ # @overload retrieve(inbound_email_id, request_options: {})
53
+ #
54
+ # @param inbound_email_id [String]
55
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
56
+ #
57
+ # @return [EInvoiceAPI::Models::InboundEmailResponse]
58
+ #
59
+ # @see EInvoiceAPI::Models::MailboxRetrieveParams
60
+ def retrieve(inbound_email_id, params = {})
61
+ @client.request(
62
+ method: :get,
63
+ path: ["api/mailbox/%1$s", inbound_email_id],
64
+ model: EInvoiceAPI::InboundEmailResponse,
65
+ options: params[:request_options]
66
+ )
67
+ end
68
+
69
+ # Download a specific attachment from an inbound email by filename. Returns the
70
+ # binary content with the correct Content-Type.
71
+ #
72
+ # @overload download_attachment(filename, inbound_email_id:, request_options: {})
73
+ #
74
+ # @param filename [String]
75
+ # @param inbound_email_id [String]
76
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
77
+ #
78
+ # @return [Object]
79
+ #
80
+ # @see EInvoiceAPI::Models::MailboxDownloadAttachmentParams
81
+ def download_attachment(filename, params)
82
+ parsed, options = EInvoiceAPI::MailboxDownloadAttachmentParams.dump_request(params)
83
+ inbound_email_id =
84
+ parsed.delete(:inbound_email_id) do
85
+ raise ArgumentError.new("missing required path argument #{_1}")
86
+ end
87
+ @client.request(
88
+ method: :get,
89
+ path: ["api/mailbox/%1$s/attachments/%2$s", inbound_email_id, filename],
90
+ model: EInvoiceAPI::Internal::Type::Unknown,
91
+ options: options
92
+ )
93
+ end
94
+
95
+ # Retry processing of a previously failed inbound email by replaying the original
96
+ # Postmark payload.
97
+ #
98
+ # @overload reprocess(inbound_email_id, request_options: {})
99
+ #
100
+ # @param inbound_email_id [String]
101
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
102
+ #
103
+ # @return [EInvoiceAPI::Models::InboundEmailResponse]
104
+ #
105
+ # @see EInvoiceAPI::Models::MailboxReprocessParams
106
+ def reprocess(inbound_email_id, params = {})
107
+ @client.request(
108
+ method: :post,
109
+ path: ["api/mailbox/%1$s/reprocess", inbound_email_id],
110
+ model: EInvoiceAPI::InboundEmailResponse,
111
+ options: params[:request_options]
112
+ )
113
+ end
114
+
115
+ # @api private
116
+ #
117
+ # @param client [EInvoiceAPI::Client]
118
+ def initialize(client:)
119
+ @client = client
120
+ end
121
+ end
122
+ end
123
+ end
@@ -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,9 +6,11 @@ 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
15
  # @param allowances [Array<EInvoiceAPI::Models::DocumentCreate::Allowance>, nil]
14
16
  #
@@ -20,6 +22,8 @@ module EInvoiceAPI
20
22
  #
21
23
  # @param billing_address_recipient [String, nil] The recipient name at the billing address
22
24
  #
25
+ # @param buyer_reference [String, nil] The buyer reference (BT-10), e.g. a cost centre or accounting reference requeste
26
+ #
23
27
  # @param charges [Array<EInvoiceAPI::Models::DocumentCreate::Charge>, nil]
24
28
  #
25
29
  # @param currency [Symbol, EInvoiceAPI::Models::CurrencyCode] Currency of the invoice (ISO 4217 currency code)
@@ -38,6 +42,8 @@ module EInvoiceAPI
38
42
  #
39
43
  # @param customer_peppol_id [String, nil] Customer Peppol ID
40
44
  #
45
+ # @param customer_phone [String, nil] The telephone number of the customer contact (BT-57)
46
+ #
41
47
  # @param customer_tax_id [String, nil] Customer tax ID. For Belgium this is the VAT number. Must include the country pr
42
48
  #
43
49
  # @param direction [Symbol, EInvoiceAPI::Models::DocumentDirection] The direction of the document: INBOUND (purchases) or OUTBOUND (sales)
@@ -60,6 +66,10 @@ module EInvoiceAPI
60
66
  #
61
67
  # @param payment_term [String, nil] The payment terms (e.g., 'Net 30', 'Due on receipt', '2/10 Net 30')
62
68
  #
69
+ # @param preceding_invoice_date [Date, nil] The preceding invoice issue date (BT-26)
70
+ #
71
+ # @param preceding_invoice_id [String, nil] The preceding invoice reference (BT-25): the number of the invoice this document
72
+ #
63
73
  # @param previous_unpaid_balance [Float, String, nil] The previous unpaid balance from prior invoices, if any. Must be positive and ro
64
74
  #
65
75
  # @param purchase_order [String, nil] The purchase order reference number
@@ -68,6 +78,10 @@ module EInvoiceAPI
68
78
  #
69
79
  # @param remittance_address_recipient [String, nil] The recipient name at the remittance address
70
80
  #
81
+ # @param rounding_amount [Float, String, nil] The amount added to the invoice total to round the amount for payment (BT-114),
82
+ #
83
+ # @param sales_order [String, nil] The sales order reference (BT-14) assigned by the seller
84
+ #
71
85
  # @param service_address [String, nil] The address where services were performed or goods were delivered
72
86
  #
73
87
  # @param service_address_recipient [String, nil] The recipient name at the service address
@@ -86,12 +100,16 @@ module EInvoiceAPI
86
100
  #
87
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
88
102
  #
103
+ # @param tax_currency [String, nil] The VAT accounting currency (BT-6, ISO 4217 currency code), when VAT is accounte
104
+ #
89
105
  # @param tax_details [Array<EInvoiceAPI::Models::DocumentCreate::TaxDetail>, nil]
90
106
  #
91
107
  # @param total_discount [Float, String, nil] The net financial discount/charge of the invoice (non-VAT charges minus non-VAT
92
108
  #
93
109
  # @param total_tax [Float, String, nil] The total tax amount of the invoice. Must be positive and rounded to maximum 2 d
94
110
  #
111
+ # @param total_tax_in_tax_currency [Float, String, nil] The total VAT amount in the VAT accounting currency tax_currency (BT-111). Does
112
+ #
95
113
  # @param vatex [Symbol, EInvoiceAPI::Models::DocumentCreate::Vatex, nil] VATEX code list for VAT exemption reasons
96
114
  #
97
115
  # @param vatex_note [String, nil] Textual explanation for VAT exemption
@@ -106,6 +124,8 @@ module EInvoiceAPI
106
124
  #
107
125
  # @param vendor_name [String, nil] The name of the vendor/seller/supplier
108
126
  #
127
+ # @param vendor_phone [String, nil] The telephone number of the vendor contact (BT-42). Required when vendor and cus
128
+ #
109
129
  # @param vendor_tax_id [String, nil] Vendor tax ID. For Belgium this is the VAT number. Must include the country pref
110
130
  #
111
131
  # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
@@ -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.32.0"
4
+ VERSION = "0.34.0"
5
5
  end
data/lib/e_invoice_api.rb CHANGED
@@ -57,6 +57,10 @@ require_relative "e_invoice_api/models/document_create"
57
57
  require_relative "e_invoice_api/models/allowance"
58
58
  require_relative "e_invoice_api/models/certificate"
59
59
  require_relative "e_invoice_api/models/charge"
60
+ require_relative "e_invoice_api/models/conversion/document_create_from_pdf_task"
61
+ require_relative "e_invoice_api/models/conversion/pdf_create_params"
62
+ require_relative "e_invoice_api/models/conversion/pdf_result_params"
63
+ require_relative "e_invoice_api/models/conversion/pdf_retrieve_params"
60
64
  require_relative "e_invoice_api/models/currency_code"
61
65
  require_relative "e_invoice_api/models/document_attachment_create"
62
66
  require_relative "e_invoice_api/models/document_create_from_pdf_params"
@@ -65,6 +69,8 @@ require_relative "e_invoice_api/models/document_create_params"
65
69
  require_relative "e_invoice_api/models/document_delete_params"
66
70
  require_relative "e_invoice_api/models/document_delete_response"
67
71
  require_relative "e_invoice_api/models/document_direction"
72
+ require_relative "e_invoice_api/models/document_lifecycle_params"
73
+ require_relative "e_invoice_api/models/document_lifecycle_response"
68
74
  require_relative "e_invoice_api/models/document_response"
69
75
  require_relative "e_invoice_api/models/document_retrieve_params"
70
76
  require_relative "e_invoice_api/models/documents/attachment_add_params"
@@ -79,8 +85,12 @@ require_relative "e_invoice_api/models/documents/ubl_get_params"
79
85
  require_relative "e_invoice_api/models/documents/ubl_get_response"
80
86
  require_relative "e_invoice_api/models/document_send_params"
81
87
  require_relative "e_invoice_api/models/document_state"
88
+ require_relative "e_invoice_api/models/document_timeline_params"
89
+ require_relative "e_invoice_api/models/document_timeline_response"
82
90
  require_relative "e_invoice_api/models/document_type"
83
91
  require_relative "e_invoice_api/models/document_validate_params"
92
+ require_relative "e_invoice_api/models/draft_list_params"
93
+ require_relative "e_invoice_api/models/inbound_email_response"
84
94
  require_relative "e_invoice_api/models/inbox_list_credit_notes_params"
85
95
  require_relative "e_invoice_api/models/inbox_list_invoices_params"
86
96
  require_relative "e_invoice_api/models/inbox_list_params"
@@ -88,12 +98,18 @@ require_relative "e_invoice_api/models/lookup_retrieve_params"
88
98
  require_relative "e_invoice_api/models/lookup_retrieve_participants_params"
89
99
  require_relative "e_invoice_api/models/lookup_retrieve_participants_response"
90
100
  require_relative "e_invoice_api/models/lookup_retrieve_response"
101
+ require_relative "e_invoice_api/models/mailbox_download_attachment_params"
102
+ require_relative "e_invoice_api/models/mailbox_list_params"
103
+ require_relative "e_invoice_api/models/mailbox_reprocess_params"
104
+ require_relative "e_invoice_api/models/mailbox_retrieve_params"
91
105
  require_relative "e_invoice_api/models/me_retrieve_params"
92
106
  require_relative "e_invoice_api/models/me_retrieve_response"
93
107
  require_relative "e_invoice_api/models/outbox_list_draft_documents_params"
94
108
  require_relative "e_invoice_api/models/outbox_list_received_documents_params"
95
109
  require_relative "e_invoice_api/models/paginated_document_response"
96
110
  require_relative "e_invoice_api/models/payment_detail_create"
111
+ require_relative "e_invoice_api/models/stats_retrieve_params"
112
+ require_relative "e_invoice_api/models/stats_retrieve_response"
97
113
  require_relative "e_invoice_api/models/ubl_document_validation"
98
114
  require_relative "e_invoice_api/models/unit_of_measure_code"
99
115
  require_relative "e_invoice_api/models/validate_validate_json_params"
@@ -103,18 +119,27 @@ require_relative "e_invoice_api/models/validate_validate_ubl_params"
103
119
  require_relative "e_invoice_api/models/webhook_create_params"
104
120
  require_relative "e_invoice_api/models/webhook_delete_params"
105
121
  require_relative "e_invoice_api/models/webhook_delete_response"
122
+ require_relative "e_invoice_api/models/webhook_history_params"
123
+ require_relative "e_invoice_api/models/webhook_history_response"
106
124
  require_relative "e_invoice_api/models/webhook_list_params"
107
125
  require_relative "e_invoice_api/models/webhook_list_response"
108
126
  require_relative "e_invoice_api/models/webhook_response"
109
127
  require_relative "e_invoice_api/models/webhook_retrieve_params"
128
+ require_relative "e_invoice_api/models/webhook_test_params"
129
+ require_relative "e_invoice_api/models/webhook_test_response"
110
130
  require_relative "e_invoice_api/models/webhook_update_params"
111
131
  require_relative "e_invoice_api/models"
132
+ require_relative "e_invoice_api/resources/conversion"
133
+ require_relative "e_invoice_api/resources/conversion/pdf"
112
134
  require_relative "e_invoice_api/resources/documents"
113
135
  require_relative "e_invoice_api/resources/documents/attachments"
114
136
  require_relative "e_invoice_api/resources/documents/ubl"
137
+ require_relative "e_invoice_api/resources/drafts"
115
138
  require_relative "e_invoice_api/resources/inbox"
116
139
  require_relative "e_invoice_api/resources/lookup"
140
+ require_relative "e_invoice_api/resources/mailbox"
117
141
  require_relative "e_invoice_api/resources/me"
118
142
  require_relative "e_invoice_api/resources/outbox"
143
+ require_relative "e_invoice_api/resources/stats"
119
144
  require_relative "e_invoice_api/resources/validate"
120
145
  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
@@ -0,0 +1,108 @@
1
+ # typed: strong
2
+
3
+ module EInvoiceAPI
4
+ module Models
5
+ DocumentCreateFromPdfTask = Conversion::DocumentCreateFromPdfTask
6
+
7
+ module Conversion
8
+ class DocumentCreateFromPdfTask < EInvoiceAPI::Internal::Type::BaseModel
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ EInvoiceAPI::Conversion::DocumentCreateFromPdfTask,
13
+ EInvoiceAPI::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ # The ID of the task that will process the PDF
18
+ sig { returns(String) }
19
+ attr_accessor :task_id
20
+
21
+ # The status of the task
22
+ sig do
23
+ returns(
24
+ T.nilable(
25
+ EInvoiceAPI::Conversion::DocumentCreateFromPdfTask::Status::TaggedSymbol
26
+ )
27
+ )
28
+ end
29
+ attr_reader :status
30
+
31
+ sig do
32
+ params(
33
+ status:
34
+ EInvoiceAPI::Conversion::DocumentCreateFromPdfTask::Status::OrSymbol
35
+ ).void
36
+ end
37
+ attr_writer :status
38
+
39
+ sig do
40
+ params(
41
+ task_id: String,
42
+ status:
43
+ EInvoiceAPI::Conversion::DocumentCreateFromPdfTask::Status::OrSymbol
44
+ ).returns(T.attached_class)
45
+ end
46
+ def self.new(
47
+ # The ID of the task that will process the PDF
48
+ task_id:,
49
+ # The status of the task
50
+ status: nil
51
+ )
52
+ end
53
+
54
+ sig do
55
+ override.returns(
56
+ {
57
+ task_id: String,
58
+ status:
59
+ EInvoiceAPI::Conversion::DocumentCreateFromPdfTask::Status::TaggedSymbol
60
+ }
61
+ )
62
+ end
63
+ def to_hash
64
+ end
65
+
66
+ # The status of the task
67
+ module Status
68
+ extend EInvoiceAPI::Internal::Type::Enum
69
+
70
+ TaggedSymbol =
71
+ T.type_alias do
72
+ T.all(
73
+ Symbol,
74
+ EInvoiceAPI::Conversion::DocumentCreateFromPdfTask::Status
75
+ )
76
+ end
77
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
78
+
79
+ PENDING =
80
+ T.let(
81
+ :pending,
82
+ EInvoiceAPI::Conversion::DocumentCreateFromPdfTask::Status::TaggedSymbol
83
+ )
84
+ COMPLETED =
85
+ T.let(
86
+ :completed,
87
+ EInvoiceAPI::Conversion::DocumentCreateFromPdfTask::Status::TaggedSymbol
88
+ )
89
+ FAILED =
90
+ T.let(
91
+ :failed,
92
+ EInvoiceAPI::Conversion::DocumentCreateFromPdfTask::Status::TaggedSymbol
93
+ )
94
+
95
+ sig do
96
+ override.returns(
97
+ T::Array[
98
+ EInvoiceAPI::Conversion::DocumentCreateFromPdfTask::Status::TaggedSymbol
99
+ ]
100
+ )
101
+ end
102
+ def self.values
103
+ end
104
+ end
105
+ end
106
+ end
107
+ end
108
+ end
@@ -0,0 +1,43 @@
1
+ # typed: strong
2
+
3
+ module EInvoiceAPI
4
+ module Models
5
+ module Conversion
6
+ class PdfCreateParams < EInvoiceAPI::Internal::Type::BaseModel
7
+ extend EInvoiceAPI::Internal::Type::RequestParameters::Converter
8
+ include EInvoiceAPI::Internal::Type::RequestParameters
9
+
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ EInvoiceAPI::Conversion::PdfCreateParams,
14
+ EInvoiceAPI::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ sig { returns(EInvoiceAPI::Internal::FileInput) }
19
+ attr_accessor :file
20
+
21
+ sig do
22
+ params(
23
+ file: EInvoiceAPI::Internal::FileInput,
24
+ request_options: EInvoiceAPI::RequestOptions::OrHash
25
+ ).returns(T.attached_class)
26
+ end
27
+ def self.new(file:, request_options: {})
28
+ end
29
+
30
+ sig do
31
+ override.returns(
32
+ {
33
+ file: EInvoiceAPI::Internal::FileInput,
34
+ request_options: EInvoiceAPI::RequestOptions
35
+ }
36
+ )
37
+ end
38
+ def to_hash
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,40 @@
1
+ # typed: strong
2
+
3
+ module EInvoiceAPI
4
+ module Models
5
+ module Conversion
6
+ class PdfResultParams < EInvoiceAPI::Internal::Type::BaseModel
7
+ extend EInvoiceAPI::Internal::Type::RequestParameters::Converter
8
+ include EInvoiceAPI::Internal::Type::RequestParameters
9
+
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ EInvoiceAPI::Conversion::PdfResultParams,
14
+ EInvoiceAPI::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ sig { returns(String) }
19
+ attr_accessor :task_id
20
+
21
+ sig do
22
+ params(
23
+ task_id: String,
24
+ request_options: EInvoiceAPI::RequestOptions::OrHash
25
+ ).returns(T.attached_class)
26
+ end
27
+ def self.new(task_id:, request_options: {})
28
+ end
29
+
30
+ sig do
31
+ override.returns(
32
+ { task_id: String, request_options: EInvoiceAPI::RequestOptions }
33
+ )
34
+ end
35
+ def to_hash
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,40 @@
1
+ # typed: strong
2
+
3
+ module EInvoiceAPI
4
+ module Models
5
+ module Conversion
6
+ class PdfRetrieveParams < EInvoiceAPI::Internal::Type::BaseModel
7
+ extend EInvoiceAPI::Internal::Type::RequestParameters::Converter
8
+ include EInvoiceAPI::Internal::Type::RequestParameters
9
+
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ EInvoiceAPI::Conversion::PdfRetrieveParams,
14
+ EInvoiceAPI::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ sig { returns(String) }
19
+ attr_accessor :task_id
20
+
21
+ sig do
22
+ params(
23
+ task_id: String,
24
+ request_options: EInvoiceAPI::RequestOptions::OrHash
25
+ ).returns(T.attached_class)
26
+ end
27
+ def self.new(task_id:, request_options: {})
28
+ end
29
+
30
+ sig do
31
+ override.returns(
32
+ { task_id: String, request_options: EInvoiceAPI::RequestOptions }
33
+ )
34
+ end
35
+ def to_hash
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end