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-8.0.11 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-8.0.10 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-8.0.9 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-8.0.8 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-8.0.7 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-8.0.6 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-8.0.5 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-8.0.4 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-8.0.3 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-8.0.2 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-8.0.1 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-8.0.0 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-7.8.1 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-8.0.0.beta.4 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-8.0.0.beta.3 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-8.0.0.beta.2 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-8.0.0.beta.1 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-7.8.0 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-7.7.3 app/services/forest_liana/stripe_invoice_getter.rb
forest_liana-7.7.2 app/services/forest_liana/stripe_invoice_getter.rb