class EwayRapid::DirectRefundResponse

Attributes

authorisation_code[RW]
customer[RW]
errors[RW]
refund[RW]
response_code[RW]
response_message[RW]
transaction_id[RW]
transaction_status[RW]
transaction_status?[RW]
verification[RW]

Public Class Methods

from_hash(hash) click to toggle source
# File lib/eway_rapid/entities/direct_refund_response.rb, line 31
def self.from_hash(hash)
  direct_refund_response = DirectRefundResponse.new
  direct_refund_response.authorisation_code = hash[Constants::AUTHORISATION_CODE]
  direct_refund_response.response_code = hash[Constants::RESPONSE_CODE]
  direct_refund_response.transaction_id = hash[Constants::TRANSACTION_ID]
  direct_refund_response.transaction_status = hash[Constants::TRANSACTION_STATUS]
  direct_refund_response.verification = hash[Constants::VERIFICATION]
  direct_refund_response.customer = InternalModels::Customer.from_hash(hash[Constants::CUSTOMER])
  direct_refund_response.refund = InternalModels::RefundDetails.from_hash(hash[Constants::REFUND])
  direct_refund_response.errors = hash[Constants::ERRORS_CAPITALIZED]
  direct_refund_response
end
from_json(json) click to toggle source
# File lib/eway_rapid/entities/direct_refund_response.rb, line 26
def self.from_json(json)
  hash = JSON.parse(json)
  from_hash(hash)
end

Public Instance Methods

to_json(options={}) click to toggle source
# File lib/eway_rapid/entities/direct_refund_response.rb, line 15
def to_json(options={})
  {Constants::AUTHORISATION_CODE  => authorisation_code,
   Constants::RESPONSE_CODE       => response_code,
   Constants::TRANSACTION_ID      => transaction_id,
   Constants::TRANSACTION_STATUS  => transaction_status,
   Constants::VERIFICATION        => verification,
   Constants::CUSTOMER            => customer,
   Constants::REFUND              => refund,
   Constants::ERRORS_CAPITALIZED  => errors}.to_json
end