Sha256: d48265c76bf12413e7d5e067f30ffabc944052923503371e969065d0a1645ba0

Contents?: true

Size: 1.31 KB

Versions: 33

Compression:

Stored size: 1.31 KB

Contents

require 'killbill/plugin'
require 'securerandom'

module Killbill
  module Plugin
    class Invoice < Notification

      def get_additional_invoice_items(invoice, dry_run, properties, context)
        []
      end


      # Helper method to build a new item from an existing one
      def build_item(item_model, amount, description = nil, type = :EXTERNAL_CHARGE)
        item = Model::InvoiceItem.new

        item.created_date    = item_model.created_date
        item.updated_date    = item_model.updated_date
        item.invoice_id      = item_model.invoice_id
        item.account_id      = item_model.account_id
        item.currency        = item_model.currency
        item.bundle_id       = item_model.bundle_id
        item.subscription_id = item_model.subscription_id
        item.start_date      = item_model.start_date
        item.end_date        = item_model.end_date
        item.plan_name       = item_model.plan_name
        item.phase_name      = item_model.phase_name
        item.usage_name      = item_model.usage_name

        item.linked_item_id = item_model.id

        item.id                = SecureRandom.uuid
        item.invoice_item_type = type
        item.amount            = amount
        item.description       = description
        item.rate              = nil

        item
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
killbill-9.4.1 lib/killbill/invoice.rb
killbill-8.3.6 lib/killbill/invoice.rb
killbill-9.4.0 lib/killbill/invoice.rb
killbill-9.3.2 lib/killbill/invoice.rb
killbill-9.3.1 lib/killbill/invoice.rb
killbill-8.3.5 lib/killbill/invoice.rb
killbill-9.3.0 lib/killbill/invoice.rb
killbill-9.2.2 lib/killbill/invoice.rb
killbill-8.3.4 lib/killbill/invoice.rb
killbill-8.3.3 lib/killbill/invoice.rb
killbill-9.2.1 lib/killbill/invoice.rb
killbill-9.2.0 lib/killbill/invoice.rb
killbill-8.3.2 lib/killbill/invoice.rb
killbill-8.3.1 lib/killbill/invoice.rb
killbill-8.3.0 lib/killbill/invoice.rb
killbill-8.2.0 lib/killbill/invoice.rb
killbill-8.1.0 lib/killbill/invoice.rb
killbill-7.0.6 lib/killbill/invoice.rb
killbill-8.0.1 lib/killbill/invoice.rb
killbill-8.0.0 lib/killbill/invoice.rb