From 3a8654e93c1f9dde19abd93bc87a57556acab329 Mon Sep 17 00:00:00 2001 From: Pradeep Nayak Date: Fri, 14 Sep 2018 11:27:01 +0100 Subject: [PATCH] Fixed redirect issue on Event registration --- CRM/Core/Payment/OmnipayMultiProcessor.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/CRM/Core/Payment/OmnipayMultiProcessor.php b/CRM/Core/Payment/OmnipayMultiProcessor.php index cef9f266a..9deedeb0e 100644 --- a/CRM/Core/Payment/OmnipayMultiProcessor.php +++ b/CRM/Core/Payment/OmnipayMultiProcessor.php @@ -791,6 +791,20 @@ public static function processPaymentResponse($params) { * @param null|object $response */ protected function redirectOrExit($outcome, $response = NULL) { + // Session is reset for event registration for unknown reason. + // set the component so that the url is build correctly. + if (!empty($this->transaction_id)) { + $participantCount = civicrm_api3('ParticipantPayment', 'getcount', [ + 'contribution_id' => $this->transaction_id, + ]); + if ($participantCount) { + $this->_component = 'event'; + } + else { + $this->_component = 'contribute'; + } + } + switch ($outcome) { case 'fail': $userMsg = ts('Your payment was not successful. Please try again'); @@ -1324,4 +1338,3 @@ public function getResponseBodies() { } } -