diff --git a/.env b/.env index 9357723..3f2886d 100644 --- a/.env +++ b/.env @@ -4,7 +4,7 @@ ACCOUNT_DATABASE_URL=postgres://postgres@localhost/bazzar_accounts CART_DATABASE_URL=postgres://postgres@localhost/bazzar_carts PASS_SALT=18CHwV7eGFAea16z+qMKZg -RUST_LOG=info +RUST_LOG=debug SESSION_SECRET="NEPJs#8jjn8SK8GC7QEC^*P844UgsyEbQB8mRWXkT%3mPrwewZoc25MMby9H#R*w2KzaQgMkk#Pif$kxrLy*N5L!Ch%jxbWoa%gb" JWT_SECRET="42^iFq&ZnQbUf!hwGWXd&CpyY6QQyJmkPU%esFCvne5&Ejcb3nJ4&GyHZp!MArZLf^9*5c6!!VgM$iZ8T%d#&bWTi&xbZk2S@4RN" SIGNATURE=David @@ -15,6 +15,7 @@ PGDATESTYLE= SENDGRID_SECRET=SG.CUWRM-eoQfGJNqSU2bbwkg.NW5aBy5vZueCSOwIIyWUBqq5USChGiwAFrWzreBKvOU SENDGRID_API_KEY=CUWRM-eoQfGJNqSU2bbwkg SMTP_FROM=adrian.wozniak@ita-prog.pl +SD=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 PAYU_CLIENT_ID="145227" PAYU_CLIENT_SECRET="12f071174cb7eb79d4aac5bc2f07563f" diff --git a/Cargo.lock b/Cargo.lock index 09f7846..52966c2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3755,9 +3755,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "sendgrid" -version = "0.17.4" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88afc7511b68247bf469e0dff55eb7ef305aab293211242695fd07cc17e36a78" +checksum = "fd6ba8c048dc4beab827cebc1d54f1007f5ebdfa240812ed6faa89452fd34ba0" dependencies = [ "data-encoding", "reqwest", diff --git a/crates/email_manager/Cargo.toml b/crates/email_manager/Cargo.toml index 0790697..3a66659 100644 --- a/crates/email_manager/Cargo.toml +++ b/crates/email_manager/Cargo.toml @@ -18,7 +18,7 @@ opentelemetry = { version = "0.17.0" } opentelemetry-jaeger = { version = "0.17.0" } pretty_env_logger = { version = "0.4", features = [] } rumqttc = { version = "*" } -sendgrid = { version = "0.17", features = ["async"] } +sendgrid = { version = "0.18.1", features = ["async"] } serde = { version = "1.0", features = ["derive"] } serde_json = { version = "1.0", features = [] } tarpc = { version = "0.30.0", features = ["tokio1", "serde-transport-bincode", "serde-transport", "serde", "serde-transport-json", "tcp"] } @@ -29,4 +29,4 @@ tracing-opentelemetry = { version = "0.17.4" } tracing-subscriber = { version = "0.3.16", features = ["env-filter"] } uuid = { version = "0.8", features = ["serde"] } dotenv = { version = "0.15.0" } -handlebars = { version = "*", features = [] } \ No newline at end of file +handlebars = { version = "*", features = [] } diff --git a/crates/email_manager/assets/welcome.hbs b/crates/email_manager/assets/welcome.hbs index b15b3e1..e33548a 100644 --- a/crates/email_manager/assets/welcome.hbs +++ b/crates/email_manager/assets/welcome.hbs @@ -15,11 +15,11 @@

Hi {{ login }}

- Welcome to {service_name} – we’re excited to have you on board, and we’d love to say thank you on behalf + Welcome to {{ service_name }} – we’re excited to have you on board, and we’d love to say thank you on behalf of our whole company for choosing us.

Take care,

-

{signature}

+

{{ signature }}

diff --git a/crates/email_manager/src/actions.rs b/crates/email_manager/src/actions.rs index d0ea483..d67ad36 100644 --- a/crates/email_manager/src/actions.rs +++ b/crates/email_manager/src/actions.rs @@ -82,6 +82,7 @@ pub async fn welcome(msg: welcome::Input, ctx: SharedContext) -> Result<()> { Error::ResetPassTemplate })?; + tracing::info!("Sending to send mail {}", html); let smtp_from = ctx.config.lock().mail().smtp_from().clone(); let status = ctx .send_grid @@ -95,7 +96,11 @@ pub async fn welcome(msg: welcome::Input, ctx: SharedContext) -> Result<()> { ) .await; - tracing::debug!("{:?}", status); + tracing::info!("status {:?}", status); + + if let Ok(res) = status { + tracing::info!("res status {:?}", res.status()); + } Ok(()) } diff --git a/crates/email_manager/src/mqtt.rs b/crates/email_manager/src/mqtt.rs index f8f7540..fcd280b 100644 --- a/crates/email_manager/src/mqtt.rs +++ b/crates/email_manager/src/mqtt.rs @@ -26,7 +26,7 @@ pub async fn start(config: SharedAppConfig, ctx: SharedContext) { match notification { Ok(Event::Incoming(Incoming::Publish(publish))) => { - tracing::info!("Received publish {:?}", publish.topic); + tracing::info!("accounts received publish {:?}", publish.topic); match publish.topic.as_str() { t if AccountTopic::AccountCreated == t => { on_created(publish, ctx.clone()).await @@ -66,7 +66,7 @@ pub async fn start(config: SharedAppConfig, ctx: SharedContext) { match notification { Ok(Event::Incoming(Incoming::Publish(publish))) => { - tracing::info!("Received publish {:?}", publish.topic); + tracing::info!("emails received publish {:?}", publish.topic); match publish.topic.as_str() { t if EmailTopic::ResetPassword == t => { on_reset(publish, ctx.clone()).await @@ -75,12 +75,12 @@ pub async fn start(config: SharedAppConfig, ctx: SharedContext) { _ => {} } } - Ok(Event::Incoming(inc)) => { - eprintln!("{:?}", inc); - } - Ok(Event::Outgoing(out)) => { - eprintln!("{:?}", out); - } + // Ok(Event::Incoming(_inc)) => { + // eprintln!("{:?}", inc); + // } + // Ok(Event::Outgoing(_out)) => { + // eprintln!("{:?}", out); + // } _ => {} } } @@ -119,12 +119,17 @@ async fn on_reset(publish: Publish, ctx: SharedContext) { } async fn on_test(publish: Publish, ctx: SharedContext) { + tracing::info!("Got test"); if let Some(msg) = emails::Topic::Test.deserialize_payload::(publish.payload) { let msg = test_mail::Input { receiver: msg.email, }; if let Err(e) = actions::test_mail(msg, ctx).await { tracing::error!("{}", e); + } else { + tracing::info!("Test mail done"); } + } else { + tracing::warn!("Invalid payload"); } }