From 1b14598cc91e558bc2fbf44cd840feceff00d57a Mon Sep 17 00:00:00 2001
From: "M.Ravi" <mondi.ravi@gmail.com>
Date: Thu, 12 Oct 2017 00:43:55 +0200
Subject: [PATCH] Create Stripe elements only stripe key is defined

---
 hosting/static/hosting/js/payment.js | 36 +---------------------------
 1 file changed, 1 insertion(+), 35 deletions(-)

diff --git a/hosting/static/hosting/js/payment.js b/hosting/static/hosting/js/payment.js
index 6149a30a..52861e02 100644
--- a/hosting/static/hosting/js/payment.js
+++ b/hosting/static/hosting/js/payment.js
@@ -49,7 +49,7 @@ $(document).ready(function () {
 
 
     var hasCreditcard = window.hasCreditcard || false;
-    if (!hasCreditcard) {
+    if (!hasCreditcard && window.stripeKey) {
         var stripe = Stripe(window.stripeKey);
         var element_style = {
             fonts: [{
@@ -88,31 +88,6 @@ $(document).ready(function () {
                 }
             }
         };
-        var credit_card_cvv_style = {
-            base: {
-                iconColor: '#666EE8',
-                color: '#31325F',
-                lineHeight: '25px',
-                fontWeight: 300,
-                fontFamily: "'lato-regular', sans-serif",
-                fontSize: '14px',
-                '::placeholder': {
-                    color: '#555'
-                }
-            },
-            invalid: {
-                iconColor: '#eb4d5c',
-                color: '#eb4d5c',
-                lineHeight: '25px',
-                fontWeight: 300,
-                fontFamily: "'lato-regular', sans-serif",
-                fontSize: '14px',
-                '::placeholder': {
-                    color: '#eb4d5c',
-                    fontWeight: 600
-                }
-            }
-        };
 
         var enter_ccard_text = "Enter your credit card number";
         if (typeof window.enter_your_card_text !== 'undefined') {
@@ -164,7 +139,6 @@ $(document).ready(function () {
 
         function stripeTokenHandler(token) {
             // Insert the token ID into the form so it gets submitted to the server
-            var form = document.getElementById('payment-form-new');
             $('#id_token').val(token.id);
             $('#billing-form').submit();
         }
@@ -227,13 +201,5 @@ $(document).ready(function () {
             $(element).closest('.form-group').append(error);
         }
     });
-    // $form.find('[type=submit]').prop('disabled', true);
-    // var readyInterval = setInterval(function() {
-    //     if (paymentFormReady()) {
-    //         $form.find('[type=submit]').prop('disabled', false);
-    //         clearInterval(readyInterval);
-    //     }
-    // }, 250);
-
 });