#893 — Fix delete endpoint so that it uses the new azure storage
Repo: Twill-AI/facade State: open | Status: open Assignee: sparsh-twillpayments
Created: 2026-01-02 · Updated: 2026-01-02
Description
Description
The DELETE endpoint for merchant documents in app/api/merchants_router.py currently uses the old PayEngine storage (payengine_proxy.delete_document()), which is no longer functional. This endpoint needs to be updated to use the new storage blob service, following the same pattern already implemented in app/api/master_merchant_router.py.
Acceptance Criteria
-
Replace PayEngine storage with blob storage service: The DELETE endpoint at
/{merchant_id}/documents/{document_id}inmerchants_router.pyshould useDepsSingleton.get_storage_blob_service()and callstorage_service.delete_blob()with container_name=“merchants-documents” and blob_name=str(document_id), matching the implementation pattern inmaster_merchant_router.py(lines 1115-1144). -
Implement proper error handling: The endpoint should handle storage deletion errors gracefully:
- Log a warning if the blob doesn’t exist in storage (ValueError) and continue with database deletion
- Log an error for other storage exceptions but still proceed with database deletion
- Always delete the document record from the database (
DbMerchantDocument) even if storage deletion fails
-
Remove PayEngine dependency: Remove the
payengine_proxy.delete_document()call and theget_payengine_proxy()import/usage from the DELETE endpoint, ensuring the endpoint no longer depends on PayEngine for document deletion.
Reference Implementation
See `app/api/master_merchant_router.py
Notes
Add implementation notes, blockers, and context here
Related
Add wikilinks to related people, meetings, or other tickets