Sha256: ff175d8fc96c20402d1596ec49b415903c3949be4ee08421ff929ba31679c584

Contents?: true

Size: 828 Bytes

Versions: 105

Compression:

Stored size: 828 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

105 entries across 105 versions & 1 rubygems

Version Path
forest_liana-2.15.1 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-3.0.0.pre.beta.7 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-3.0.0.pre.beta.6 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.15.0 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-3.0.0.pre.beta.5 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.14.7 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-3.0.0.pre.beta.3 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-3.0.0.pre.beta.2 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-3.0.0.pre.beta.1 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-3.0.0.pre.beta.0 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.14.6 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.14.5 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.14.4 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.14.3 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.14.2 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.14.1 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.14.0 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.13.7 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.13.6 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.13.5 app/services/forest_liana/stripe_invoice_getter.rb