X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FPayment%2FPaymentExpressIPN.php;h=f500076b996d13c1a86bc10945afa242f7d9934d;hb=79c0e11ec92e46b36336f7903a537c5fcc78efef;hp=0fd5e068fae0897101bb47b75823b270fb03928a;hpb=347185d7709adf00659d042b2fa98b93f03f2672;p=civicrm-core.git diff --git a/CRM/Core/Payment/PaymentExpressIPN.php b/CRM/Core/Payment/PaymentExpressIPN.php index 0fd5e068fa..f500076b99 100644 --- a/CRM/Core/Payment/PaymentExpressIPN.php +++ b/CRM/Core/Payment/PaymentExpressIPN.php @@ -62,7 +62,7 @@ class CRM_Core_Payment_PaymentExpressIPN extends CRM_Core_Payment_BaseIPN { * * @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"); @@ -84,43 +84,26 @@ class CRM_Core_Payment_PaymentExpressIPN extends CRM_Core_Payment_BaseIPN { /** * 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 + * @param array $privateData + * Contains the name value pair of . * * @param $component * @param $amount @@ -129,7 +112,7 @@ class CRM_Core_Payment_PaymentExpressIPN extends CRM_Core_Payment_BaseIPN { * @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); @@ -206,16 +189,18 @@ class CRM_Core_Payment_PaymentExpressIPN extends CRM_Core_Payment_BaseIPN { /** - /** + /** * 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 send by google + * @param array $privateData + * Contains the name-value pairs of transaction related data. + * @param int $orderNo + * 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; @@ -273,16 +258,16 @@ class CRM_Core_Payment_PaymentExpressIPN extends CRM_Core_Payment_BaseIPN { } 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'); @@ -327,7 +312,7 @@ class CRM_Core_Payment_PaymentExpressIPN extends CRM_Core_Payment_BaseIPN { $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"); } @@ -339,7 +324,7 @@ class CRM_Core_Payment_PaymentExpressIPN extends CRM_Core_Payment_BaseIPN { } 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 @@ -348,7 +333,7 @@ class CRM_Core_Payment_PaymentExpressIPN extends CRM_Core_Payment_BaseIPN { $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(); @@ -383,14 +368,12 @@ class CRM_Core_Payment_PaymentExpressIPN extends CRM_Core_Payment_BaseIPN { 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) { @@ -436,7 +419,7 @@ class CRM_Core_Payment_PaymentExpressIPN extends CRM_Core_Payment_BaseIPN { * Converts the comma separated name-value pairs in * to an array of values. */ - static function stringToArray($str) { + public static function stringToArray($str) { $vars = $labels = array(); $labels = explode(',', $str); foreach ($labels as $label) { @@ -446,4 +429,3 @@ class CRM_Core_Payment_PaymentExpressIPN extends CRM_Core_Payment_BaseIPN { return $vars; } } -