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.13.4 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.13.3 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.13.2 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.13.1 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.13.0 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.12.0 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.11.13 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.11.12 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.11.11 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.11.10 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.11.9 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.11.8 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.11.7 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.11.6 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.11.5 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.11.4 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.11.3 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.11.2 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.11.1 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-2.11.0 app/services/forest_liana/stripe_invoice_getter.rb