class EwayRapid::InternalModels::Payment

Attributes

currency_code[RW]
invoice_description[RW]
invoice_number[RW]
invoice_reference[RW]
total_amount[RW]

Public Class Methods

from_hash(hash) click to toggle source
# File lib/eway_rapid/models/internal_models.rb, line 215
def self.from_hash(hash)
  payment = Payment.new
  payment.total_amount = hash[Constants::TOTAL_AMOUNT]
  payment.invoice_number = hash[Constants::INVOICE_NUMBER]
  payment.invoice_description = hash[Constants::INVOICE_DESCRIPTION]
  payment.invoice_reference = hash[Constants::INVOICE_REFERENCE]
  payment.currency_code = hash[Constants::CURRENCY_CODE]
  payment
end
from_json(json) click to toggle source
# File lib/eway_rapid/models/internal_models.rb, line 210
def self.from_json(json)
  hash = JSON.parse(json)
  from_hash(hash)
end
to_hash(payment) click to toggle source
# File lib/eway_rapid/models/internal_models.rb, line 198
def self.to_hash(payment)
  hash = {}
  if payment
   hash[Constants::TOTAL_AMOUNT] = payment.total_amount if payment.total_amount
   hash[Constants::INVOICE_NUMBER] = payment.invoice_number if payment.invoice_number
   hash[Constants::INVOICE_DESCRIPTION] = payment.invoice_description if payment.invoice_description
   hash[Constants::INVOICE_REFERENCE] = payment.invoice_reference if payment.invoice_reference
   hash[Constants::CURRENCY_CODE] = payment.currency_code if payment.currency_code
  end
  hash
end