Property | Type | Description | |
---|---|---|---|
$businessCountryCode | string | ||
$company | boolean | ||
$config | Illuminate\Contracts\Config\Repository | ||
$countryCode | string | ||
$netPrice | float | ||
$postalCode | string | ||
$postalCodeExceptions | array | All possible postal code exceptions. | |
$soapClient | |||
$taxRate | float | ||
$taxRules | array | Taken from: http://ec.europa.eu/taxation_customs/resources/documents/taxation/vat/how_vat_works/rates/vat_rates_en.pdf | |
$taxValue | float | ||
$value | float | The calculate net + tax value. |
Method | Description | |
---|---|---|
__construct ( $config = null ) | ||
calculate ( integer | float $netPrice, null | string $countryCode = null, null | string $postalCode = null, null | boolean $company = null ) : float | Calculate the VAT based on the net price, country code and indication if the customer is a company or not. | |
getCountryCode ( ) : string | ||
getIPBasedCountry ( ) : boolean | string | Returns the ISO 3166-1 alpha-2 two letter country code for the client IP. If the IP can't be resolved it returns false. | |
getNetPrice ( ) : float | ||
getPostalCode ( ) : string | ||
getTaxRate ( ) : float | ||
getTaxRateForCountry ( $countryCode, boolean $company = false ) : float | Returns the tax rate for the given country code. | |
getTaxRateForLocation ( string $countryCode, string | null $postalCode = null, boolean | false $company = false ) : float | Returns the tax rate for the given country code. | |
getTaxValue ( ) : float | ||
isCompany ( ) : boolean | ||
isValidVATNumber ( $vatNumber ) : boolean | ||
setBusinessCountryCode ( string $businessCountryCode ) | ||
setCompany ( boolean $company ) | ||
setCountryCode ( mixed $countryCode ) | ||
setPostalCode ( mixed $postalCode ) | ||
setSoapClient ( SoapClient $soapClient ) | ||
shouldCollectVAT ( $countryCode ) : boolean | Determines if you need to collect VAT for the given country code. |
Method | Description | |
---|---|---|
getClientIP ( ) : mixed | Finds the client IP address. |
public calculate ( integer | float $netPrice, null | string $countryCode = null, null | string $postalCode = null, null | boolean $company = null ) : float | ||
$netPrice | integer | float | The net price to use for the calculation |
$countryCode | null | string | The country code to use for the rate lookup |
$postalCode | null | string | The postal code to use for the rate exception lookup |
$company | null | boolean | |
return | float |
public getIPBasedCountry ( ) : boolean | string | ||
return | boolean | string |
public getTaxRateForCountry ( $countryCode, boolean $company = false ) : float | ||
$countryCode | ||
$company | boolean | |
return | float |
public isValidVATNumber ( $vatNumber ) : boolean | ||
$vatNumber | ||
return | boolean |
public setBusinessCountryCode ( string $businessCountryCode ) | ||
$businessCountryCode | string |
public setSoapClient ( SoapClient $soapClient ) | ||
$soapClient | SoapClient |
public shouldCollectVAT ( $countryCode ) : boolean | ||
$countryCode | ||
return | boolean |
protected Repository,Illuminate\Contracts\Config $config | ||
return | Illuminate\Contracts\Config\Repository |
protected array $postalCodeExceptions | ||
return | array |
protected array $taxRules | ||
return | array |