public function calculateCorvusPrice(CalculateCorvusPrice $request): JsonResponse 	{ 		$totalWeight = $total_return_fee = $base_price = $base_tax = 0; 		$corvusSignature = $orderNumber = $cart = null;  		$discount = Discount::where('code', $request->discount_code)->first(); 		$delivery_price = DeliveryPrice::where('country_code', $request->country_code)->first();  		$discount_valid = $discount && $discount->isUsable(); 		$corvusPayHandler = new CorvusPayHandler;  		$items = $request->items;  		foreach ($items as $key => $item) { 			$item_object = Product::where('id', $item['id'])->first();  			$total_return_fee += round($item_object->return_fee * $item['quantity'], 2); 			$base_price += round($item_object->price * $item['quantity'], 2); 			$base_tax += round($item_object->tax_amount * $item['quantity'], 2);  			$totalWeight += round($item_object->weight, 2) * $item['quantity'];  			$cart .= $item_object->id . 'x' . $item['quantity'] . ($key === array_key_last($items) ? '' : ','); 		}  		if (Order::checkAlowedWeight($totalWeight, $delivery_price->delivery_type)) { 			abort(403, __('orders.max_weight_passed', ['weight' => setting('max_weight')])); 		}  		// 1. calculate discount then check if shipping is free etc. 		$priceWithoutTax = $discount_valid ? round($discount->calculate($base_price), 2) : $base_price; 		$tax = $discount_valid ? round($discount->calculate($base_tax), 2) : $base_tax; 		$totalPriceWithoutShipping = $priceWithoutTax + $tax + $total_return_fee; 		// 2. shipping price 		$shippingPrice = $delivery_price->calculateShippingPrice($totalWeight, $totalPriceWithoutShipping, $request->payment_type, $request->country_code);  		// 3. all prices added up 		$finalPrice = round($totalPriceWithoutShipping + $shippingPrice, 2);  		// 4. Corvus 		$cart = substr($cart, 0, 255); // make sure it doesnt go over limit 		$orderNumber = Str::uuid();  		$corvusSignature = $corvusPayHandler->calculateFormSignature($orderNumber, $cart, $finalPrice);  		return response()->json([ 			'data' => [ 				'order_number' => $orderNumber, 				'cart' => $cart, 				'price_without_tax' => $priceWithoutTax, 				'tax' => $tax, 				'return_fee' => round($total_return_fee, 2), 				'shipping_price' => $shippingPrice, 				'corvus_price' => $finalPrice, 				'corvus_signature' => $corvusSignature, 			], 		]); 	}