public function create(StoreOrder $request): JsonResource 	{ 		$totalWeight = $totalProductPrice = 0; 		$discount = Discount::where('code', $request->discount_code)->first(); 		$delivery_price = DeliveryPrice::where('country_code', $request->country_code)->first(); 		$discount_valid = $discount && $discount->isUsable();  		$order = Order::create([ 			'email' => $request->email, 			'phone_number' => $request->phone_number, 			'language' => $request->language, 			'vat_number' => $request->vat_number, 			'company_name' => $request->is_vat ? $request->company_name : null, 			'name' => $request->name, 			'surname' => $request->surname,  			'delivery_address' => $request->delivery_address, 			'delivery_zip_code' => $request->delivery_zip_code, 			'delivery_city' => $request->delivery_city, 			'delivery_country' => $request->delivery_country, 			'delivery_company_name' => $request->delivery_company_name,  			'billable_address' => $request->billable_address ?? $request->delivery_address, 			'billable_zip_code' => $request->billable_zip_code ?? $request->delivery_zip_code, 			'billable_city' => $request->billable_city ?? $request->delivery_city, 			'billable_country' => $request->billable_country ?? $request->delivery_country,  			'order_number_timestamp' => time(), 			'discount_id' => $discount_valid ? $discount->id : null, 			'delivery_price_id' => $delivery_price->id, 			'customer_id' => getUser()?->user->id, 		]);  		foreach ($request->items as $item) { 			$item_object = Product::where('id', $item['id'])->first();  			$order->orderItems()->create([ 				'item_id' => $item_object->id, 				'price' => $item_object->price, 				'quantity' => $item['quantity'], 				'name' => $item_object->name, 			]);  			$totalProductPrice += $item_object->price * $item['quantity'];  			$totalWeight += round($item_object->weight, 2) * $item['quantity']; 		}  		// 1. calculate discount then check if shipping is free etc. 		$price_after_discount = $discount_valid ? round($discount->calculate($totalProductPrice), 2) : $totalProductPrice; 		$tax = $order->getTaxAmount($totalProductPrice - $price_after_discount); 		$totalPriceWithoutShipping = $price_after_discount + $tax; 		// 2. shipping price 		$shippingPrice = $delivery_price->calculateShippingPrice($totalWeight);  		// 3. all prices added up 		$finalPrice = round($totalPriceWithoutShipping + $shippingPrice, 2); 		$discount_amount = $totalProductPrice - $price_after_discount;  		$stripeHandler = new StripeHandler; 		$session_url = $stripeHandler->createSession($order, $finalPrice);  		$order->update([ 			'checkout_url' => $session_url, 			'base_price' => $totalProductPrice, 			'discount_amount' => $discount_amount, 			'price_after_discount' => $price_after_discount, 			'shipping_price' => $shippingPrice, 			'tax' => $tax, 			'final_price' => $finalPrice, 		]);  		return new OrderSingleResource($order); 	}