Fix localhost domain issue in economically unviable refund emails
Updated economically unviable refund email notifications to use create_shop_context_request() instead of passing env_request directly or creating DummyRequest objects. This ensures emails are sent from the proper shop domain instead of localhost.
Fixed in:
- Expired payment processing (line ~2147)
- Underpayment processing (line ~2911)
- Passive monitoring refund retries (line ~3290)
Note: Duplicate payment processing was already correct.
Summary by CodeRabbit
- Bug Fixes
- Purchase and refund emails now consistently use the correct shop domain and links.
- Improved handling of overpayments, underpayments, expired invoices, and out-of-stock scenarios to ensure accurate notifications.
- Email sending is attempted only when required invoice and user details are available, reducing missed or misrouted messages.
- Greater consistency across duplicate-payment flows, reducing confusion in payment status emails.
Edited by CodeRabbit