mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-07 16:41:48 +01:00
Request VAT details from the Greek Ministry of Finance GSIS SOAP web service
This commit is contained in:
54
htdocs/societe/checkvat/checkVatGr.php
Normal file
54
htdocs/societe/checkvat/checkVatGr.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/* Copyright (C) 2016 Spiros Ioannou
|
||||
* Copyright (C) 2017 Marios Kaintatzis
|
||||
* Copyright (C) 2023 Nick Fragoulis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/societe/checkvat/checkVatGr.php
|
||||
* \ingroup societe
|
||||
* \brief Request VAT details from the Greek Ministry of Finance GSIS SOAP web service
|
||||
*/
|
||||
|
||||
$username = (isset($_REQUEST['u']) ? $_REQUEST['u'] : ''); // Get username from request
|
||||
$password = (isset($_REQUEST['p']) ? $_REQUEST['p'] : ''); // Get password from request
|
||||
$myafm = (isset($_REQUEST['myafm']) ? $_REQUEST['myafm'] : ''); // Get Vat from request
|
||||
$afm = (isset($_REQUEST['afm']) ? $_REQUEST['afm'] : ''); // Get client Vat from request
|
||||
|
||||
// Make call to check VAT for Greek client
|
||||
$result = checkVATGR($username, $password, $myafm, $afm);
|
||||
|
||||
echo json_encode($result); // Encode the result as JSON and output
|
||||
|
||||
// Function to check VAT
|
||||
function checkVATGR($username, $password, $AFMcalledby = '', $AFMcalledfor)
|
||||
{
|
||||
$client = new SoapClient("https://www1.gsis.gr/webtax2/wsgsis/RgWsPublic/RgWsPublicPort?WSDL", array('trace' => true));
|
||||
$authHeader = new stdClass();
|
||||
$authHeader->UsernameToken = new stdClass();
|
||||
$authHeader->UsernameToken->Username = "$username";
|
||||
$authHeader->UsernameToken->Password = "$password";
|
||||
$Headers[] = new SoapHeader('http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd', 'Security', $authHeader, true);
|
||||
$client->__setSoapHeaders($Headers);
|
||||
$result = $client->rgWsPublicAfmMethod(
|
||||
array(
|
||||
'afmCalledBy' => "$AFMcalledby",
|
||||
'afmCalledFor' => "$AFMcalledfor",
|
||||
)
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
Reference in New Issue
Block a user