pub struct NFeService {
pub cert_path: String,
pub cert_pass: String,
pub uf: String,
pub environment: u8,
}Expand description
Builder fluente para consulta de status do webservice SEFAZ.
§Exemplo
use dfe::NFeService;
let r = NFeService::new()
.cert_path("./cert.pfx")
.cert_pass("senha")
.uf("SP")
.environment(2)
.send()
.await?;
println!("{} — {}", r.c_stat, r.x_motivo);Fields§
§cert_path: StringCaminho do certificado A1 (.pfx).
cert_pass: StringSenha do certificado.
uf: StringSigla da UF (ex.: "SP", "RJ").
environment: u8Ambiente: 1 = Produção · 2 = Homologação.
Implementations§
Source§impl NFeService
impl NFeService
Sourcepub fn environment(self, environment: u8) -> Self
pub fn environment(self, environment: u8) -> Self
Ambiente: 1 = Produção · 2 = Homologação.
Sourcepub fn build(self) -> Result<Self, String>
pub fn build(self) -> Result<Self, String>
Valida os campos sem enviar a requisição. Retorna Err se algum campo obrigatório estiver vazio.
Sourcepub async fn send(self) -> Result<NFeServiceResponse, String>
pub async fn send(self) -> Result<NFeServiceResponse, String>
Consulta o status do webservice SEFAZ e retorna NFeServiceResponse.
§Erros
Retorna Err(String) se a requisição SOAP falhar ou a UF não for suportada.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for NFeService
impl RefUnwindSafe for NFeService
impl Send for NFeService
impl Sync for NFeService
impl Unpin for NFeService
impl UnsafeUnpin for NFeService
impl UnwindSafe for NFeService
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more