Untitled
unknown
plain_text
2 years ago
1.1 kB
10
Indexable
const handlePaymentAlert = (sendableDomainArray) => {
const messages = {
5: 'Reminder: (5) Day left till platform shutdown',
3: 'Reminder: (3) Day left till platform shutdown',
1: 'Reminder: (1) Day left till platform shutdown',
'-1': 'Reminder: (1) Days ago platform shut down',
'-2': 'Reminder: (2) Days ago platform shut down'
};
return sendableDomainArray
.filter(item => messages[calculateDaysLeft(item.domain, item.endDate)])
.map(item => ({
'domain': item.domain,
'message': messages[calculateDaysLeft(item.domain, item.endDate)]
}));
};
const handlePaymentDates = async () => {
const domains = await controllers.readDomainsFile(filePath);
const sendableDomains = domains
.filter(item => item.paidAt && item.paidAt.trim() !== "")
.map(item => ({ 'domain': item.domain, 'endDate': item.paidAt.split('|')[1] }));
const sendableItems = handlePaymentAlert(sendableDomains);
console.log(sendableItems);
};
// Assuming that you have the calculateDaysLeft function implemented
Editor is loading...
Leave a Comment