fix(email): add lead acceptance/rejection compatibility methods for customers
This commit is contained in:
parent
1b42cd1f20
commit
a57e344bc4
1 changed files with 43 additions and 0 deletions
|
|
@ -326,6 +326,30 @@ impl Mailer {
|
|||
self.send_html(to, "Lead Request Accepted!", html).await
|
||||
}
|
||||
|
||||
pub async fn send_lead_rejected_email(&self, to: &str, name: &str, requirement_title: &str) -> Result<()> {
|
||||
let frontend_url = env::var("FRONTEND_URL").unwrap_or_else(|_| "https://nxtgauge.com".to_string());
|
||||
let lead_url = format!("{}/dashboard/leads", frontend_url);
|
||||
|
||||
let vars = HashMap::from([
|
||||
("first_name", name),
|
||||
("requirement_title", requirement_title),
|
||||
("lead_url", &lead_url),
|
||||
]);
|
||||
|
||||
// Reuse the lead-expired template as a safe fallback for rejection notifications.
|
||||
let html = self
|
||||
.template_engine
|
||||
.render("lead-expired", vars)
|
||||
.unwrap_or_else(|_| {
|
||||
format!(
|
||||
"<p>Hi {},</p><p>Your lead request for <strong>{}</strong> was rejected.</p><p>You can view details here: <a href=\"{}\">View Leads</a></p>",
|
||||
name, requirement_title, lead_url
|
||||
)
|
||||
});
|
||||
|
||||
self.send_html(to, "Lead Request Rejected", html).await
|
||||
}
|
||||
|
||||
pub async fn send_new_lead_request_email(&self, to: &str, customer_name: &str, requirement_title: &str, professional_name: &str, profession: &str) -> Result<()> {
|
||||
let frontend_url = env::var("FRONTEND_URL").unwrap_or_else(|_| "https://nxtgauge.com".to_string());
|
||||
let now = chrono::Local::now().format("%B %d, %Y at %I:%M %p").to_string();
|
||||
|
|
@ -497,6 +521,25 @@ impl Mailer {
|
|||
).await
|
||||
}
|
||||
|
||||
pub async fn send_lead_accepted_professional_email(
|
||||
&self,
|
||||
to: &str,
|
||||
professional_name: &str,
|
||||
customer_name: &str,
|
||||
customer_email: &str,
|
||||
customer_phone: &str,
|
||||
) -> Result<()> {
|
||||
self.send_html(
|
||||
to,
|
||||
"Customer Contact Details",
|
||||
format!(
|
||||
"<html><body><h1>Customer Contact</h1><p>Hi {},</p><p>Your request for {} was accepted.</p><p>Email: {}</p><p>Phone: {}</p></body></html>",
|
||||
professional_name, customer_name, customer_email, customer_phone
|
||||
),
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn send_manual_credit_email(&self, to: &str, name: &str, amount: i32, reason: &str) -> Result<()> {
|
||||
let frontend_url = env::var("FRONTEND_URL").unwrap_or_else(|_| "https://nxtgauge.com".to_string());
|
||||
let wallet_url = format!("{}/dashboard/wallet", frontend_url);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue