From f2a2894f2ecb35bd87cc3a0ea8fc181e4dfa7db4 Mon Sep 17 00:00:00 2001 From: Uddeshya Singh Date: Thu, 8 Aug 2019 19:08:55 +0530 Subject: [PATCH] fix: change validation check and add is_billing_enabled check --- app/api/orders.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/api/orders.py b/app/api/orders.py index 5b06744b73..9215f17a57 100644 --- a/app/api/orders.py +++ b/app/api/orders.py @@ -68,7 +68,7 @@ def check_billing_info(data): raise UnprocessableEntity({'pointer': '/data/attributes/is_billing_enabled'}, "Billing information is mandatory for paid orders") if data.get('is_billing_enabled') and not (data.get('company') and data.get('address') and data.get('city') and - data.get('zip') and data.get('country')): + data.get('zipcode') and data.get('country')): raise UnprocessableEntity({'pointer': '/data/attributes/is_billing_enabled'}, "Billing information incomplete") @@ -106,7 +106,8 @@ def before_create_object(self, data, view_kwargs): :param view_kwargs: :return: """ - check_billing_info(data) + if data.get('amount') > 0 and not data.get('is_billing_enabled'): + data['is_billing_enabled'] = True free_ticket_quantity = 0