CRM-15993, added CiviCRM BN code and notice fixes
authorkurund <kurund@civicrm.org>
Tue, 24 Feb 2015 14:59:57 +0000 (20:29 +0530)
committerkurund <kurund@civicrm.org>
Tue, 24 Feb 2015 14:59:57 +0000 (20:29 +0530)
----------------------------------------
* CRM-15993: Add CiviCRM BN code to all PayPal methods for partner program tracking
  https://issues.civicrm.org/jira/browse/CRM-15993

CRM/Contribute/BAO/Contribution/Utils.php
CRM/Contribute/Form/Contribution/Confirm.php
CRM/Core/Payment/PayPalImpl.php

index 03748a2cc56d0ccf9756ddb23df80c88a855f703..ddd35c8c79ab5717b83abbd4d524823eb7198cf9 100644 (file)
@@ -193,7 +193,7 @@ class CRM_Contribute_BAO_Contribution_Utils {
     elseif ($form->_contributeMode == 'express') {
       if ($form->_values['is_monetary'] && $form->_amount > 0.0) {
         // determine if express + recurring and direct accordingly
-        if ($paymentParams['is_recur'] == 1) {
+        if (!empty($paymentParams['is_recur']) && $paymentParams['is_recur'] == 1) {
           if (is_object($payment)) {
             $result = $payment->createRecurringPayments($paymentParams);
           }
index cda8f4a58cc0b5a5a8e6c107d716282d18991e1e..21a24f6dab04101b151c456da8f5a64068f3982d 100644 (file)
@@ -187,7 +187,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
         $payment = CRM_Core_Payment::singleton($this->_mode, $this->_paymentProcessor, $this);
         $expressParams = $payment->getExpressCheckoutDetails($this->get('token'));
 
-        $this->_params['payer'] = $expressParams['payer'];
+        $this->_params['payer'] = CRM_Utils_Array::value('payer', $expressParams);
         $this->_params['payer_id'] = $expressParams['payer_id'];
         $this->_params['payer_status'] = $expressParams['payer_status'];
 
index 867df555c826f75600ae51aaece50d8ee0310d21..3ad4b4ecd596e20523ec29942700c0be13471640 100644 (file)
@@ -204,6 +204,9 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment {
     $args['cancelURL'] = CRM_Utils_Array::value('cancelURL', $params);
     $args['desc'] = $params['description'];
 
+    // add CiviCRM BN code
+    $args['BUTTONSOURCE'] = 'CiviCRM_SP';
+
     $result = $this->invokeAPI($args);
 
     if (is_a($result, 'CRM_Core_Error')) {
@@ -332,6 +335,9 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment {
     $args['desc'] = substr(CRM_Utils_Array::value('description', $params), 0, 127);
     $args['custom'] = CRM_Utils_Array::value('accountingCode', $params);
 
+    // add CiviCRM BN code
+    $args['BUTTONSOURCE'] = 'CiviCRM_SP';
+
     if (CRM_Utils_Array::value('is_recur', $params) == 1) {
       $start_time = strtotime(date('m/d/Y'));
       $start_date = date('Y-m-d\T00:00:00\Z', $start_time);