Popravek api klica za preverjanje ddv - vracamo ddv - true/false in pri preverjanju pocistimo crke iz davcne stevilke

This commit is contained in:
pero1203 2020-12-02 10:49:04 +01:00
parent 16b6bf280d
commit 285dbe4861
2 changed files with 7 additions and 1 deletions

View File

@ -295,10 +295,12 @@ class ApiNarocilaController{
// Mora placati ddv - cena ostane ista
if(UserNarocila::checkPayDDV($podjetje_davcna, $podjetje_drzava)){
$this->response['cena'] = $cena;
$this->response['ddv'] = true;
}
// Ne placa ddv - placa samo osnovo
else{
$this->response['cena'] = number_format(floatval($cena) / 1.22, 2, '.', '');
$this->response['ddv'] = false;
}
$this->response['success'] = true;

View File

@ -1267,7 +1267,11 @@ class UserNarocila{
if(!isset($countries_eu[$drzava]))
return false;
// Drugace gre za tujca iz EU - preverimo ce je zavezanec
// Drugace gre za tujca iz EU
// Pocistimo davcno stevilko - ohranimo samo stevilke ce je vnesel v obliki "DE12345678" -> "12345678"
$davcna_stevilka = preg_replace('[\D]', '', $davcna_stevilka);
// Preverimo, ce je zavezanec
$client = new SoapClient("http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl");
try{
$response = $client->checkVat( array('countryCode' => $countries_eu[$drzava], 'vatNumber' => $davcna_stevilka) );