.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Business::Tax::VAT::Validation 3pm" .TH Business::Tax::VAT::Validation 3pm "2012-11-30" "perl v5.14.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Business::Tax::VAT::Validation \- A class for european VAT numbers validation. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Business::Tax::VAT::Validation; \& \& my $hvatn=Business::Tax::VAT::Validation\->new(); \& \& # Check number \& if ($hvatn\->check($VAT, [$member_state])){ \& print "OK\en"; \& } else { \& print $hvatn\->get_last_error; \& } .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This class provides an easy api to check european \s-1VAT\s0 numbers' syntax, and if they has been registered by the competent authorities. .PP It asks the \s-1EU\s0 database (\s-1VIES\s0) for this, using its \s-1SOAP\s0 interface methods. .SH "CONSTRUCTOR" .IX Header "CONSTRUCTOR" .IP "\fBnew\fR Class constructor." 4 .IX Item "new Class constructor." .Vb 1 \& $hvatn=Business::Tax::VAT::Validation\->new(); \& \& \& If your system is located behind a proxy : \& \& $hvatn=Business::Tax::VAT::Validation\->new(\-proxy => [\*(Aqhttp\*(Aq, \*(Aqhttp://example.com:8001/\*(Aq]); \& \& Note : See LWP::UserAgent for proxy options. .Ve .SH "PROPERTIES" .IX Header "PROPERTIES" .IP "\fBmember_states\fR Returns all member states 2\-digit codes as array" 4 .IX Item "member_states Returns all member states 2-digit codes as array" .Vb 1 \& @ms=$hvatn\->member_states; .Ve .IP "\fBregular_expressions\fR \- Returns a hash list containing one regular expression for each country" 4 .IX Item "regular_expressions - Returns a hash list containing one regular expression for each country" If you want to test a \s-1VAT\s0 number format ouside this module, e.g. embedded as javascript in a web form. .Sp .Vb 1 \& %re=$hvatn\->regular_expressions; .Ve .Sp returns .Sp .Vb 5 \& ( \& AT => \*(AqU[0\-9]{8}\*(Aq, \& ... \& SK => \*(Aq[0\-9]{10}\*(Aq, \& ); .Ve .SH "METHODS" .IX Header "METHODS" .IP "\fBcheck\fR \- Checks if a \s-1VAT\s0 number exists in the \s-1VIES\s0 database" 4 .IX Item "check - Checks if a VAT number exists in the VIES database" .Vb 1 \& $ok=$hvatn\->check($vatNumber, [$countryCode]); .Ve .Sp You may either provide the \s-1VAT\s0 number under its complete form (e.g. \s-1BE\-123456789\s0, \s-1BE123456789\s0) or specify the \s-1VAT\s0 and \s-1MSC\s0 (vatNumber and countryCode) individually. .Sp Valid \s-1MS\s0 values are : .Sp .Vb 3 \& AT, BE, BG, CY, CZ, DE, DK, EE, EL, ES, \& FI, FR, GB, HU, IE, IT, LU, LT, LV, MT, \& NL, PL, PT, RO, SE, SI, SK .Ve .IP "\fBlocal_check\fR \- Checks if a \s-1VAT\s0 number format is valid This method is based on regexps only and \s-1DOES\s0 \s-1NOT\s0 ask the \s-1VIES\s0 database" 4 .IX Item "local_check - Checks if a VAT number format is valid This method is based on regexps only and DOES NOT ask the VIES database" .Vb 1 \& $ok=$hvatn\->local_check($VAT, [$member_state]); .Ve .IP "\fBinformations\fR \- Returns informations related to the last validated \s-1VAT\s0 number" 4 .IX Item "informations - Returns informations related to the last validated VAT number" .Vb 1 \& %infos=$hvatn\->informations(); .Ve .IP "\fBget_last_error_code\fR \- Returns the last recorded error code" 4 .IX Item "get_last_error_code - Returns the last recorded error code" .PD 0 .IP "\fBget_last_error\fR \- Returns the last recorded error" 4 .IX Item "get_last_error - Returns the last recorded error" .PD .Vb 2 \& my $err = $hvatn\->get_last_error_code(); \& my $txt = $hvatn\->get_last_error(); .Ve .Sp Possible errors are : .RS 4 .IP "\(bu" 4 \&\-1 The provided \s-1VAT\s0 number is valid. .IP "\(bu" 4 0 Unknown \s-1MS\s0 code : Internal checkup failed (Specified Member State does not exist) .IP "\(bu" 4 1 Invalid \s-1VAT\s0 number format : Internal checkup failed (bad syntax) .IP "\(bu" 4 2 This \s-1VAT\s0 number doesn't exist in \s-1EU\s0 database : distant checkup .IP "\(bu" 4 3 This \s-1VAT\s0 number contains errors : distant checkup .IP "\(bu" 4 17 Time out connecting to the database : Temporary error when the connection to the database times out .IP "\(bu" 4 18 Member Sevice Unavailable: The \s-1EU\s0 database is unable to reach the requested member's database. .IP "\(bu" 4 19 The \s-1EU\s0 database is too busy. .IP "\(bu" 4 20 Connexion to the \s-1VIES\s0 database failed. .IP "\(bu" 4 21 The \s-1VIES\s0 interface failed to parse a stream. This error occurs unpredictabely, so you should retry your validation request. .IP "\(bu" 4 257 Invalid response, please contact the author of this module. : This normally only happens if this software doesn't recognize any valid pattern into the response document: this generally means that the database interface has been modified, and you'll make the author happy by submitting the returned response !!! .IP "\(bu" 4 500 The \s-1VIES\s0 server encountered an internal server error. Error 500 : soap:Server \s-1TIMEOUT\s0 Error 500 : soap:Server \s-1MS_UNAVAILABLE\s0 .RE .RS 4 .Sp If error_code > 16, you should temporarily accept the provided number, and periodically perform new checks until response is \s-1OK\s0 or error < 17 If error_code > 256, you should temporarily accept the provided number, contact the author, and perform a new check when the software is updated. .RE .SH "SEE ALSO" .IX Header "SEE ALSO" LWP::UserAgent .PP \&\fIhttp://ec.europa.eu/taxation_customs/vies/faqvies.do\fR for the FAQs related to the \s-1VIES\s0 service. .SH "FEEDBACK" .IX Header "FEEDBACK" If you find this module useful, or have any comments, suggestions or improvements, feel free to let me know. .SH "AUTHOR" .IX Header "AUTHOR" Bernard Nauwelaerts .SH "CREDITS" .IX Header "CREDITS" Many thanks to the following people, actively involved in the development of this software by submitting patches, bug reports, new members regexps, \s-1VIES\s0 interface changes,... (sorted by last intervention) : .IP "\(bu" 4 Gregor Herrmann, Debian. .IP "\(bu" 4 Graham Knop. .IP "\(bu" 4 Bart Heupers, Netherlands. .IP "\(bu" 4 Martin H. Sluka, noris network \s-1AG\s0, Germany. .IP "\(bu" 4 Simon Williams, \s-1UK2\s0 Limited, United Kingdom & Benoi\*^t Galy, Greenacres, France & Raluca Boboia, Evozon, Romania .IP "\(bu" 4 Dave O., POBox, U.S.A. .IP "\(bu" 4 Kaloyan Iliev, Digital Systems, Bulgaria. .IP "\(bu" 4 Tom Kirkpatrick, Virus Bulletin, United Kingdom. .IP "\(bu" 4 Andy Wardley, individual, United Kingdom. .IP "\(bu" 4 Robert Alloway, Service Centre, United Kingdom. .IP "\(bu" 4 Torsten Mueller, Archesoft, Germany .SH "LICENSE" .IX Header "LICENSE" \&\s-1GPL\s0. Enjoy! See \s-1COPYING\s0 for further information on the \s-1GPL\s0. .SH "DISCLAIMER" .IX Header "DISCLAIMER" See \fIhttp://ec.europa.eu/taxation_customs/vies/viesdisc.do\fR to known the limitations of the \s-1EU\s0 validation service. .PP .Vb 2 \& This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; \& without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. .Ve