Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed redirect issue on Event registration #60

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pradpnayak
Copy link
Contributor

When using sagepay payment processor to purchase a event user get error saying 'Your browser session has expired and we are unable to complete your form submission. We have returned you to the initial step so you can complete and resubmit the form. If you experience continued difficulties, please contact us for assistance.' even though the payment is successful and recorded successfully in CiviCRM. The user also gets confirmation email saying they have registered for event.

Digging into the code i found that extension is saving the success or fail url in session before leaving CiviCRM to go to Payment Gateway screen and when it comes back it doesn't find the url in session and when it tries to rebuild the url and it defaults to use Contribution thank you page(because the component is not being set) which causes the controller to throw above error.

My PR fixes the problem by just checking if the contribution is linked to Participant and based on it sets the component.

@eileenmcnaughton @mattwire Can you please review this for me?

@eileenmcnaughton
Copy link
Owner

I never quite got my head around this " when it comes back it doesn't find the url in session" - why is the url not being saved in the session with Sagepay?

@mattwire
Copy link
Contributor

@pradpnayak I've merged this into my sagepay branch. Any ideas why the session is not being saved for events? Be better if we could fix that rather than use this workaround forever.

@pradpnayak
Copy link
Contributor Author

@mattwire it doesn't get set in both cases for event and contribute. It does work for Contribution since the redirect url is always set to contribution at https://github.com/civicrm/civicrm-core/blob/master/CRM/Core/Payment.php#L996

As far as I know incase of Sagepay when user hits confirm form it get redirected to sagepay gateway with return url set as '/civicrm/payment/ipn/1?qfkey=xxxx'. Once the payment is done sagepay returns to CiviCRM on '/civicrm/payment/ipn/1?qfkey=xxxx' where it sets the contribution to completed and tries to build the success url at
https://github.com/eileenmcnaughton/nz.co.fuzion.omnipaymultiprocessor/blob/master/CRM/Core/Payment/OmnipayMultiProcessor.php#L823 and then
https://github.com/eileenmcnaughton/nz.co.fuzion.omnipaymultiprocessor/blob/master/CRM/Core/Payment/PaymentExtended.php#L204 where its is returns NULL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants