Class: SixSaferpay::SixTransaction::AlternativePayment

Inherits:
Object
  • Object
show all
Defined in:
lib/six_saferpay/api/six_transaction/requests/alternative_payment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_header: nil, terminal_id:, payment:, payment_method:, payment_method_options: nil, payer: nil, notification:, order: nil, risk_factors: nil) ⇒ AlternativePayment

Returns a new instance of AlternativePayment.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/six_saferpay/api/six_transaction/requests/alternative_payment.rb', line 18

def initialize(request_header: nil,
               terminal_id:,
               payment:,
               payment_method:,
               payment_method_options: nil,
               payer: nil,
               notification:,
               order: nil,
               risk_factors: nil
              )
  @request_header = request_header || SixSaferpay::RequestHeader.new()
  @terminal_id = terminal_id
  @payment = SixSaferpay::Payment.new(**payment.to_h)
  @payment_method = payment_method
  @payment_method_options = SixSaferpay::PaymentMethodOptions.new(**payment_method_options.to_h) if payment_method_options
  @payer = SixSaferpay::Payer.new(**payer.to_h) if payer
  @notification = SixSaferpay::Notification.new(**notification.to_h)
  @order = SixSaferpay::Order.new(**order.to_h) if order
  @risk_factors = SixSaferpay::RiskFactors.new(**risk_factors.to_h) if risk_factors
end

Instance Attribute Details

#notificationObject

Returns the value of attribute notification.



5
6
7
# File 'lib/six_saferpay/api/six_transaction/requests/alternative_payment.rb', line 5

def notification
  @notification
end

#orderObject

Returns the value of attribute order.



5
6
7
# File 'lib/six_saferpay/api/six_transaction/requests/alternative_payment.rb', line 5

def order
  @order
end

#payerObject

Returns the value of attribute payer.



5
6
7
# File 'lib/six_saferpay/api/six_transaction/requests/alternative_payment.rb', line 5

def payer
  @payer
end

#paymentObject

Returns the value of attribute payment.



5
6
7
# File 'lib/six_saferpay/api/six_transaction/requests/alternative_payment.rb', line 5

def payment
  @payment
end

#payment_methodObject

Returns the value of attribute payment_method.



5
6
7
# File 'lib/six_saferpay/api/six_transaction/requests/alternative_payment.rb', line 5

def payment_method
  @payment_method
end

#payment_method_optionsObject

Returns the value of attribute payment_method_options.



5
6
7
# File 'lib/six_saferpay/api/six_transaction/requests/alternative_payment.rb', line 5

def payment_method_options
  @payment_method_options
end

#request_headerObject

Returns the value of attribute request_header.



5
6
7
# File 'lib/six_saferpay/api/six_transaction/requests/alternative_payment.rb', line 5

def request_header
  @request_header
end

#terminal_idObject

Returns the value of attribute terminal_id.



5
6
7
# File 'lib/six_saferpay/api/six_transaction/requests/alternative_payment.rb', line 5

def terminal_id
  @terminal_id
end

Instance Method Details

#response_classObject



62
63
64
# File 'lib/six_saferpay/api/six_transaction/requests/alternative_payment.rb', line 62

def response_class
  SixSaferpay::SixTransaction::AlternativePaymentResponse
end

#to_hashObject Also known as: to_h



39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/six_saferpay/api/six_transaction/requests/alternative_payment.rb', line 39

def to_hash
  hash = Hash.new
  hash.merge!(request_header: @request_header.to_h) if @request_header
  hash.merge!(terminal_id: @terminal_id)
  hash.merge!(payment: @payment.to_h)
  hash.merge!(payment_method: @payment_method)
  hash.merge!(payment_method_options: @payment_method_options.to_h) if @payment_method_options
  hash.merge!(payer: @payer.to_h) if @payer
  hash.merge!(notification: @notification.to_h)
  hash.merge!(order: @order.to_h) if @order
  hash.merge!(risk_factors: @risk_factors.to_h) if @risk_factors
  hash
end

#to_jsonObject



54
55
56
# File 'lib/six_saferpay/api/six_transaction/requests/alternative_payment.rb', line 54

def to_json
  to_hash.to_json
end

#urlObject



58
59
60
# File 'lib/six_saferpay/api/six_transaction/requests/alternative_payment.rb', line 58

def url
  '/Payment/v1/Transaction/AlternativePayment'
end