class EwayRapid::DirectPaymentResponse

Attributes

authorisation_code[RW]
beagle_score[RW]
customer[RW]
errors[RW]
fraud_action[RW]
payment[RW]
response_code[RW]
response_message[RW]
transaction_captured[RW]
transaction_id[RW]
transaction_status[RW]
transaction_status?[RW]
transaction_type[RW]
verification[RW]

Public Class Methods

from_hash(hash) click to toggle source
# File lib/eway_rapid/entities/direct_payment_response.rb, line 40
def self.from_hash(hash)
  direct_payment_response = DirectPaymentResponse.new
  direct_payment_response.authorisation_code = hash[Constants::AUTHORISATION_CODE]
  direct_payment_response.response_code = hash[Constants::RESPONSE_CODE]
  direct_payment_response.response_message = hash[Constants::RESPONSE_MESSAGE]
  direct_payment_response.transaction_id = hash[Constants::TRANSACTION_ID]
  direct_payment_response.transaction_status = hash[Constants::TRANSACTION_STATUS]
  direct_payment_response.transaction_type = hash[Constants::TRANSACTION_TYPE]
  direct_payment_response.beagle_score = hash[Constants::BEAGLE_SCORE]
  direct_payment_response.errors = hash[Constants::ERRORS_CAPITALIZED]
  direct_payment_response.transaction_captured = hash[Constants::TRANSACTION_CAPTURED]
  direct_payment_response.fraud_action = hash[Constants::FRAUD_ACTION]
  direct_payment_response.verification = InternalModels::Verification.from_hash(hash[Constants::VERIFICATION]) if hash[Constants::VERIFICATION]
  direct_payment_response.customer = InternalModels::Customer.from_hash(hash[Constants::CUSTOMER])
  direct_payment_response.payment = InternalModels::Payment.from_hash(hash[Constants::PAYMENT])
  direct_payment_response
end
from_json(json) click to toggle source
# File lib/eway_rapid/entities/direct_payment_response.rb, line 35
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_payment_response.rb, line 19
def to_json(options={})
  {Constants::AUTHORISATION_CODE   => authorisation_code,
   Constants::RESPONSE_CODE        => response_code,
   Constants::RESPONSE_MESSAGE     => response_message,
   Constants::TRANSACTION_ID       => transaction_id,
   Constants::TRANSACTION_STATUS   => transaction_status,
   Constants::TRANSACTION_TYPE     => transaction_type,
   Constants::BEAGLE_SCORE         => beagle_score,
   Constants::ERRORS_CAPITALIZED   => errors,
   Constants::TRANSACTION_CAPTURED => transaction_captured,
   Constants::FRAUD_ACTION         => fraud_action,
   Constants::VERIFICATION         => verification,
   Constants::CUSTOMER             => customer,
   Constants::PAYMENT              => payment}.to_json
end