1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-21 17:01:33 +02:00
invoiceninja/app/Services/Tax/TaxService.php
2023-05-15 12:37:38 +10:00

39 lines
913 B
PHP

<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Services\Tax;
use App\Models\Client;
class TaxService
{
public function __construct(public Client $client)
{
}
public function validateVat(): self
{
$client_country_code = $this->client->shipping_country ? $this->client->shipping_country->iso_3166_2 : $this->client->country->iso_3166_2;
$vat_check = (new VatNumberCheck($this->client->vat_number, $client_country_code))->run();
$this->client->has_valid_vat_number = $vat_check->isValid();
$this->client->saveQuietly();
return $this;
}
public function initTaxProvider()
{
}
}