for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Mpociot\VatCalculator\Traits;
use Mpociot\VatCalculator\Facades\VatCalculator;
trait BillableWithinTheEU
{
/**
* @var int
*/
protected $stripeTaxPercent = 0;
* @var
protected $userCountryCode;
* @var bool
protected $userIsCompany = false;
* @param string $countryCode
* @param bool|false $company
*
* @return $this
public function setTaxForCountry($countryCode, $company = false)
$this->userCountryCode = $countryCode;
$this->userIsCompany = $company;
return $this;
}
* @param $countryCode
public function useTaxFrom($countryCode)
public function asBusiness()
$this->userIsCompany = true;
public function asIndividual()
$this->userIsCompany = false;
* Get the tax percentage to apply to the subscription.
* @return int
public function getTaxPercent()
return VatCalculator::getTaxRateForCountry($this->userCountryCode, $this->userIsCompany) * 100;
* Get the tax percentage to apply to the subscription for Cashier > 6.0.
public function taxPercentage()
return $this->getTaxPercent();