.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35) .\" .\" 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" '' . ds C` . ds C' '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 >0, 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. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Business::Tax::VAT::Validation 3pm" .TH Business::Tax::VAT::Validation 3pm "2020-03-24" "perl v5.30.0" "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 \- Validate EU VAT numbers against VIES .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 \s-1API\s0 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 API.\s0 Basic checks that the supplied \s-1VAT\s0 number fit the expected format for the specified \s-1EU\s0 member state are performed first, to avoid unnecessarily sending queries to \s-1VIES\s0 for input that could never be valid. .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, BE123456789\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 NOT\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 .IP "\fBget_last_response\fR \- Returns the full last response" 4 .IX Item "get_last_response - Returns the full last response" .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" Original author: Bernard Nauwelaerts .PP Maintainership since 2015: David Precious (\s-1BIGPRESH\s0) .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 & BenoƮ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