Skip to content
Snippets Groups Projects
Commit eecc276b authored by mattwire's avatar mattwire
Browse files

Log errors if payment processor cannot be found for IPN

parent b08edd8f
No related branches found
No related tags found
No related merge requests found
......@@ -94,8 +94,10 @@ trait CRM_Core_Payment_MJWIPNTrait {
* @throws \Civi\Payment\Exception\PaymentProcessorException
*/
protected function getPaymentProcessor() {
$paymentProcessorID = CRM_Utils_Request::retrieveValue('processor_id', 'Positive', NULL, TRUE, 'GET');
$paymentProcessorID = CRM_Utils_Request::retrieveValue('processor_id', 'Positive', NULL, FALSE, 'GET');
if (!$paymentProcessorID) {
$this->exception('Failed to get payment processor ID');
}
try {
$this->_paymentProcessor = \Civi\Payment\System::singleton()->getById($paymentProcessorID);
}
......@@ -399,8 +401,9 @@ trait CRM_Core_Payment_MJWIPNTrait {
* @throws \Civi\Payment\Exception\PaymentProcessorException
*/
protected function exception($message) {
$errorMessage = $this->_paymentProcessor->getPaymentProcessorLabel() . ' Exception: Event: ' . $this->eventType . ' Error: ' . $message;
Civi::log()->debug($errorMessage);
$label = method_exists($this->_paymentProcessor, 'getPaymentProcessorLabel') ? $this->_paymentProcessor->getPaymentProcessorLabel() : __CLASS__;
$errorMessage = $label . ' Exception: Event: ' . $this->eventType . ' Error: ' . $message;
Civi::log()->error($errorMessage);
if ($this->exitOnException) {
http_response_code(400);
exit(1);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment