Blesta Source Documentation

UnitedKingdomTax extends AbstractTax

United Kingdom Tax

Table of Contents

Properties

$endpoint
$language

Methods

getCountries() Gets a list of the countries where these tax requirements apply
getFields() Gets a list of input fields for this tax provider
getName() Gets the name of the tax provider
getNotes() Gets the invoice notes from the tax provider
getRegions() Gets a list of the states/provinces where these tax requirements apply
getTaxIdName() Fetches the name of the tax ID field
getTaxInformation() Gets the tax information of a given tax ID
getTaxType() Gets the type of tax used in the country by the tax provider
isEnabled() Checks if the tax provider is enabled or not
isExemptionHandlerEnabled() Checks if the tax provider will automatically handle TAX exemptions or not
validateTaxId() Verifies if a given tax ID is valid
getFromContainer() Fetch an item from the container
getReverseChargeNote() Gets the reverse charge note for this tax provider
makeRequest() Makes a request to the HMRC API
reverseChargeApplies() Checks if the reverse charge applies for the given client with the tax provider
Properties

$endpoint

private string $endpoint = 'https://api.service.hmrc.gov.uk'

The API base URL

Methods

getCountries()

Gets a list of the countries where these tax requirements apply

public getCountries() : array<string|int, mixed>
Return values
array<string|int, mixed>

A list containing the country codes in ISO 3166-1 alpha2

getFields()

Gets a list of input fields for this tax provider

public getFields([array<string|int, mixed> $vars = [] ]) : InputFields
Parameters
$vars : array<string|int, mixed> = []

A list of submitted inputs that act as defaults for filter fields

Return values
InputFields

An object representing the list of filter input field

getName()

Gets the name of the tax provider

public getName() : string
Return values
string

The name of the tax provider

getNotes()

Gets the invoice notes from the tax provider

public getNotes(stdClass $invoice) : array<string|int, mixed>
Parameters
$invoice : stdClass
Return values
array<string|int, mixed>

A list of notes from the tax provider

getRegions()

Gets a list of the states/provinces where these tax requirements apply

public getRegions() : array<string|int, mixed>
Return values
array<string|int, mixed>

A list containing the state/province codes

getTaxIdName()

Fetches the name of the tax ID field

public getTaxIdName([stdClass $client = null ]) : string
Parameters
$client : stdClass = null

An object representing the client to be taxed

Return values
string

The name of the tax ID field

getTaxInformation()

Gets the tax information of a given tax ID

public getTaxInformation(string $tax_id[, array<string|int, mixed> $client = null ]) : array<string|int, mixed>
Parameters
$tax_id : string

The tax ID from which to obtain the information

$client : array<string|int, mixed> = null

An array containing the client data associated with the tax ID

Return values
array<string|int, mixed>

An array containing the tax data

  • name The name of the taxpayer
  • address The address of the taxpayer
  • country The country of the taxpayer
  • state The state/province of the taxpayer
  • type Whether the taxpayer is an individual or a business
  • tax_id The formatted tax ID
  • tax_exempt True if the taxpayer is exempt from taxes, false otherwise
  • settings A list of additional parameters (optional)

getTaxType()

Gets the type of tax used in the country by the tax provider

public getTaxType() : array<string|int, mixed>
Return values
array<string|int, mixed>

The taxation type, it can be 'inclusive_calculated', 'inclusive' or 'exclusive'

isEnabled()

Checks if the tax provider is enabled or not

public isEnabled([int $company_id = null ]) : bool
Parameters
$company_id : int = null

The ID of the company to check (optional)

Return values
bool

True if the tax provider is enabled

isExemptionHandlerEnabled()

Checks if the tax provider will automatically handle TAX exemptions or not

public isExemptionHandlerEnabled([int $company_id = null ]) : bool
Parameters
$company_id : int = null

The ID of the company to check (optional)

Return values
bool

True if the tax provider will handle TAX exemptions

validateTaxId()

Verifies if a given tax ID is valid

public validateTaxId(string $tax_id[, array<string|int, mixed> $client = null ]) : bool
Parameters
$tax_id : string

The tax ID to verify

$client : array<string|int, mixed> = null

An array containing the client data associated with the tax ID

Return values
bool

True if the given tax ID is valid, false otherwise

getFromContainer()

Fetch an item from the container

protected getFromContainer(string $service) : mixed
Parameters
$service : string

The name of the service from the container to fetch

Return values
mixed

The service if found, otherwise null

getReverseChargeNote()

Gets the reverse charge note for this tax provider

private getReverseChargeNote(stdClass $client) : string
Parameters
$client : stdClass

An object representing the client to validate

Return values
string

The reverse charge note

makeRequest()

Makes a request to the HMRC API

private makeRequest(string $path[, array<string|int, mixed> $params = [] ]) : stdClass
Parameters
$path : string

The API path to call

$params : array<string|int, mixed> = []

The query parameters

Return values
stdClass

The API response

reverseChargeApplies()

Checks if the reverse charge applies for the given client with the tax provider

private reverseChargeApplies(stdClass $client) : bool
Parameters
$client : stdClass

An object representing the client to validate

Return values
bool

True if the reverse charge principle applies to the given invoice

Tags
subpackage

core.Util.Tax

copyright

Copyright (c) 2021, Phillips Data, Inc.

license

http://www.blesta.com/license/ The Blesta License Agreement

link

Blesta


        
On this page

Search results