forked from uncloud/uncloud
Fix empty vat number bug
This commit is contained in:
parent
927fb20671
commit
7d708cfbb6
1 changed files with 3 additions and 2 deletions
|
@ -215,10 +215,11 @@ class BillingAddressViewSet(mixins.CreateModelMixin,
|
|||
|
||||
# Validate VAT numbers.
|
||||
country = serializer.validated_data["country"]
|
||||
vat_number = serializer.validated_data["vat_number"]
|
||||
|
||||
# We ignore empty VAT numbers.
|
||||
if vat_number != "":
|
||||
if 'vat_number' in serializer.validated_data and serializer.validated_data["vat_number"] != "":
|
||||
vat_number = serializer.validated_data["vat_number"]
|
||||
|
||||
if not validate_vat(country, vat_number):
|
||||
return Response(
|
||||
{'error': 'Malformed VAT number.'},
|
||||
|
|
Loading…
Reference in a new issue