Ignore spaces, hyphens and dots in vat number comparison
This commit is contained in:
parent
7949ab274e
commit
aba3092207
1 changed files with 6 additions and 1 deletions
|
@ -442,7 +442,7 @@ class StripeUtils(object):
|
||||||
limit=100,
|
limit=100,
|
||||||
)
|
)
|
||||||
for tax_id_obj in tax_ids_list.data:
|
for tax_id_obj in tax_ids_list.data:
|
||||||
if tax_id_obj.value == vat_number:
|
if self.compare_vat_numbers(tax_id_obj.value, vat_number):
|
||||||
logger.debug("tax id obj exists already")
|
logger.debug("tax id obj exists already")
|
||||||
return tax_id_obj
|
return tax_id_obj
|
||||||
else:
|
else:
|
||||||
|
@ -458,3 +458,8 @@ class StripeUtils(object):
|
||||||
value=vat_number,
|
value=vat_number,
|
||||||
)
|
)
|
||||||
return tax_id_obj
|
return tax_id_obj
|
||||||
|
|
||||||
|
def compare_vat_numbers(self, vat1, vat2):
|
||||||
|
_vat1 = vat1.replace(" ", "").replace(".", "").replace("-","")
|
||||||
|
_vat2 = vat2.replace(" ", "").replace(".", "").replace("-","")
|
||||||
|
return True if _vat1 == _vat2 else False
|
Loading…
Reference in a new issue