Sha256: fa79ecf4e4d60ccb6d6a0226f8bf64c662309b70be1f82d2a51d71ab397f4eb0

Contents?: true

Size: 1.42 KB

Versions: 24

Compression:

Stored size: 1.42 KB

Contents

module ForestLiana
  class StripeController < ForestLiana::ApplicationController

    def payments
      getter = StripePaymentsGetter.new(params,
                                        request.headers['Stripe-Secret-Key'],
                                        request.headers['Stripe-Reference'])
      getter.perform

      render json: serialize_models(getter.records, {
        count: getter.count,
        include: ['customer']
      })
    end

    def refund
      begin
        refunder = StripePaymentRefunder.new(params)
        refunder.perform

        render json: {}
      rescue Stripe::InvalidRequestError => err
        render json: { error: err.message }, status: 400
      end
    end

    def cards
      getter = StripeCardsGetter.new(params,
                                     request.headers['Stripe-Secret-Key'],
                                     request.headers['Stripe-Reference'])
      getter.perform

      render json: serialize_models(getter.records, {
        count: getter.count,
        include: ['customer']
      })
    end

    def invoices
      getter = StripeInvoicesGetter.new(params,
                                        request.headers['Stripe-Secret-Key'],
                                        request.headers['Stripe-Reference'])
      getter.perform

      render json: serialize_models(getter.records, {
        count: getter.count,
        include: ['customer']
      })
    end

  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
forest_liana-1.1.0 app/controllers/forest_liana/stripe_controller.rb
forest_liana-1.0.11 app/controllers/forest_liana/stripe_controller.rb
forest_liana-1.0.10 app/controllers/forest_liana/stripe_controller.rb
forest_liana-1.0.8 app/controllers/forest_liana/stripe_controller.rb