From 7c49eb3c366afe8c99cd4f9d204b1b25ea779000 Mon Sep 17 00:00:00 2001 From: Greg Lindstrom Date: Tue, 10 Dec 2024 14:24:18 -0800 Subject: [PATCH] fix: function deprecations and required macro fields --- src/ipn_handler.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ipn_handler.rs b/src/ipn_handler.rs index 68e4120..e77b068 100644 --- a/src/ipn_handler.rs +++ b/src/ipn_handler.rs @@ -10,7 +10,7 @@ use tide::{Body, Response, StatusCode}; use crate::azure_function::{AzureFnLogger, AzureFnLoggerExt}; use crate::{AppRequest, MailchimpQuery, MailchimpResponse}; -#[allow(clippy::upper_case_acronyms)] +#[allow(clippy::upper_case_acronyms, reason = "The struct name uses a naming convention aligned with external API standards")] #[derive(Debug, Deserialize)] struct IPNTransationMessage { txn_id: String, @@ -27,7 +27,7 @@ struct IPNTransationMessage { transaction_subject: Option, } -#[allow(clippy::upper_case_acronyms)] +#[allow(clippy::upper_case_acronyms, reason = "The struct name uses a naming convention aligned with external API standards")] #[derive(Debug, Deserialize)] struct IPNMessageTypeOnly { txn_type: Option, @@ -254,8 +254,8 @@ pub async fn ipn_handler(mut req: AppRequest) -> tide::Result { if let Ok(existing_expire_day) = NaiveDate::parse_from_str(&mc_json.merge_fields.expires, "%Y-%m-%d") { - let existing_expire = existing_expire_day.and_hms(12, 0, 0); - let existing_expire = DateTime::from_utc(existing_expire, Utc); + let existing_expire = existing_expire_day.and_hms_opt(12, 0, 0).expect("Failed to create a NaiveDateTime with the given date and time."); + let existing_expire = DateTime::from_naive_utc_and_offset(existing_expire, Utc); if existing_expire > utc_expires { info!( logger,