Class: SixSaferpay::Payment
- Inherits:
-
Object
- Object
- SixSaferpay::Payment
- Defined in:
- lib/six_saferpay/models/payment.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#description ⇒ Object
Returns the value of attribute description.
-
#installment ⇒ Object
Returns the value of attribute installment.
-
#mandate_id ⇒ Object
Returns the value of attribute mandate_id.
-
#options ⇒ Object
Returns the value of attribute options.
-
#order_id ⇒ Object
Returns the value of attribute order_id.
-
#payer_note ⇒ Object
Returns the value of attribute payer_note.
-
#recurring ⇒ Object
Returns the value of attribute recurring.
Instance Method Summary collapse
-
#initialize(amount:, order_id: nil, description:, payer_note: nil, mandate_id: nil, options: nil, recurring: nil, installment: nil) ⇒ Payment
constructor
A new instance of Payment.
- #to_hash ⇒ Object (also: #to_h)
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(**.to_h) if @recurring = SixSaferpay::Recurring.new(**recurring.to_h) if recurring @installment = SixSaferpay::Installment.new(**installment.to_h) if installment end |
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
3 4 5 |
# File 'lib/six_saferpay/models/payment.rb', line 3 def amount @amount end |
#description ⇒ Object
Returns the value of attribute description.
3 4 5 |
# File 'lib/six_saferpay/models/payment.rb', line 3 def description @description end |
#installment ⇒ Object
Returns the value of attribute installment.
3 4 5 |
# File 'lib/six_saferpay/models/payment.rb', line 3 def installment @installment end |
#mandate_id ⇒ Object
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 |
#options ⇒ Object
Returns the value of attribute options.
3 4 5 |
# File 'lib/six_saferpay/models/payment.rb', line 3 def @options end |
#order_id ⇒ Object
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_note ⇒ Object
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 |
#recurring ⇒ Object
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_hash ⇒ Object 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 |