pub struct Eric;Expand description
A structure to manage the Eric instance from the shared C library.
Use Eric::new to initialize Eric. Closes Eric when dropped.
Implementations§
Source§impl Eric
impl Eric
Sourcepub fn new(
log_path: Option<&Path>,
plugin_path: Option<&Path>,
) -> Result<Self, EricError>
pub fn new( log_path: Option<&Path>, plugin_path: Option<&Path>, ) -> Result<Self, EricError>
Initializes a single-threaded Eric instance.
If log_path is None, the system directory for temporary files is
used. If plugin_path is None, the path to the shared C library is
used.
Sourcepub fn validate(
&self,
xml: String,
taxonomy_type: &str,
taxonomy_version: &str,
pdf_path: Option<&str>,
) -> Result<EricResponse, EricError>
pub fn validate( &self, xml: String, taxonomy_type: &str, taxonomy_version: &str, pdf_path: Option<&str>, ) -> Result<EricResponse, EricError>
Validates an XML file for a specific taxonomy.
Optionally, a confirmation is printed to pdf_path.
Sourcepub fn send(
&self,
xml: String,
taxonomy_type: &str,
taxonomy_version: &str,
certificate_path: &Path,
certificate_password: &str,
pdf_path: Option<&str>,
) -> Result<EricResponse, EricError>
pub fn send( &self, xml: String, taxonomy_type: &str, taxonomy_version: &str, certificate_path: &Path, certificate_password: &str, pdf_path: Option<&str>, ) -> Result<EricResponse, EricError>
Sends an XML file for a specific taxonomy to the tax authorities.
The Elster certificate needs to be provided at path certificate_path
with password certificate_password.
Optionally, a confirmation is printed to pdf_path.
Sourcepub fn check_xml(
&self,
xml: String,
taxonomy_type: &str,
taxonomy_version: &str,
) -> Result<EricResponse, EricError>
pub fn check_xml( &self, xml: String, taxonomy_type: &str, taxonomy_version: &str, ) -> Result<EricResponse, EricError>
Validates an XML file against the schema of a specific taxonomy.
This is a schema-only check via ERiC’s EricCheckXML and does not
execute the full validation/send pipeline of Eric::validate or
Eric::send.
Note that ERiC may report unsupported data types/versions for this API function.
Sourcepub fn get_error_text(&self, error_code: i32) -> Result<String, EricError>
pub fn get_error_text(&self, error_code: i32) -> Result<String, EricError>
Returns the error text for a specific error code.
Sourcepub fn certificate_properties(
&self,
certificate_path: &Path,
pin: &str,
) -> Result<String, EricError>
pub fn certificate_properties( &self, certificate_path: &Path, pin: &str, ) -> Result<String, EricError>
Reads the properties of a certificate as an XML document, via
EricHoleZertifikatEigenschaften.
The returned XML conforms to the EricHoleZertifikatEigenschaften
return schema and carries, among other fields, <TokenTyp>
(Software / Stick / Karte / …) and an optional
<Testzertifikat> boolean.
Useful as a local check of certificate suitability before send.
Purely local: no server contact.