/**
  * Check that the MDs is valid.
  *
  * Note that this only checks if it is provided.
  *
  * @param array $ids
  * @param array $input
  *
  * @throws CRM_Core_Exception
  */
 public function checkMD5($ids, $input)
 {
     if (empty($input['trxn_id'])) {
         // For decline we have nothing to check against.
         return;
     }
     $paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($ids['paymentProcessor'], $input['is_test'] ? 'test' : 'live');
     $paymentObject = CRM_Core_Payment::singleton($input['is_test'] ? 'test' : 'live', $paymentProcessor);
     if (!$paymentObject->checkMD5($input['MD5_Hash'], $input['trxn_id'], $input['amount'], TRUE)) {
         $message = "Failure: Security verification failed";
         $log = new CRM_Utils_SystemLogger();
         $log->error('payment_notification', array('message' => $message, 'ids' => $ids, 'input' => $input));
         throw new CRM_Core_Exception($message);
     }
 }
 /**
  * Check and validate gateway MD5 response if present.
  *
  * @param CRM_Core_Payment_AuthorizeNet $paymentObject
  * @param array $input
  *
  * @throws CRM_Core_Exception
  */
 public function checkMD5($paymentObject, $input)
 {
     if (empty($input['trxn_id'])) {
         // For decline we have nothing to check against.
         return;
     }
     if (!$paymentObject->checkMD5($input['MD5_Hash'], $input['trxn_id'], $input['amount'], TRUE)) {
         $message = "Failure: Security verification failed";
         $log = new CRM_Utils_SystemLogger();
         $log->error('payment_notification', array('message' => $message, 'input' => $input));
         throw new CRM_Core_Exception($message);
     }
 }