Class: SixSaferpay::Payment

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(amount:, order_id: nil, description:, payer_note: nil, mandate_id: nil, options: nil, recurring: nil, installment: nil) ⇒ Payment

Returns a new instance of Payment.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/six_saferpay/models/payment.rb', line 13

def initialize(amount:,
               order_id: nil,
               description:,
               payer_note: nil,
               mandate_id: nil,
               options: nil,
               recurring: nil,
               installment: nil)
  @amount = SixSaferpay::Amount.new(**amount.to_h) if amount
  @order_id = order_id
  @description = description
  @payer_note = payer_note
  @mandate_id = mandate_id
  @options = SixSaferpay::Options.new(**options.to_h) if options
  @recurring = SixSaferpay::Recurring.new(**recurring.to_h) if recurring
  @installment = SixSaferpay::Installment.new(**installment.to_h) if installment
end

Instance Attribute Details

#amountObject

Returns the value of attribute amount.



3
4
5
# File 'lib/six_saferpay/models/payment.rb', line 3

def amount
  @amount
end

#descriptionObject

Returns the value of attribute description.



3
4
5
# File 'lib/six_saferpay/models/payment.rb', line 3

def description
  @description
end

#installmentObject

Returns the value of attribute installment.



3
4
5
# File 'lib/six_saferpay/models/payment.rb', line 3

def installment
  @installment
end

#mandate_idObject

Returns the value of attribute mandate_id.



3
4
5
# File 'lib/six_saferpay/models/payment.rb', line 3

def mandate_id
  @mandate_id
end

#optionsObject

Returns the value of attribute options.



3
4
5
# File 'lib/six_saferpay/models/payment.rb', line 3

def options
  @options
end

#order_idObject

Returns the value of attribute order_id.



3
4
5
# File 'lib/six_saferpay/models/payment.rb', line 3

def order_id
  @order_id
end

#payer_noteObject

Returns the value of attribute payer_note.



3
4
5
# File 'lib/six_saferpay/models/payment.rb', line 3

def payer_note
  @payer_note
end

#recurringObject

Returns the value of attribute recurring.



3
4
5
# File 'lib/six_saferpay/models/payment.rb', line 3

def recurring
  @recurring
end

Instance Method Details

#to_hashObject Also known as: to_h



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/six_saferpay/models/payment.rb', line 31

def to_hash
  hash = Hash.new
  hash.merge!(amount: @amount.to_h)
  hash.merge!(order_id: @order_id) if @order_id
  hash.merge!(description: @description)
  hash.merge!(payer_note: @payer_note) if @payer_note
  hash.merge!(mandate_id: @mandate_id) if @mandate_id
  hash.merge!(options: @options.to_h) if @options
  hash.merge!(recurring: @recurring.to_h) if @recurring
  hash.merge!(installment: @installment.to_h) if @installment
  hash
end