Skip to content

Commit

Permalink
fixed Postal Code change
Browse files Browse the repository at this point in the history
  • Loading branch information
satcfdi committed Oct 12, 2023
1 parent 28d8634 commit f5b13fe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions satdigitalinvoice/client_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,21 @@ def error(msg):

if rfc.type == RFCType.FISICA:
razon_social = f"{res['Nombre']} {res['Apellido Paterno']} {res['Apellido Materno']}"
else:
elif 'Denominación o Razón Social' in res:
razon_social = res['Denominación o Razón Social']
else:
error(f"Does not have 'Denominación o Razón Social'")

if client['RazonSocial'] != razon_social:
error(f"RazonSocial '{client['RazonSocial']}' is invalid, expected '{razon_social}'")

if client['CodigoPostal'] != res['CP']:
error(f"CodigoPostal '{client['CodigoPostal']}' is invalid, expected '{res['CP']}'")

for r in res['Regimenes']:
if r['RegimenFiscal'].code == None:
error(f"RegimenFiscal '{r['RegimenFiscal']}' is invalid")

if client['RegimenFiscal'] not in (r['RegimenFiscal'] for r in res['Regimenes']):
regimen = ', '.join(r['RegimenFiscal'].code or "" for r in res['Regimenes'])
error(
Expand All @@ -54,7 +61,7 @@ def error(msg):
taxpayer_status = sat_service.list_69b(rfc)
if taxpayer_status:
error(f"has status '{taxpayer_status}'")
except ValueError as ex:
except Exception as ex:
error(ex)

return errors
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
],
},
install_requires=[
'satcfdi==4.2.5',
'satcfdi==4.2.7',
'diskcache',
'num2words',
'PyYAML',
Expand Down

0 comments on commit f5b13fe

Please sign in to comment.