Class: VertexClient::Payload::Quotation

Inherits:
Base
  • Object
show all
Defined in:
lib/vertex_client/payloads/quotation.rb

Direct Known Subclasses

Invoice, QuotationFallback

Constant Summary collapse

SALE_TRANSACTION_TYPE =
'SALE'.freeze

Instance Attribute Summary

Attributes inherited from Base

#params

Instance Method Summary collapse

Methods inherited from Base

#initialize, #transform

Constructor Details

This class inherits a constructor from VertexClient::Payload::Base

Instance Method Details

#bodyObject



11
12
13
14
15
16
17
18
# File 'lib/vertex_client/payloads/quotation.rb', line 11

def body
  {
    :'@transactionType' => SALE_TRANSACTION_TYPE,
    line_item: params[:line_items].map.with_index do |line_item, index|
      transform_line_item(line_item, index, params)
    end
  }
end

#validate!Object



7
8
9
# File 'lib/vertex_client/payloads/quotation.rb', line 7

def validate!
  raise VertexClient::ValidationError.new('customer requires a state and postal_code') if customer_missing_location?
end