Sha256: d4921964b82241c9d279692f3f5073e93c8cdf30851a8a4e5ebaf9b1992ccd7e

Contents?: true

Size: 865 Bytes

Versions: 163

Compression:

Stored size: 865 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.due_date = Time.at(@record.due_date).to_datetime unless @record.due_date.nil?
      @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

163 entries across 163 versions & 1 rubygems

Version Path
forest_liana-9.11.1 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-9.11.0 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-9.10.6 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-9.10.5 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-9.10.4 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-9.10.3 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-9.10.2 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-9.10.1 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-9.10.0 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-9.9.1 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-9.9.0 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-9.8.0 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-9.7.0 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-9.6.4 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-9.6.3 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-9.6.0 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-9.5.7 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-9.5.6 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-9.5.5 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-9.5.4 app/services/forest_liana/stripe_invoice_getter.rb