-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathVatService.php
83 lines (63 loc) · 2.2 KB
/
VatService.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
* Description of VatService
*
* @author mirjana
*/
use \SoapClient;
use \Exception;
use \SoapFault;
class VatService
{
//put your code here
protected $countryCode;
protected $vatNumber;
public function setCountryCode($countryCode)
{
$this->countryCode = $countryCode;
}
public function getCountryCode()
{
return $this->countryCode;
}
public function setVatNumber($vatNumber)
{
$this->vatNumber = $vatNumber;
}
public function getVatNumber()
{
return $this->vatNumber;
}
public function checkVatNumber(){
// $message =
'<?xml version="1.0" encoding="UTF-8" standalone="no"?>' +
'<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" '+
'xmlns:tns1="urn:ec.europa.eu:taxud:vies:services:checkVat:types" ' +
'xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" ' +
'xmlns:impl="urn:ec.europa.eu:taxud:vies:services:checkVat" ' +
'xmlns:apachesoap="http://xml.apache.org/xml-soap" ' +
'xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" ' +
'xmlns:xsd="http://www.w3.org/2001/XMLSchema" ' +
'xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" ' +
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > ' +
'<SOAP-ENV:Body>' +
'<tns1:checkVat xmlns:tns1="urn:ec.europa.eu:taxud:vies:services:checkVat:types">' +
'<tns1:countryCode>NL</tns1:countryCode>' +
'<tns1:vatNumber>809808572B01</tns1:vatNumber>' +
'</tns1:checkVat></SOAP-ENV:Body></SOAP-ENV:Envelope>';
$client = new SoapClient("http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl");
$param = array("vatNumber" => $this->vatNumber, "countryCode" =>$this->countryCode);
try {
$response = $client->CheckVat($param);
} catch (SoapFault $e){
echo $e->getMessage();
}
var_dump($response);die();
return new Response("h");
// return $response;
}
}