Class: VertexClient::Payload::DistributeTax
- Defined in:
- lib/vertex_client/payloads/distribute_tax.rb
Constant Summary
Constants inherited from Invoice
Invoice::DOCUMENT_NUMBER_LIMIT
Constants inherited from Quotation
Quotation::SALE_TRANSACTION_TYPE
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #all_line_items_have_tax? ⇒ Boolean
- #transform_line_item(line_item, number, defaults) ⇒ Object
- #validate! ⇒ Object
Methods inherited from Invoice
#body, #document_number_missing?, #document_number_too_long?
Methods inherited from Quotation
Methods inherited from Base
Constructor Details
This class inherits a constructor from VertexClient::Payload::Base
Instance Method Details
#all_line_items_have_tax? ⇒ Boolean
9 10 11 |
# File 'lib/vertex_client/payloads/distribute_tax.rb', line 9 def all_line_items_have_tax? params[:line_items].all?{ |item| item[:total_tax].present? } end |
#transform_line_item(line_item, number, defaults) ⇒ Object
13 14 15 16 17 |
# File 'lib/vertex_client/payloads/distribute_tax.rb', line 13 def transform_line_item(line_item, number, defaults) remove_nils(super(line_item, number, defaults).merge( input_total_tax: line_item[:total_tax] )) end |
#validate! ⇒ Object
4 5 6 7 |
# File 'lib/vertex_client/payloads/distribute_tax.rb', line 4 def validate! super raise VertexClient::ValidationError.new('total_tax must be specified for all line items') unless all_line_items_have_tax? end |