Class: EwayRapid::DirectRefundResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/eway_rapid/entities/direct_refund_response.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#authorisation_codeObject

Returns the value of attribute authorisation_code.



3
4
5
# File 'lib/eway_rapid/entities/direct_refund_response.rb', line 3

def authorisation_code
  @authorisation_code
end

#customerObject

Returns the value of attribute customer.



9
10
11
# File 'lib/eway_rapid/entities/direct_refund_response.rb', line 9

def customer
  @customer
end

#errorsObject

Returns the value of attribute errors.



11
12
13
# File 'lib/eway_rapid/entities/direct_refund_response.rb', line 11

def errors
  @errors
end

#refundObject

Returns the value of attribute refund.



10
11
12
# File 'lib/eway_rapid/entities/direct_refund_response.rb', line 10

def refund
  @refund
end

#response_codeObject

Returns the value of attribute response_code.



4
5
6
# File 'lib/eway_rapid/entities/direct_refund_response.rb', line 4

def response_code
  @response_code
end

#response_messageObject

Returns the value of attribute response_message.



5
6
7
# File 'lib/eway_rapid/entities/direct_refund_response.rb', line 5

def response_message
  @response_message
end

#transaction_idObject

Returns the value of attribute transaction_id.



6
7
8
# File 'lib/eway_rapid/entities/direct_refund_response.rb', line 6

def transaction_id
  @transaction_id
end

#transaction_statusObject Also known as: transaction_status?

Returns the value of attribute transaction_status.



7
8
9
# File 'lib/eway_rapid/entities/direct_refund_response.rb', line 7

def transaction_status
  @transaction_status
end

#verificationObject

Returns the value of attribute verification.



8
9
10
# File 'lib/eway_rapid/entities/direct_refund_response.rb', line 8

def verification
  @verification
end

Class Method Details

.from_hash(hash) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
# 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) ⇒ Object



26
27
28
29
# File 'lib/eway_rapid/entities/direct_refund_response.rb', line 26

def self.from_json(json)
  hash = JSON.parse(json)
  from_hash(hash)
end

Instance Method Details

#to_json(options = {}) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# 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