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