Fixed redirect issue on Event registration - #60
Conversation
|
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? |
|
@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. |
|
@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 |
8f31154 to
679df0f
Compare
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?