Skip to content

Commit 0a0e2c4

Browse files
codedsuniamareebjamal
authored andcommitted
fix: handelled invalid price value in paid tickets (#6604)
1 parent 006110f commit 0a0e2c4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

app/api/schema/tickets.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ def validate_quantity(self, data):
6767
raise UnprocessableEntity({'pointer': '/data/attributes/quantity'},
6868
"quantity should be greater than or equal to max-order")
6969

70+
@validates_schema
71+
def validate_price(self, data):
72+
if data['type'] == 'paid' and ('price' not in data or data['price'] <= 0):
73+
raise UnprocessableEntity({'pointer': 'data/attributes/price'},
74+
"paid ticket price should be greater than 0")
75+
7076
@validates_schema(pass_original=True)
7177
def validate_discount_code(self, data, original_data):
7278
if 'relationships' in original_data and 'discount-codes' in original_data['data']['relationships']:

0 commit comments

Comments
 (0)