if (!$this->preProcessExpress()) {
//process only primary participant params.
$registerParams = $this->_params[0];
- if (isset($registerParams["billing_state_province_id-{$this->_bltID}"])
- && $registerParams["billing_state_province_id-{$this->_bltID}"]
- ) {
- $registerParams["billing_state_province-{$this->_bltID}"] = CRM_Core_PseudoConstant::stateProvinceAbbreviation($registerParams["billing_state_province_id-{$this->_bltID}"]);
- }
+ $registerParams = $this->prepareParamsForPaymentProcessor($registerParams);
- if (isset($registerParams["billing_country_id-{$this->_bltID}"]) && $registerParams["billing_country_id-{$this->_bltID}"]) {
- $registerParams["billing_country-{$this->_bltID}"] = CRM_Core_PseudoConstant::countryIsoCode($registerParams["billing_country_id-{$this->_bltID}"]);
- }
if (isset($registerParams['credit_card_exp_date'])) {
$registerParams['year'] = CRM_Core_Payment_Form::getCreditCardExpirationYear($registerParams);
$registerParams['month'] = CRM_Core_Payment_Form::getCreditCardExpirationMonth($registerParams);
}
}
- $invoiceSettings = Civi::settings()->get('contribution_invoice_settings');
- $taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings);
- $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
- if ($invoicing) {
+ if (CRM_Invoicing_Utils::isInvoicingEnabled()) {
$this->assign('totalTaxAmount', $taxAmount);
- $this->assign('taxTerm', $taxTerm);
+ $this->assign('taxTerm', CRM_Invoicing_Utils::getTaxTerm());
$this->assign('individual', $individual);
$this->set('individual', $individual);
}
$this->set('finalAmount', $this->_amount);
}
$participantCount = [];
- $taxAmount = $totalTaxAmount = 0;
+ $totalTaxAmount = 0;
//unset the skip participant from params.
//build the $participantCount array.
$participantCount[$participantNum] = 'participant';
}
$totalTaxAmount += CRM_Utils_Array::value('tax_amount', $record, 0);
- if (CRM_Utils_Array::value('is_primary', $record)) {
+ if (!empty($record['is_primary'])) {
$taxAmount = &$params[$participantNum]['tax_amount'];
}
//lets get additional participant id to cancel.
$registerDate = CRM_Utils_Array::value('participant_register_date', $params);
}
elseif (!empty($params['participant_register_date']) &&
- is_array($params['participant_register_date']) &&
- !empty($params['participant_register_date'])
+ is_array($params['participant_register_date'])
) {
$registerDate = CRM_Utils_Date::format($params['participant_register_date']);
}
}
$this->assign('register_date', $registerDate);
- $this->confirmPostProcess($contactID, $contribution, $payment);
+ $this->confirmPostProcess($contactID, $contribution);
}
//handle if no additional participant.
}
$entityTable = 'civicrm_participant';
- $invoiceSettings = Civi::settings()->get('contribution_invoice_settings');
- $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
$totalTaxAmount = 0;
$dataArray = [];
foreach ($this->_lineItem as $key => $value) {
$lineItem[$this->_priceSetId] = $value;
CRM_Price_BAO_LineItem::processPriceSet($entityId, $lineItem, $contribution, $entityTable);
}
- if ($invoicing) {
+ if (CRM_Invoicing_Utils::isInvoicingEnabled()) {
foreach ($value as $line) {
if (isset($line['tax_amount']) && isset($line['tax_rate'])) {
$totalTaxAmount = $line['tax_amount'] + $totalTaxAmount;
}
}
}
- if ($invoicing) {
- $this->assign('dataArray', $dataArray);
- $this->assign('totalTaxAmount', $totalTaxAmount);
- }
+ $this->assign('dataArray', $dataArray);
+ $this->assign('totalTaxAmount', $totalTaxAmount);
}
//update status and send mail to cancelled additional participants, CRM-4320
//lets carry all participant params w/ values.
foreach ($additionalIDs as $participantID => $contactId) {
- $participantNum = NULL;
$participantNum = $participantID;
if ($participantID == $registerByID) {
// This is the is primary participant.
if ($lineItemValue = CRM_Utils_Array::value($participantNum, $lineItems)) {
$lineItem[] = $lineItemValue;
}
- if ($invoicing) {
+ if (CRM_Invoicing_Utils::isInvoicingEnabled()) {
$individual = $this->get('individual');
$dataArray[key($dataArray)] = $individual[$participantNum]['totalTaxAmt'];
$this->assign('dataArray', $dataArray);
//send mail to primary as well as additional participants.
$this->assign('contactID', $contactId);
- $this->assign('participantID', $participantID);
CRM_Event_BAO_Event::sendMail($contactId, $this->_values, $participantID, $isTest);
}
}
* @param array $paymentProcessor
*
* @return \CRM_Contribute_BAO_Contribution
+ *
* @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
*/
public static function processContribution(
&$form, $params, $result, $contactID,
if (!$pending && $result) {
$contribParams += [
'fee_amount' => CRM_Utils_Array::value('fee_amount', $result),
- 'net_amount' => CRM_Utils_Array::value('net_amount', $result, $params['amount']),
'trxn_id' => $result['trxn_id'],
'receipt_date' => $receiptDate,
];
}
/**
- * Assign Profiles.
+ * Assign Profiles to the template.
*
- * @param CRM_Core_Form $form
+ * @param CRM_Event_Form_Registration_Confirm $form
+ *
+ * @throws \Exception
*/
- public static function assignProfiles(&$form) {
+ public static function assignProfiles($form) {
$participantParams = $form->_params;
$formattedValues = $profileFields = [];
$count = 1;
$prefix1 = '';
$prefix2 = '';
}
- if ($participantValue != 'skip') {
+ if ($participantValue !== 'skip') {
//get the customPre profile info
if (!empty($form->_values[$prefix2 . 'custom_pre_id'])) {
$values = $groupName = [];
// This happens in buildQuickForm so emulate here.
$form->_amount = $form->_totalAmount = CRM_Utils_Rule::cleanMoney(CRM_Utils_Array::value('totalAmount', $params));
$form->set('params', $params['params']);
- $form->_values['custom_pre_id'] = [];
- $form->_values['custom_post_id'] = [];
+ $form->_values['custom_pre_id'] = CRM_Utils_Array::value('custom_pre_id', $params);
+ $form->_values['custom_post_id'] = CRM_Utils_Array::value('custom_post_id', $params);
$form->_values['event'] = CRM_Utils_Array::value('event', $params);
$form->_contributeMode = $params['contributeMode'];
$eventParams = ['id' => $params['id']];
/**
* Process the payment, redirecting back to the page on error.
*
- * @param $payment
+ * @param \CRM_Core_Payment $payment
* @param $value
*
* @return array