Class: EInvoiceAPI::Resources::Documents
- Inherits:
-
Object
- Object
- EInvoiceAPI::Resources::Documents
- Defined in:
- lib/e_invoice_api/resources/documents.rb,
lib/e_invoice_api/resources/documents/ubl.rb,
lib/e_invoice_api/resources/documents/attachments.rb
Defined Under Namespace
Classes: Attachments, Ubl
Instance Attribute Summary collapse
- #attachments ⇒ EInvoiceAPI::Resources::Documents::Attachments readonly
- #ubl ⇒ EInvoiceAPI::Resources::Documents::Ubl readonly
Instance Method Summary collapse
-
#create(construct_pdf: nil, 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: {}) ⇒ EInvoiceAPI::Models::DocumentResponse
Some parameter documentations has been truncated, see Models::DocumentCreateParams for more details.
-
#create_from_pdf(file:, customer_tax_id: nil, vendor_tax_id: nil, request_options: {}) ⇒ EInvoiceAPI::Models::DocumentCreateFromPdfResponse
Create a new invoice or credit note from a PDF file.
-
#delete(document_id, request_options: {}) ⇒ EInvoiceAPI::Models::DocumentDeleteResponse
Delete an invoice or credit note.
-
#initialize(client:) ⇒ Documents
constructor
private
A new instance of Documents.
-
#retrieve(document_id, request_options: {}) ⇒ EInvoiceAPI::Models::DocumentResponse
Get an invoice or credit note by ID.
-
#send_(document_id, email: nil, receiver_peppol_id: nil, receiver_peppol_scheme: nil, sender_peppol_id: nil, sender_peppol_scheme: nil, request_options: {}) ⇒ EInvoiceAPI::Models::DocumentResponse
Send an invoice or credit note via Peppol.
-
#validate(document_id, request_options: {}) ⇒ EInvoiceAPI::Models::UblDocumentValidation
Validate a UBL document according to Peppol BIS Billing 3.0.
Constructor Details
#initialize(client:) ⇒ Documents
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Documents.
264 265 266 267 268 |
# File 'lib/e_invoice_api/resources/documents.rb', line 264 def initialize(client:) @client = client = EInvoiceAPI::Resources::Documents::Attachments.new(client: client) @ubl = EInvoiceAPI::Resources::Documents::Ubl.new(client: client) end |
Instance Attribute Details
#attachments ⇒ EInvoiceAPI::Resources::Documents::Attachments (readonly)
7 8 9 |
# File 'lib/e_invoice_api/resources/documents.rb', line 7 def end |
#ubl ⇒ EInvoiceAPI::Resources::Documents::Ubl (readonly)
10 11 12 |
# File 'lib/e_invoice_api/resources/documents.rb', line 10 def ubl @ubl end |
Instance Method Details
#create(construct_pdf: nil, 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: {}) ⇒ EInvoiceAPI::Models::DocumentResponse
Some parameter documentations has been truncated, see Models::DocumentCreateParams for more details.
Create a new invoice or credit note
124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/e_invoice_api/resources/documents.rb', line 124 def create(params = {}) query_params = [:construct_pdf] parsed, = EInvoiceAPI::DocumentCreateParams.dump_request(params) query = EInvoiceAPI::Internal::Util.encode_query_params(parsed.slice(*query_params)) @client.request( method: :post, path: "api/documents/", query: query, body: parsed.except(*query_params), model: EInvoiceAPI::DocumentResponse, options: ) end |
#create_from_pdf(file:, customer_tax_id: nil, vendor_tax_id: nil, request_options: {}) ⇒ EInvoiceAPI::Models::DocumentCreateFromPdfResponse
Create a new invoice or credit note from a PDF file. If the ‘ubl_document’ field is set in the response, it indicates that sufficient details were extracted from the PDF to automatically generate a valid UBL document ready for sending. If ‘ubl_document’ is not set, human intervention may be required to ensure compliance.
195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
# File 'lib/e_invoice_api/resources/documents.rb', line 195 def create_from_pdf(params) query_params = [:customer_tax_id, :vendor_tax_id] parsed, = EInvoiceAPI::DocumentCreateFromPdfParams.dump_request(params) query = EInvoiceAPI::Internal::Util.encode_query_params(parsed.slice(*query_params)) @client.request( method: :post, path: "api/documents/pdf", query: query, headers: {"content-type" => "multipart/form-data"}, body: parsed.except(*query_params), model: EInvoiceAPI::Models::DocumentCreateFromPdfResponse, options: ) end |
#delete(document_id, request_options: {}) ⇒ EInvoiceAPI::Models::DocumentDeleteResponse
Delete an invoice or credit note
167 168 169 170 171 172 173 174 |
# File 'lib/e_invoice_api/resources/documents.rb', line 167 def delete(document_id, params = {}) @client.request( method: :delete, path: ["api/documents/%1$s", document_id], model: EInvoiceAPI::Models::DocumentDeleteResponse, options: params[:request_options] ) end |
#retrieve(document_id, request_options: {}) ⇒ EInvoiceAPI::Models::DocumentResponse
Get an invoice or credit note by ID
148 149 150 151 152 153 154 155 |
# File 'lib/e_invoice_api/resources/documents.rb', line 148 def retrieve(document_id, params = {}) @client.request( method: :get, path: ["api/documents/%1$s", document_id], model: EInvoiceAPI::DocumentResponse, options: params[:request_options] ) end |
#send_(document_id, email: nil, receiver_peppol_id: nil, receiver_peppol_scheme: nil, sender_peppol_id: nil, sender_peppol_scheme: nil, request_options: {}) ⇒ EInvoiceAPI::Models::DocumentResponse
Send an invoice or credit note via Peppol. By default, the sender and receiver Peppol IDs are derived from the company (tax) IDs in the document, regardless of whether the document was created from a UBL with a different endpoint ID. To explicitly set the sender or receiver Peppol ID, provide them via the query parameters (sender_peppol_scheme, sender_peppol_id, receiver_peppol_scheme, receiver_peppol_id).
230 231 232 233 234 235 236 237 238 239 240 |
# File 'lib/e_invoice_api/resources/documents.rb', line 230 def send_(document_id, params = {}) parsed, = EInvoiceAPI::DocumentSendParams.dump_request(params) query = EInvoiceAPI::Internal::Util.encode_query_params(parsed) @client.request( method: :post, path: ["api/documents/%1$s/send", document_id], query: query, model: EInvoiceAPI::DocumentResponse, options: ) end |
#validate(document_id, request_options: {}) ⇒ EInvoiceAPI::Models::UblDocumentValidation
Validate a UBL document according to Peppol BIS Billing 3.0
252 253 254 255 256 257 258 259 |
# File 'lib/e_invoice_api/resources/documents.rb', line 252 def validate(document_id, params = {}) @client.request( method: :post, path: ["api/documents/%1$s/validate", document_id], model: EInvoiceAPI::UblDocumentValidation, options: params[:request_options] ) end |