| 1 | <?php |
||
| 7 | trait BillableWithinTheEU |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var int |
||
| 11 | */ |
||
| 12 | protected $stripeTaxPercent = 0; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @var |
||
| 16 | */ |
||
| 17 | protected $userCountryCode; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @var bool |
||
| 21 | */ |
||
| 22 | protected $userIsCompany = false; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @param string $countryCode |
||
| 26 | * @param bool|false $company |
||
| 27 | * |
||
| 28 | * @return $this |
||
| 29 | */ |
||
| 30 | public function setTaxForCountry($countryCode, $company = false) |
||
| 31 | { |
||
| 32 | $this->userCountryCode = $countryCode; |
||
| 33 | $this->userIsCompany = $company; |
||
| 34 | |||
| 35 | return $this; |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @param $countryCode |
||
| 40 | * |
||
| 41 | * @return $this |
||
| 42 | */ |
||
| 43 | public function useTaxFrom($countryCode) |
||
| 44 | { |
||
| 45 | $this->userCountryCode = $countryCode; |
||
| 46 | |||
| 47 | return $this; |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @return $this |
||
| 52 | */ |
||
| 53 | public function asBusiness() |
||
| 54 | { |
||
| 55 | $this->userIsCompany = true; |
||
| 56 | |||
| 57 | return $this; |
||
| 58 | } |
||
| 59 | |||
| 60 | /** |
||
| 61 | * @return $this |
||
| 62 | */ |
||
| 63 | public function asIndividual() |
||
| 64 | { |
||
| 65 | $this->userIsCompany = false; |
||
| 66 | |||
| 67 | return $this; |
||
| 68 | } |
||
| 69 | |||
| 70 | /** |
||
| 71 | * Get the tax percentage to apply to the subscription. |
||
| 72 | * |
||
| 73 | * @return int |
||
| 74 | */ |
||
| 75 | public function getTaxPercent() |
||
| 79 | |||
| 80 | /** |
||
| 81 | * Get the tax percentage to apply to the subscription for Cashier > 6.0. |
||
| 82 | * |
||
| 83 | * @return int |
||
| 84 | */ |
||
| 85 | public function taxPercentage() |
||
| 89 | } |
||
| 90 |