Skip to content

Commit b41b9b0

Browse files
committed
Addition of check for amount
1 parent e013923 commit b41b9b0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

app/api/orders.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,12 @@ def is_payment_valid(order, mode):
6969

7070

7171
def check_billing_info(data, order):
72-
if order.event.is_billing_info_mandatory and not (data.get('company') and data.get('address') and data.get('city') and
73-
data.get('zipcode') and data.get('country')):
72+
if data.get('amount') and data.get('amount') > 0 and order.event.is_billing_info_mandatory:
73+
raise UnprocessableEntity({'pointer': '/data/attributes/is_billing_enabled'},
74+
"Billing information is mandatory for paid orders for this event")
75+
76+
if order.event.is_billing_info_mandatory and not (data.get('company') and data.get('address')
77+
and data.get('city') and data.get('zipcode') and data.get('country')):
7478
raise UnprocessableEntity({'pointer': '/data/attributes/is_billing_enabled'},
7579
"Billing information incomplete")
7680

0 commit comments

Comments
 (0)