/**
* Function to process payment after confirmation
*
- * @param object $form form object
- * @param array $paymentParams array with payment related key
+ * @param object $form form object
+ * @param array $paymentParams array with payment related key
* value pairs
- * @param array $premiumParams array with premium related key
+ * @param array $premiumParams array with premium related key
* value pairs
- * @param int $contactID contact id
- * @param int $contributionTypeId financial type id
- * @param int $component component id
+ * @param int $contactID contact id
+ * @param int $contributionTypeId financial type id
+ * @param int|string $component component id
+ *
+ * @param null $fieldTypes
*
* @return array associated array
*
$fieldTypes = NULL
) {
CRM_Core_Payment_Form::mapParams($form->_bltID, $form->_params, $paymentParams, TRUE);
+ $isTest = ($form->_mode == 'test') ? 1 : 0;
+ $lineItems = $form->_lineItem;
$contributionType = new CRM_Financial_DAO_FinancialType();
if (isset($paymentParams['financial_type'])) {
NULL,
$contactID,
$contributionType,
- TRUE, TRUE, TRUE
+ TRUE, TRUE,
+ $isTest,
+ $lineItems
);
if ($contribution) {
NULL,
$contactID,
$contributionType,
- TRUE, TRUE, TRUE
+ TRUE, TRUE,
+ $isTest,
+ $lineItems
);
// restore cached values (part of fix for CRM-14354)
// check if pending was set to true by payment processor
$pending = FALSE;
- if (!empty($form->_params
-['contribution_status_pending'])) {
+ if (!empty($form->_params['contribution_status_pending'])) {
$pending = TRUE;
}
if (!(!empty($paymentParams['is_recur']) && $form->_contributeMode == 'direct')) {
$contribution = CRM_Contribute_Form_Contribution_Confirm::processContribution($form,
$form->_params, $result,
$contactID, $contributionType,
- TRUE, $pending, TRUE
+ $pending, TRUE,
+ $isTest,
+ $lineItems
);
}
$form->postProcessPremium($premiumParams, $contribution);
return $params;
}
+ /**
+ * @param $params
+ * @param $contactID
+ * @param $mail
+ */
static function createCMSUser(&$params, $contactID, $mail) {
// lets ensure we only create one CMS user
static $created = FALSE;
}
}
+ /**
+ * @param $params
+ * @param string $type
+ *
+ * @return bool
+ */
static function _fillCommonParams(&$params, $type = 'paypal') {
if (array_key_exists('transaction', $params)) {
$transaction = &$params['transaction'];
return TRUE;
}
+ /**
+ * @param $apiParams
+ * @param $mapper
+ * @param string $type
+ * @param bool $category
+ *
+ * @return array
+ */
static function formatAPIParams($apiParams, $mapper, $type = 'paypal', $category = TRUE) {
$type = strtolower($type);
}
}
+ /**
+ * @param $params
+ *
+ * @return bool
+ */
static function processAPIContribution($params) {
if (empty($params) || array_key_exists('error', $params)) {
return FALSE;
return TRUE;
}
+ /**
+ * @param $contactID
+ *
+ * @return mixed
+ */
static function getFirstLastDetails($contactID) {
static $_cache;
}
return $_cache[$contactID];
}
+
+ /**
+ * 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
+ *
+ * @access public
+ * @static
+ *
+ */
+ public static function calculateTaxAmount($amount, $taxRate) {
+ $taxAmount = array();
+ $taxAmount['tax_amount'] = ($taxRate/100) * $amount;
+
+ return $taxAmount;
+ }
}