diff --git a/Cargo.lock b/Cargo.lock index 2b03cd8..11df179 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1451,7 +1451,6 @@ dependencies = [ "toml_edit", "tracing", "tracing-subscriber", - "ureq", "zeroize", ] @@ -3163,20 +3162,6 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" -[[package]] -name = "ureq" -version = "2.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b74fc6b57825be3373f7054754755f03ac3a8f5d70015ccad699ba2029956f4a" -dependencies = [ - "base64", - "log", - "once_cell", - "serde", - "serde_json", - "url", -] - [[package]] name = "url" version = "2.5.2" diff --git a/Cargo.toml b/Cargo.toml index 2c9e934..5a60d65 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,6 @@ axum = { version = "0.7", default-features = false, features = [ "matched-path", ] } tracing-subscriber = { version = "0.3", features = ["env-filter", "time"] } -ureq = { version = "2", default-features = false, features = ["json"] } names = { version = "0.14", default-features = false } tokio-util = { version = "0.7", features = ["rt"] } tokio = { version = "1", features = ["rt-multi-thread", "signal", "time"] } diff --git a/src/callback.rs b/src/callback.rs deleted file mode 100644 index 4e86e6c..0000000 --- a/src/callback.rs +++ /dev/null @@ -1,16 +0,0 @@ -use crate::definitions::api_v2::OrderStatus; -use tokio::task; - -pub const MODULE: &str = module_path!(); - -// TODO: This will be used once we setup callback functionality -#[allow(dead_code)] -pub async fn callback(path: String, order_status: OrderStatus) { - let req = ureq::post(&path); - - task::spawn_blocking(move || { - let _d = req.send_json(order_status).unwrap(); - }) - .await - .unwrap(); -} diff --git a/src/lib.rs b/src/lib.rs index ef3382b..e88eaa1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,4 @@ mod arguments; -mod callback; mod chain; mod database; mod definitions; diff --git a/src/main.rs b/src/main.rs index 9277f91..5e4ff22 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,7 +11,6 @@ use utils::{ }; mod arguments; -mod callback; mod chain; mod database; mod definitions; diff --git a/src/state.rs b/src/state.rs index 8335edc..588e471 100644 --- a/src/state.rs +++ b/src/state.rs @@ -132,13 +132,13 @@ impl State { // Only perform actions if the record is saved in ledger match state.db.mark_paid(id.clone()).await { Ok(order) => { - if let Some(callback) = order.callback.clone() { + if !order.callback.is_empty() { + let callback = order.callback.clone(); tokio::spawn(async move { tracing::info!("Sending callback to: {}", callback); - let client = reqwest::Client::new(); // fire and forget - if let Err(e) = client.get(&callback).send().await { + if let Err(e) = reqwest::Client::new().get(&callback).send().await { tracing::error!("Failed to send callback to {}: {:?}", callback, e); } }); diff --git a/src/utils/logger.rs b/src/utils/logger.rs index 8c75112..2549e36 100644 --- a/src/utils/logger.rs +++ b/src/utils/logger.rs @@ -1,9 +1,8 @@ use super::shutdown; -use crate::{callback, database, error::Error, server}; +use crate::{database, error::Error, server}; use tracing_subscriber::{fmt::time::UtcTime, EnvFilter}; const TARGETS: &[&str] = &[ - callback::MODULE, database::MODULE, server::MODULE, shutdown::MODULE,