Sha256: d4921964b82241c9d279692f3f5073e93c8cdf30851a8a4e5ebaf9b1992ccd7e

Contents?: true

Size: 865 Bytes

Versions: 151

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

151 entries across 151 versions & 1 rubygems

Version Path
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
forest_liana-9.5.3 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-9.5.2 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-9.5.1 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-9.5.0 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-9.4.3 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-9.4.2 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-9.4.1 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-9.4.0 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-8.3.3 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-9.3.16 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-9.3.15 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-9.3.14 app/services/forest_liana/stripe_invoice_getter.rb