Skip to main content

attach_b2b

Function attach_b2b 

Source
pub fn attach_b2b(
    nfe_proc_xml: &str,
    b2b_xml: &str,
    tag_b2b: Option<&str>,
) -> Result<String, FiscalError>
Expand description

Attach a B2B financial tag to an authorized <nfeProc> XML, wrapping both in a <nfeProcB2B> element.

§Arguments

  • nfe_proc_xml - The authorized nfeProc XML.
  • b2b_xml - The B2B financial XML (must contain the tag_b2b element).
  • tag_b2b - Optional B2B tag name; defaults to "NFeB2BFin".

§Errors

Returns FiscalError::XmlParsing if:

  • The nfe_proc_xml does not contain <nfeProc>
  • The b2b_xml does not contain the expected B2B tag
  • Either tag cannot be extracted