From bbfc248c79311b6fe6ec394c0093306489185b36 Mon Sep 17 00:00:00 2001
From: Matthew Wire <mjw@mjwconsult.co.uk>
Date: Sat, 15 Aug 2020 11:49:55 +0100
Subject: [PATCH] Move getCurrency() to CRM.payment (requires mjwshared 0.9.2)

---
 js/civicrm_stripe.js | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/js/civicrm_stripe.js b/js/civicrm_stripe.js
index b2b619cd..44d0ba56 100644
--- a/js/civicrm_stripe.js
+++ b/js/civicrm_stripe.js
@@ -205,7 +205,7 @@
           $.post(url, {
             payment_method_id: result.paymentMethod.id,
             amount: CRM.payment.getTotalAmount().toFixed(2),
-            currency: getCurrency(),
+            currency: CRM.payment.getCurrency(CRM.vars.stripe.currency),
             id: CRM.vars.stripe.id,
             description: document.title,
             csrfToken: CRM.vars.stripe.csrfToken
@@ -625,19 +625,6 @@
     return submit;
   }
 
-  /**
-   * Get currency on the form
-   * @returns {currency}
-   */
-  function getCurrency() {
-    if (document.getElementById('currency')) {
-      return document.getElementById("currency").value;
-    }
-    else {
-      return CRM.vars.stripe.currency;
-    }
-  }
-
   function cardElementChanged(event) {
     if (event.empty) {
       $('div#card-errors').hide();
-- 
GitLab