summaryrefslogtreecommitdiff
path: root/billing/app/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'billing/app/controllers')
-rw-r--r--billing/app/controllers/payments_controller.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/billing/app/controllers/payments_controller.rb b/billing/app/controllers/payments_controller.rb
new file mode 100644
index 0000000..2a76bb1
--- /dev/null
+++ b/billing/app/controllers/payments_controller.rb
@@ -0,0 +1,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