client = $client; return $this; } public function setTaxData(Response $tax_data): self { $this->tax_data = $tax_data; return $this; } //need to add logic here to capture if public function tax(): self { if ($this->client->is_tax_exempt || $this->client->has_valid_vat_number) { return $this->taxExempt(); } $this->tax_name1 = $this->vat_rate; $this->tax_rate1 = "VAT"; return $this; } public function taxByType(?int $product_tax_type): self { if ($this->client->is_tax_exempt) { return $this->taxExempt(); } if (!$product_tax_type) { return $this; } match ($product_tax_type) { Product::PRODUCT_TYPE_EXEMPT => $this->taxExempt(), Product::PRODUCT_TYPE_DIGITAL => $this->taxDigital(), Product::PRODUCT_TYPE_SERVICE => $this->taxService(), Product::PRODUCT_TYPE_SHIPPING => $this->taxShipping(), Product::PRODUCT_TYPE_PHYSICAL => $this->taxPhysical(), Product::PRODUCT_TYPE_REDUCED_TAX => $this->taxReduced(), Product::PRODUCT_TYPE_OVERRIDE_TAX => $this->override(), default => $this->default(), }; return $this; } public function taxReduced(): self { $this->tax_rate1 = $this->vat_reduced_rate; $this->tax_name1 = 'Reduced VAT'; return $this; } public function taxExempt(): self { $this->tax_name1 = ''; $this->tax_rate1 = 0; return $this; } public function taxDigital(): self { $this->tax(); return $this; } public function taxService(): self { $this->tax(); return $this; } public function taxShipping(): self { $this->tax(); return $this; } public function taxPhysical(): self { $this->tax(); return $this; } public function default(): self { $this->tax_name1 = ''; $this->tax_rate1 = 0; return $this; } public function override(): self { return $this; } }