TaxProviders extends AppModel
Tax providers management
Table of Contents
Methods
| __construct() | Initialize Taxes |
| get() | Get an instance of the given tax provider |
| getAll() | Get a list of all tax providers |
| getAllCountries() | Get a list of all countries handled by all tax providers |
| getByCountry() | Get an instance of the tax provider for a given country |
| getCountries() | Get a list of all countries handled by a tax provider |
| isExemptionHandlerEnabled() | Checks if a tax provider is handling the tax exemption of clients |
Methods
__construct()
Initialize Taxes
public
__construct() : mixed
get()
Get an instance of the given tax provider
public
get(string $tax_provider) : AbstractTax
Parameters
- $tax_provider : string
-
The name of the tax provider to initialize
Return values
AbstractTax —An instance of the tax provider or false if provider not exists
getAll()
Get a list of all tax providers
public
getAll([bool $enabled = true ]) : array<string|int, mixed>
Parameters
- $enabled : bool = true
-
True to fetch only the enabled providers (default, true)
Return values
array<string|int, mixed> —A list of all tax providers
getAllCountries()
Get a list of all countries handled by all tax providers
public
getAllCountries([bool $enabled = true ][, bool $exempt = true ]) : array<string|int, mixed>
Parameters
- $enabled : bool = true
-
True to fetch only the countries from the enabled providers (default, true)
- $exempt : bool = true
-
True to fetch only the countries with a tax exemption handler enabled (default, true)
Return values
array<string|int, mixed> —A list of all countries handled by all tax providers
getByCountry()
Get an instance of the tax provider for a given country
public
getByCountry(string $country_code) : AbstractTax
Parameters
- $country_code : string
-
The code of the country of the tax provider to initialize
Return values
AbstractTax —An instance of the tax provider or false if provider not exists
getCountries()
Get a list of all countries handled by a tax provider
public
getCountries(string $tax_provider) : array<string|int, mixed>
Parameters
- $tax_provider : string
-
The name of the tax provider to fetch the countries list
Return values
array<string|int, mixed> —A list of all countries handled by a tax provider or false if provider not exists
isExemptionHandlerEnabled()
Checks if a tax provider is handling the tax exemption of clients
public
isExemptionHandlerEnabled([string $tax_provider = null ]) : bool
Parameters
- $tax_provider : string = null
-
The name of the tax provider to check or null to check if any provider is enabled (default, null)
Return values
bool —True if the tax provider exemption handler is enabled