Crates.io | rifven |
lib.rs | rifven |
version | 0.1.0 |
source | src |
created_at | 2021-02-23 02:53:01.695723 |
updated_at | 2021-02-23 02:53:01.695723 |
description | Venezuelan RIF implementation useful for creating and validating RIF numbers |
homepage | |
repository | https://github.com/EstebanBorai/rifven |
max_upload_size | |
id | 359271 |
size | 124,426 |
RIF (Registro de Informacion Fiscal) in english Fiscal Information Registry is a number provided by a Venezuelan entity SAIME used to identify multiple entities for taxable purposes.
The RIF is composed by a kind which could be:
An identifier number followed by a hyphen symbol and finally a checksum digit, as well followed by a hyphen symbol.
Implement a crate to help create instances of valid RIF numbers
Creating a new Rif
instance providing each of its parts values
such as Kind
(J; V; P; G; C), identifier (tax payer ID), check number.
The following code, creates an instance of Rif
for a RIF string which
looks like J-07013380-5
:
use rifven::{Kind, Rif};
let rif = Rif::new(Kind::Legal, 07013380, 5).unwrap();
assert_eq!(rif.kind(), Kind::Legal);
assert_eq!(rif.identifier(), 7013380);
assert_eq!(rif.checksum_digit(), 5);
You can also create instances of Rif
from its string representation
use rifven::{Kind, Rif};
use std::str::FromStr;
let myrif = Rif::from_str("J-07013380-5").unwrap();
assert_eq!(Rif::new(Kind::Legal, 07013380, 5).unwrap(), myrif);
Licensed under the Apache 2.0 and MIT licenses
Every contribution to this project is welcome, feel free to either open a Pull Request or issue