Changes Updated
This commit is contained in:
parent
3c405012b9
commit
a2ce504b02
@ -299,7 +299,6 @@ async function sendPlanExpiredNotification(
|
||||
|
||||
let expiryDate: Date | undefined;
|
||||
let formattedDate = "Unknown Date";
|
||||
let daysSinceExpiry = 0;
|
||||
|
||||
const payments = await getPaymentsForMembership(membershipId);
|
||||
if (payments.length > 0) {
|
||||
@ -314,9 +313,6 @@ async function sendPlanExpiredNotification(
|
||||
day: "numeric",
|
||||
});
|
||||
|
||||
const now = new Date();
|
||||
const timeDiff = now.getTime() - expiryDate.getTime();
|
||||
daysSinceExpiry = Math.floor(timeDiff / (1000 * 3600 * 24));
|
||||
}
|
||||
|
||||
await app
|
||||
@ -331,17 +327,12 @@ async function sendPlanExpiredNotification(
|
||||
read: false,
|
||||
readBy: [],
|
||||
data: {
|
||||
title: "Plan Expired",
|
||||
message: `The plan ${
|
||||
membershipData.subscription?.name || "Unknown Plan"
|
||||
} for client ${clientName} has expired.`,
|
||||
planName: membershipData.subscription?.name || "Unknown Plan",
|
||||
clientName,
|
||||
membershipId,
|
||||
gymName,
|
||||
ownerId: gymOwnerId,
|
||||
formattedExpiryDate: formattedDate,
|
||||
daysSinceExpiry,
|
||||
expiryDate: expiryDate
|
||||
? admin.firestore.Timestamp.fromDate(expiryDate)
|
||||
: admin.firestore.Timestamp.fromDate(new Date()),
|
||||
|
||||
@ -240,7 +240,7 @@ function prepareNotificationMessage(
|
||||
title = notification.data?.title || "Plan Expired";
|
||||
body =
|
||||
notification.data?.message ||
|
||||
`The plan ${notification.data?.planName} for client ${notification.data?.clientName} has expired.`;
|
||||
`${notification.data?.clientName}/s subscription for plan ${notification.data?.planName} has expired.`;
|
||||
break;
|
||||
|
||||
case "schedule_update":
|
||||
|
||||
Loading…
Reference in New Issue
Block a user