CRM-16808 paypal refactoring, fix enotice on generating url
authorEileen McNaughton <eileen@fuzion.co.nz>
Mon, 20 Jul 2015 09:55:04 +0000 (21:55 +1200)
committerEileen McNaughton <eileen@fuzion.co.nz>
Wed, 22 Jul 2015 09:41:18 +0000 (21:41 +1200)
Fix misnamed var (from prev commit)

CRM/Contribute/Form/Contribution/Main.php
CRM/Core/Payment.php
CRM/Core/Payment/PayPalImpl.php
CRM/Event/Form/Registration/Register.php

index fb50237948abd4bd4238c5929b69b4f8a7a198bc..171b2d45b3b9d48c8fe85fb15acf71de9e71b99c 100644 (file)
@@ -1358,6 +1358,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
   protected function handlePreApproval(&$params) {
     try {
       $payment = Civi\Payment\System::singleton()->getByProcessor($this->_paymentProcessor);
+      $params['component'] = 'contribute';
       $result = $payment->doPreApproval($params);
     }
     catch (\Civi\Payment\Exception\PaymentProcessorException $e) {
index 4e489797337e7a8b166f318ab3082d978a4f3687..d07478e7129301c65d817dfae571d7db083b312c 100644 (file)
@@ -39,7 +39,17 @@ use Civi\Payment\Exception\PaymentProcessorException;
 abstract class CRM_Core_Payment {
 
   /**
-   * How are we getting billing information?
+   * Component - ie. event or contribute.
+   *
+   * This is used for setting return urls.
+   *
+   * @var string
+   */
+   protected $_component;
+  /**
+   * How are we getting billing information.
+   *
+   * We are trying to completely deprecate these parameters.
    *
    * FORM   - we collect it on the same page
    * BUTTON - the processor collects it and sends it back to us via some protocol
@@ -660,6 +670,7 @@ abstract class CRM_Core_Payment {
    * @throws \Civi\Payment\Exception\PaymentProcessorException
    */
   public function doPayment(&$params, $component = 'contribute') {
+    $this->_component = $component;
     $statuses = CRM_Contribute_BAO_Contribution::buildOptions('contribution_status_id');
     if ($this->_paymentProcessor['billing_mode'] == 4) {
       $result = $this->doTransferCheckout($params, $component);
index 6dd7432d89a2c2fc5c87864f13095f240bec8099..1bacf20c246219b250a15eef1bba5776bbbafd53 100644 (file)
@@ -638,6 +638,7 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment {
    *   - redirect_url (if set the browser will be redirected to this.
    */
   public function doPreApproval(&$params) {
+    $this->_component = $params['component'];
     $token = $this->setExpressCheckOut($params);
     return array(
       'pre_approval_parameters' => array('token' => $token),
index 8100e4e7eeb5f65e588a668d92555aa250e015fa..f4a7c8baa266943c4c33aeb430c2462f7fa8fc31 100644 (file)
@@ -1170,6 +1170,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration {
           );
           $params['invoiceID'] = $invoiceID;
 
+          $params['component'] = 'event';
           $token = $payment->doPreApproval($params);
           if (is_a($token, 'CRM_Core_Error')) {
             CRM_Core_Error::displaySessionError($token);