class SixSaferpay::Payment

Attributes

amount[RW]
description[RW]
installment[RW]
mandate_id[RW]
options[RW]
order_id[RW]
payer_note[RW]
recurring[RW]

Public Class Methods

new(amount:, order_id: nil, description:, payer_note: nil, mandate_id: nil, options: nil, recurring: nil, installment: nil) click to toggle source
# 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

Public Instance Methods

to_h()
Alias for: to_hash
to_hash() click to toggle source
# 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
Also aliased as: to_h