<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
/**
* Process payment after confirmation
*
- * @param CRM_Core_Form $form form object
- * @param array $paymentParams array with payment related key
- * value pairs
- * @param array $premiumParams array with premium related key
- * value pairs
- * @param int $contactID contact id
- * @param int $contributionTypeId financial type id
+ * @param CRM_Core_Form $form
+ * Form object.
+ * @param array $paymentParams
+ * Array with payment related key.
+ * value pairs
+ * @param array $premiumParams
+ * Array with premium related key.
+ * value pairs
+ * @param int $contactID
+ * Contact id.
+ * @param int $contributionTypeId
+ * Financial type id.
* @param int|string $component component id
- * @param array $fieldTypes presumably relates to custom field types - used when building data for sendMail
+ * @param array $fieldTypes
+ * Presumably relates to custom field types - used when building data for sendMail.
* @param $isTest
* @param $isPayLater
*
* @throws CRM_Core_Exception
* @throws Exception
- * @return array associated array
+ * @return array
+ * associated array
*
- * @static
- * @access public
*/
- static function processConfirm(&$form,
+ public static function processConfirm(
+ &$form,
&$paymentParams,
&$premiumParams,
$contactID,
//CRM-15297 - contributionType is obsolete - pass financial type as well so people can deprecate it
$paymentParams['financialType_name'] = $paymentParams['contributionType_name'] = $form->_params['contributionType_name'] = $contributionType->name;
//CRM-11456
- $paymentParams['financialType_accounting_code'] = $paymentParams['contributionType_accounting_code'] = $form->_params['contributionType_accounting_code'] = CRM_Financial_BAO_FinancialAccount::getAccountingCode($contributionTypeId);
+ $paymentParams['financialType_accounting_code'] = $paymentParams['contributionType_accounting_code'] = $form->_params['contributionType_accounting_code'] = CRM_Financial_BAO_FinancialAccount::getAccountingCode($contributionTypeId);
$paymentParams['contributionPageID'] = $form->_params['contributionPageID'] = $form->_values['id'];
-
$payment = NULL;
$paymentObjError = ts('The system did not record payment details for this payment and so could not process the transaction. Please report this error to the site administrator.');
);
if ($contribution) {
- $form->_params['contributionID'] = $contribution->id;
+ $form->_params['contributionID'] = $contribution->id;
}
$form->_params['contributionTypeID'] = $contributionTypeId;
// this does not return
$result = $payment->doTransferCheckout($form->_params, 'contribute');
}
- else{
+ else {
CRM_Core_Error::fatal($paymentObjError);
}
}
if ($component !== 'membership') {
CRM_Core_Error::displaySessionError($result);
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contribute/transact',
- "_qf_Main_display=true&qfKey={$form->_params['qfKey']}"
- ));
+ "_qf_Main_display=true&qfKey={$form->_params['qfKey']}"
+ ));
}
$membershipResult[1] = $result;
}
// finally send an email receipt
if ($contribution) {
- $form->_values['contribution_id'] = $contribution->id;
+ $form->_values['contribution_id'] = $contribution->id;
CRM_Contribute_BAO_ContributionPage::sendMail($contactID,
$form->_values, $contribution->is_test,
- FALSE, $fieldTypes
- );
- }
+ FALSE, $fieldTypes
+ );
+ }
}
/**
* @return bool
*/
static protected function isPaymentTransaction($form) {
- if(!empty($form->_values['is_monetary']) && $form->_amount >= 0.0) {
+ if (!empty($form->_values['is_monetary']) && $form->_amount >= 0.0) {
return TRUE;
}
return FALSE;
}
+
/**
* Get the contribution details by month
* of the year
*
- * @param int $param year
+ * @param int $param
+ * Year.
*
- * @return array associated array
+ * @return array
+ * associated array
*
- * @static
- * @access public
*/
- static function contributionChartMonthly($param) {
+ public static function contributionChartMonthly($param) {
if ($param) {
$param = array(1 => array($param, 'Integer'));
}
/**
* Get the contribution details by year
*
- * @return array associated array
+ * @return array
+ * associated array
*
- * @static
- * @access public
*/
- static function contributionChartYearly() {
+ public static function contributionChartYearly() {
$config = CRM_Core_Config::singleton();
$yearClause = "year(contrib.receive_date) as contribYear";
if (!empty($config->fiscalYearStart) && ($config->fiscalYearStart['M'] != 1 || $config->fiscalYearStart['d'] != 1)) {
* @param int $contactID
* @param $mail
*/
- static function createCMSUser(&$params, $contactID, $mail) {
+ public static function createCMSUser(&$params, $contactID, $mail) {
// lets ensure we only create one CMS user
static $created = FALSE;
*
* @return bool
*/
- static function _fillCommonParams(&$params, $type = 'paypal') {
+ public static function _fillCommonParams(&$params, $type = 'paypal') {
if (array_key_exists('transaction', $params)) {
$transaction = &$params['transaction'];
}
}
if (!CRM_Utils_System::isNull($params['email'])) {
$params['email'] = array(
- 1 => array('email' => $params['email'],
+ 1 => array(
+ 'email' => $params['email'],
'location_type_id' => $billingLocTypeId,
- ));
+ ),
+ );
}
if (isset($transaction['trxn_id'])) {
$transaction['trxn_id'] = md5(uniqid(rand(), TRUE));
}
- if (!isset( $transaction['financial_type_id'])) {
+ if (!isset($transaction['financial_type_id'])) {
$contributionTypes = array_keys(CRM_Contribute_PseudoConstant::financialType());
$transaction['financial_type_id'] = $contributionTypes[0];
}
*
* @return array
*/
- static function formatAPIParams($apiParams, $mapper, $type = 'paypal', $category = TRUE) {
+ public static function formatAPIParams($apiParams, $mapper, $type = 'paypal', $category = TRUE) {
$type = strtolower($type);
if (!in_array($type, array(
- 'paypal', 'google', 'csv'))) {
+ 'paypal',
+ 'google',
+ 'csv',
+ ))
+ ) {
// return the params as is
return $apiParams;
}
*
* @return bool
*/
- static function processAPIContribution($params) {
+ public static function processAPIContribution($params) {
if (empty($params) || array_key_exists('error', $params)) {
return FALSE;
}
// if this is a recurring contribution then process it first
if ($params['trxn_type'] == 'subscrpayment') {
// see if a recurring record already exists
- $recurring = new CRM_Contribute_BAO_ContributionRecur;
+ $recurring = new CRM_Contribute_BAO_ContributionRecur();
$recurring->processor_id = $params['processor_id'];
if (!$recurring->find(TRUE)) {
- $recurring = new CRM_Contribute_BAO_ContributionRecur;
+ $recurring = new CRM_Contribute_BAO_ContributionRecur();
$recurring->invoice_id = $params['invoice_id'];
$recurring->find(TRUE);
}
*
* @return mixed
*/
- static function getFirstLastDetails($contactID) {
+ public static function getFirstLastDetails($contactID) {
static $_cache;
if (!$_cache) {
/**
* Calculate the tax amount based on given tax rate.
*
- * @param float $amount amount of field.
- * @param float $taxRate tax rate of selected financial account for field.
- *
- * @return array array of tax amount
+ * @param float $amount
+ * Amount of field.
+ * @param float $taxRate
+ * Tax rate of selected financial account for field.
*
- * @access public
- * @static
+ * @return array
+ * array of tax amount
*
*/
public static function calculateTaxAmount($amount, $taxRate) {
$taxAmount = array();
- $taxAmount['tax_amount'] = ($taxRate/100) * CRM_Utils_Rule::cleanMoney($amount);
+ $taxAmount['tax_amount'] = ($taxRate / 100) * CRM_Utils_Rule::cleanMoney($amount);
return $taxAmount;
}
}
-