class PaysonAPI::V2::Models::Order

Attributes

currency[RW]
items[RW]
total_credited_amount[RW]
total_fee_excluding_tax[RW]
total_fee_including_tax[RW]
total_price_excluding_tax[RW]
total_price_including_tax[RW]
total_tax_amount[RW]

Public Class Methods

from_hash(hash) click to toggle source
# File lib/payson_api/v2/models/order.rb, line 11
def self.from_hash(hash)
  new.tap do |order|
    order.currency = hash['currency']
    order.total_fee_excluding_tax = hash['totalFeeExcludingTax']
    order.total_fee_including_tax = hash['totalFeeIncludingTax']
    order.total_price_excluding_tax = hash['totalPriceIncludingTax']
    order.total_price_including_tax = hash['totalPriceIncludingTax']
    order.total_tax_amount = hash['totalTaxAmount']
    order.total_credited_amount = hash['totalCreditedAmount']

    if hash['items']
      order.items = []
      hash['items'].each do |item|
        order.items << PaysonAPI::V2::Models::OrderItem.from_hash(item)
      end
    end
  end
end