Posted on 16 Aug 2022, this text provides information on Syllabus Queries related to Course Queries. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
After a user has signed up for an account, they are automatically signed in.
Then they have the option of "Activating their account" to unlock the app's features. The account activation leads them to a Paypal gateway. After successfully completing payment they are redirected back to an invoice page. However there is no current user session on the invoice page. Any ideas on what I'm doing wrong? the code is below
Rails.application.routes.draw do
devise_for :users #, :controllers => {:registrations => 'memberships'}
root 'pages#dashboard'get'home'=>'pages#dashboard'
devise_scope :user do
post 'invoice'=>"memberships#show"
post 'hook'=>"memberships#hook"end
Here's the controller managing the payment/webhook
classMembershipsController<ApplicationControllerdef show
@user= current_user
end
protect_from_forgery except:[:hook]def hook
params.permit!# Permit all Paypal input params
status =params[:payment_status]if status =="Completed"@user=User.find params[:invoice]@user.update_attributes notification_params:params, status: status, transaction_id:params[:txn_id], purchased_at:Time.now
end
render nothing:trueendend
Here's the show page for the invoice post, keep in mind it's been simplified for testing:
No matter what stage you're at in your education or career, TuteeHUB will help you reach the next level that
you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice
sessions to improve your knowledge and scores.
manpreet
Best Answer
2 years ago
After a user has signed up for an account, they are automatically signed in.
Then they have the option of "Activating their account" to unlock the app's features. The account activation leads them to a Paypal gateway. After successfully completing payment they are redirected back to an invoice page. However there is no current user session on the invoice page. Any ideas on what I'm doing wrong? the code is below
I'm using devise to manage authentication.
Here's the User Model
Here are my routes:
Here's the controller managing the payment/webhook
Here's the show page for the invoice post, keep in mind it's been simplified for testing: