Exemple #1
0
 /**
  * Log payment notification message to forensic system log.
  *
  * @todo move to factory class \Civi\Payment\System (or similar)
  *
  * @param array $params
  *
  * @return mixed
  */
 public static function logPaymentNotification($params)
 {
     $message = 'payment_notification ';
     if (!empty($params['processor_name'])) {
         $message .= 'processor_name=' . $params['processor_name'];
     }
     if (!empty($params['processor_id'])) {
         $message .= 'processor_id=' . $params['processor_id'];
     }
     $log = new CRM_Utils_SystemLogger();
     $log->alert($message, $_REQUEST);
 }
/**
 * Log entry to system log table.
 *
 * @param array $params
 *
 * @return array
 */
function civicrm_api3_system_log($params)
{
    $log = new CRM_Utils_SystemLogger();
    // This part means fields with separate db storage are accepted as params which kind of seems more intuitive to me
    // because I felt like not doing this required a bunch of explanation in the spec function - but perhaps other won't see it as helpful?
    if (!isset($params['context'])) {
        $params['context'] = array();
    }
    $specialFields = array('contact_id', 'hostname');
    foreach ($specialFields as $specialField) {
        if (isset($params[$specialField]) && !isset($params['context'])) {
            $params['context'][$specialField] = $params[$specialField];
        }
    }
    $returnValues = $log->log($params['level'], $params['message'], $params['context']);
    return civicrm_api3_create_success($returnValues, $params, 'System', 'Log');
}
<?php

/*
 * PxPay Functionality Copyright (C) 2008 Lucas Baker,
 *   Logistic Information Systems Limited (Logis)
 * PxAccess Functionality Copyright (C) 2008 Eileen McNaughton
 * Licensed to CiviCRM under the Academic Free License version 3.0.
 *
 * Grateful acknowledgements go to Donald Lobo for invaluable assistance
 * in creating this payment processor module
 */
session_start();
require_once '../civicrm.config.php';
require_once 'CRM/Core/Config.php';
$config = CRM_Core_Config::singleton();
$log = new CRM_Utils_SystemLogger();
$log->alert('payment_notification processor_name=Payment_Express', $_REQUEST);
/*
 * Get the password from the Payment Processor's table based on the DPS user id
 * being passed back from the server
 */
