feat: include receipt tax amount in match-specific endpoint response

This commit is contained in:
Iyeoluwa Akinrinola
2025-07-07 17:42:52 +01:00
parent 00b42f2c0f
commit 2e9afe5204
7 changed files with 32 additions and 2 deletions
+9 -1
View File
@@ -252,6 +252,7 @@ async def process_document(file_id: str):
file_id=file_id,
extraction_success=receipt_data.get("extraction_success", False),
vendor=receipt_data.get("vendor", ""),
description=receipt_data.get("description", ""),
total_amount=receipt_data.get("total_amount", 0.0),
tax_amount=receipt_data.get("tax_amount", 0.0),
date=receipt_data.get("date", ""),
@@ -350,6 +351,9 @@ async def match_specific_receipts(file_ids: List[str]):
# Handle missing category field
category = receipt_data.get("category", "Other")
# Handle description field
description = receipt_data.get("description", "")
# Handle tax field
tax = receipt_data.get("tax", receipt_data.get("tax_amount", 0.0))
try:
@@ -365,7 +369,8 @@ async def match_specific_receipts(file_ids: List[str]):
amount=amount,
tax=tax,
vendor=vendor,
category=category
category=category,
description=description
)
receipts.append(receipt)
logger.info(f"Added receipt: {receipt.vendor} - ${receipt.amount}")
@@ -414,6 +419,9 @@ async def match_specific_receipts(file_ids: List[str]):
match_reason=match.match_reason,
receipt_vendor=match.receipt.vendor,
receipt_amount=match.receipt.amount,
receipt_description=match.receipt.description,
receipt_category=match.receipt.category,
receipt_tax_amount=match.receipt.tax,
transaction_vendor=match.transaction.vendor,
transaction_amount=match.transaction.amount
)