Class: Einvoice::Neweb::Model::Invoice

Inherits:
Base
  • Object
show all
Defined in:
lib/einvoice/neweb/model/invoice.rb

Direct Known Subclasses

PreInvoice, SellerInvoice

Constant Summary collapse

VALID_OPTIONS_KEYS =
[
  :seller_id,
  :buyer_name,
  :buyer_id,
  :customs_clearance_mark,
  :invoice_type,
  :donate_mark,
  :carrier_type,
  :carrier_id1,
  :carrier_id2,
  :print_mark,
  :n_p_o_b_a_n,
  :random_number,
  :invoice_item,
  :sales_amount,
  :free_tax_sales_amount,
  :zero_tax_sales_amount,
  :tax_type,
  :tax_rate,
  :tax_amount,
  :total_amount,
  :contact,
  :customer_defined
].freeze

Instance Method Summary collapse

Methods inherited from Base

#attributes, #attributes=

Methods included from Validator

#valid_float?

Constructor Details

#initializeInvoice

Returns a new instance of Invoice.

Raises:

  • (NotImplementedError)


54
55
56
# File 'lib/einvoice/neweb/model/invoice.rb', line 54

def initialize
  raise NotImplementedError, "You should initialize with subclasses"
end

Instance Method Details

#payloadObject



58
59
60
# File 'lib/einvoice/neweb/model/invoice.rb', line 58

def payload
  serializable_hash(except: [:errors, :validation_context], include: [:invoice_item, :contact, :customer_defined])
end

#wrapped_payloadObject



62
63
64
65
66
# File 'lib/einvoice/neweb/model/invoice.rb', line 62

def wrapped_payload
  { invoice_root:
    { invoice: payload }
  }
end