Skip to content

Instantly share code, notes, and snippets.

@sivabudh
Created November 17, 2011 03:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sivabudh/1372252 to your computer and use it in GitHub Desktop.
Save sivabudh/1372252 to your computer and use it in GitHub Desktop.
PaypalExpressController#review
class PaypalExpressController < ApplicationController
before_filter :assigns_gateway
include ActiveMerchant::Billing
include PaypalExpressHelper
def checkout
# implemented in the previous blog post
end
def review
if params[:token].nil?
redirect_to home_url, :notice => 'Woops! Something went wrong!'
return
end
gateway_response = @gateway.details_for(params[:token])
unless gateway_response.success?
redirect_to home_url, :notice => "Sorry! Something went wrong with the Paypal purchase. Here's what Paypal said: #{gateway_response.message}"
return
end
@order_info = get_order_info gateway_response, @cart
end
private
def assigns_gateway
# implemented in the previous blog post
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment