Crates.io | nuban |
lib.rs | nuban |
version | 1.1.0 |
source | src |
created_at | 2019-03-20 16:32:55.224025 |
updated_at | 2023-01-29 15:58:53.997625 |
description | A light weight crate for verifying account numbers based on NUBAN guidelines |
homepage | https://github.com/timolinn/nuban#readme |
repository | https://github.com/timolinn/nuban |
max_upload_size | |
id | 122711 |
size | 10,261 |
This is a lightweight Rust crate for verifying NUBAN numbers for all Nigerian bank accounts as was directed by the CBN.
It checks the validity of a Nigerian bank account number based on the NUBAN guidelines provided by the CBN.
use nuban::Nuban;
fn main() {
// pass the bank code and account number as arguments
let nuban = Nuban::new("058", "0739082716").unwrap();
if let Ok(true) = nuban.is_valid_account() {
println!("'{}' is a valid account number", nuban.account_number());
} else {
println!("'{}' is not a valid account number", nuban.account_number());
}
}
Create a NUBAN
instance using the conventional new
method
let nuban = Nuban::new("098", "1038489302");
To check validity on a NUBAN
instance:
println!("{}", nuban.is_valid_account().unwrap());
cargo test
to ensure all tests are passing.Like this crate? Please star this repo.
You can give me a shoutout on Twitter