Created
October 23, 2011 02:00
-
-
Save sivabudh/1306747 to your computer and use it in GitHub Desktop.
PaypalExpressController checkout
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 | |
total_as_cents, setup_purchase_params = get_setup_purchase_params @cart, request | |
setup_response = @gateway.setup_purchase(total_as_cents, setup_purchase_params) | |
redirect_to @gateway.redirect_url_for(setup_response.token) | |
end | |
private | |
def assigns_gateway | |
@gateway ||= PaypalExpressGateway.new( | |
:login => PaypalLogin.login, | |
:password => PaypalLogin.password, | |
:signature => PaypalLogin.signature, | |
) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment