Remove deprecated call to
authorEileen McNaughton <emcnaughton@wikimedia.org>
Fri, 29 Jul 2022 09:39:34 +0000 (10:39 +0100)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Tue, 2 Aug 2022 19:04:31 +0000 (07:04 +1200)
CRM/Core/Payment/BaseIPN.php

index 7226d2f2324de20bf4dff56992976facf582b6d6..b21f4fa5190f99af1caf7c594a13ef24bb1d9256 100644 (file)
@@ -64,104 +64,6 @@ class CRM_Core_Payment_BaseIPN {
     $this->_inputParameters = $parameters;
   }
 
-  /**
-   * Validate incoming data.
-   *
-   * This function is intended to ensure that incoming data matches
-   * It provides a form of pseudo-authentication - by checking the calling fn already knows
-   * the correct contact id & contribution id (this can be problematic when that has changed in
-   * the meantime for transactions that are delayed & contacts are merged in-between. e.g
-   * Paypal allows you to resend Instant Payment Notifications if you, for example, moved site
-   * and didn't update your IPN URL.
-   *
-   * @param array $input
-   *   Interpreted values from the values returned through the IPN.
-   * @param array $ids
-   *   More interpreted values (ids) from the values returned through the IPN.
-   * @param array $objects
-   *   An empty array that will be populated with loaded object.
-   * @param bool $required
-   *   Boolean Return FALSE if the relevant objects don't exist.
-   * @param int $paymentProcessorID
-   *   Id of the payment processor ID in use.
-   *
-   * @deprecated
-   *
-   * @return bool
-   */
-  public function validateData($input, &$ids, &$objects, $required = TRUE, $paymentProcessorID = NULL) {
-    CRM_Core_Error::deprecatedFunctionWarning('unused');
-    // Check if the contribution exists
-    // make sure contribution exists and is valid
-    $contribution = new CRM_Contribute_BAO_Contribution();
-    $contribution->id = $ids['contribution'];
-    if (!$contribution->find(TRUE)) {
-      throw new CRM_Core_Exception('Failure: Could not find contribution record for ' . (int) $contribution->id, NULL, ['context' => "Could not find contribution record: {$contribution->id} in IPN request: " . print_r($input, TRUE)]);
-    }
-
-    // make sure contact exists and is valid
-    // use the contact id from the contribution record as the id in the IPN may not be valid anymore.
-    $contact = new CRM_Contact_BAO_Contact();
-    $contact->id = $contribution->contact_id;
-    $contact->find(TRUE);
-    if ($contact->id != $ids['contact']) {
-      // If the ids do not match then it is possible the contact id in the IPN has been merged into another contact which is why we use the contact_id from the contribution
-      CRM_Core_Error::debug_log_message("Contact ID in IPN {$ids['contact']} not found but contact_id found in contribution {$contribution->contact_id} used instead");
-      echo "WARNING: Could not find contact record: {$ids['contact']}<p>";
-      $ids['contact'] = $contribution->contact_id;
-    }
-
-    if (!empty($ids['contributionRecur'])) {
-      $contributionRecur = new CRM_Contribute_BAO_ContributionRecur();
-      $contributionRecur->id = $ids['contributionRecur'];
-      if (!$contributionRecur->find(TRUE)) {
-        CRM_Core_Error::debug_log_message("Could not find contribution recur record: {$ids['ContributionRecur']} in IPN request: " . print_r($input, TRUE));
-        echo "Failure: Could not find contribution recur record: {$ids['ContributionRecur']}<p>";
-        return FALSE;
-      }
-    }
-
-    $objects['contact'] = &$contact;
-    $objects['contribution'] = &$contribution;
-
-    // CRM-19478: handle oddity when p=null is set in place of contribution page ID,
-    if (!empty($ids['contributionPage']) && !is_numeric($ids['contributionPage'])) {
-      // We don't need to worry if about removing contribution page id as it will be set later in
-      //  CRM_Contribute_BAO_Contribution::loadRelatedObjects(..) using $objects['contribution']->contribution_page_id
-      unset($ids['contributionPage']);
-    }
-
-    if (!$this->loadObjects($input, $ids, $objects, $required, $paymentProcessorID)) {
-      return FALSE;
-    }
-    return TRUE;
-  }
-
-  /**
-   * Load objects related to contribution.
-   *
-   * @deprecated
-   *
-   * @input array information from Payment processor
-   *
-   * @param array $input
-   * @param array $ids
-   * @param array $objects
-   * @param bool $required
-   * @param int $paymentProcessorID
-   *
-   * @return bool|array
-   * @throws \CRM_Core_Exception
-   */
-  public function loadObjects($input, &$ids, &$objects, $required, $paymentProcessorID) {
-    CRM_Core_Error::deprecatedFunctionWarning('use api methods in ipn');
-    $contribution = &$objects['contribution'];
-    $ids['paymentProcessor'] = $paymentProcessorID;
-    $success = $contribution->loadRelatedObjects($input, $ids);
-    $objects = array_merge($objects, $contribution->_relatedObjects);
-    return $success;
-  }
-
   /**
    * Set contribution to failed.
    *