From aba3092207efb73dd5e7cac34f374f154734ba32 Mon Sep 17 00:00:00 2001 From: PCoder Date: Tue, 31 Dec 2019 15:57:50 +0530 Subject: [PATCH] Ignore spaces, hyphens and dots in vat number comparison --- utils/stripe_utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/utils/stripe_utils.py b/utils/stripe_utils.py index 9d9bb77f..50de6979 100644 --- a/utils/stripe_utils.py +++ b/utils/stripe_utils.py @@ -442,7 +442,7 @@ class StripeUtils(object): limit=100, ) 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") return tax_id_obj else: @@ -458,3 +458,8 @@ class StripeUtils(object): value=vat_number, ) 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 \ No newline at end of file