Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
feat(themes): Add email configuration support for themes (#7580)
Kanika Bansal7805a20d64b6
diff --git a/config/config.example.toml b/config/config.example.tomlindex c373cabac0..915516ab10 100644--- a/config/config.example.toml+++ b/config/config.example.toml@@ -943,11 +943,11 @@ service = "dynamo" # Service namefile_storage_backend = "file_system" # Theme storage backend to be used[theme.email_config]-entity_name = "Hyperswitch" # Name of the entity to be showed in emails-entity_logo_url = "https://example.com/logo.svg" # Logo URL of the entity to be used in emails-foreground_color = "#000000" # Foreground color of email text-primary_color = "#006DF9" # Primary color of email body-background_color = "#FFFFFF" # Background color of email body+entity_name = "Hyperswitch" # Display name in emails+entity_logo_url = "https://app.hyperswitch.io/email-assets/HyperswitchLogo.png" # Logo URL for emails+foreground_color = "#111326" # Text color+primary_color = "#006DF9" # Primary color+background_color = "#FFFFFF" # Email background color[additional_revenue_recovery_details_call]connectors_with_additional_revenue_recovery_details_call = "stripebilling" # List of connectors which has additional revenue recovery details api-calldiff --git a/config/development.toml b/config/development.tomlindex a61785cd82..944283411d 100644--- a/config/development.toml+++ b/config/development.toml@@ -1007,11 +1007,11 @@ service = "dynamo"file_storage_backend = "file_system" # Theme storage backend to be used[theme.email_config]-entity_name = "Hyperswitch" # Name of the entity to be showed in emails-entity_logo_url = "https://example.com/logo.svg" # Logo URL of the entity to be used in emails-foreground_color = "#000000" # Foreground color of email text-primary_color = "#006DF9" # Primary color of email body-background_color = "#FFFFFF" # Background color of email body+entity_name = "Hyperswitch" # Display name in emails+entity_logo_url = "https://app.hyperswitch.io/email-assets/HyperswitchLogo.png" # Logo URL for emails+foreground_color = "#111326" # Text color+primary_color = "#006DF9" # Primary color+background_color = "#FFFFFF" # Email background color[platform]enabled = truediff --git a/config/docker_compose.toml b/config/docker_compose.tomlindex 0676ffa5e2..f9addd08b6 100644--- a/config/docker_compose.toml+++ b/config/docker_compose.toml@@ -846,11 +846,11 @@ timeout = 10 # Timeout for SMTP connection in secondsconnection = "plaintext" #currently plaintext and starttls are supported[theme.email_config]-entity_name = "Hyperswitch" # Name of the entity to be showed in emails-entity_logo_url = "https://example.com/logo.svg" # Logo URL of the entity to be used in emails-foreground_color = "#000000" # Foreground color of email text-primary_color = "#006DF9" # Primary color of email body-background_color = "#FFFFFF" # Background color of email body+entity_name = "Hyperswitch" # Display name in emails+entity_logo_url = "https://app.hyperswitch.io/email-assets/HyperswitchLogo.png" # Logo URL for emails+foreground_color = "#111326" # Text color+primary_color = "#006DF9" # Primary color+background_color = "#FFFFFF" # Email background color[platform]enabled = truediff --git a/crates/router/src/consts/user.rs b/crates/router/src/consts/user.rsindex 3601f22982..4f681cda25 100644--- a/crates/router/src/consts/user.rs+++ b/crates/router/src/consts/user.rs@@ -38,15 +38,6 @@ pub const REDIS_RECOVERY_CODE_ATTEMPTS_TTL_IN_SECS: i64 = 10 * 60; // 10 minspub const REDIS_SSO_PREFIX: &str = "SSO_";pub const REDIS_SSO_TTL: i64 = 5 * 60; // 5 minutes-/// Email subject-pub const EMAIL_SUBJECT_SIGNUP: &str = "Welcome to the Hyperswitch community!";-pub const EMAIL_SUBJECT_INVITATION: &str = "You have been invited to join Hyperswitch Community!";-pub const EMAIL_SUBJECT_MAGIC_LINK: &str = "Unlock Hyperswitch: Use Your Magic Link to Sign In";-pub const EMAIL_SUBJECT_RESET_PASSWORD: &str = "Get back to Hyperswitch - Reset Your Password Now";-pub const EMAIL_SUBJECT_NEW_PROD_INTENT: &str = "New Prod Intent";-pub const EMAIL_SUBJECT_WELCOME_TO_COMMUNITY: &str =- "Thank you for signing up on Hyperswitch Dashboard!";-pub const DEFAULT_PROFILE_NAME: &str = "default";pub const DEFAULT_PRODUCT_TYPE: common_enums::MerchantProductType =common_enums::MerchantProductType::Orchestration;diff --git a/crates/router/src/core/user.rs b/crates/router/src/core/user.rsindex f0a6df9445..b9ebdf1302 100644--- a/crates/router/src/core/user.rs+++ b/crates/router/src/core/user.rs@@ -86,7 +86,6 @@ pub async fn signup_with_merchant_id(recipient_email: user_from_db.get_email().try_into()?,user_name: domain::UserName::new(user_from_db.get_name())?,settings: state.conf.clone(),- subject: consts::user::EMAIL_SUBJECT_RESET_PASSWORD,auth_id,theme_id: theme.as_ref().map(|theme| theme.theme_id.clone()),theme_config: theme@@ -307,7 +306,6 @@ pub async fn connect_account(recipient_email: domain::UserEmail::from_pii_email(user_from_db.get_email())?,settings: state.conf.clone(),user_name: domain::UserName::new(user_from_db.get_name())?,- subject: consts::user::EMAIL_SUBJECT_MAGIC_LINK,auth_id,theme_id: theme.as_ref().map(|theme| theme.theme_id.clone()),theme_config: theme@@ -363,7 +361,6 @@ pub async fn connect_account(let magic_link_email = email_types::VerifyEmail {recipient_email: domain::UserEmail::from_pii_email(user_from_db.get_email())?,settings: state.conf.clone(),- subject: consts::user::EMAIL_SUBJECT_SIGNUP,auth_id,theme_id: theme.as_ref().map(|theme| theme.theme_id.clone()),theme_config: theme@@ -385,7 +382,6 @@ pub async fn connect_account(if state.tenant.tenant_id.get_string_repr() == common_utils::consts::DEFAULT_TENANT {let welcome_to_community_email = email_types::WelcomeToCommunity {recipient_email: domain::UserEmail::from_pii_email(user_from_db.get_email())?,- subject: consts::user::EMAIL_SUBJECT_WELCOME_TO_COMMUNITY,};let welcome_email_result = state@@ -516,7 +512,6 @@ pub async fn forgot_password(recipient_email: domain::UserEmail::from_pii_email(user_from_db.get_email())?,settings: state.conf.clone(),user_name: domain::UserName::new(user_from_db.get_name())?,- subject: consts::user::EMAIL_SUBJECT_RESET_PASSWORD,auth_id,theme_id: theme.as_ref().map(|theme| theme.theme_id.clone()),theme_config: theme@@ -928,7 +923,6 @@ async fn handle_existing_user_invitation(recipient_email: invitee_email,user_name: domain::UserName::new(invitee_user_from_db.get_name())?,settings: state.conf.clone(),- subject: consts::user::EMAIL_SUBJECT_INVITATION,entity,auth_id: auth_id.clone(),theme_id: theme.as_ref().map(|theme| theme.theme_id.clone()),@@ -1085,7 +1079,6 @@ async fn handle_new_user_invitation(recipient_email: invitee_email,user_name: domain::UserName::new(new_user.get_name())?,settings: state.conf.clone(),- subject: consts::user::EMAIL_SUBJECT_INVITATION,entity,auth_id: auth_id.clone(),theme_id: theme.as_ref().map(|theme| theme.theme_id.clone()),@@ -1237,7 +1230,6 @@ pub async fn resend_invite(recipient_email: invitee_email,user_name: domain::UserName::new(user.get_name())?,settings: state.conf.clone(),- subject: consts::user::EMAIL_SUBJECT_INVITATION,entity: email_types::Entity {entity_id,entity_type,@@ -1896,7 +1888,6 @@ pub async fn send_verification_mail(let email_contents = email_types::VerifyEmail {recipient_email: domain::UserEmail::from_pii_email(user.email)?,settings: state.conf.clone(),- subject: consts::user::EMAIL_SUBJECT_SIGNUP,auth_id,theme_id: theme.as_ref().map(|theme| theme.theme_id.clone()),theme_config: themediff --git a/crates/router/src/services/email/assets/invite.html b/crates/router/src/services/email/assets/invite.htmlindex 9962da0638..0cf3ee1c34 100644--- a/crates/router/src/services/email/assets/invite.html+++ b/crates/router/src/services/email/assets/invite.html@@ -1,118 +1,103 @@<!DOCTYPE html><html lang="en">- <head>- <meta charset="UTF-8" />- <meta name="viewport" content="width=device-width, initial-scale=1.0" />- <meta http-equiv="X-UA-Compatible" content="ie=edge" />- <title>Invite User</title>- </head>- <body- style="- background-color: #f8f9fb;++<head>+ <meta charset="UTF-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />+ <meta http-equiv="X-UA-Compatible" content="ie=edge" />+ <title>Invite User</title>+</head>++<body style="+ background-color: #f8f9fb; /*outer wrapper*/height: 100%;font-family: Arial, Helvetica, sans-serif;- "- >- <div- style="+ ">+ <div style="width: 100%;margin: auto;text-align: center;- background-color: #f8f9fb;- "- >- <table style="text-align: center; width: 100%">- <tr>- <td style="height: 6px"></td>- </tr>- <tr>- <td style="text-align: center">- <table- style="- background-color: #ffffff;+ background-color: #f8f9fb; /*outer wrapper*/+ ">+ <table style="text-align: center; width: 100%">+ <tr>+ <td style="height: 6px"></td>+ </tr>+ <tr>+ <td style="text-align: center">+ <table style="+ background-color: {background_color};text-align: center;max-width: 55%;margin: auto;- "- >- <tr>- <td style="height: 20px"></td>- </tr>- <tr>- <td>- <table style="width: 100%">- <tr>- <td style="text-align: center">- <img- src="https://app.hyperswitch.io/email-assets/HyperswitchLogo.png"- alt="Hyperswitch"- style="+ ">+ <tr>+ <td style="height: 20px"></td>+ </tr>+ <tr>+ <td>+ <table style="width: 100%">+ <tr>+ <td style="text-align: center">+ <img src={entity_logo_url} alt={entity_name} style="text-align: center;- height: 1.3rem;- width: auto;- "- />- </td>- </tr>- </table>- </td>- </tr>- <tr>- <td style="height: 40px"></td>- </tr>- <tr>- <td- style="+ height: auto;+ width: 4rem;+ " />+ </td>+ </tr>+ </table>+ </td>+ </tr>+ <tr>+ <td style="height: 40px"></td>+ </tr>+ <tr>+ <td style="font-size: 2.02rem;font-weight: 600;line-height: 2.5rem;- color: #111326;+ color: {foreground_color};min-width: 550px;- "- >- Welcome to Hyperswitch!- </td>- </tr>- <tr>- <td style="height: 10px"></td>- </tr>- <tr>- <td- style="- color: #666666;+ ">+ Welcome to {entity_name}!+ </td>+ </tr>+ <tr>+ <td style="height: 10px"></td>+ </tr>+ <tr>+ <td style="+ color: {foreground_color};+ opacity:0.8;width: 50%;font-size: 1.02rem;font-weight: 400;line-height: 1.4rem;min-width: 300px;- "- >- <table- style="+ ">+ <table style="width: 50%;min-width: 440px;text-align: center;margin: auto;- "- >- <tr>- <td>- Hi {username}, you have received this email because your- administrator has invited you as a new user on- Hyperswitch.- </td>- </tr>- </table>- </td>- </tr>- <tr>- <td style="height: 30px"></td>- </tr>- <tr>- <td>- <a- href="{link}"- style="+ ">+ <tr>+ <td>+ Hi {username}, you have received this email because your+ administrator has invited you as a new user on+ {entity_name}.+ </td>+ </tr>+ </table>+ </td>+ </tr>+ <tr>+ <td style="height: 30px"></td>+ </tr>+ <tr>+ <td>+ <a href="{link}" style="text-decoration: none;border: none;border-radius: 64px;@@ -122,108 +107,55 @@line-height: 1.5rem;width: 50%;padding: 0.9rem 4rem;- background: #0070ff;+ background: {primary_color};min-width: 18rem;max-width: 25rem;cursor: pointer;- "- >- Click here to join- </a>- </td>- </tr>- <tr>- <td style="height: 30px"></td>- </tr>- <tr>- <td- style="- color: #666666;+ ">+ Click here to join+ </a>+ </td>+ </tr>+ <tr>+ <td style="height: 30px"></td>+ </tr>+ <tr>+ <td style="+ color: {foreground_color};+ opacity:0.8;width: 50%;font-size: 1.02rem;font-weight: 400;line-height: 1.4rem;min-width: 300px;- "- >- <table- style="+ ">+ <table style="width: 50%;min-width: 500px;text-align: center;margin: auto;- "- >- <tr>- <td>- If the link has already expired, you can request a new- link from your administrator or reach out to your- internal support for more assistance.- </td>- </tr>- </table>- </td>- </tr>- <tr>- <td style="height: 50px"></td>- </tr>- <tr>- <td- style="- font-size: 12px;- line-height: 1rem;- font-weight: 400;- color: #111326b2;- "- >- Follow us on- </td>- </tr>- <tr>- <td style="font-size: 0">- <a- href="https://github.com/juspay/hyperswitch"- target="_blank"- >- <img- src="https://app.hyperswitch.io/email-assets/Github.png"- alt="Github"- height="15"- />- </a>- <a- href="https://x.com/hyperswitchio?s=21"- target="_blank"- style="margin: 0 6px 0"- >- <img- src="https://app.hyperswitch.io/email-assets/Twitter.png"- alt="Twitter"- height="15"- />- </a>- <a- href="https://www.linkedin.com/company/hyperswitch/"- target="_blank"- >- <img- src="https://app.hyperswitch.io/email-assets/Linkedin-Dark.png"- alt="LinkedIn"- height="15"- />- </a>- </td>- </tr>- <tr>- <td style="height: 20px"></td>- </tr>- </table>- </td>- </tr>- <tr>- <td style="height: 6px"></td>- </tr>- </table>- </div>- </body>-</html>+ ">+ <tr>+ <td>+ If the link has already expired, you can request a new+ link from your administrator or reach out to your+ internal support for more assistance.+ </td>+ </tr>+ </table>+ </td>+ </tr>+ <tr>+ <td style="height: 70px"></td>+ </tr>+ </table>+ </td>+ </tr>+ <tr>+ <td style="height: 6px"></td>+ </tr>+ </table>+ </div>+</body>++</html>\ No newline at end of filediff --git a/crates/router/src/services/email/assets/magic_link.html b/crates/router/src/services/email/assets/magic_link.htmlindex 7cb474b52c..6bd530c2e9 100644--- a/crates/router/src/services/email/assets/magic_link.html+++ b/crates/router/src/services/email/assets/magic_link.html@@ -1,117 +1,103 @@<!DOCTYPE html><html lang="en">- <head>- <meta charset="UTF-8" />- <meta name="viewport" content="width=device-width, initial-scale=1.0" />- <meta http-equiv="X-UA-Compatible" content="ie=edge" />- <title>Login to Hyperswitch</title>- </head>- <body- style="- background-color: #f8f9fb;++<head>+ <meta charset="UTF-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />+ <meta http-equiv="X-UA-Compatible" content="ie=edge" />+ <title>Login to {entity_name}</title>+</head>+++<body style="+ background-color: #f8f9fb; /*outer wrapper*/height: 100%;font-family: Arial, Helvetica, sans-serif;- "- >- <div- style="+ ">+ <div style="width: 100%;margin: auto;text-align: center;- background-color: #f8f9fb;- "- >- <table style="text-align: center; width: 100%">- <tr>- <td style="height: 6px"></td>- </tr>- <tr>- <td style="text-align: center">- <table- style="- background-color: #ffffff;+ background-color: #f8f9fb; /*outer wrapper*/+ ">+ <table style="text-align: center; width: 100%">+ <tr>+ <td style="height: 6px"></td>+ </tr>+ <tr>+ <td style="text-align: center">+ <table style="+ background-color: {background_color};text-align: center;max-width: 55%;margin: auto;- "- >- <tr>- <td style="height: 20px"></td>- </tr>- <tr>- <td>- <table style="width: 100%">- <tr>- <td style="text-align: center">- <img- src="https://app.hyperswitch.io/email-assets/HyperswitchLogo.png"- alt="Hyperswitch"- style="+ ">+ <tr>+ <td style="height: 20px"></td>+ </tr>+ <tr>+ <td>+ <table style="width: 100%">+ <tr>+ <td style="text-align: center">+ <img src={entity_logo_url} alt={entity_name} style="text-align: center;- height: 1.3rem;- width: auto;- "- />- </td>- </tr>- </table>- </td>- </tr>- <tr>- <td style="height: 40px"></td>- </tr>- <tr>- <td- style="+ height: auto;+ width: 4rem;+ " />+ </td>+ </tr>+ </table>+ </td>+ </tr>+ <tr>+ <td style="height: 40px"></td>+ </tr>+ <tr>+ <td style="font-size: 2.02rem;font-weight: 600;line-height: 2.5rem;- color: #111326;+ color: {foreground_color};min-width: 550px;- "- >- Welcome to Hyperswitch!- </td>- </tr>- <tr>- <td style="height: 10px"></td>- </tr>- <tr>- <td- style="- color: #666666;+ ">+ Welcome to {entity_name}!+ </td>+ </tr>+ <tr>+ <td style="height: 10px"></td>+ </tr>+ <tr>+ <td style="+ color: {foreground_color};+ opacity:0.8;width: 50%;font-size: 1.02rem;font-weight: 400;line-height: 1.4rem;min-width: 300px;- "- >- <table- style="+ ">+ <table style="width: 50%;min-width: 350px;text-align: center;margin: auto;- "- >- <tr>- <td>- Dear {username}, we are thrilled to welcome you into our- community!- </td>- </tr>- </table>- </td>- </tr>- <tr>- <td style="height: 30px"></td>- </tr>- <tr>- <td>- <a- href="{link}"- style="+ ">+ <tr>+ <td>+ Dear {username}, we are thrilled to welcome you into our+ community!+ </td>+ </tr>+ </table>+ </td>+ </tr>+ <tr>+ <td style="height: 30px"></td>+ </tr>+ <tr>+ <td>+ <a href="{link}" style="text-decoration: none;border: none;border-radius: 64px;@@ -121,108 +107,55 @@line-height: 1.5rem;width: 50%;padding: 0.9rem 3.5rem;- background: #0070ff;+ background: {primary_color};min-width: 18rem;max-width: 25rem;cursor: pointer;- "- >- Unlock Hyperswitch- </a>- </td>- </tr>- <tr>- <td style="height: 30px"></td>- </tr>- <tr>- <td- style="- color: #666666;+ ">+ Unlock {entity_name}+ </a>+ </td>+ </tr>+ <tr>+ <td style="height: 30px"></td>+ </tr>+ <tr>+ <td style="+ color: {foreground_color};+ opacity:0.8;width: 50%;font-size: 1.02rem;font-weight: 400;line-height: 1.4rem;min-width: 300px;- "- >- <table- style="+ ">+ <table style="width: 50%;min-width: 500px;text-align: center;margin: auto;- "- >- <tr>- <td>- This link provides instant access to Hyperswitch- account. It will expire in 24 hours and can only be used- once.- </td>- </tr>- </table>- </td>- </tr>- <tr>- <td style="height: 50px"></td>- </tr>- <tr>- <td- style="- font-size: 12px;- line-height: 1rem;- font-weight: 400;- color: #111326b2;- "- >- Follow us on- </td>- </tr>- <tr>- <td style="font-size: 0">- <a- href="https://github.com/juspay/hyperswitch"- target="_blank"- >- <img- src="https://app.hyperswitch.io/email-assets/Github.png"- alt="Github"- height="15"- />- </a>- <a- href="https://x.com/hyperswitchio?s=21"- target="_blank"- style="margin: 0 6px 0"- >- <img- src="https://app.hyperswitch.io/email-assets/Twitter.png"- alt="Twitter"- height="15"- />- </a>- <a- href="https://www.linkedin.com/company/hyperswitch/"- target="_blank"- >- <img- src="https://app.hyperswitch.io/email-assets/Linkedin-Dark.png"- alt="LinkedIn"- height="15"- />- </a>- </td>- </tr>- <tr>- <td style="height: 20px"></td>- </tr>- </table>- </td>- </tr>- <tr>- <td style="height: 6px"></td>- </tr>- </table>- </div>- </body>-</html>+ ">+ <tr>+ <td>+ This link provides instant access to {entity_name}+ account. It will expire in 24 hours and can only be used+ once.+ </td>+ </tr>+ </table>+ </td>+ </tr>+ <tr>+ <td style="height: 70px"></td>+ </tr>+ </table>+ </td>+ </tr>+ <tr>+ <td style="height: 6px"></td>+ </tr>+ </table>+ </div>+</body>++</html>\ No newline at end of filediff --git a/crates/router/src/services/email/assets/reset.html b/crates/router/src/services/email/assets/reset.htmlindex 23eadbeb06..3f2283c0c1 100644--- a/crates/router/src/services/email/assets/reset.html+++ b/crates/router/src/services/email/assets/reset.html@@ -1,147 +1,129 @@<!DOCTYPE html><html lang="en">- <head>- <meta charset="UTF-8" />- <meta name="viewport" content="width=device-width, initial-scale=1.0" />- <meta http-equiv="X-UA-Compatible" content="ie=edge" />- <title>Reset Password</title>- </head>- <body- style="- background-color: #f8f9fb;++<head>+ <meta charset="UTF-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />+ <meta http-equiv="X-UA-Compatible" content="ie=edge" />+ <title>Reset Password</title>+</head>++<body style="+ background-color: #f8f9fb; /*outer wrapper*/height: 100%;font-family: Arial, Helvetica, sans-serif;- "- >- <div- style="+ ">+ <div style="width: 100%;margin: auto;text-align: center;- background-color: #f8f9fb;- "- >- <table style="text-align: center; width: 100%">- <tr>- <td style="height: 6px"></td>- </tr>- <tr>- <td style="text-align: center">- <table- style="- background-color: #ffffff;+ background-color: #f8f9fb; /*outer wrapper*/+ ">+ <table style="text-align: center; width: 100%">+ <tr>+ <td style="height: 6px"></td>+ </tr>+ <tr>+ <td style="text-align: center">+ <table style="+ background-color: {background_color};text-align: center;max-width: 55%;margin: auto;- "- >- <tr>- <td style="height: 20px"></td>- </tr>- <tr>- <td>- <table style="width: 100%">- <tr>- <td style="text-align: center">- <img- src="https://app.hyperswitch.io/email-assets/HyperswitchLogo.png"- alt="Hyperswitch"- style="+ ">+ <tr>+ <td style="height: 20px"></td>+ </tr>+ <tr>+ <td>+ <table style="width: 100%">+ <tr>+ <td style="text-align: center">+ <img src={entity_logo_url} alt={entity_name} style="text-align: center;- height: 1.3rem;- width: auto;- "- />- </td>- </tr>- </table>- </td>- </tr>- <tr>- <td style="height: 40px"></td>- </tr>- <tr>- <td- style="+ height: auto;+ width: 4rem;+ " />+ </td>+ </tr>+ </table>+ </td>+ </tr>+ <tr>+ <td style="height: 40px"></td>+ </tr>+ <tr>+ <td style="font-size: 2.02rem;font-weight: 600;line-height: 2.5rem;- color: #111326;+ color: {foreground_color};min-width: 550px;- "- >- Reset password!- </td>- </tr>- <tr>- <td style="height: 10px"></td>- </tr>- <tr>- <td- style="- color: #666666;+ ">+ Reset password!+ </td>+ </tr>+ <tr>+ <td style="height: 10px"></td>+ </tr>+ <tr>+ <td style="+ color: {foreground_color};+ opacity:0.8;width: 50%;font-size: 1.02rem;font-weight: 400;line-height: 1.4rem;min-width: 300px;- "- >- <table- style="+ ">+ <table style="width: 50%;min-width: 450px;text-align: center;margin: auto;- "- >- <tr>- <td>- We have received a request to reset your password- associated with- <span style="font-weight: bold"> username : </span>- {username}- </td>- </tr>- </table>- </td>- </tr>- <tr>- <td style="height: 10px"></td>- </tr>- <tr>- <td- style="- color: #666666;+ ">+ <tr>+ <td>+ We have received a request to reset your password+ associated with+ <span style="font-weight: bold"> username : </span>+ {username}+ </td>+ </tr>+ </table>+ </td>+ </tr>+ <tr>+ <td style="height: 10px"></td>+ </tr>+ <tr>+ <td style="+ color: {foreground_color};+ opacity:0.8;width: 50%;font-size: 1.02rem;font-weight: 400;line-height: 1.4rem;min-width: 300px;- "- >- <table- style="+ ">+ <table style="width: 50%;min-width: 370px;text-align: center;margin: auto;- "- >- <tr>- <td>Click on the below button to reset your password.</td>- </tr>- </table>- </td>- </tr>- <tr>- <td style="height: 30px"></td>- </tr>- <tr>- <td>- <a- href="{link}"- style="+ ">+ <tr>+ <td>Click on the below button to reset your password.</td>+ </tr>+ </table>+ </td>+ </tr>+ <tr>+ <td style="height: 30px"></td>+ </tr>+ <tr>+ <td>+ <a href="{link}" style="text-decoration: none;border: none;border-radius: 64px;@@ -151,76 +133,26 @@line-height: 1.5rem;width: 50%;padding: 0.9rem 4rem;- background: #0070ff;+ background: {primary_color};min-width: 18rem;max-width: 25rem;cursor: pointer;- "- >- Reset Password- </a>- </td>- </tr>- <tr>- <td style="height: 70px"></td>- </tr>- <tr>- <td- style="- font-size: 12px;- line-height: 1rem;- font-weight: 400;- color: #111326b2;- "- >- Follow us on- </td>- </tr>- <tr>- <td style="font-size: 0">- <a- href="https://github.com/juspay/hyperswitch"- target="_blank"- >- <img- src="https://app.hyperswitch.io/email-assets/Github.png"- alt="Github"- height="15"- />- </a>- <a- href="https://x.com/hyperswitchio?s=21"- target="_blank"- style="margin: 0 6px 0"- >- <img- src="https://app.hyperswitch.io/email-assets/Twitter.png"- alt="Twitter"- height="15"- />- </a>- <a- href="https://www.linkedin.com/company/hyperswitch/"- target="_blank"- >- <img- src="https://app.hyperswitch.io/email-assets/Linkedin-Dark.png"- alt="LinkedIn"- height="15"- />- </a>- </td>- </tr>- <tr>- <td style="height: 20px"></td>- </tr>- </table>- </td>- </tr>- <tr>- <td style="height: 6px"></td>- </tr>- </table>- </div>- </body>-</html>+ ">+ Reset Password+ </a>+ </td>+ </tr>+ <tr>+ <td style="height: 70px"></td>+ </tr>+ </table>+ </td>+ </tr>+ <tr>+ <td style="height: 6px"></td>+ </tr>+ </table>+ </div>+</body>++</html>\ No newline at end of filediff --git a/crates/router/src/services/email/assets/verify.html b/crates/router/src/services/email/assets/verify.htmlindex 718e7446ec..fa19089544 100644--- a/crates/router/src/services/email/assets/verify.html+++ b/crates/router/src/services/email/assets/verify.html@@ -1,117 +1,102 @@<!DOCTYPE html><html lang="en">- <head>- <meta charset="UTF-8" />- <meta name="viewport" content="width=device-width, initial-scale=1.0" />- <meta http-equiv="X-UA-Compatible" content="ie=edge" />- <title>Verify Email</title>- </head>- <body- style="- background-color: #f8f9fb;++<head>+ <meta charset="UTF-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />+ <meta http-equiv="X-UA-Compatible" content="ie=edge" />+ <title>Verify Email</title>+</head>++<body style="+ background-color: #f8f9fb; /*outer wrapper*/height: 100%;font-family: Arial, Helvetica, sans-serif;- "- >- <div- style="+ ">+ <div style="width: 100%;margin: auto;text-align: center;- background-color: #f8f9fb;- "- >- <table style="text-align: center; width: 100%">- <tr>- <td style="height: 6px"></td>- </tr>- <tr>- <td style="text-align: center">- <table- style="- background-color: #ffffff;+ background-color: #f8f9fb; /*outer wrapper*/+ ">+ <table style="text-align: center; width: 100%">+ <tr>+ <td style="height: 6px"></td>+ </tr>+ <tr>+ <td style="text-align: center">+ <table style="+ background-color: {background_color};text-align: center;min-width: 55%;margin: auto;padding: 0 13px;- "- >- <tr>- <td style="height: 20px"></td>- </tr>- <tr>- <td>- <table style="width: 100%">- <tr>- <td style="text-align: center">- <img- src="https://app.hyperswitch.io/email-assets/HyperswitchLogo.png"- alt="Hyperswitch"- style="+ ">+ <tr>+ <td style="height: 20px"></td>+ </tr>+ <tr>+ <td>+ <table style="width: 100%">+ <tr>+ <td style="text-align: center">+ <img src={entity_logo_url} alt={entity_name} style="text-align: center;- height: 1.3rem;- width: auto;- "- />- </td>- </tr>- </table>- </td>- </tr>- <tr>- <td style="height: 40px"></td>- </tr>- <tr>- <td- style="+ height: auto;+ width: 4rem;+ " />+ </td>+ </tr>+ </table>+ </td>+ </tr>+ <tr>+ <td style="height: 40px"></td>+ </tr>+ <tr>+ <td style="font-size: 2.01rem;font-weight: 600;line-height: 2.5rem;- color: #111326;+ color: {foreground_color};min-width: 500px;- "- >- Thanks for signing up with Hyperswitch!- </td>- </tr>- <tr>- <td style="height: 10px"></td>- </tr>- <tr>- <td- style="- color: #666666;+ ">+ Thanks for signing up with {entity_name}!+ </td>+ </tr>+ <tr>+ <td style="height: 10px"></td>+ </tr>+ <tr>+ <td style="+ color: {foreground_color};+ opacity:0.8;font-size: 1.02rem;font-weight: 400;line-height: 1.4rem;min-width: 450px;- "- >- <table- style="+ ">+ <table style="width: 50%;min-width: 350px;text-align: center;margin: auto;- "- >- <tr>- <td>- Confirm your email address to complete your registration- by clicking the button below.- </td>- </tr>- </table>- </td>- </tr>- <tr>- <td style="height: 30px"></td>- </tr>- <tr>- <td>- <a- href="{link}"- style="+ ">+ <tr>+ <td>+ Confirm your email address to complete your registration+ by clicking the button below.+ </td>+ </tr>+ </table>+ </td>+ </tr>+ <tr>+ <td style="height: 30px"></td>+ </tr>+ <tr>+ <td>+ <a href="{link}" style="text-decoration: none;border: none;border-radius: 64px;@@ -121,74 +106,24 @@line-height: 1.5rem;width: 55%;padding: 1rem 3rem;- background: #0070ff;+ background: {primary_color};min-width: 18rem;- "- >- Confirm your email address- </a>- </td>- </tr>- <tr>- <td style="height: 70px"></td>- </tr>- <tr>- <td- style="- font-size: 12px;- line-height: 1rem;- font-weight: 400;- color: #111326b2;- "- >- Follow us on- </td>- </tr>- <tr>- <td style="font-size: 0">- <a- href="https://github.com/juspay/hyperswitch"- target="_blank"- >- <img- src="https://app.hyperswitch.io/email-assets/Github.png"- alt="Github"- height="15"- />- </a>- <a- href="https://x.com/hyperswitchio?s=21"- target="_blank"- style="margin: 0 6px 0"- >- <img- src="https://app.hyperswitch.io/email-assets/Twitter.png"- alt="Twitter"- height="15"- />- </a>- <a- href="https://www.linkedin.com/company/hyperswitch/"- target="_blank"- >- <img- src="https://app.hyperswitch.io/email-assets/Linkedin-Dark.png"- alt="LinkedIn"- height="15"- />- </a>- </td>- </tr>- <tr>- <td style="height: 20px"></td>- </tr>- </table>- </td>- </tr>- <tr>- <td style="height: 6px"></td>- </tr>- </table>- </div>- </body>-</html>+ ">+ Confirm your email address+ </a>+ </td>+ </tr>+ <tr>+ <td style="height: 70px"></td>+ </tr>+ </table>+ </td>+ </tr>+ <tr>+ <td style="height: 6px"></td>+ </tr>+ </table>+ </div>+</body>++</html>\ No newline at end of filediff --git a/crates/router/src/services/email/types.rs b/crates/router/src/services/email/types.rsindex 1b88f64867..5f611bc1b3 100644--- a/crates/router/src/services/email/types.rs+++ b/crates/router/src/services/email/types.rs@@ -16,22 +16,47 @@ use crate::{pub enum EmailBody {Verify {link: String,+ entity_name: String,+ entity_logo_url: String,+ primary_color: String,+ background_color: String,+ foreground_color: String,},Reset {link: String,user_name: String,+ entity_name: String,+ entity_logo_url: String,+ primary_color: String,+ background_color: String,+ foreground_color: String,},MagicLink {link: String,user_name: String,+ entity_name: String,+ entity_logo_url: String,+ primary_color: String,+ background_color: String,+ foreground_color: String,},InviteUser {link: String,user_name: String,+ entity_name: String,+ entity_logo_url: String,+ primary_color: String,+ background_color: String,+ foreground_color: String,},AcceptInviteFromEmail {link: String,user_name: String,+ entity_name: String,+ entity_logo_url: String,+ primary_color: String,+ background_color: String,+ foreground_color: String,},BizEmailProd {user_name: String,@@ -62,36 +87,104 @@ pub mod html {pub fn get_html_body(email_body: EmailBody) -> String {match email_body {- EmailBody::Verify { link } => {- format!(include_str!("assets/verify.html"), link = link)+ EmailBody::Verify {+ link,+ entity_name,+ entity_logo_url,+ primary_color,+ background_color,+ foreground_color,+ } => {+ format!(+ include_str!("assets/verify.html"),+ link = link,+ entity_name = entity_name,+ entity_logo_url = entity_logo_url,+ primary_color = primary_color,+ background_color = background_color,+ foreground_color = foreground_color+ )}- EmailBody::Reset { link, user_name } => {+ EmailBody::Reset {+ link,+ user_name,+ entity_name,+ entity_logo_url,+ primary_color,+ background_color,+ foreground_color,+ } => {format!(include_str!("assets/reset.html"),link = link,- username = user_name+ username = user_name,+ entity_name = entity_name,+ entity_logo_url = entity_logo_url,+ primary_color = primary_color,+ background_color = background_color,+ foreground_color = foreground_color)}- EmailBody::MagicLink { link, user_name } => {+ EmailBody::MagicLink {+ link,+ user_name,+ entity_name,+ entity_logo_url,+ primary_color,+ background_color,+ foreground_color,+ } => {format!(include_str!("assets/magic_link.html"),username = user_name,- link = link+ link = link,+ entity_name = entity_name,+ entity_logo_url = entity_logo_url,+ primary_color = primary_color,+ background_color = background_color,+ foreground_color = foreground_color)}- EmailBody::InviteUser { link, user_name } => {++ EmailBody::InviteUser {+ link,+ user_name,+ entity_name,+ entity_logo_url,+ primary_color,+ background_color,+ foreground_color,+ } => {format!(include_str!("assets/invite.html"),username = user_name,- link = link+ link = link,+ entity_name = entity_name,+ entity_logo_url = entity_logo_url,+ primary_color = primary_color,+ background_color = background_color,+ foreground_color = foreground_color)}// TODO: Change the linked html for accept invite from email- EmailBody::AcceptInviteFromEmail { link, user_name } => {+ EmailBody::AcceptInviteFromEmail {+ link,+ user_name,+ entity_name,+ entity_logo_url,+ primary_color,+ background_color,+ foreground_color,+ } => {format!(include_str!("assets/invite.html"),username = user_name,- link = link+ link = link,+ entity_name = entity_name,+ entity_logo_url = entity_logo_url,+ primary_color = primary_color,+ background_color = background_color,+ foreground_color = foreground_color)}EmailBody::ReconActivation { user_name } => {@@ -236,7 +329,6 @@ pub fn get_base_url(state: &SessionState) -> &str {pub struct VerifyEmail {pub recipient_email: domain::UserEmail,pub settings: std::sync::Arc<configs::Settings>,- pub subject: &'static str,pub auth_id: Option<String>,pub theme_id: Option<String>,pub theme_config: EmailThemeConfig,@@ -265,10 +357,18 @@ impl EmailData for VerifyEmail {let body = html::get_html_body(EmailBody::Verify {link: verify_email_link,+ entity_name: self.theme_config.entity_name.clone(),+ entity_logo_url: self.theme_config.entity_logo_url.clone(),+ primary_color: self.theme_config.primary_color.clone(),+ background_color: self.theme_config.background_color.clone(),+ foreground_color: self.theme_config.foreground_color.clone(),});Ok(EmailContents {- subject: self.subject.to_string(),+ subject: format!(+ "Welcome to the {} community!",+ self.theme_config.entity_name+ ),body: external_services::email::IntermediateString::new(body),recipient: self.recipient_email.clone().into_inner(),})@@ -279,7 +379,6 @@ pub struct ResetPassword {pub recipient_email: domain::UserEmail,pub user_name: domain::UserName,pub settings: std::sync::Arc<configs::Settings>,- pub subject: &'static str,pub auth_id: Option<String>,pub theme_id: Option<String>,pub theme_config: EmailThemeConfig,@@ -308,10 +407,18 @@ impl EmailData for ResetPassword {let body = html::get_html_body(EmailBody::Reset {link: reset_password_link,user_name: self.user_name.clone().get_secret().expose(),+ entity_name: self.theme_config.entity_name.clone(),+ entity_logo_url: self.theme_config.entity_logo_url.clone(),+ primary_color: self.theme_config.primary_color.clone(),+ background_color: self.theme_config.background_color.clone(),+ foreground_color: self.theme_config.foreground_color.clone(),});Ok(EmailContents {- subject: self.subject.to_string(),+ subject: format!(+ "Get back to {} - Reset Your Password Now!",+ self.theme_config.entity_name+ ),body: external_services::email::IntermediateString::new(body),recipient: self.recipient_email.clone().into_inner(),})@@ -322,7 +429,6 @@ pub struct MagicLink {pub recipient_email: domain::UserEmail,pub user_name: domain::UserName,pub settings: std::sync::Arc<configs::Settings>,- pub subject: &'static str,pub auth_id: Option<String>,pub theme_id: Option<String>,pub theme_config: EmailThemeConfig,@@ -351,10 +457,18 @@ impl EmailData for MagicLink {let body = html::get_html_body(EmailBody::MagicLink {link: magic_link_login,user_name: self.user_name.clone().get_secret().expose(),+ entity_name: self.theme_config.entity_name.clone(),+ entity_logo_url: self.theme_config.entity_logo_url.clone(),+ primary_color: self.theme_config.primary_color.clone(),+ background_color: self.theme_config.background_color.clone(),+ foreground_color: self.theme_config.foreground_color.clone(),});Ok(EmailContents {- subject: self.subject.to_string(),+ subject: format!(+ "Unlock {}: Use Your Magic Link to Sign In",+ self.theme_config.entity_name+ ),body: external_services::email::IntermediateString::new(body),recipient: self.recipient_email.clone().into_inner(),})@@ -365,7 +479,6 @@ pub struct InviteUser {pub recipient_email: domain::UserEmail,pub user_name: domain::UserName,pub settings: std::sync::Arc<configs::Settings>,- pub subject: &'static str,pub entity: Entity,pub auth_id: Option<String>,pub theme_id: Option<String>,@@ -394,10 +507,18 @@ impl EmailData for InviteUser {let body = html::get_html_body(EmailBody::AcceptInviteFromEmail {link: invite_user_link,user_name: self.user_name.clone().get_secret().expose(),+ entity_name: self.theme_config.entity_name.clone(),+ entity_logo_url: self.theme_config.entity_logo_url.clone(),+ primary_color: self.theme_config.primary_color.clone(),+ background_color: self.theme_config.background_color.clone(),+ foreground_color: self.theme_config.foreground_color.clone(),});Ok(EmailContents {- subject: self.subject.to_string(),+ subject: format!(+ "You have been invited to join {} Community!",+ self.theme_config.entity_name+ ),body: external_services::email::IntermediateString::new(body),recipient: self.recipient_email.clone().into_inner(),})@@ -435,7 +556,6 @@ pub struct BizEmailProd {pub business_location: String,pub business_website: String,pub settings: std::sync::Arc<configs::Settings>,- pub subject: &'static str,pub theme_id: Option<String>,pub theme_config: EmailThemeConfig,}@@ -452,7 +572,6 @@ impl BizEmailProd {state.conf.email.prod_intent_recipient_email.clone(),)?,settings: state.conf.clone(),- subject: consts::user::EMAIL_SUBJECT_NEW_PROD_INTENT,user_name: data.poc_name.unwrap_or_default().into(),poc_email: data.poc_email.unwrap_or_default(),legal_business_name: data.legal_business_name.unwrap_or_default(),@@ -479,7 +598,7 @@ impl EmailData for BizEmailProd {});Ok(EmailContents {- subject: self.subject.to_string(),+ subject: "New Prod Intent".to_string(),body: external_services::email::IntermediateString::new(body),recipient: self.recipient_email.clone().into_inner(),})@@ -548,7 +667,6 @@ impl EmailData for ApiKeyExpiryReminder {pub struct WelcomeToCommunity {pub recipient_email: domain::UserEmail,- pub subject: &'static str,}#[async_trait::async_trait]@@ -557,7 +675,7 @@ impl EmailData for WelcomeToCommunity {let body = html::get_html_body(EmailBody::WelcomeToCommunity);Ok(EmailContents {- subject: self.subject.to_string(),+ subject: "Thank you for signing up on Hyperswitch Dashboard!".to_string(),body: external_services::email::IntermediateString::new(body),recipient: self.recipient_email.clone().into_inner(),})