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-5.4.1 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-6.0.0.pre.beta.4 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-6.0.0.pre.beta.3 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-5.4.0 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-6.0.0.pre.beta.2 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-6.0.0.pre.beta.1 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-5.3.3 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-5.3.2 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-5.3.1 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-5.3.0 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-5.2.3 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-5.2.2 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-5.2.1 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-5.2.0 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-5.1.3 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-5.1.2 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-5.1.1 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-5.1.0 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-5.0.0 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-5.0.0.pre.beta.0 app/services/forest_liana/stripe_invoice_getter.rb