CRM-21365 Ensure currency param passed via api.Contribution.transact is passed to...
authoreileen <emcnaughton@wikimedia.org>
Sun, 26 Nov 2017 23:27:12 +0000 (12:27 +1300)
committereileen <emcnaughton@wikimedia.org>
Sun, 26 Nov 2017 23:27:12 +0000 (12:27 +1300)
Change-Id: I59a5cd16499e89fbaa54594071fd396de81dfb82

CRM/Core/Payment.php
CRM/Core/Payment/PayPalImpl.php

index 4858b801da57bcb56bbd3413e62ec4f582bb11a6..80879d97db1ca21cabaf5bf9db88b3c20a003c15 100644 (file)
@@ -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.
    *
index e2b64a60afefe9bfd4d7d87c54c421a3c88b02a6..bd1fb53e7ac518030bfc66d969e1ca26da8da036 100644 (file)
@@ -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'];