Modify messages
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
import nodemailer from "nodemailer";
|
||||
|
||||
export const offerLetter = async (req, res)=>{
|
||||
|
||||
const employee_name = req.body.firstname + " " + req.body.lastname; // "EMPLOYEE NAME";
|
||||
const signatory_name = req.body.signatory_name;
|
||||
const approve_link = "https://digifi-employer.chiefsoft.net";
|
||||
const approve_password = req.body.signatory_password; //"1234567890";
|
||||
const application_uid = req.body.application_uid;
|
||||
const signatory_email = req.body.signatory_email;
|
||||
|
||||
const mainHtml = `
|
||||
Dear, Banji,
|
||||
|
||||
We are happy to present your loan offer with the details below:
|
||||
|
||||
Loan Offer
|
||||
Loan Amount: N1,000,000
|
||||
Tenor: 12 months
|
||||
Monthly Interest rate: 5%
|
||||
Management Fee (taken upfront): 1%
|
||||
Insurance fee (taken upfront): 1%
|
||||
Installment payment: N112,825.41
|
||||
Next repayment date: February 12, 2025
|
||||
Total repayment: N1,353,904.92
|
||||
Accept Loan Offer
|
||||
|
||||
***Loan Offer Approval (You are to login with this to your portal to approve the loan )
|
||||
|
||||
If you have any questions or concerns about this email, please get in touch with our finance department at processingbank@email.com. Kind Regards,
|
||||
|
||||
Finance team,
|
||||
Processing Bank
|
||||
`;
|
||||
|
||||
try {
|
||||
console.log("verifyEmployer REQ-----------------------------------------");
|
||||
console.log(req.body);
|
||||
console.log("verifyEmployer REQ=========================================");
|
||||
|
||||
const transporter = nodemailer.createTransport({
|
||||
service: "gmail",
|
||||
host: "smtp.gmail.com",
|
||||
port: 587,
|
||||
secure: false,
|
||||
auth: {
|
||||
user: "message@chiefsoft.com",
|
||||
pass: "may12002!",
|
||||
},
|
||||
});
|
||||
// async..await is not allowed in global scope, must use a wrapper
|
||||
async function main() {
|
||||
// send mail with defined transport object
|
||||
const info = await transporter.sendMail({
|
||||
from: '"Support ChiefSoft 👻" <message@chiefsoft.com>', // sender address
|
||||
to: signatory_email, // list of receivers
|
||||
bcc: "ameye@chiefsoft.com, victor.ebuka@chiefsoft.com", // list of receivers
|
||||
subject: "Bank Loan Offer ✔", // Subject line
|
||||
text: "Hello "+signatory_name+"?", // plain text body
|
||||
html: mainHtml, // html body
|
||||
});
|
||||
console.log("Message sent: %s", info.messageId);
|
||||
// Message sent: <d786aa62-4e0a-070a-47ed-0b0666549519@ethereal.email>
|
||||
}
|
||||
main().catch(console.error);
|
||||
|
||||
return res.json({res : 'sent'});
|
||||
|
||||
}
|
||||
catch(error){
|
||||
res.status(500).json({error: "Internal Server error"});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -27,7 +27,7 @@ export const verifyEmployer = async (req, res)=>{
|
||||
"This serves as an employer’s commitment to notify you that your staff (<b>"+employee_name+"</b>) who holds the position of software engineer in your organization took a loan facility from our bank and has prompted us to notify you so as to confirm his existence as a staff of your organization." +
|
||||
" Please click on the link below to confirm this before we can approve his loan\n " +
|
||||
"<br><br>\n" +
|
||||
"***<a href='"+approve_link+"/"+application_uid+"'>Employer commitment link</a> (You are to login with this email address and default password <b> "+approve_password+" </b>)\n " +
|
||||
"***<a href='"+approve_link+"/"+application_uid+"'>Employer commitment link</a> (You are to login with this email address and default password <b> "+approve_password+" </b> )\n " +
|
||||
"<br><br>\n" +
|
||||
"If you have any questions or concerns with respect to this email, please contact our finance department at <b>"+req.body.processing_bank_email+"</b>.\n \n Kind Regards,<br><br>\n" +
|
||||
"Finance team, <br> "+req.body.processing_bank_name+"<br>\n";
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import express from "express"
|
||||
import { fetch } from "../controller/verifyController.js"
|
||||
import { verifyEmployer } from "../controller/verifyEmployer.js"
|
||||
import { offerLetter } from "../controller/offerLetter.js";
|
||||
|
||||
const verify_route = express.Router();
|
||||
verify_route.post("/bvn",fetch);
|
||||
verify_route.post("/employer",verifyEmployer);
|
||||
verify_route.post("/offer",offerLetter);
|
||||
|
||||
export default verify_route;
|
||||
Reference in New Issue
Block a user