Class: Akatus::InstallmentOptions

Inherits:
Object
  • Object
show all
Includes:
Transferrable
Defined in:
lib/akatus/installment_options.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Methods included from Transferrable

included, #initialize, #to_payload

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



4
5
6
# File 'lib/akatus/installment_options.rb', line 4

def description
  @description
end

#installmentsObject

Returns the value of attribute installments.



4
5
6
# File 'lib/akatus/installment_options.rb', line 4

def installments
  @installments
end

#taken_installmentsObject

Returns the value of attribute taken_installments.



4
5
6
# File 'lib/akatus/installment_options.rb', line 4

def taken_installments
  @taken_installments
end

Class Method Details

.blank(payment) ⇒ Object

Build an empty (“dummy”) object.



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/akatus/installment_options.rb', line 9

def self.blank(payment)

  # The only "option" is to pay the full amount in one installment.
  installment_options = [
    Installment.new({
        :quantity       => 1,
        :unitary_amount => payment.total_amount,
        :total_amount   => payment.total_amount
    })
  ]

  new({ :taken_installments => 0, :installments => installment_options })
end