Add DCA payment status update functionality: implement update_dca_payment_status method in CRUD operations and integrate it into the LamassuTransactionProcessor for updating payment statuses to 'confirmed' or 'failed' based on transaction outcomes. Enhance error handling and logging for better traceability.

This commit is contained in:
padreug 2025-06-19 17:33:24 +02:00
parent 5f21a27f0e
commit 5bbcee2afa
2 changed files with 30 additions and 3 deletions

View file

@ -238,6 +238,14 @@ async def get_all_payments() -> List[DcaPayment]:
)
async def update_dca_payment_status(payment_id: str, status: str) -> None:
"""Update the status of a DCA payment"""
await db.execute(
"UPDATE myextension.dca_payments SET status = :status WHERE id = :id",
{"status": status, "id": payment_id}
)
async def get_payments_by_lamassu_transaction(lamassu_transaction_id: str) -> List[DcaPayment]:
return await db.fetchall(
"SELECT * FROM myextension.dca_payments WHERE lamassu_transaction_id = :transaction_id",