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
{ | |
:login => "seller_1229899173_biz_api1.railscasts.com", | |
:password => "FXWU58S7KXFC6HBE", | |
:signature => "AGjv6SW.mTiKxtkm6L9DcSUCUgePAUDQ3L-kTdszkPG8mRfjaRZDYtSu" | |
} |
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) |
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
YourApp::Application.configure do | |
# Some other stuff in development.rb | |
# Force ActiveMerchant into test mode | |
config.after_initialize do | |
ActiveMerchant::Billing::Base.mode = :test | |
end | |
end |
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
:ip => request.remote_ip, | |
:return_url => url_for(:action => 'review', :only_path => false), | |
:cancel_return_url => home_url, |
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
module PaypalExpressHelper | |
def get_setup_purchase_params(cart, request) | |
subtotal, shipping, total = get_totals(cart) | |
return to_cents(total), { | |
:ip => request.remote_ip, | |
:return_url => url_for(:action => 'review', :only_path => false), | |
:cancel_return_url => home_url, | |
:subtotal => to_cents(subtotal), | |
:shipping => to_cents(shipping), | |
:handling => 0, |
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
#!/usr/bin/env ruby | |
require "open-uri" | |
open("http://www.forkedelic.com") do |f| | |
puts "Successfully pinged Forkedelic.com at #{Time.now}" | |
end |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>com.pac.HitForkedelic</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/scripts/hit_forkedelic.rb</string> |
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 |
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
module PaypalExpressHelper | |
def get_setup_purchase_params(cart, request) | |
# implemented in the previous blog post | |
end | |
def get_order_info(gateway_response, cart) | |
subtotal, shipping, total = get_totals(cart) | |
{ | |
shipping_address: gateway_response.address, | |
email: gateway_response.email, |
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
%h3 Example of rendering Order Information | |
%h4 Your Total | |
%p= "Subtotal: #{number_to_currency @order_info[:subtotal]}" | |
%p= "Shipping: #{number_to_currency @order_info[:shipping]}" | |
%p= "Total: #{number_to_currency @order_info[:total]}" | |
%h4 Shipping Address | |
%table | |
%tr |