2023-03-27 22:47:07 +02:00
|
|
|
<?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\DataMapper\Tax;
|
|
|
|
|
|
|
|
use App\DataMapper\Tax\ZipTax\Response;
|
2023-03-29 04:13:50 +02:00
|
|
|
use App\Models\Client;
|
2023-03-27 22:47:07 +02:00
|
|
|
|
|
|
|
class BaseRule implements RuleInterface
|
|
|
|
{
|
|
|
|
/** EU TAXES */
|
|
|
|
public bool $consumer_tax_exempt = false;
|
2023-03-29 05:23:06 +02:00
|
|
|
|
2023-03-27 22:47:07 +02:00
|
|
|
public bool $business_tax_exempt = true;
|
2023-03-29 05:23:06 +02:00
|
|
|
|
2023-03-27 22:47:07 +02:00
|
|
|
public bool $eu_business_tax_exempt = true;
|
2023-03-29 05:23:06 +02:00
|
|
|
|
2023-03-27 22:47:07 +02:00
|
|
|
public bool $foreign_business_tax_exempt = true;
|
2023-03-29 05:23:06 +02:00
|
|
|
|
2023-03-27 22:47:07 +02:00
|
|
|
public bool $foreign_consumer_tax_exempt = true;
|
2023-03-29 05:23:06 +02:00
|
|
|
|
|
|
|
public array $eu_country_codes = [
|
|
|
|
'AT', // Austria
|
|
|
|
'BE', // Belgium
|
|
|
|
'BG', // Bulgaria
|
|
|
|
'CY', // Cyprus
|
|
|
|
'CZ', // Czech Republic
|
|
|
|
'DE', // Germany
|
|
|
|
'DK', // Denmark
|
|
|
|
'EE', // Estonia
|
|
|
|
'ES', // Spain
|
|
|
|
'FI', // Finland
|
|
|
|
'FR', // France
|
|
|
|
'GR', // Greece
|
|
|
|
'HR', // Croatia
|
|
|
|
'HU', // Hungary
|
|
|
|
'IE', // Ireland
|
|
|
|
'IT', // Italy
|
|
|
|
'LT', // Lithuania
|
|
|
|
'LU', // Luxembourg
|
|
|
|
'LV', // Latvia
|
|
|
|
'MT', // Malta
|
|
|
|
'NL', // Netherlands
|
|
|
|
'PL', // Poland
|
|
|
|
'PT', // Portugal
|
|
|
|
'RO', // Romania
|
|
|
|
'SE', // Sweden
|
|
|
|
'SI', // Slovenia
|
|
|
|
'SK', // Slovakia
|
|
|
|
];
|
|
|
|
|
2023-03-29 04:13:50 +02:00
|
|
|
/** EU TAXES */
|
2023-03-27 22:47:07 +02:00
|
|
|
|
|
|
|
|
2023-03-29 04:13:50 +02:00
|
|
|
/** US TAXES */
|
|
|
|
/** US TAXES */
|
|
|
|
|
2023-03-27 22:47:07 +02:00
|
|
|
public string $tax_name1 = '';
|
|
|
|
public float $tax_rate1 = 0;
|
|
|
|
|
|
|
|
public string $tax_name2 = '';
|
|
|
|
public float $tax_rate2 = 0;
|
|
|
|
|
|
|
|
public string $tax_name3 = '';
|
|
|
|
public float $tax_rate3 = 0;
|
|
|
|
|
|
|
|
protected ?Client $client;
|
|
|
|
|
|
|
|
protected ?Response $tax_data;
|
|
|
|
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2023-03-29 05:23:06 +02:00
|
|
|
public function init(): self
|
|
|
|
{
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2023-03-27 22:47:07 +02:00
|
|
|
public function setClient(Client $client): self
|
|
|
|
{
|
|
|
|
$this->client = $client;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setTaxData(Response $tax_data): self
|
|
|
|
{
|
|
|
|
$this->tax_data = $tax_data;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2023-04-02 23:48:59 +02:00
|
|
|
public function tax($product_tax_type): self
|
2023-03-27 22:47:07 +02:00
|
|
|
{
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2023-03-31 06:25:30 +02:00
|
|
|
public function taxByType($product_tax_type): self
|
2023-03-27 22:47:07 +02:00
|
|
|
{
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function taxReduced(): self
|
|
|
|
{
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function taxExempt(): self
|
|
|
|
{
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function taxDigital(): self
|
|
|
|
{
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function taxService(): self
|
|
|
|
{
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function taxShipping(): self
|
|
|
|
{
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function taxPhysical(): self
|
|
|
|
{
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function default(): self
|
|
|
|
{
|
|
|
|
return $this;
|
|
|
|
}
|
2023-03-28 23:27:13 +02:00
|
|
|
|
|
|
|
public function override(): self
|
|
|
|
{
|
|
|
|
return $this;
|
|
|
|
}
|
2023-03-29 05:23:06 +02:00
|
|
|
|
|
|
|
public function calculateRates(): self
|
|
|
|
{
|
|
|
|
return $this;
|
|
|
|
}
|
2023-03-27 22:47:07 +02:00
|
|
|
}
|