CRM-18483 further Joomla! fix
authoreileen <emcnaughton@wikimedia.org>
Tue, 4 Oct 2016 09:08:14 +0000 (22:08 +1300)
committereileen <emcnaughton@wikimedia.org>
Mon, 10 Oct 2016 09:48:29 +0000 (10:48 +0100)
CRM/Core/Payment.php
CRM/Core/Payment/PayPalIPN.php
CRM/Core/Payment/PayPalImpl.php

index 2bc31161005244981249f9eb35d4b8065017bf07..ee25a938677fff9ba9ab6c176103ac4b91df8d34 100644 (file)
@@ -47,33 +47,6 @@ abstract class CRM_Core_Payment {
    */
   protected $_component;
 
-  /**
-   * Parameters to append to the notify url.
-   *
-   * The notify url is passed to the payment processor and the processor uses it for return ping backs or redirection.
-   *
-   * @var array
-   */
-  protected $notifyUrlParameters = array();
-
-  /**
-   * Get notify url parameters.
-   *
-   * @return array
-   */
-  public function getNotifyUrlParameters() {
-    return $this->notifyUrlParameters;
-  }
-
-  /**
-   * Set notify url parameters.
-   *
-   * @param array $notifyUrlParameters
-   */
-  public function setNotifyUrlParameters($notifyUrlParameters) {
-    $this->notifyUrlParameters = $notifyUrlParameters;
-  }
-
   /**
    * How are we getting billing information.
    *
@@ -993,7 +966,7 @@ abstract class CRM_Core_Payment {
   protected function getNotifyUrl() {
     $url = CRM_Utils_System::url(
       'civicrm/payment/ipn/' . $this->_paymentProcessor['id'],
-      $this->getNotifyUrlParameters(),
+      array(),
       TRUE,
       NULL,
       FALSE
@@ -1173,6 +1146,7 @@ abstract class CRM_Core_Payment {
         $params['processor_id'] = $_GET['processor_id'] = $lastParam;
       }
       else {
+        self::logPaymentNotification($params);
         throw new CRM_Core_Exception("Either 'processor_id' (recommended) or 'processor_name' (deprecated) is required for payment callback.");
       }
     }
index 6bdc0e4623e5d59c5a197e64b6bda4e93980b30b..c65a25152287601461dc1ee4422c37391d803d33 100644 (file)
@@ -52,7 +52,7 @@ class CRM_Core_Payment_PayPalIPN extends CRM_Core_Payment_BaseIPN {
    * @throws CRM_Core_Exception
    */
   public function __construct($inputData) {
-    $this->setInputParameters($inputData);
+    $this->setInputParameters(array_merge($inputData, json_decode($inputData['custom'], TRUE)));
     parent::__construct();
   }
 
index c996175f390cb9c3f721d8f930cce7c2b729ce8f..92691180d4afe083c69cb8b278d0b1ef0d79352b 100644 (file)
@@ -805,13 +805,13 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment {
       'membershipID' => 'membershipID',
       'related_contact' => 'relatedContactID',
       'onbehalf_dupe_alert' => 'onBehalfDupeAlert',
+      'accountingCode' => 'accountingCode',
     );
     foreach ($notifyParameterMap as $paramsName => $notifyName) {
       if (!empty($params[$paramsName])) {
         $notifyParameters[$notifyName] = $params[$paramsName];
       }
     }
-    $this->setNotifyUrlParameters($notifyParameters);
     $notifyURL = $this->getNotifyUrl();
 
     $config = CRM_Core_Config::singleton();
@@ -829,9 +829,6 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment {
       TRUE, NULL, FALSE
     );
 
-    $customParams = array_merge($notifyParameters, array(
-      'accountingCode' => CRM_Utils_Array::value('accountingCode', $params),
-    ));
     $paypalParams = array(
       'business' => $this->_paymentProcessor['user_name'],
       'notify_url' => $notifyURL,
@@ -847,7 +844,7 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment {
       'invoice' => $params['invoiceID'],
       'lc' => substr($config->lcMessages, -2),
       'charset' => function_exists('mb_internal_encoding') ? mb_internal_encoding() : 'UTF-8',
-      'custom' => json_encode($customParams),
+      'custom' => json_encode($notifyParameters),
       'bn' => 'CiviCRM_SP',
     );