From 899c09b31463863fe0a5307baa957411fcc1ada9 Mon Sep 17 00:00:00 2001 From: eileen Date: Mon, 27 Nov 2017 12:27:12 +1300 Subject: [PATCH] CRM-21365 Ensure currency param passed via api.Contribution.transact is passed to processor Change-Id: I59a5cd16499e89fbaa54594071fd396de81dfb82 --- CRM/Core/Payment.php | 13 +++++++++++++ CRM/Core/Payment/PayPalImpl.php | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) 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']; -- 2.25.1