$query = "\nSELECT    url_site, password, user_name, signature\nFROM      civicrm_payment_processor\nLEFT JOIN civicrm_payment_processor_type ON civicrm_payment_processor_type.id = civicrm_payment_processor.payment_processor_type_id\nWHERE     civicrm_payment_processor_type.name = 'Payment_Express'\nAND       user_name = %1\n";
$params = array(1 => array($_GET['userid'], 'String'));
$dpsSettings = CRM_Core_DAO::executeQuery($query, $params);
while ($dpsSettings->fetch()) {
    $dpsUrl = $dpsSettings->url_site;
    $dpsUser = $dpsSettings->user_name;
    $dpsKey = $dpsSettings->password;
    $dpsMacKey = $dpsSettings->signature;
}
if ($dpsMacKey) {
 /**
  * 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);
     }
 }
| This file is a part of CiviCRM.                                    |
|                                                                    |
| CiviCRM is free software; you can copy, modify, and distribute it  |
| under the terms of the GNU Affero General Public License           |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
|                                                                    |
| CiviCRM is distributed in the hope that it will be useful, but     |
| WITHOUT ANY WARRANTY; without even the implied warranty of         |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
| See the GNU Affero General Public License for more details.        |
|                                                                    |
| You should have received a copy of the GNU Affero General Public   |
| License and the CiviCRM Licensing Exception along                  |
| with this program; if not, contact CiviCRM LLC                     |
| at info[AT]civicrm[DOT]org. If you have questions about the        |
| GNU Affero General Public License or the licensing of CiviCRM,     |
| see the CiviCRM license FAQ at http://civicrm.org/licensing        |
+--------------------------------------------------------------------+
*/
/**
 * @package CRM
 * @copyright CiviCRM LLC (c) 2004-2015
 * $Id$
 */
session_start();
require_once '../civicrm.config.php';
$config = CRM_Core_Config::singleton();
$log = new CRM_Utils_SystemLogger();
$log->alert('payment_notification processor_name=Google_Checkout', $_REQUEST);
$rawPostData = file_get_contents('php://input');
CRM_Core_Payment_GoogleIPN::main($rawPostData);
Exemple #7
0
| License and the CiviCRM Licensing Exception along                  |
| with this program; if not, contact CiviCRM LLC                     |
| at info[AT]civicrm[DOT]org. If you have questions about the        |
| GNU Affero General Public License or the licensing of CiviCRM,     |
| see the CiviCRM license FAQ at http://civicrm.org/licensing        |
+--------------------------------------------------------------------+
*/
/**
 * @package CRM
 * @copyright CiviCRM LLC (c) 2004-2015
 * $Id$
 */
session_start();
require_once '../civicrm.config.php';
$config = CRM_Core_Config::singleton();
$log = new CRM_Utils_SystemLogger();
$log->alert('payment_notification processor_name=AuthNet', $_REQUEST);
$authorizeNetIPN = new CRM_Core_Payment_AuthorizeNetIPN($_REQUEST);
try {
    // We allow the possibility of the site opting out of real-(Authorize.net)-time
    // processing in favour of using the nz.co.fuzion.notificationlog for greater
    // reliability.
    if (!defined('CIVICRM_ANET_SKIP_IPN_PROCESSING')) {
        $authorizeNetIPN->main();
    }
    echo "processing intentionally delayed";
} catch (CRM_Core_Exception $e) {
    CRM_Core_Error::debug_log_message($e->getMessage());
    CRM_Core_Error::debug_var('error data', $e->getErrorData(), TRUE, TRUE);
    CRM_Core_Error::debug_var('REQUEST', $_REQUEST, TRUE, TRUE);
    echo "The transaction has failed. Please review the log for more detail";
Exemple #8
0
| with this program; if not, contact CiviCRM LLC                     |
| at info[AT]civicrm[DOT]org. If you have questions about the        |
| GNU Affero General Public License or the licensing of CiviCRM,     |
| see the CiviCRM license FAQ at http://civicrm.org/licensing        |
+--------------------------------------------------------------------+
*/
/**
 * @package CRM
 * @copyright CiviCRM LLC (c) 2004-2015
 * $Id$
 */
session_start();
require_once '../civicrm.config.php';
/* Cache the real UF, override it with the SOAP environment */
$config = CRM_Core_Config::singleton();
$log = new CRM_Utils_SystemLogger();
if (empty($_GET)) {
    $log->alert('payment_notification processor_name=PayPal', $_REQUEST);
    $paypalIPN = new CRM_Core_Payment_PayPalProIPN($_REQUEST);
} else {
    $log->alert('payment_notification PayPal_Standard', $_REQUEST);
    $paypalIPN = new CRM_Core_Payment_PayPalIPN();
    // @todo upgrade standard per Pro
}
try {
    $paypalIPN->main();
} catch (CRM_Core_Exception $e) {
    CRM_Core_Error::debug_log_message($e->getMessage());
    CRM_Core_Error::debug_var('error data', $e->getErrorData(), TRUE, TRUE);
    CRM_Core_Error::debug_var('REQUEST', $_REQUEST, TRUE, TRUE);
    //@todo give better info to logged in user - ie dev
 /**
  * Handle processor error.
  *
  * If we pass error handling through this function it will be easy to switch to throwing exceptions later.
  *
  * @param string $level
  * @param string $message
  * @param string $context
  *
  * @param int $errorCode
  * @param string $userMessage
  *
  * @return mixed
  */
 protected function handleError($level, $message, $context, $errorCode = 9001, $userMessage = NULL)
 {
     if (omnipaymultiprocessor__versionAtLeast(4.5)) {
         $log = new CRM_Utils_SystemLogger();
         $log->log($level, $message, (array) $context);
     } else {
         CRM_Core_Error::debug($errorCode . ': ' . $message . print_r($context, TRUE));
     }
     CRM_Core_Session::setStatus(empty($userMessage) ? $message : $userMessage);
     return new CRM_Core_Error();
 }