Class: EInvoiceAPI::Resources::Validate

Inherits:
Object
  • Object
show all
Defined in:
lib/e_invoice_api/resources/validate.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Validate

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 Validate.

Parameters:



176
177
178
# File 'lib/e_invoice_api/resources/validate.rb', line 176

def initialize(client:)
  @client = client
end

Instance Method Details

#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_email: nil, customer_id: nil, customer_name: 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_email: nil, vendor_name: nil, vendor_tax_id: nil, request_options: {}) ⇒ EInvoiceAPI::Models::UblDocumentValidation

Some parameter documentations has been truncated, see Models::ValidateValidateJsonParams for more details.

Validate if the JSON document can be converted to a valid UBL document

Parameters:

  • allowances (Array<EInvoiceAPI::Models::DocumentCreate::Allowance>, nil)
  • amount_due (Float, String, nil)

    The amount due of the invoice. Must be positive and rounded to maximum 2 decimal

  • attachments (Array<EInvoiceAPI::Models::DocumentAttachmentCreate>, nil)
  • billing_address (String, nil)
  • billing_address_recipient (String, nil)
  • charges (Array<EInvoiceAPI::Models::DocumentCreate::Charge>, nil)
  • currency (Symbol, EInvoiceAPI::Models::CurrencyCode)

    Currency of the invoice

  • customer_address (String, nil)
  • customer_address_recipient (String, nil)
  • customer_email (String, nil)
  • customer_id (String, nil)
  • customer_name (String, nil)
  • customer_tax_id (String, nil)
  • direction (Symbol, EInvoiceAPI::Models::DocumentDirection)
  • document_type (Symbol, EInvoiceAPI::Models::DocumentType)
  • due_date (Date, nil)
  • invoice_date (Date, nil)
  • invoice_id (String, nil)
  • invoice_total (Float, String, nil)

    The total amount of the invoice (so invoice_total = subtotal + total_tax + total

  • items (Array<EInvoiceAPI::Models::DocumentCreate::Item>)

    At least one line item is required

  • note (String, nil)
  • payment_details (Array<EInvoiceAPI::Models::PaymentDetailCreate>, nil)
  • payment_term (String, nil)
  • previous_unpaid_balance (Float, String, nil)

    The previous unpaid balance of the invoice, if any. Must be positive and rounded

  • purchase_order (String, nil)
  • remittance_address (String, nil)
  • remittance_address_recipient (String, nil)
  • service_address (String, nil)
  • service_address_recipient (String, nil)
  • service_end_date (Date, nil)
  • service_start_date (Date, nil)
  • shipping_address (String, nil)
  • shipping_address_recipient (String, nil)
  • state (Symbol, EInvoiceAPI::Models::DocumentState)
  • subtotal (Float, String, nil)

    The taxable base of the invoice. Should be the sum of all line items - allowance

  • tax_code (Symbol, EInvoiceAPI::Models::DocumentCreate::TaxCode)

    Tax category code of the invoice

  • tax_details (Array<EInvoiceAPI::Models::DocumentCreate::TaxDetail>, nil)
  • total_discount (Float, String, nil)

    The total financial discount of the invoice (so discounts not subject to VAT). M

  • total_tax (Float, String, nil)

    The total tax of the invoice. Must be positive and rounded to maximum 2 decimals

  • vatex (Symbol, EInvoiceAPI::Models::DocumentCreate::Vatex, nil)

    VATEX code list for VAT exemption reasons

  • vatex_note (String, nil)

    VAT exemption note of the invoice

  • vendor_address (String, nil)
  • vendor_address_recipient (String, nil)
  • vendor_email (String, nil)
  • vendor_name (String, nil)
  • vendor_tax_id (String, nil)
  • request_options (EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



110
111
112
113
114
115
116
117
118
119
# File 'lib/e_invoice_api/resources/validate.rb', line 110

def validate_json(params = {})
  parsed, options = EInvoiceAPI::ValidateValidateJsonParams.dump_request(params)
  @client.request(
    method: :post,
    path: "api/validate/json",
    body: parsed,
    model: EInvoiceAPI::UblDocumentValidation,
    options: options
  )
end

#validate_peppol_id(peppol_id: , request_options: {}) ⇒ EInvoiceAPI::Models::ValidateValidatePeppolIDResponse

Some parameter documentations has been truncated, see Models::ValidateValidatePeppolIDParams for more details.

Validate if a Peppol ID exists in the Peppol network and retrieve supported document types. The peppol_id must be in the form of ‘<scheme>:<id>`. The scheme is a 4-digit code representing the identifier scheme, and the id is the actual identifier value. For example, for a Belgian company it is `0208:0123456789` (where 0208 is the scheme for Belgian enterprises, followed by the 10 digits of the official BTW / KBO number).

Parameters:

  • peppol_id (String)

    Peppol ID in the format ‘<scheme>:<id>`. Example: `0208:1018265814` for a Belgia

  • request_options (EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



140
141
142
143
144
145
146
147
148
149
# File 'lib/e_invoice_api/resources/validate.rb', line 140

def validate_peppol_id(params)
  parsed, options = EInvoiceAPI::ValidateValidatePeppolIDParams.dump_request(params)
  @client.request(
    method: :get,
    path: "api/validate/peppol-id",
    query: parsed,
    model: EInvoiceAPI::Models::ValidateValidatePeppolIDResponse,
    options: options
  )
end

#validate_ubl(file: , request_options: {}) ⇒ EInvoiceAPI::Models::UblDocumentValidation

Validate the correctness of a UBL document

Parameters:

Returns:

See Also:



161
162
163
164
165
166
167
168
169
170
171
# File 'lib/e_invoice_api/resources/validate.rb', line 161

def validate_ubl(params)
  parsed, options = EInvoiceAPI::ValidateValidateUblParams.dump_request(params)
  @client.request(
    method: :post,
    path: "api/validate/ubl",
    headers: {"content-type" => "multipart/form-data"},
    body: parsed,
    model: EInvoiceAPI::UblDocumentValidation,
    options: options
  )
end