Zend_Validate_SalesTaxNum
1. Overview
Zend_Validate_SalesTaxNum is a simple component that validates European (EU) sales tax numbers.
It offers two kinds of validation:
- Whether the syntax of an EU sales tax number is correct (each country has its own pattern)
- Whether an EU sales tax number exists and is being used (via VIES API)
Each EU member state has a different name for their sales tax numbers [1], hence a neutral term has been chosen for the class name: "sales tax number".
Comments on the class name are requested. For example, Zend_Validate_Eusalestaxno could also be possible.
A sample implementation of this class is attached to this page ("Zend_Validate_SalesTaxNum.tar.bz2")
[1] - UK: "VAT", DE: "MwSt", FR: "TVA" etc.
2. References
3. Component Requirements, Constraints, and Acceptance Criteria
- This component will validate the syntax of an EU sales tax number
- This component will validate the existence (whether it is being used used or not) of an EU sales tax number
- This component will not validate sales tax from countries other than EU member states.
4. Dependencies on Other Framework Components
- Zend_Exception
- Zend_Validate_Abstract
5. Theory of Operation
Validates and checks existence of EU sales tax numbers. On failure, following error strings are available:
6. Milestones / Tasks
- Milestone 1: [DONE] write proposal
- Milestone 2: get the proposal approved
- Milestone 3: working prototype checked into the incubator
- Milestone 4: write unit test, and check into SVN
- Milestone 5: write documentation for this validator.
- Milestone 6: introduce "component" to core.
ZF Home Page
Code Browser
Wiki Dashboard
Zend_Validate_SalesTaxId might be better, because the input contains letter also. If not I think cutting short the word Number is not a good idea, since it doesn't really save space.
But more importantly I think there should be Zend_Validate_SalesTaxNum_Eu, Zend_Validate_SalesTaxNum_Usa for the continents and probably Zend_Validate_SalesTaxNum_Finland etc. for each country. In Finland VAT and Business IDs are the same thing, but in a bit different format.
VAT=FI12345678, ID=1234567-8
In my opinion validator should check automatically validation for either case. User should then use filter to put it in correct format.