*
* @return mixed
*/
- static function retrieve($name, $type, $object, $abort = TRUE) {
+ public static function retrieve($name, $type, $object, $abort = TRUE) {
$value = CRM_Utils_Array::value($name, $object);
if ($abort && $value === NULL) {
CRM_Core_Error::debug_log_message("Could not find an entry for $name");
/**
* Constructor
*
- * @param string $mode the mode of operation: live or test
+ * @param string $mode
+ * The mode of operation: live or test.
*
* @param $paymentProcessor
*
* @return \CRM_Core_Payment_PaymentExpressIPN
*/
- function __construct($mode, &$paymentProcessor) {
+ public function __construct($mode, &$paymentProcessor) {
parent::__construct();
$this->_mode = $mode;
$this->_paymentProcessor = $paymentProcessor;
}
- /**
- * Singleton function used to manage this object
- *
- * @param string $mode the mode of operation: live or test
- *
- * @param $paymentProcessor
- * @param null $paymentForm
- * @param bool $force
- *
- * @return object
- * @static
- */
- static function &singleton($mode = 'test', &$paymentProcessor, &$paymentForm = NULL, $force = FALSE) {
- if (self::$_singleton === NULL) {
- self::$_singleton = new CRM_Core_Payment_PaymentExpressIPN($mode, $paymentProcessor);
- }
- return self::$_singleton;
- }
-
/**
* The function gets called when a new order takes place.
*
* @param $success
- * @param array $privateData contains the name value pair of <merchant-private-data>
+ * @param array $privateData
+ * Contains the name value pair of <merchant-private-data>.
*
* @param $component
* @param $amount
* @internal param \xml $dataRoot response send by google in xml format
* @return void
*/
- function newOrderNotify($success, $privateData, $component, $amount, $transactionReference) {
+ public function newOrderNotify($success, $privateData, $component, $amount, $transactionReference) {
$ids = $input = $params = array();
$input['component'] = strtolower($component);
/**
- /**
+ /**
* The function returns the component(Event/Contribute..)and whether it is Test or not
*
- * @param array $privateData contains the name-value pairs of transaction related data
- * @param int $orderNo <order-total> send by google
+ * @param array $privateData
+ * Contains the name-value pairs of transaction related data.
+ * @param int $orderNo
+ * <order-total> send by google.
*
* @return array context of this call (test, component, payment processor id)
* @static
*/
- static function getContext($privateData, $orderNo) {
+ public static function getContext($privateData, $orderNo) {
$component = NULL;
$isTest = NULL;
}
return array($isTest, $component, $duplicateTransaction);
- }
+ }
/**
* This method is handles the response that will be invoked by the
* notification or request sent by the payment processor.
- *hex string from paymentexpress is passed to this function as hex string. Code based on googleIPN
+ * hex string from paymentexpress is passed to this function as hex string. Code based on googleIPN
* mac_key is only passed if the processor is pxaccess as it is used for decryption
* $dps_method is either pxaccess or pxpay
*/
- static function main($dps_method, $rawPostData, $dps_url, $dps_user, $dps_key, $mac_key) {
+ public static function main($dps_method, $rawPostData, $dps_url, $dps_user, $dps_key, $mac_key) {
$config = CRM_Core_Config::singleton();
define('RESPONSE_HANDLER_LOG_FILE', $config->uploadDir . 'CiviCRM.PaymentExpress.log');
$DPStxnRef = CRM_Core_Payment_PaymentExpressUtils::_xmlElement($response, 'DpsTxnRef');
$qfKey = CRM_Core_Payment_PaymentExpressUtils::_xmlElement($response, "TxnData1");
$privateData = CRM_Core_Payment_PaymentExpressUtils::_xmlElement($response, "TxnData2");
- list($component,$paymentProcessorID,) =explode(',', CRM_Core_Payment_PaymentExpressUtils::_xmlElement($response, "TxnData3"));
+ list($component, $paymentProcessorID,) = explode(',', CRM_Core_Payment_PaymentExpressUtils::_xmlElement($response, "TxnData3"));
$amount = CRM_Core_Payment_PaymentExpressUtils::_xmlElement($response, "AmountSettlement");
$merchantReference = CRM_Core_Payment_PaymentExpressUtils::_xmlElement($response, "MerchantReference");
}
}
elseif ($dps_method == "pxaccess") {
- require_once ('PaymentExpress/pxaccess.inc.php');
+ require_once 'PaymentExpress/pxaccess.inc.php';
global $pxaccess;
$pxaccess = new PxAccess($dps_url, $dps_user, $dps_key, $mac_key);
#getResponse method in PxAccess object returns PxPayResponse object
$qfKey = $rsp->getTxnData1();
$privateData = $rsp->getTxnData2();
- list($component,$paymentProcessorID) = explode(',',$rsp->getTxnData3());
+ list($component, $paymentProcessorID) = explode(',', $rsp->getTxnData3());
$success = $rsp->getSuccess();
$authCode = $rsp->getAuthCode();
$DPStxnRef = $rsp->getDpsTxnRef();
list($mode, $component, $duplicateTransaction) = self::getContext($privateData, $transactionReference);
$mode = $mode ? 'test' : 'live';
-
$paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($paymentProcessorID,
$mode
);
$ipn = self::singleton($mode, $component, $paymentProcessor);
-
//Check status and take appropriate action
if ($success == 1) {
* Converts the comma separated name-value pairs in <TxnData2>
* to an array of values.
*/
- static function stringToArray($str) {
+ public static function stringToArray($str) {
$vars = $labels = array();
$labels = explode(',', $str);
foreach ($labels as $label) {
return $vars;
}
}
-