-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ses_email): add email services to hyperswitch #2977
Conversation
8ccd80b
to
19fa3fb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than that, looks good to me!
@Chethan-rao Can we also update the API key expiry task to send richer HTML emails, maybe in a separate PR?
hyperswitch/crates/router/src/workflows/api_key_expiry.rs
Lines 63 to 77 in bfa1645
state | |
.email_client | |
.clone() | |
.send_email( | |
email_id.ok_or_else(|| errors::ProcessTrackerError::MissingRequiredField)?, | |
"API Key Expiry Notice".to_string(), | |
format!("Dear Merchant,\n | |
It has come to our attention that your API key will expire in {expires_in} days. To ensure uninterrupted access to our platform and continued smooth operation of your services, we kindly request that you take the necessary actions as soon as possible.\n\n | |
Thanks,\n | |
Team Hyperswitch"), | |
) | |
.await | |
.map_err(|_| errors::ProcessTrackerError::FlowExecutionError { | |
flow: "ApiKeyExpiryWorkflow", | |
})?; |
pub fn get_html_body(email_body: EmailBody) -> String { | ||
match email_body { | ||
EmailBody::Verify { link } => { | ||
format!(include_str!("assets/verify.html"), link = link) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please use tera
instead of using format!()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc: @ThisIsMani
d944ee4
to
fa5090b
Compare
No test cases need to be tested here. |
Type of Change
Description
This PR supports integrating multiple email services with hyperswitch. SES support is added in this PR.
Motivation and Context
There are two traits created in the external_services. In order to implement an email client, The
EmailClient
trait should be implemented.How did you test it?
Checklist
cargo +nightly fmt --all
cargo clippy