Class: BlackStack::InvoiceItem

Inherits:
Object
  • Object
show all
Defined in:
lib/invoiceitem.rb

Instance Method Summary collapse

Instance Method Details

#number_of_packagesObject

Returns the number of plans ordered in this item



11
12
13
14
15
16
17
18
# File 'lib/invoiceitem.rb', line 11

def number_of_packages()
  plan = BlackStack::InvoicingPaymentsProcessing.plan_descriptor(self.item_number)
  if self.amount.to_f == plan[:trial_fee].to_f || self.amount.to_f == plan[:trial2_fee].to_f
    return 1.to_i 
  else
    return (self.units.to_f / plan[:credits].to_f).to_i
  end
end

#plan_descriptorObject



6
7
8
# File 'lib/invoiceitem.rb', line 6

def plan_descriptor()
  BlackStack::InvoicingPaymentsProcessing::plan_descriptor(self.item_number)
end