Skip to content

Commit

Permalink
full response info
Browse files Browse the repository at this point in the history
  • Loading branch information
mixisLv committed Apr 13, 2021
1 parent 97c9fb5 commit 16e4430
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/Vies/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,19 @@ public function __construct(int $timeout = 10)
* @throws ViesException
*/
public function checkVat(string $countryCode, string $vatNumber) : bool
{
return (bool)$this->getInfo($countryCode, $vatNumber)->valid;
}

/**
* @param string $countryCode
* @param string $vatNumber
*
* @return object
*
* @throws ViesException
*/
public function getInfo(string $countryCode, string $vatNumber) : object
{
try {
$response = $this->getClient()->checkVat(
Expand All @@ -51,11 +64,12 @@ public function checkVat(string $countryCode, string $vatNumber) : bool
'vatNumber' => $vatNumber
)
);

} catch (SoapFault $e) {
throw new ViesException($e->getMessage(), $e->getCode());
}

return (bool) $response->valid;
return $response;
}

/**
Expand Down

0 comments on commit 16e4430

Please sign in to comment.