grow food, not lawn.

Skip to content

Add email notifications for economically unviable refunds

Enhanced the refund email system to properly notify users when their cryptocurrency refunds cannot be processed due to being economically unviable (too small to cover network transaction fees).

Changes:

  • Updated send_refund_email() to differentiate between "no refund address" and "economically unviable" scenarios with appropriate messaging
  • Added email notifications in crypto watcher for all NOT_REFUNDED status transitions due to economic viability:
    • Duplicate payment processing (line ~1770)
    • Expired payment processing (line ~2145)
    • Underpayment processing (line ~2905)
    • Passive monitoring refund retries (line ~3280)
  • Added proper error handling for email sending to prevent disruption
  • All economically unviable refund tests pass with no regressions

Users now receive clear explanations when refunds are too small to send rather than being left without notification.

Summary by CodeRabbit

  • New Features
    • Automatic refund notification emails for duplicate payments, expired invoices, underpayments, and other refund outcomes, including passive/monitoring paths.
    • Updated subject lines and messages for "economically unviable" (too-small) refunds, referencing the received amount.
    • Emails sent with shop-domain context when available, with safe fallbacks.
    • Email send failures are logged and handled so refund processing continues.
Edited by CodeRabbit

Merge request reports