Sha256: 985b0646ad57cd3ec133ff61273c068cf1126ad5dc12643368561cd705b39713

Contents?: true

Size: 567 Bytes

Versions: 6

Compression:

Stored size: 567 Bytes

Contents

require_dependency "stripe_wrapper/application_controller"

module StripeWrapper
  class ChargesController < ApplicationController

  def process_payment
    @user = main_app_current_user
    token = params[:stripe_token]
    @amount = stripe_get_amount
    redirect_url = params[:redirect_path]

    @customer = Customer.find_or_create_customer(token,@user)
    @charge = @customer.process_new_charge(@amount)

    # abort

    return redirect_to redirect_url+"?charge_id=#{@charge.id}"
  end

  def index
    @charges = Charge.all.order("ID DESC")
  end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
stripe_wrapper-0.1.6 app/controllers/stripe_wrapper/charges_controller.rb
stripe_wrapper-0.1.5 app/controllers/stripe_wrapper/charges_controller.rb
stripe_wrapper-0.1.4 app/controllers/stripe_wrapper/charges_controller.rb
stripe_wrapper-0.1.3 app/controllers/stripe_wrapper/charges_controller.rb
stripe_wrapper-0.1.2 app/controllers/stripe_wrapper/charges_controller.rb
stripe_wrapper-0.1.1 app/controllers/stripe_wrapper/charges_controller.rb