Class: IntegratedPaymentController

Inherits:
ApplicationController show all
Defined in:
lib/forge/app/controllers/integrated_payment_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#app_init

Instance Method Details

#billingObject



6
7
8
9
# File 'lib/forge/app/controllers/integrated_payment_controller.rb', line 6

def billing
  @user = current_user
  @page_title = "Pay Securely Online WIth Your Credit Card"
end

#payObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/forge/app/controllers/integrated_payment_controller.rb', line 11

def pay
  processor = Forge::CreditCardProcessor.new(@cart_order)
  processor.create_credit_card(
    :number => params[:credit_card][:number],
    :verification_value => params[:credit_card][:verification_value],
    :month => params[:date][:month],
    :year => params[:date][:year]
  )
  if processor.pay(@cart_order)
    flash[:notice] = processor.message
    redirect_to paid_order_path(@cart_order, :key => @cart_order.key)
  else
    flash[:warning] = processor.message
    render :action => "billing" and return
  end
end