mollemoll / tax-ids Goto Github PK
View Code? Open in Web Editor NEWValidate Tax Ids (VAT/GST) for businesses operating within the European Union, the United Kingdom, Switzerland, and Norway.
License: Apache License 2.0
Validate Tax Ids (VAT/GST) for businesses operating within the European Union, the United Kingdom, Switzerland, and Norway.
License: Apache License 2.0
Expose a public syntax validation that can be used without creating/verifying any TaxIds.
Need a validator and verifier to enable verification of CH VATs
CH VATs can take different formatting variations. They start with CHE, followed by 9 digits and an optional suffix describing the regional part of Switzerland (MWST, IVA or TVA).
Format examples:
CHE123456789
CHE123456789 MWST
CHE-123.456.789
CHE-123.456.789 MWST
Does not accept CHE123456789MWST (without a whitespace before MWST)
Errors
According to Google Translate and the [Spécifications Webservice Interface 5.0 PDF](Spécifications Webservice
Interface 5.0) the ValidateVatNumber operation can only return two errors:
Lookup:
BFS UIDs
BFS SOAP API
Checksum details (weight and mod):
Details on checksum
PDF with checksum weights
Both VIES and HMRC accept incoming requests that include requester info, ie who's performing the lookup.
Look into whether it could be worth adding caching
Add checksum control for tax ids that support it to avoid unnecessary calls to already strained APIs.
Need a validator and verifier to lookup the legitimacy of NO VATs
Need a verifier for HMRC to enable verification of GBVats
Some stuff should be configurable.
The VIES service can reply with several fault codes. Right now they all lead to VerificationStatus Unavailable. However, it would be nice to forward the VIES fault within the Unavailable status in case the user can act upon it.
Here are the codes.
#[derive(Debug)]
pub enum VIESFault {
ServiceUnavailable,
MemberStateUnavailable,
InvalidRequester,
Timeout,
BlockedError,
RateLimitError,
}
lazy_static! {
pub static ref VIES_FAULT: HashMap<&'static str, VIESFault> = {
let mut m = HashMap::new();
m.insert("SERVICE_UNAVAILABLE", VIESFault::ServiceUnavailable);
m.insert("MS_UNAVAILABLE", VIESFault::MemberStateUnavailable);
m.insert("INVALID_REQUESTER_INFO", VIESFault::InvalidRequester);
m.insert("TIMEOUT", VIESFault::Timeout);
m.insert("VAT_BLOCKED", VIESFault::BlockedError);
m.insert("IP_BLOCKED", VIESFault::BlockedError);
m.insert("GLOBAL_MAX_CONCURRENT_REQ", VIESFault::RateLimitError);
m.insert("GLOBAL_MAX_CONCURRENT_REQ_TIME", VIESFault::RateLimitError);
m.insert("MS_MAX_CONCURRENT_REQ", VIESFault::RateLimitError);
m.insert("MS_MAX_CONCURRENT_REQ_TIME", VIESFault::RateLimitError);
m
};
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.