From: eileen Date: Sun, 26 Nov 2017 23:27:12 +0000 (+1300) Subject: CRM-21365 Ensure currency param passed via api.Contribution.transact is passed to... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=899c09b31463863fe0a5307baa957411fcc1ada9;p=civicrm-core.git CRM-21365 Ensure currency param passed via api.Contribution.transact is passed to processor Change-Id: I59a5cd16499e89fbaa54594071fd396de81dfb82 --- diff --git a/CRM/Core/Payment.php b/CRM/Core/Payment.php index 4858b801da..80879d97db 100644 --- a/CRM/Core/Payment.php +++ b/CRM/Core/Payment.php @@ -985,6 +985,19 @@ abstract class CRM_Core_Payment { return $baseURL; } + /** + * Get the currency for the transaction. + * + * Handle any inconsistency about how it is passed in here. + * + * @param $params + * + * @return string + */ + protected function getCurrency($params) { + return CRM_Utils_Array::value('currencyID', $params, CRM_Utils_Array::value('currency', $params)); + } + /** * Get url to return to after cancelled or failed transaction. * diff --git a/CRM/Core/Payment/PayPalImpl.php b/CRM/Core/Payment/PayPalImpl.php index e2b64a60af..bd1fb53e7a 100644 --- a/CRM/Core/Payment/PayPalImpl.php +++ b/CRM/Core/Payment/PayPalImpl.php @@ -477,7 +477,7 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment { $args['paymentAction'] = 'Sale'; $args['amt'] = $params['amount']; - $args['currencyCode'] = $params['currencyID']; + $args['currencyCode'] = $this->getCurrency($params); $args['invnum'] = $params['invoiceID']; $args['ipaddress'] = $params['ip_address']; $args['creditCardType'] = $params['credit_card_type'];