Validation

IBAN and BIC

IBANs checked (country, length, check digits) and printed as banks print them, and BICs checked.

Version 1.0.0 · 3 functions · 1 crate

#forms#banking#payments#finance

Functions

What use iban.qwer gives a program, with the types Quillo sees. To take only some, or under other names: use iban_parse, iban_valid from iban (Quillo 0.6).

iban_parse(text: str) → anyor an error

{ iban, printed, country, bban, bank } of a valid IBAN (spaces allowed), or an error saying what is wrong.

iban_valid(text: str) → bool

Whether text is a valid IBAN.

bic_valid(text: str) → bool

Whether text is a well-formed BIC (SWIFT code), 8 or 11 characters.

Get it

$ quillo install iban               # iban.qwer into this folder$ quillo install iban --example     # and its example, iban.qwe

Or with curl:

$ curl -O https://quillolang.org/plugins/files/iban.qwer$ curl -O https://quillolang.org/plugins/files/iban.qwe

Then, in your program, all of it or only what you call:

main.qwe
use iban.qweruse iban_parse, iban_valid from iban      // Quillo 0.6: only these

It uses this crate, which cargo fetches the first time the plugin is built:

[dependencies]
iban_validate = "4"

Example

iban.qwe
// A payout form's bank details.////   quillo run iban.qwe      then open http://localhost:8080/check?iban=DE44+5001+0517+5407+3249+31use "iban.qwer"route GET /check ? { iban: str } = iban_parse(iban)route GET /samples = { good: iban_valid("GB82 WEST 1234 5698 7654 32"), typo: iban_valid("GB82 WEST 1234 5698 7654 33"), bic: bic_valid("DEUTDEFF") }
$ quillo run iban.qwe$ curl 'localhost:8080/check?iban=DE44+5001+0517+5407+3249+31'$ curl 'localhost:8080/samples'

Source

iban.qwer
//! IBANs and BICs checked (country, length, check digits) and written as banks print them.//! version: 1.0.0//!//! [dependencies]//! iban_validate = "4"use iban::{Iban, IbanLike};use serde_json::{json, Value};/// `{ iban, printed, country, bban, bank }` of a valid IBAN (spaces allowed), or an error saying what is wrong.pub fn iban_parse(text: &str) -> Result<Value, String> {    let i: Iban = text.parse().map_err(|e: iban::ParseIbanError| e.to_string())?;    Ok(json!({        "iban": i.electronic_str(), "printed": i.to_string(), "country": i.country_code(),        "bban": i.bban(), "bank": i.bank_identifier(),    }))}/// Whether `text` is a valid IBAN.pub fn iban_valid(text: &str) -> bool {    text.parse::<Iban>().is_ok()}/// Whether `text` is a well-formed BIC (SWIFT code), 8 or 11 characters.pub fn bic_valid(text: &str) -> bool {    // Four letters for the bank, two for the country, two letters or digits for the place, and three for a branch.    let b: Vec<char> = text.trim().to_uppercase().chars().collect();    (b.len() == 8 || b.len() == 11)        && b[..6].iter().all(|c| c.is_ascii_uppercase())        && b[6..].iter().all(|c| c.is_ascii_uppercase() || c.is_ascii_digit())}
US routing numbers aba_routing.qwer · 1.0.0US bank routing numbers checked by their check digit and read for the Federal Reserve district and kind of institution, a check's MICR line read into routing, account and check number, and Canadian transit numbers.bankingpaymentsvalidationfinance7 views · 6 downloadsCard numbers cards.qwer · 1.0.0Payment card numbers checked before they reach a payment provider: Luhn check digit, brand and length, expiry, and the number formatted or masked for receipts.paymentsformscheckoutvalidation7 views · 7 downloadsCurrencies currencies.qwer · 1.0.0ISO 4217 currencies: names, symbols, minor units and the countries using them, prices formatted, and amounts turned into the cents payment APIs take.moneypaymentsi18nforms6 views · 7 downloadsLegal Entity Identifiers lei.qwer · 1.0.0Legal Entity Identifiers (ISO 17442) checked by their check digits, taken apart, made from an 18-character base, found in text, and looked up in GLEIF's public register for the company's name and status.financebankingcompliancecodes8 views · 9 downloadsISO 20022 bank files iso20022.qwer · 1.0.0ISO 20022 bank files: camt.053 statements (and camt.052 and 054) read into balances, entries and each payment's counterparty and reference, and pain.001 SEPA credit transfers built with checked IBANs and exact totals.bankingpaymentsaccountingimport7 views · 6 downloadsMT940 mt940.qwer · 1.0.0MT940 bank statements: accounts, opening and closing balances, and each transaction with its date, amount and counterparty.bankingimportaccountingpayments8 views · 6 downloads
Thread
98Useful? Like it, or add to its thread below.

Thread 0 posts

On IBAN and BIC: questions, tips, corrections, and code that uses it.

No posts yet. The first one opens the thread.