diff --git a/billing/tasks.py b/billing/tasks.py index e1f89da..5136c7d 100644 --- a/billing/tasks.py +++ b/billing/tasks.py @@ -5,6 +5,7 @@ from django.utils import timezone from procrastinate.contrib.django import app from api.notifications import send_sms from billing.models import Topup +from django.utils.timezone import localtime logger = logging.getLogger(__name__) @@ -28,6 +29,7 @@ def update_expired_topups(timestamp: int): mobile=topup.user.mobile, amount=topup.amount, topup_id=str(topup.id), + created_at=localtime(topup.created_at).isoformat(), ) else: # Mark as notified even if we can't send SMS (no mobile number) @@ -41,9 +43,9 @@ def update_expired_topups(timestamp: int): # Assuming you have a separate task for sending SMS if you go that route @app.task -def send_sms_task(mobile: str, amount: float, topup_id: str): +def send_sms_task(mobile: str, amount: float, topup_id: str, created_at: str): message = ( - f"Dear {mobile}, \n\nYour topup of {amount} MVR has expired. " + f"Dear {mobile}, \n\nYour topup of {amount} MVR [created at {created_at}] has expired. " "Please make a new topup to update your wallet. \n\n- SAR Link" ) send_sms(mobile, message)