//! Exemplo básico de como consultar _status_ do serviço. use std::env; use fiscalidade::{Ambiente, Dfe, Modelo, Pkcs12Certificate, Uf, WebServices}; #[tokio::main(flavor = "current_thread")] async fn main() -> anyhow::Result<()> { let args: Vec = env::args().collect(); if args.len() != 6 { println!("Uso: "); return Ok(()); } #[cfg(feature = "embed_webservices")] let webservices = WebServices::from_embedded()?; #[cfg(not(feature = "embed_webservices"))] let webservices = WebServices::from_file("resources/webservices.toml").await?; let pkcs12 = Pkcs12Certificate::from_file(&args[1], &args[2]).await?; let dfe = Dfe::new().set_webservices(webservices).set_pkcs12(pkcs12); let xml = dfe .status_servico( Modelo::from_str(&args[3]).unwrap(), Uf::from_str(&args[4]).unwrap(), Ambiente::from_str(&args[5]).unwrap(), ) .await?; println!("XML retornado: {}", xml); Ok(()) }