private function createOrder(CalculationOrder $calculation, Request $request, ?Customer $customer, ?array $orderDetails): Order 	{ 		$discountInfo = null;  		if ($calculation->getOrderWiseDiscounts()) { 			$discountInfo = $this->createOrderDiscountsInfo($calculation->getOrderWiseDiscounts()); 		}  		$order = Order::create([ 			'customer_id' => $customer?->id, 			'status' => Order::STATUS_PENDING, 			'payment_type' => $request->payment_method == Order::PAYMENT_METHOD_GIFT_CODE ? $this->checkIfPaymentMethodGiftCardIsReallyApplied($calculation) : $request->payment_method, 			'payment_card_provider' => $request->payment_card_provider, 			'number_of_packages' => $calculation->getTotalNumberOfPackages(), 			'total_price' => round((float) $calculation->getTotalPrice(), 2), // ukupna cijena prije popusta 			'total_discounts' => round((float) $calculation->getTotalDiscounts(), 2), // ukupno popusti 			'total_price_minus_discounts' => round((float) $calculation->getTotalWithDiscounts(), 2), // ukupna cijena minus popusti 			'tax_total' => round((float) $calculation->getTotalTax(), 2), // iznos poreza u ukupnoj cijeni 			'shipping_price' => round((float) $calculation->getShipping(), 2), // iznos postarine 			'final_price' => round((float) $calculation->getTotalWithShippingAdded(), 2), // cijena sa popustima + poštarina, 			'currency' => Setting::getMainCurrency(), 			'order_details' => $orderDetails ?? null, 			'delivery_address' => $request->delivery_address, 			'invoice_address' => $request->invoice_address, 			'order_dump' => $this->createOrderDumpStringifiedData($calculation), 			'guest_mode' => $customer ? false : true, 			'customer_email' => $request->email, 			'store_id' => $request->delivery == Order::DELIVERY_PICKUP_IN_STORE ? $request->store_id : null, 			'reference_number' => Order::createReferenceNumber(), 			'r1' => $request->boolean('r1'), 			'discounts_applied' => $discountInfo ?? null, 			'lang' => $request->lang == 'hr' ? Order::LANG_HR : Order::LANG_EN,  		]);  		if ($discountInfo) { 			foreach ($discountInfo as $discount) { 				$order->appliedDiscounts()->create([ 					'order_id' => $order->id, 					'discount_id' => $discount['discount_id'], 				]); 			} 		}  		return $order; 	}