From 9212c02cd7b3b7a8aa37591dedfd4f97a41afb2e Mon Sep 17 00:00:00 2001 From: PCoder Date: Fri, 10 Jan 2020 19:47:49 +0530 Subject: [PATCH] Check vat_validation_status exists in dict before using it --- datacenterlight/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/datacenterlight/views.py b/datacenterlight/views.py index c6929fd8..d2581fd9 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -617,7 +617,8 @@ class OrderConfirmationView(DetailView, FormView): if ('generic_payment_type' in request.session and self.request.session['generic_payment_type'] == 'generic'): - if (request.session["vat_validation_status"] == "verified" or + if "vat_validation_status" in request.session and ( + request.session["vat_validation_status"] == "verified" or request.session["vat_validation_status"] == "not_needed"): request.session['generic_payment_details']['vat_rate'] = 0 request.session['generic_payment_details']['vat_amount'] = 0