Created
November 17, 2011 03:06
-
-
Save sivabudh/1372252 to your computer and use it in GitHub Desktop.
PaypalExpressController#review
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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