Enhance invoice processing logic for IMD and Mexican purchases
- Updated validation logic to restrict 'IMD' document type usage unless the invoice type is 'DEF'. - Refactored value assignment in the main processing flow to handle 'DEF' and 'MEX' invoice types with specific IVA calculations. - Added logging for invoice processing to improve traceability and debugging. These changes improve the accuracy of invoice validations and processing for specific document types.
This commit is contained in:
@@ -107,16 +107,12 @@ class SitarAPIBaseService:
|
||||
# DEBUG LOGGING for SITAR inspection
|
||||
if "fracciones" in url:
|
||||
import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
logger.info(f"SITAR API Response Headers for {url}: {dict(response.headers)}")
|
||||
logger = logging.getLogger(__name__)
|
||||
try:
|
||||
data = response.json()
|
||||
if isinstance(data, dict):
|
||||
logger.info(f"SITAR API Response Body Keys: {list(data.keys())}")
|
||||
elif isinstance(data, list) and len(data) > 0:
|
||||
logger.info(f"SITAR API Response List Item Keys: {list(data[0].keys())}")
|
||||
data = response.json()
|
||||
return data
|
||||
except Exception:
|
||||
logger.error(f"Error parsing SITAR API Response Body: {response.text}")
|
||||
pass
|
||||
|
||||
return response.json()
|
||||
|
||||
Reference in New Issue
Block a user