Class: Atol::Request::PostDocument::Item::V5::Body

Inherits:
Object
  • Object
show all
Defined in:
lib/atol/request/post_document/item/v5/body.rb

Constant Summary collapse

BadPaymentMethodError =
Class.new(StandardError)
BadPaymentObjectError =
Class.new(StandardError)
BadMeasureError =
Class.new(StandardError)
BadVatTypeError =
Class.new(StandardError)
PAYMENT_METHODS =

atol-kassa.ru/wp-content/nfiles/files/ATOL/kassa/АТОЛ%20Онлайн%20-%20Описание%20протокола%20v5%20(ФФД%201.2).pdf

%w[full_prepayment prepayment advance full_payment partial_payment credit credit_payment].freeze
PAYMENT_OBJECTS =
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23].freeze
MEASURE =
[0, 10, 11, 12, 20, 21, 22, 30, 31, 32, 40, 41, 42, 50, 51, 70, 71, 72, 73, 80, 81, 82, 83, 255].freeze
VAT_TYPES =
%w[none vat0 vat5 vat7 vat10 vat22 vat105 vat107 vat110 vat20 vat120 vat122].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, price:, quantity: 1, payment_method:, payment_object:, measure:, vat:, **options) ⇒ Body

Returns a new instance of Body.



34
35
36
37
# File 'lib/atol/request/post_document/item/v5/body.rb', line 34

def initialize(name:, price:, quantity: 1, payment_method:, payment_object:, measure:, vat:, **options)
  setup_attributes(name, price, quantity, payment_method, payment_object, measure, vat, options)
  validate_attributes
end

Instance Attribute Details

#agent_info_typeObject

Returns the value of attribute agent_info_type.



23
24
25
# File 'lib/atol/request/post_document/item/v5/body.rb', line 23

def agent_info_type
  @agent_info_type
end

#measureObject

Returns the value of attribute measure.



23
24
25
# File 'lib/atol/request/post_document/item/v5/body.rb', line 23

def measure
  @measure
end

#nameObject

Returns the value of attribute name.



23
24
25
# File 'lib/atol/request/post_document/item/v5/body.rb', line 23

def name
  @name
end

#payment_methodObject

Returns the value of attribute payment_method.



23
24
25
# File 'lib/atol/request/post_document/item/v5/body.rb', line 23

def payment_method
  @payment_method
end

#payment_objectObject

Returns the value of attribute payment_object.



23
24
25
# File 'lib/atol/request/post_document/item/v5/body.rb', line 23

def payment_object
  @payment_object
end

#priceObject

Returns the value of attribute price.



23
24
25
# File 'lib/atol/request/post_document/item/v5/body.rb', line 23

def price
  @price
end

#quantityObject

Returns the value of attribute quantity.



23
24
25
# File 'lib/atol/request/post_document/item/v5/body.rb', line 23

def quantity
  @quantity
end

#supplier_info_innObject

Returns the value of attribute supplier_info_inn.



23
24
25
# File 'lib/atol/request/post_document/item/v5/body.rb', line 23

def supplier_info_inn
  @supplier_info_inn
end

#supplier_info_nameObject

Returns the value of attribute supplier_info_name.



23
24
25
# File 'lib/atol/request/post_document/item/v5/body.rb', line 23

def supplier_info_name
  @supplier_info_name
end

#vatObject

Returns the value of attribute vat.



23
24
25
# File 'lib/atol/request/post_document/item/v5/body.rb', line 23

def vat
  @vat
end

Instance Method Details

#to_hObject



39
40
41
# File 'lib/atol/request/post_document/item/v5/body.rb', line 39

def to_h
  body.clone
end

#to_json(*_args) ⇒ Object



43
44
45
# File 'lib/atol/request/post_document/item/v5/body.rb', line 43

def to_json(*_args)
  body.to_json
end