pub fn to_authorize(
request_xml: &str,
response_xml: &str,
) -> Result<String, FiscalError>Expand description
Detect the document type from raw XML and dispatch to the correct protocol-attachment function.
This mirrors the PHP Complements::toAuthorize() method, which uses
Standardize::whichIs() internally. The detection logic checks for
the same root tags in the same priority order as the PHP implementation:
| Detected tag | Dispatches to |
|---|---|
NFe | attach_protocol |
envEvento | attach_event_protocol |
inutNFe | attach_inutilizacao |
ยงErrors
Returns FiscalError::XmlParsing if:
- Either input is empty
- The request XML does not match any of the known document types
- The delegated function returns an error