Sha256: 2003beac60a4172dd52604c5950535425b3ea017d7d0bd7f131784878a23097f

Contents?: true

Size: 826 Bytes

Versions: 47

Compression:

Stored size: 826 Bytes

Contents

module ForestLiana
  class StripeInvoiceGetter < StripeBaseGetter
    attr_accessor :record

    def initialize(params, secret_key, reference)
      @params = params
      Stripe.api_key = ForestLiana.integrations[:stripe][:api_key]
    end

    def perform
      query = {}
      @record = Stripe::Invoice.retrieve(@params[:invoice_id])

      @record.date = Time.at(@record.date).to_datetime
      @record.period_start = Time.at(@record.period_start).to_datetime
      @record.period_end = Time.at(@record.period_end).to_datetime
      @record.subtotal /= 100.00
      @record.total /= 100.00
      @record.amount_due /= 100.00

      query[field] = @record.customer
      if collection
        @record.customer = collection.find_by(query)
      else
        @record.customer = nil
      end
      @record
    end
  end
end

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
forest_liana-2.10.0 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.9.2 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.9.1 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.9.0 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.8.6 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.8.5 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.8.4 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.8.3 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.8.2 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.8.1 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.8.0 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.7.0 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.6.1 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.6.0 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.5.5 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.5.4 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.5.3 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.5.2 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.5.1 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.5.0 app/services/forest_liana/stripe_invoice_getter.rb