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:



183
184
185
# File 'lib/e_invoice_api/resources/validate.rb', line 183

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_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::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 for payment. Must be positive and rounded to maximum 2 decimals

  • attachments (Array<EInvoiceAPI::Models::DocumentAttachmentCreate>, nil)
  • billing_address (String, nil)

    The billing address (if different from customer address)

  • billing_address_recipient (String, nil)

    The recipient name at the billing address

  • charges (Array<EInvoiceAPI::Models::DocumentCreate::Charge>, nil)
  • currency (Symbol, EInvoiceAPI::Models::CurrencyCode)

    Currency of the invoice (ISO 4217 currency code)

  • customer_address (String, nil)

    The address of the customer/buyer

  • customer_address_recipient (String, nil)

    The recipient name at the customer address

  • customer_company_id (String, nil)

    Customer company ID. For Belgium this is the CBE number or their EUID (European

  • customer_email (String, nil)

    The email address of the customer

  • customer_id (String, nil)

    The unique identifier for the customer in your system

  • customer_name (String, nil)

    The company name of the customer/buyer

  • customer_peppol_id (String, nil)

    Customer Peppol ID

  • customer_tax_id (String, nil)

    Customer tax ID. For Belgium this is the VAT number. Must include the country pr

  • direction (Symbol, EInvoiceAPI::Models::DocumentDirection)

    The direction of the document: INBOUND (purchases) or OUTBOUND (sales)

  • document_type (Symbol, EInvoiceAPI::Models::DocumentType)

    The type of document: INVOICE, CREDIT_NOTE, or DEBIT_NOTE

  • due_date (Date, nil)

    The date when payment is due

  • invoice_date (Date, nil)

    The date when the invoice was issued

  • invoice_id (String, nil)

    The unique invoice identifier/number

  • invoice_total (Float, String, nil)

    The total amount of the invoice including tax (invoice*total = subtotal + total*

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

    At least one line item is required

  • note (String, nil)

    Additional notes or comments for the invoice

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

    The payment terms (e.g., ‘Net 30’, ‘Due on receipt’, ‘2/10 Net 30’)

  • previous_unpaid_balance (Float, String, nil)

    The previous unpaid balance from prior invoices, if any. Must be positive and ro

  • purchase_order (String, nil)

    The purchase order reference number

  • remittance_address (String, nil)

    The address where payment should be sent or remitted to

  • remittance_address_recipient (String, nil)

    The recipient name at the remittance address

  • service_address (String, nil)

    The address where services were performed or goods were delivered

  • service_address_recipient (String, nil)

    The recipient name at the service address

  • service_end_date (Date, nil)

    The end date of the service period or delivery period

  • service_start_date (Date, nil)

    The start date of the service period or delivery period

  • shipping_address (String, nil)

    The shipping/delivery address

  • shipping_address_recipient (String, nil)

    The recipient name at the shipping address

  • state (Symbol, EInvoiceAPI::Models::DocumentState)

    The current state of the document: DRAFT, TRANSIT, FAILED, SENT, or RECEIVED

  • 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 (e.g., S for standard rate, Z for zero rate, E

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

    The net financial discount/charge of the invoice (non-VAT charges minus non-VAT

  • total_tax (Float, String, nil)

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

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

    VATEX code list for VAT exemption reasons

  • vatex_note (String, nil)

    Textual explanation for VAT exemption

  • vendor_address (String, nil)

    The address of the vendor/seller

  • vendor_address_recipient (String, nil)

    The recipient name at the vendor address

  • vendor_company_id (String, nil)

    Vendor company ID. For Belgium this is the CBE number or their EUID (European Un

  • vendor_email (String, nil)

    The email address of the vendor

  • vendor_name (String, nil)

    The name of the vendor/seller/supplier

  • vendor_tax_id (String, nil)

    Vendor tax ID. For Belgium this is the VAT number. Must include the country pref

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

Returns:

See Also:



116
117
118
119
120
121
122
123
124
125
# File 'lib/e_invoice_api/resources/validate.rb', line 116

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:



146
147
148
149
150
151
152
153
154
155
156
# File 'lib/e_invoice_api/resources/validate.rb', line 146

def validate_peppol_id(params)
  parsed, options = EInvoiceAPI::ValidateValidatePeppolIDParams.dump_request(params)
  query = EInvoiceAPI::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "api/validate/peppol-id",
    query: query,
    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:



168
169
170
171
172
173
174
175
176
177
178
# File 'lib/e_invoice_api/resources/validate.rb', line 168

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