X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FPayment%2FPayPalImpl.php;h=838542d15f6f40402bbb3508c74fac7927284e86;hb=ee9c028679b097f6f7e92f367a6cb8da3fd54037;hp=978bc514edf02178bf44ec4a660328480a1c4df4;hpb=ad314df7cc28a13a58caee38ccf30750572c5f11;p=civicrm-core.git diff --git a/CRM/Core/Payment/PayPalImpl.php b/CRM/Core/Payment/PayPalImpl.php index 978bc514ed..838542d15f 100644 --- a/CRM/Core/Payment/PayPalImpl.php +++ b/CRM/Core/Payment/PayPalImpl.php @@ -3,7 +3,7 @@ +--------------------------------------------------------------------+ | CiviCRM version 4.6 | +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2014 | + | Copyright CiviCRM LLC (c) 2004-2015 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -23,12 +23,12 @@ | GNU Affero General Public License or the licensing of CiviCRM, | | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ -*/ + */ /** * * @package CRM - * @copyright CiviCRM LLC (c) 2004-2014 + * @copyright CiviCRM LLC (c) 2004-2015 * $Id$ * */ @@ -46,7 +46,7 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment { static private $_singleton = NULL; /** - * Constructor + * Constructor. * * @param string $mode * The mode of operation: live or test. @@ -197,6 +197,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')) { @@ -248,14 +251,16 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment { //$args['desc'] = 'Recurring Contribution'; $args['totalbillingcycles'] = $params['installments']; $args['version'] = '56.0'; - $args['profilereference'] = - "i={$params['invoiceID']}" . + $args['profilereference'] = "i={$params['invoiceID']}" . "&m=$component" . "&c={$params['contactID']}" . "&r={$params['contributionRecurID']}" . "&b={$params['contributionID']}" . "&p={$params['contributionPageID']}"; + // add CiviCRM BN code + $args['BUTTONSOURCE'] = 'CiviCRM_SP'; + $result = $this->invokeAPI($args); if (is_a($result, 'CRM_Core_Error')) { @@ -263,7 +268,6 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment { } /* Success */ - $params['trxn_id'] = $result['transactionid']; $params['gross_amount'] = $result['amt']; $params['fee_amount'] = $result['feeamt']; @@ -326,6 +330,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); @@ -335,7 +342,7 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment { $args['billingfrequency'] = $params['frequency_interval']; $args['method'] = "CreateRecurringPaymentsProfile"; $args['profilestartdate'] = $start_date; - $args['desc'] = + $args['desc'] = "" . $params['description'] . ": " . $params['amount'] . " Per " . $params['frequency_interval'] . " " . @@ -343,7 +350,7 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment { $args['amt'] = $params['amount']; $args['totalbillingcycles'] = $params['installments']; $args['version'] = 56.0; - $args['PROFILEREFERENCE'] = + $args['PROFILEREFERENCE'] = "" . "i=" . $params['invoiceID'] . "&m=" . $component . "&c=" . $params['contactID'] . "&r=" . $params['contributionRecurID'] . "&b=" . $params['contributionID'] . "&p=" . $params['contributionPageID']; @@ -373,7 +380,7 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment { } /** - * This function checks to see if we have the right config values + * This function checks to see if we have the right config values. * * @return string * the error message if any @@ -426,7 +433,7 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment { * @param string $method * Method to check for. * - * @return boolean + * @return bool */ public function isSupported($method = 'cancelSubscription') { if ($this->_paymentProcessor['payment_processor_type'] != 'PayPal') { @@ -601,9 +608,8 @@ 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' => CRM_Utils_Array::value('accountingCode', - $params - ), + 'custom' => CRM_Utils_Array::value('accountingCode', $params), + 'bn' => 'CiviCRM_SP', ); // add name and address if available, CRM-3130 @@ -774,7 +780,8 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment { return $result; } - /** This function will take NVPString and convert it to an Associative Array and it will decode the response. + /** + * This function will take NVPString and convert it to an Associative Array and it will decode the response. * It is usefull to search for a particular key and displaying arrays. * @nvpstr is NVPString. * @nvpArray is Associative Array. @@ -801,4 +808,5 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment { return $result; } + }