Paypal IPN Gem

Having some problems. Using instant rails 1.3 updated with to rails
1.1.4. Gem Paypal and Money gems are installed. Also installed the
plugin paypal, I see it in /vendor/plugins/paypal and restarted the
server. I posted my error at the bottom. Any Ideas?

Thanks Kindly

-Ryan

I have a controller called byc, in it I have this action.

def create
@registrant = Registrant.new(params[:registrant])
if @registrant.save
flash[:notice] = ‘Registrant was successfully created.’
redirect_to :controller => ‘payment’, :action => ‘pay’

else
  render :action => 'new'
end

end

I am redirecting the action in another controller called payment, I

also tried keeping this in the same controller byc

class PaymentController < ApplicationController

Simplification, please write better code then this…

def pay
  notify = Paypal::Notification.new(request.raw_post)

   if notify.acknowledge
     order = Order.find(notify.item_id)
     order.success = (notify.complete? and order.total ==

notify.amount) ? ‘success’ : ‘failure’
order.save
end

   render :nothing => true
  end

end

My helper

Methods added to this helper will be available to all templates in the

application.
require ‘paypal’
module ApplicationHelper
include Paypal::Helpers
#include OpenSSL::Helpers
end

This is my view for payment, file called pay.rhtml

<%= paypal_form_tag %>
<%= paypal_setup “BYC Registration”, Money.us_dollar(50), "
[email protected]", :notify_url => url_for(:only_path => false, :action =>
‘pay’) %>

 Please press here to pay $50US using paypal. <br/>
 <%= submit_tag "Go to paypal >>" %>

<% end_form_tag %>

This is the Error I get

NameError in PaymentController#pay

uninitialized constant Paypal

RAILS_ROOT: ./script/…/config/…
Application Trace | Framework Trace | Full Trace

C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/
active_support/dependencies.rb:100:in const_missing' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/ active_support/dependencies.rb:131:inconst_missing’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/
active_support/dependencies.rb:133:in const_missing' #{RAILS_ROOT}/app/controllers/payment_controller.rb:4:inpay’
-e:4

C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/
active_support/dependencies.rb:100:in const_missing' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/ active_support/dependencies.rb:131:inconst_missing’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/
active_support/dependencies.rb:133:in const_missing' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.2/lib/ action_controller/base.rb:910:inperform_action_without_filters’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.2/lib/
action_controller/filters.rb:368:in perform_action_without_benchmark' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.2/lib/ action_controller/benchmarking.rb:69:inperform_action_without_rescue’
C:/InstantRails/ruby/lib/ruby/1.8/benchmark.rb:293:in measure' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.2/lib/ action_controller/benchmarking.rb:69:inperform_action_without_rescue’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.2/lib/
action_controller/rescue.rb:82:in perform_action' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.2/lib/ action_controller/base.rb:381:inprocess_without_filters’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.2/lib/
action_controller/filters.rb:377:in
process_without_session_management_support' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.2/lib/ action_controller/session_management.rb:117:inprocess’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.1.3/lib/
dispatcher.rb:38:in dispatch' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.1.3/lib/ webrick_server.rb:115:inhandle_dispatch’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.1.3/lib/
webrick_server.rb:81:in service' C:/InstantRails/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:inservice’
C:/InstantRails/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in run' C:/InstantRails/ruby/lib/ruby/1.8/webrick/server.rb:173:instart_thread’
C:/InstantRails/ruby/lib/ruby/1.8/webrick/server.rb:162:in
start_thread' C:/InstantRails/ruby/lib/ruby/1.8/webrick/server.rb:95:instart’
C:/InstantRails/ruby/lib/ruby/1.8/webrick/server.rb:92:in start' C:/InstantRails/ruby/lib/ruby/1.8/webrick/server.rb:23:instart’
C:/InstantRails/ruby/lib/ruby/1.8/webrick/server.rb:82:in start' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.1.3/lib/ webrick_server.rb:67:indispatch’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.1.3/lib/commands/
servers/webrick.rb:59
C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/
custom_require.rb:21:in require' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/ active_support/dependencies.rb:147:inrequire’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.1.3/lib/commands/
server.rb:30
C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/
custom_require.rb:21:in require' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/ active_support/dependencies.rb:147:inrequire’
script/server:3

C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/
active_support/dependencies.rb:100:in const_missing' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport- 1.3.1/lib/active_support/dependencies.rb:131:inconst_missing’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/
active_support/dependencies.rb:133:in const_missing' #{RAILS_ROOT}/app/controllers/payment_controller.rb:4:inpay’

C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.2/lib/
action_controller/base.rb:910:in perform_action_without_filters' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.2/lib/ action_controller/filters.rb:368:inperform_action_without_benchmark’

C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.2/lib/
action_controller/benchmarking.rb:69:in perform_action_without_rescue' C:/InstantRails/ruby/lib/ruby/1.8/benchmark.rb:293:inmeasure’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-
1.12.2/lib/action_controller/benchmarking.rb:69:in
perform_action_without_rescue' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.2/lib/ action_controller/rescue.rb:82:inperform_action’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-
1.12.2/lib/action_controller/base.rb:381:in process_without_filters' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.2/lib/ action_controller/filters.rb:377:inprocess_without_session_management_support’

C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.2/lib/
action_controller/session_management.rb:117:in process' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.1.3/lib/ dispatcher.rb:38:indispatch’
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-
1.1.3/lib/webrick_server.rb:115:in handle_dispatch' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.1.3/lib/ webrick_server.rb:81:inservice’
C:/InstantRails/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service’

C:/InstantRails/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in run' C:/InstantRails/ruby/lib/ruby/1.8/webrick/server.rb:173:instart_thread’
C:/InstantRails/ruby/lib/ruby/1.8/webrick/server.rb:162:in
`start_thread’

C:/InstantRails/ruby/lib/ruby/1.8/webrick/server.rb:95:in start' C:/InstantRails/ruby/lib/ruby/1.8/webrick/server.rb:92:instart’
C:/InstantRails/ruby/lib/ruby/1.8/webrick/server.rb:23:in start' C:/InstantRails/ruby/lib/ruby/1.8/webrick/server.rb:82:instart’

C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.1.3/lib/
webrick_server.rb:67:in dispatch' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.1.3/lib/commands/ servers/webrick.rb:59 C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/ custom_require.rb:21:inrequire’

C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/
active_support/dependencies.rb:147:in require' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.1.3/lib/commands/ server.rb:30 C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/ custom_require.rb:21:inrequire’

C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/
active_support/dependencies.rb:147:in `require’
script/server:3
-e:4

Request

Parameters: None

Show session dump


flash: !map:ActionController::Flash::FlashHash
:notice: Registrant was successfully created.

Response
Headers: {“cookie”=>[], “Cache-Control”=>“no-cache”}

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs