summaryrefslogtreecommitdiff
path: root/billing/app/controllers/payments_controller.rb
blob: 2a76bb1716a7e603334f3d33036a1e2fe8f83c3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
class PaymentsController < ApplicationController
  def new
    @amount = calculate_amount
  end

  def confirm
    @result = Braintree::TransparentRedirect.confirm(request.query_string)
    if @result.success?
      render :action => "confirm"
    else
      @amount = calculate_amount
      render :action => "new"
    end
  end

  protected

  def calculate_amount
    # in a real app this be calculated from a shopping cart, determined by the product, etc.
    "100.00"
  end
end