}
}
catch (\Civi\Payment\Exception\PaymentProcessorException $e) {
- CRM_Core_Error::displaySessionError($e->getMessage());
- CRM_Utils_System::redirect($params['cancelURL']);
+ CRM_Core_Error::statusBounce(ts('Payment approval failed with message :') . $e->getMessage(), $payment->getCancelUrl($params['qfKey'], CRM_Utils_Array::value('participant_id', $params)));
}
$this->set('pre_approval_parameters', $result['pre_approval_parameters']);
*
* @return string cancel url
*/
- protected function getCancelUrl($qfKey, $participantID) {
+ public function getCancelUrl($qfKey, $participantID) {
if ($this->_component == 'event') {
return CRM_Utils_System::url($this->getBaseReturnUrl(), array(
'reset' => 1,
$result = $this->invokeAPI($args);
if (is_a($result, 'CRM_Core_Error')) {
- return $result;
+ throw new PaymentProcessorException($result->message);
}
/* Success */
$result = $this->invokeAPI($args);
if (is_a($result, 'CRM_Core_Error')) {
- return $result;
+ throw new PaymentProcessorException(CRM_Core_Error::getMessages($result));
}
/* Success */
if (strtolower($result['ack']) != 'success' &&
strtolower($result['ack']) != 'successwithwarning'
) {
+ throw new PaymentProcessorException("{$result['l_shortmessage0']} {$result['l_longmessage0']}");
$e = CRM_Core_Error::singleton();
$e->push($result['l_errorcode0'],
0, NULL,