Class: EwayRapid::DirectPaymentResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/eway_rapid/entities/direct_payment_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_payment_response.rb', line 3

def authorisation_code
  @authorisation_code
end

#beagle_scoreObject

Returns the value of attribute beagle_score.



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

def beagle_score
  @beagle_score
end

#customerObject

Returns the value of attribute customer.



14
15
16
# File 'lib/eway_rapid/entities/direct_payment_response.rb', line 14

def customer
  @customer
end

#errorsObject

Returns the value of attribute errors.



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

def errors
  @errors
end

#fraud_actionObject

Returns the value of attribute fraud_action.



12
13
14
# File 'lib/eway_rapid/entities/direct_payment_response.rb', line 12

def fraud_action
  @fraud_action
end

#paymentObject

Returns the value of attribute payment.



15
16
17
# File 'lib/eway_rapid/entities/direct_payment_response.rb', line 15

def payment
  @payment
end

#response_codeObject

Returns the value of attribute response_code.



4
5
6
# File 'lib/eway_rapid/entities/direct_payment_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_payment_response.rb', line 5

def response_message
  @response_message
end

#transaction_capturedObject

Returns the value of attribute transaction_captured.



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

def transaction_captured
  @transaction_captured
end

#transaction_idObject

Returns the value of attribute transaction_id.



6
7
8
# File 'lib/eway_rapid/entities/direct_payment_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_payment_response.rb', line 7

def transaction_status
  @transaction_status
end

#transaction_typeObject

Returns the value of attribute transaction_type.



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

def transaction_type
  @transaction_type
end

#verificationObject

Returns the value of attribute verification.



13
14
15
# File 'lib/eway_rapid/entities/direct_payment_response.rb', line 13

def verification
  @verification
end

Class Method Details

.from_hash(hash) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# 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) ⇒ Object



35
36
37
38
# File 'lib/eway_rapid/entities/direct_payment_response.rb', line 35

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

Instance Method Details

#to_json(options = {}) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# 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