public function calculateTotal(array $items, int $delivery, bool $r1 = false, ?string $code = null, ?string $lang = null, ?Address $address = null, ?string $points = null, ?string $shippingProvider = null): Order 	{ 		$this->setUpOrderAndOrderProducts($items, $r1, $address?->invoice_country ?? 'HR');  		foreach ($this->order->getProducts() as $product) { 			$this->applyDiscounts($product, $code, $points); 			// $this->getTaxRate($product, $address?->country_code); 		}  		$this->recalculate();  		$this->applyGiftCodeDiscount($code);  		$this->recalculate();  		$this->applyGlobalDiscounts($this->order->getTotalWithDiscounts());  		$this->shipping($shippingProvider, $delivery, $address);  		$this->addExtraCostsToShipping(app()->make(ExtraShippingCosts::class), $delivery, $shippingProvider);  		$this->orderTotalWithShipping();  		return $this->order; 	}