// be performed yet, so do it now.
if ($isPaidMembership && !$this->isSeparatePaymentSelected()) {
$paymentParams['amount'] = $this->getMainContributionAmount();
+ $paymentParams['currency'] = $this->getCurrency();
$paymentActionResult = $payment->doPayment($paymentParams);
$paymentResults[] = ['contribution_id' => $paymentResult['contribution']->id, 'result' => $paymentActionResult];
}
// and always calling it first.
$form->postProcessHook();
}
+ $paymentParams['currency'] = $this->getCurrency();
$result = $payment->doPayment($paymentParams);
$form->_params = array_merge($form->_params, $result);
$form->assign('trxn_id', $result['trxn_id'] ?? '');
* Rather historic - might have unneeded stuff
*
* @return string
+ * @throws \CRM_Core_Exception
*/
- public function getCurrency() {
- $currency = $this->_values['currency'] ?? NULL;
- // For event forms, currency is in a different spot
- if (empty($currency)) {
- $currency = CRM_Utils_Array::value('currency', CRM_Utils_Array::value('event', $this->_values));
- }
+ public function getCurrency(): string {
+ $currency = $this->getContributionValue('currency');
if (empty($currency)) {
$currency = CRM_Utils_Request::retrieveValue('currency', 'String');
}
- // @todo If empty there is a problem - we should probably put in a deprecation notice
- // to warn if that seems to be happening.
- return (string) $currency;
+ return (string) ($currency ?? \Civi::settings()->get('currency'));
}
}
$paymentParams['invoiceID'] = $paymentParams['invoice_id'];
$payment = $this->_paymentProcessor['object'];
+ $paymentParams['currency'] = $this->getCurrency();
$result = $payment->doPayment($paymentParams);
$this->_params = array_merge($this->_params, $result);