Class: SixSaferpay::Refund

Inherits:
Object
  • Object
show all
Defined in:
lib/six_saferpay/models/refund.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(amount:, order_id: nil, description: nil) ⇒ Refund

Returns a new instance of Refund.



9
10
11
12
13
14
15
# File 'lib/six_saferpay/models/refund.rb', line 9

def initialize(amount:,
               order_id: nil,
               description: nil)
  @amount = SixSaferpay::Amount.new(**amount.to_h) if amount
  @order_id = order_id
  @description = description
end

Instance Attribute Details

#amountObject

Returns the value of attribute amount.



4
5
6
# File 'lib/six_saferpay/models/refund.rb', line 4

def amount
  @amount
end

#descriptionObject

Returns the value of attribute description.



4
5
6
# File 'lib/six_saferpay/models/refund.rb', line 4

def description
  @description
end

#order_idObject

Returns the value of attribute order_id.



4
5
6
# File 'lib/six_saferpay/models/refund.rb', line 4

def order_id
  @order_id
end

Instance Method Details

#to_hashObject Also known as: to_h



17
18
19
20
21
22
23
# File 'lib/six_saferpay/models/refund.rb', line 17

def to_hash
  hash = Hash.new
  hash.merge!(amount: @amount.to_h) if @amount
  hash.merge!(order_id: @order_id) if @order_id
  hash.merge!(description: @description) if @description
  hash
end