Files
ICICI_backend/src/utils/helper/notificationMsg.helper.js
2024-10-11 13:20:53 +05:30

132 lines
6.8 KiB
JavaScript

const { sendNotification } = require("../../services/push_notification/onesignal.service");
// Function to get deposit received message
const getDepositReceivedMessage = amount => ({
en: `Funds Added to Your Wallet: A deposit of $${amount} has been credited to your account.`,
ar: `تمت إضافة أموال إلى محفظتك: تمت إضافة إيداع بقيمة ${amount} دولار إلى حسابك.`
});
// Function to get educational material published message
const getEducationalMaterialPublishedMessage = () => ({
en: 'Learn and Grow! Expand your knowledge with new educational material in our Academy.',
ar: 'تعلم ونم! وسع معرفتك من خلال المواد التعليمية الجديدة في أكاديميتنا.'
});
// Function to get investment opportunity cancelled message
const investmentOpportunityCancelled = investmentName => ({
en: `Investment Opportunity Cancelled: ${investmentName} has been cancelled.`,
ar: `تم إلغاء فرصة الاستثمار: ${investmentName} قد تم إلغاؤه.`
});
// Function to get investor qualification upgrade message
const investorQualificationUpgrade = () => ({
en: 'Congratulations, Investor! Your Investor Qualification has been upgraded. Enjoy enhanced benefits!',
ar: 'تهانينا، مستثمر! تم ترقية مؤهلاتك كمستثمر. استمتع بالمزايا المعززة!'
});
// Function to get KYC status approved message
const kycStatusApproved = () => ({
en: 'KYC Approved: Great news! Your KYC verification is successful.',
ar: 'تمت الموافقة على KYC: أخبار رائعة! تم التحقق من KYC بنجاح.'
});
// Function to get KYC status declined message
const kycStatusDeclined = () => ({
en: 'KYC Update: Your KYC status requires attention. Please pass the verification again.',
ar: 'تحديث KYC: حالة KYC الخاصة بك تتطلب انتباهاً. يرجى إعادة إجراء التحقق.'
});
// Function to get new investment opportunity message
const newInvestmentOpportunity = () => ({
en: 'Discover New Opportunities! A fresh investment opportunity awaits you. Dive in now!',
ar: 'اكتشف الفرص الجديدة! تنتظرك فرصة استثمارية جديدة. ابدأ الآن!'
});
// Function to get subscription investment closed message
const subscriptionInvestmentClosed = () => ({
en: 'Investment Update: Your investment opportunity has just closed.',
ar: 'تحديث الاستثمار: لقد تم إغلاق فرصة استثمارك للتو.'
});
// Function to get subscription investment updated message
const subscriptionInvestmentUpdated = () => ({
en: 'Investment Status Alert: Your investment subscription details have been updated.',
ar: 'تنبيه حالة الاستثمار: تمت تحديث تفاصيل اشتراكك في الاستثمار.'
});
// Function to get withdrawal completed message
const withdrawalCompleted = () => ({
en: 'Withdrawal Complete: Your withdrawal is processed. Check your bank for funds!',
ar: 'اكتمل السحب: تمت معالجة سحبك. تحقق من بنكك للحصول على الأموال!'
});
// Function to send new investment opportunity notification
const sendNewInvestmentOpportunityNotification = async (investmentName, manualDate, manualTime, expectedReturn, playerIds = [], imageUrl = '', additionalData = {}) => {
const title = 'New investment opportunity';
const message = `${investmentName} launching on ${manualDate} at ${manualTime} with an expected return of ${expectedReturn}%. Tap for more details.`;
return await sendNotification(title, message, playerIds, imageUrl, additionalData);
};
// Function to send investment open notification
const sendInvestmentOpenNotification = async (investmentName, playerIds = [], imageUrl = '', additionalData = {}) => {
const title = `${investmentName} is LIVE`;
const message = `${investmentName} is now open for investment! Tap for more details.`;
return await sendNotification(title, message, playerIds, imageUrl, additionalData);
};
// Function to send investment fully subscribed notification
const sendInvestmentFullySubscribedNotification = async (investmentName, playerIds = [], imageUrl = '', additionalData = {}) => {
const title = `${investmentName} fully subscribed`;
const message = `${investmentName} has been fully subscribed and is now closed to new investors.`;
return await sendNotification(title, message, playerIds, imageUrl, additionalData);
};
// Function to send deposit received notification
const sendDepositReceivedNotification = async (playerIds = [], imageUrl = '', additionalData = {}) => {
const title = 'Deposit received';
const message = 'A new deposit has been made into your Tanami wallet. Explore exclusive investment opportunities only at Tanami.';
return await sendNotification(title, message, playerIds, imageUrl, additionalData);
};
// Function to send distribution notice notification
const sendDistributionNoticeNotification = async (investmentName, playerIds = [], imageUrl = '', additionalData = {}) => {
const title = 'Distribution notice';
const message = `New distribution received regarding your investment in ${investmentName}. Tap for more details.`;
return await sendNotification(title, message, playerIds, imageUrl, additionalData);
};
// Function to send KYC approved notification
const sendKYCApprovedNotification = async (playerIds = [], imageUrl = '', additionalData = {}) => {
const title = 'You\'re verified!';
const message = 'KYC approved - You\'re all set to start investing! Tap to explore the latest exclusive opportunities available.';
return await sendNotification(title, message, playerIds, imageUrl, additionalData);
};
// Function to send investor status upgrade notification
const sendInvestorStatusUpgradeNotification = async (playerIds = [], imageUrl = '', additionalData = {}) => {
const title = 'You\'ve been upgraded!';
const message = 'Congrats! You can now enjoy investing with no limits! Tap to explore the latest exclusive opportunities available.';
return await sendNotification(title, message, playerIds, imageUrl, additionalData);
};
// Exporting functions
module.exports = {
getDepositReceivedMessage,
getEducationalMaterialPublishedMessage,
investmentOpportunityCancelled,
investorQualificationUpgrade,
kycStatusApproved,
kycStatusDeclined,
newInvestmentOpportunity,
subscriptionInvestmentClosed,
subscriptionInvestmentUpdated,
withdrawalCompleted,
sendNewInvestmentOpportunityNotification,
sendInvestmentOpenNotification,
sendInvestmentFullySubscribedNotification,
sendDepositReceivedNotification,
sendDistributionNoticeNotification,
sendKYCApprovedNotification,
sendInvestorStatusUpgradeNotification
};