CRM-16808 make functions called by paypal express more generic
authorEileen McNaughton <eileen@fuzion.co.nz>
Sun, 12 Jul 2015 06:44:15 +0000 (18:44 +1200)
committerEileen McNaughton <eileen@fuzion.co.nz>
Sun, 12 Jul 2015 06:44:15 +0000 (18:44 +1200)
CRM/Contribute/Form/Contribution/Confirm.php
CRM/Core/Payment.php
CRM/Core/Payment/PayPalImpl.php

index 6506549f7a6fa3e457a56e92dd0145f34b7689ed..bcc80a2b3d2ab81c1ea0c06dc53887ca7a6caa8c 100644 (file)
@@ -219,7 +219,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
       );
       if ($rfp) {
         $payment = CRM_Core_Payment::singleton($this->_mode, $this->_paymentProcessor, $this);
-        $expressParams = $payment->getExpressCheckoutDetails($this->get('token'));
+        $expressParams = $payment->getPreApprovalDetails($this->get('pre_approval_parameters'));
 
         $this->_params['payer'] = CRM_Utils_Array::value('payer', $expressParams);
         $this->_params['payer_id'] = $expressParams['payer_id'];
index 8499202b384a1fef1c7d2c52ef9af2e616178723..7a753b296d12d1385b3a4bae96bfee0b34083032 100644 (file)
@@ -251,6 +251,20 @@ abstract class CRM_Core_Payment {
    */
   public function doPreApproval($params) {}
 
+  /**
+   * Get any details that may be available to the payment processor due to an approval process having happened.
+   *
+   * In some cases the browser is redirected to enter details on a processor site. Some details may be available as a
+   * result.
+   *
+   * @param array $storedDetails
+   *
+   * @return array
+   */
+  public function getPreApprovalDetails($storedDetails) {
+    return array();
+  }
+
   /**
    * Default payment instrument validation.
    *
index ee6b4adbcc561b2e6ebd17b5cbf64aca100ade21..600ec5c544c896c0aff645728b61a5b2453870ca 100644 (file)
@@ -190,6 +190,20 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment {
     return $result['token'];
   }
 
+  /**
+   * Get any details that may be available to the payment processor due to an approval process having happened.
+   *
+   * In some cases the browser is redirected to enter details on a processor site. Some details may be available as a
+   * result.
+   *
+   * @param array $storedDetails
+   *
+   * @return array
+   */
+  public function getPreApprovalDetails($storedDetails) {
+    return $this->getExpressCheckoutDetails($storedDetails['token']);
+  }
+
   /**
    * Get details from paypal. Check PayPal documentation for more information
    *