class BlackStack::InvoiceItem

Public Instance Methods

number_of_packages() click to toggle source

Returns the number of plans ordered in this item

# 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_descriptor() click to toggle source
# File lib/invoiceitem.rb, line 6
def plan_descriptor()
  BlackStack::InvoicingPaymentsProcessing::plan_descriptor(self.item_number)
end