public function recur(&$input, &$ids, &$objects, $first) {
$this->_isRecurring = TRUE;
$recur = &$objects['contributionRecur'];
+ $paymentProcessorObject = $objects['contribution']->_relatedObjects['paymentProcessor']['object'];
// do a subscription check
if ($recur->processor_id != $input['subscription_id']) {
$objects['contribution']->total_amount = $input['amount'];
$objects['contribution']->trxn_id = $input['trxn_id'];
- // since we have processor loaded for sure at this point,
- // check and validate gateway MD5 response if present
- $this->checkMD5($ids, $input);
+ $this->checkMD5($paymentProcessorObject, $input);
if ($input['response_code'] == 1) {
// Approved
}
/**
- * @param $ids
- * @param $input
+ * Check and validate gateway MD5 response if present.
+ *
+ * @param CRM_Core_Payment_AuthorizeNet $paymentObject
+ * @param array $input
*
* @return bool
*/
- 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>";