From 1e67bef4f54cec9910fb1ab8c54ee571d8a786e1 Mon Sep 17 00:00:00 2001 From: PCoder Date: Thu, 7 Jan 2021 16:30:33 +0530 Subject: [PATCH] Remove unwanted code/comments --- datacenterlight/views.py | 10 +++++++--- hosting/static/hosting/js/payment.js | 18 ------------------ hosting/views.py | 1 - utils/stripe_utils.py | 1 - 4 files changed, 7 insertions(+), 23 deletions(-) diff --git a/datacenterlight/views.py b/datacenterlight/views.py index 6f765da8..3d3543c5 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -471,7 +471,6 @@ class PaymentOrderView(FormView): id_payment_method = self.request.POST.get('id_payment_method', None) if id_payment_method == 'undefined': - # Probably user chose one of the previously saved cards id_payment_method = address_form.cleaned_data.get('card') request.session["id_payment_method"] = id_payment_method logger.debug("id_payment_method is %s" % id_payment_method) @@ -1125,8 +1124,9 @@ class OrderConfirmationView(DetailView, FormView): def create_incomplete_intent_request(request): """ - Persist session variables so that they could be pick up - in the webhook for processing. + Creates a dictionary of all session variables so that they could be + picked up in the webhook for processing. + :param request: :return: """ @@ -1233,6 +1233,10 @@ def do_provisioning_generic( stripe_api_cus_id, request['id_payment_method'], set_as_default=True ) + """ + Identical to do_provisioning(), except for the fact that this + is specific to handling provisioning of the generic products + """ logger.debug("Card %s associate result %s" % ( request['id_payment_method'], acc_result.get('response_object') diff --git a/hosting/static/hosting/js/payment.js b/hosting/static/hosting/js/payment.js index a2e2717a..3c4d67da 100644 --- a/hosting/static/hosting/js/payment.js +++ b/hosting/static/hosting/js/payment.js @@ -211,24 +211,6 @@ $(document).ready(function () { } }); window.card = cardNumberElement; - /* stripe.confirmCardPayment( - window.paymentIntentSecret, - { - payment_method: {card: cardNumberElement} - } - ).then(function(result) { - window.result = result; - if (result.error) { - // Display error.message in your UI. - var errorElement = document.getElementById('card-errors'); - errorElement.textContent = result.error.message; - } else { - // The payment has succeeded - // Display a success message - alert("Thanks for the order. Your product will be provisioned " + - "as soon as we receive the payment. Thank you."); - } - }); */ } function payWithStripe_new(e) { e.preventDefault(); diff --git a/hosting/views.py b/hosting/views.py index 913a9643..011da997 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -677,7 +677,6 @@ class SettingsView(LoginRequiredMixin, FormView): msg = _("Billing address updated successfully") messages.add_message(request, messages.SUCCESS, msg) else: - # TODO : Test this flow id_payment_method = request.POST.get('id_payment_method', None) stripe_utils = StripeUtils() card_details = stripe_utils.get_cards_details_from_payment_method( diff --git a/utils/stripe_utils.py b/utils/stripe_utils.py index 0bfb2412..875a174e 100644 --- a/utils/stripe_utils.py +++ b/utils/stripe_utils.py @@ -111,7 +111,6 @@ class StripeUtils(object): @handleStripeError def update_customer_card(self, customer_id, token): - # TODO replace token with payment intent customer = stripe.Customer.retrieve(customer_id) current_card_token = customer.default_source customer.sources.retrieve(current_card_token).delete()