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