Class: SixSaferpay::SixTransaction::Authorize

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_header: nil, token:, condition: nil, verification_code: nil, register_alias: nil) ⇒ Authorize

Returns a new instance of Authorize.



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/six_saferpay/api/six_transaction/requests/authorize.rb', line 13

def initialize(request_header: nil,
               token:,
               condition: nil,
               verification_code: nil,
               register_alias: nil
              )
  @request_header = request_header || SixSaferpay::RequestHeader.new()
  @token = token
  @condition = condition
  @verification_code = verification_code
  @register_alias = SixSaferpay::RegisterAlias.new(**register_alias.to_h) if register_alias
end

Instance Attribute Details

#conditionObject

Returns the value of attribute condition.



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

def condition
  @condition
end

#register_aliasObject

Returns the value of attribute register_alias.



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

def request_header
  @request_header
end

#tokenObject

Returns the value of attribute token.



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

def token
  @token
end

#verification_codeObject

Returns the value of attribute verification_code.



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

def verification_code
  @verification_code
end

Instance Method Details

#response_classObject



45
46
47
# File 'lib/six_saferpay/api/six_transaction/requests/authorize.rb', line 45

def response_class
  SixSaferpay::SixTransaction::AuthorizeResponse
end

#to_hashObject Also known as: to_h



26
27
28
29
30
31
32
33
34
# File 'lib/six_saferpay/api/six_transaction/requests/authorize.rb', line 26

def to_hash
  hash = Hash.new
  hash.merge!(request_header: @request_header.to_h) if @request_header
  hash.merge!(token: @token) if @token
  hash.merge!(condition: @condition) if @condition
  hash.merge!(verification_code: @verification_code) if @verification_code
  hash.merge!(register_alias: @register_alias.to_h) if @register_alias
  hash
end

#to_jsonObject



37
38
39
# File 'lib/six_saferpay/api/six_transaction/requests/authorize.rb', line 37

def to_json
  to_hash.to_json
end

#urlObject



41
42
43
# File 'lib/six_saferpay/api/six_transaction/requests/authorize.rb', line 41

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