Class: SixSaferpay::SixTransaction::AuthorizeDirect

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_header: nil, terminal_id: nil, payment:, payment_means:, authentication: nil, register_alias: nil, payer: nil, order: nil, risk_factors: nil) ⇒ AuthorizeDirect

Returns a new instance of AuthorizeDirect.



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

def initialize(request_header: nil,
               terminal_id: nil,
               payment:,
               payment_means:,
               authentication: nil,
               register_alias: nil,
               payer: nil,
               order: nil,
               risk_factors: nil
              )
  @request_header = request_header || SixSaferpay::RequestHeader.new()
  @terminal_id = SixSaferpay.config.terminal_id || terminal_id
  @payment = SixSaferpay::Payment.new(**payment.to_h) if payment
  @payment_means = SixSaferpay::RequestPaymentMeans.new(**payment_means.to_h) if payment_means
  @authentication = SixSaferpay::Authentication.new(**authentication.to_h) if authentication
  @register_alias = SixSaferpay::RegisterAlias.new(**register_alias.to_h) if register_alias
  @payer = SixSaferpay::Payer.new(**payer.to_h) if payer
  @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

#authenticationObject

Returns the value of attribute authentication.



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

def authentication
  @authentication
end

#orderObject

Returns the value of attribute order.



5
6
7
# File 'lib/six_saferpay/api/six_transaction/requests/authorize_direct.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/authorize_direct.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/authorize_direct.rb', line 5

def payment
  @payment
end

#payment_meansObject

Returns the value of attribute payment_means.



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

def payment_means
  @payment_means
end

#register_aliasObject

Returns the value of attribute register_alias.



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

def register_alias
  @register_alias
end

#request_headerObject

Returns the value of attribute request_header.



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

def request_header
  @request_header
end

#risk_factorsObject

Returns the value of attribute risk_factors.



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

def risk_factors
  @risk_factors
end

#terminal_idObject

Returns the value of attribute terminal_id.



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

def terminal_id
  @terminal_id
end

Instance Method Details

#response_classObject



61
62
63
# File 'lib/six_saferpay/api/six_transaction/requests/authorize_direct.rb', line 61

def response_class
  SixSaferpay::SixTransaction::AuthorizeDirectResponse
end

#to_hashObject Also known as: to_h



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

def to_hash
  hash = Hash.new
  hash.merge!(request_header: @request_header.to_h) if @register_alias
  hash.merge!(terminal_id: @terminal_id) if @terminal_id
  hash.merge!(payment: @payment.to_h) if @payment
  hash.merge!(payment_means: @payment_means.to_h) if @payment_means
  hash.merge!(authentication: @authentication.to_h) if @authentication
  hash.merge!(register_alias: @register_alias.to_h) if @register_alias
  hash.merge!(payer: @payer.to_h) if @payer
  hash.merge!(order: @order.to_h) if @order
  hash.merge!(risk_factors: @risk_factors.to_h) if @risk_factors
  hash
end

#to_jsonObject



53
54
55
# File 'lib/six_saferpay/api/six_transaction/requests/authorize_direct.rb', line 53

def to_json
  to_hash.to_json
end

#urlObject



57
58
59
# File 'lib/six_saferpay/api/six_transaction/requests/authorize_direct.rb', line 57

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