Sha256: 5c2e5cebfebb3bb6b594df0d45e23e1aa5af2e3db2e015c07b685c6de2e5b622
Contents?: true
Size: 745 Bytes
Versions: 21
Compression:
Stored size: 745 Bytes
Contents
module Zuora class InvoiceItem < ZObject def invoice @invoice ||= Invoice.find(invoiceId) end def rate_plan_charge @rate_plan_charge ||= RatePlanCharge.find(ratePlanChargeId) end def adjustments @adjustments ||= InvoiceItemAdjustment.where(:sourceType => 'InvoiceDetail', :sourceId => id) end def adjusted_charge_amount @adjusted_charge_amount ||= adjustments.inject(chargeAmount) do |amount, adjustment| # Adjustment types are either Credit or Charge # Credits will have a reducing (subtracting) effect on the invoice item charge. adjustment.type == "Credit" ? amount - adjustment.amount : amount + adjustment.amount end end end end
Version data entries
21 entries across 21 versions & 1 rubygems