I am implementing a payment gateway in my app.
Its like this:
The user fills the form with necessary details, along with a field containing return_url(say http://myapp.com/ebs_payment/ebs_response?dr={somedata})
and submit the form to a secure payment site. After the transaction is complete, the secure site puts some encrypted data into my param {dr} and the user is redirected back to the return url. The problem here is, when the user returns to the app with the return_url
, the application fails to pick up the session data and returns a nil
value.
Before submitting the form, I put the object @fdPaymentDets
in to session.
Here is my controller:
class EbsPaymentController < ApplicationController
#before_filter :login_required,:check_user_authenticate
#access_control [:ebs_response] => ('user')
def ebs_response
@fdPaymentDets = session["fd_payment_details"]
@deal = Deal.find(@fdPaymentDets.deal_id)
@categories = find_all_categories
end
private
def find_all_categories
@sp = SitePreference.find(:first)
Category.find(:all,:limit => @sp.categories_display_limit,:order => 'position')
end
end
When the user is redirected to the return url (http://myapp.com/ebs_payment/ebs_response?dr={encrypted_data})
from the secure site, rails is not picking the @fdPaymentDets
object from session and making it nil
thus resulting in an error when accessing data from the nil
object.
The surprising thing is that, when I put the same return_url
in my browser by hand, the session data is neatly picked and everything goes well.
Am missing any thing here? What could be the obvious reason? Any help appreciated.