Added the due date in email content
This commit is contained in:
parent
254f99c817
commit
d78dd5c836
@ -156,32 +156,28 @@ def send_email_notifications(email_config, recurring_payment_data):
|
|||||||
logging.warning("No recipient emails found for one of the payment requests.")
|
logging.warning("No recipient emails found for one of the payment requests.")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
next_strike_date = recurringPayment.get("nextStrikeDate", "")
|
|
||||||
formatted_next_strike_date = next_strike_date[:10] if next_strike_date else "N/A"
|
|
||||||
|
|
||||||
frequency = get_frequency(recurringPayment.get("frequency"))
|
frequency = get_frequency(recurringPayment.get("frequency"))
|
||||||
|
|
||||||
# Compose email content
|
# Compose email content
|
||||||
content = f"""
|
content = f"""
|
||||||
Here are the details of the payment:
|
Here are the details of the payment:
|
||||||
|
|
||||||
- Title: {recurringPayment.get('title', 'N/A')}
|
Title: {recurringPayment.get('title', 'N/A')}
|
||||||
- Description: {recurringPayment.get('description', 'N/A')}
|
Description: {recurringPayment.get('description', 'N/A')}
|
||||||
- Payee: {recurringPayment.get('payee', 'N/A')}
|
Payee: {recurringPayment.get('payee', 'N/A')}
|
||||||
- Amount: {recurringPayment.get('currency', {}).get('symbol', '')} {recurringPayment.get('amount', 'N/A')} ({recurringPayment.get('currency', {}).get('currencyName', 'N/A')})
|
Amount: {recurringPayment.get('currency', {}).get('symbol', '')} {recurringPayment.get('amount', 'N/A')} ({recurringPayment.get('currency', {}).get('currencyName', 'N/A')})
|
||||||
- Currency Code: {recurringPayment.get('currency', {}).get('currencyCode', 'N/A')}
|
Due Date: {item.get('dueDate', '')[:10] if item.get('dueDate') else 'N/A'}
|
||||||
- Recurring Frequency: {frequency}
|
Currency Code: {recurringPayment.get('currency', {}).get('currencyCode', 'N/A')}
|
||||||
- Next Strike Date: {formatted_next_strike_date}
|
Recurring Frequency: {frequency}
|
||||||
- Strike Date: {recurringPayment.get('strikeDate', '')[:10] if recurringPayment.get('strikeDate') else 'N/A'}
|
Next Strike Date: {recurringPayment.get("nextStrikeDate", "")[:10] if recurringPayment.get("nextStrikeDate", "") else "N/A"}
|
||||||
- End Date: {recurringPayment.get('endDate', '')[:10] if recurringPayment.get('endDate') else 'N/A'}
|
Expense Category: {recurringPayment.get('expenseCategory', {}).get('name', 'N/A')}
|
||||||
- Expense Category: {recurringPayment.get('expenseCategory', {}).get('name', 'N/A')}
|
Status: {recurringPayment.get('status', {}).get('name', 'N/A')}
|
||||||
- Status: {recurringPayment.get('status', {}).get('name', 'N/A')}
|
|
||||||
|
|
||||||
Please ensure timely processing.
|
Please ensure timely processing.
|
||||||
"""
|
"""
|
||||||
# Setup EmailMessage
|
# Setup EmailMessage
|
||||||
msg = EmailMessage()
|
msg = EmailMessage()
|
||||||
msg["Subject"] = f"Payment Request Generated from Recurring Payment Template \"{recurringPayment.get('title', '')}\""
|
msg["Subject"] = f"Payment Request Generated for \"{recurringPayment.get('payee', 'N/A')}\""
|
||||||
msg["From"] = SENDER_EMAIL
|
msg["From"] = SENDER_EMAIL
|
||||||
msg["To"] = emails
|
msg["To"] = emails
|
||||||
msg.set_content(content)
|
msg.set_content(content)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user