Class: SixSaferpay::SixTransaction::AdjustAmount

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_header: nil, token:, amount:) ⇒ AdjustAmount

Returns a new instance of AdjustAmount.



12
13
14
15
16
17
18
# File 'lib/six_saferpay/api/six_transaction/requests/adjust_amount.rb', line 12

def initialize(request_header: nil,
               token: ,
               amount: )
  @request_header = request_header || SixSaferpay::RequestHeader.new()
  @token = token
  @amount = SixSaferpay::Amount.new(**amount.to_h) if amount
end

Instance Attribute Details

#amountObject

Returns the value of attribute amount.



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

def amount
  @amount
end

#request_headerObject

Returns the value of attribute request_header.



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

def token
  @token
end

Instance Method Details

#response_classObject



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

def response_class
  SixSaferpay::SixTransaction::AdjustAmountResponse
end

#to_hashObject Also known as: to_h



20
21
22
23
24
25
26
# File 'lib/six_saferpay/api/six_transaction/requests/adjust_amount.rb', line 20

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!(amount: @amount.to_h) if @amount
  hash
end

#to_jsonObject



29
30
31
# File 'lib/six_saferpay/api/six_transaction/requests/adjust_amount.rb', line 29

def to_json
  to_hash.to_json
end

#urlObject



33
34
35
# File 'lib/six_saferpay/api/six_transaction/requests/adjust_amount.rb', line 33

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