diff --git a/make_post_sell/lib/crypto_watcher.py b/make_post_sell/lib/crypto_watcher.py
index 16eb367..9863ea1 100644
--- a/make_post_sell/lib/crypto_watcher.py
+++ b/make_post_sell/lib/crypto_watcher.py
@@ -884,6 +884,10 @@ def process_payment(
logger.info(
f"Expired payment {crypto_payment.id} eligible for refund: {refund_details}"
)
+
+ # Set status to expired-refunded immediately when refund is determined
+ crypto_payment.status = CryptoPayment.STATUS_EXPIRED_REFUNDED
+
result = payment_rescue.execute_refund(
refund_details, crypto_payment
)
@@ -898,9 +902,7 @@ def process_payment(
)
crypto_payment.refund_tx_hash = result["tx_hash"]
crypto_payment.refund_reason = refund_details["reason"]
- crypto_payment.status = (
- CryptoPayment.STATUS_EXPIRED_REFUNDED
- )
+ # Status already set above
# Commit the refund first
env_request.dbsession.add(crypto_payment)
@@ -1147,6 +1149,10 @@ def process_payment(
logger.info(
f"Underpayment {crypto_payment.id} eligible for refund: {refund_details}"
)
+
+ # Set status to underpaid-refunded immediately when refund is determined
+ crypto_payment.status = CryptoPayment.STATUS_UNDERPAID_REFUNDED
+
result = payment_rescue.execute_refund(
refund_details, crypto_payment
)
@@ -1154,11 +1160,12 @@ def process_payment(
logger.info(
f"Refund executed for underpayment {crypto_payment.id}: TX {result['tx_hash']}"
)
- crypto_payment.status = CryptoPayment.STATUS_UNDERPAID_REFUNDED
+ # Status already set above
else:
logger.error(
f"Refund failed for underpayment {crypto_payment.id}: {result['error']}"
)
+ # Status remains underpaid-refunded, refund will be retried later
else:
# No refund possible - no refund address configured
logger.warning(
diff --git a/make_post_sell/templates/crypto_quotes_history.j2 b/make_post_sell/templates/crypto_quotes_history.j2
index 2445c16..547ed2d 100644
--- a/make_post_sell/templates/crypto_quotes_history.j2
+++ b/make_post_sell/templates/crypto_quotes_history.j2
@@ -46,6 +46,8 @@
{% else %}
{{ '%.8f' % payment.received_crypto }} {{ payment.coin_type }}
{% endif %}
+
+ ${{ '%.2f' % (payment.received_crypto * (payment.rate_usd_per_coin|float)) }} USD
{% if payment.confirmations > 0 %}
{{ payment.confirmations }}/{{ payment.confirmations_required }} confirmations
@@ -88,11 +90,20 @@
{% elif payment.status.endswith('-refunded') %}