Class: SixSaferpay::SixTransaction::QueryAlternativePaymentResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/six_saferpay/api/six_transaction/responses/query_alternative_payment_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response_header:, transaction:, payment_means:, payer: nil, liability: nil, fraud_prevention: nil) ⇒ QueryAlternativePaymentResponse

Returns a new instance of QueryAlternativePaymentResponse.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/six_saferpay/api/six_transaction/responses/query_alternative_payment_response.rb', line 13

def initialize(response_header: ,
               transaction: ,
               payment_means: ,
               payer: nil,
               liability: nil,
               fraud_prevention: nil
              )


  @response_header = SixSaferpay::ResponseHeader.new(**response_header.to_h) if response_header
  @transaction = SixSaferpay::Transaction.new(**transaction.to_h)
  @payment_means = SixSaferpay::ResponsePaymentMeans.new(**payment_means.to_h)
  @payer = SixSaferpay::Payer.new(**payer.to_h) if payer
  @liability = SixSaferpay::Liability.new(**liability.to_h) if liability
  if fraud_prevention
    @fraud_prevention = SixSaferpay::FraudPrevention.new(**fraud_prevention.to_h)
  end
end

Instance Attribute Details

#fraud_preventionObject

Returns the value of attribute fraud_prevention.



5
6
7
# File 'lib/six_saferpay/api/six_transaction/responses/query_alternative_payment_response.rb', line 5

def fraud_prevention
  @fraud_prevention
end

#liabilityObject

Returns the value of attribute liability.



5
6
7
# File 'lib/six_saferpay/api/six_transaction/responses/query_alternative_payment_response.rb', line 5

def liability
  @liability
end

#payerObject

Returns the value of attribute payer.



5
6
7
# File 'lib/six_saferpay/api/six_transaction/responses/query_alternative_payment_response.rb', line 5

def payer
  @payer
end

#payment_meansObject

Returns the value of attribute payment_means.



5
6
7
# File 'lib/six_saferpay/api/six_transaction/responses/query_alternative_payment_response.rb', line 5

def payment_means
  @payment_means
end

#response_headerObject

Returns the value of attribute response_header.



5
6
7
# File 'lib/six_saferpay/api/six_transaction/responses/query_alternative_payment_response.rb', line 5

def response_header
  @response_header
end

#transactionObject

Returns the value of attribute transaction.



5
6
7
# File 'lib/six_saferpay/api/six_transaction/responses/query_alternative_payment_response.rb', line 5

def transaction
  @transaction
end

Instance Method Details

#to_hashObject Also known as: to_h



32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/six_saferpay/api/six_transaction/responses/query_alternative_payment_response.rb', line 32

def to_hash
  hash = Hash.new
  hash.merge!(response_header: @response_header.to_h) if @response_header
  hash.merge!(transaction: @transaction.to_h) if @transaction
  hash.merge!(payment_means: @payment_means.to_h) if @payment_means
  hash.merge!(payer: @payer.to_h) if @payer
  hash.merge!(liability: @liability.to_h) if @liability
  if @fraud_prevention
    hash.merge!(fraud_prevention: fraud_prevention.to_h)
  end
  hash
end