Skip to content

Commit

Permalink
Always validate permit_id existence
Browse files Browse the repository at this point in the history
  • Loading branch information
mhieta committed Sep 11, 2023
1 parent 6355d4d commit f62398d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions parking_permits/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,12 @@ def post(self, request, format=None):
meta = validated_subscription_data.get("meta")
meta_item = get_meta_item(meta, "permitId")
permit_id = meta_item.get("value") if meta_item else None
if not permit_id:
logger.error("Permit id is missing from subscription meta data")
return Response(
{"message": "No permit id is provided"},
status=400,
)

order_item_qs = OrderItem.objects.filter(
order__talpa_order_id=talpa_order_id,
Expand Down

0 comments on commit f62398d

Please sign in to comment.