All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.liferay.commerce.checkout.web.internal.display.context.DeliveryGroupDisplayContext Maven / Gradle / Ivy

There is a newer version: 5.0.100
Show newest version
/**
 * SPDX-FileCopyrightText: (c) 2024 Liferay, Inc. https://liferay.com
 * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
 */

package com.liferay.commerce.checkout.web.internal.display.context;

import com.liferay.commerce.model.CommerceAddress;
import com.liferay.commerce.service.CommerceAddressService;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.util.ParamUtil;

import java.util.Date;

import javax.servlet.http.HttpServletRequest;

/**
 * @author Luca Pellizzon
 */
public class DeliveryGroupDisplayContext {

	public DeliveryGroupDisplayContext(
		CommerceAddressService commerceAddressService) {

		_commerceAddressService = commerceAddressService;
	}

	public CommerceAddress getCommerceAddress(
			HttpServletRequest httpServletRequest)
		throws PortalException {

		return _commerceAddressService.fetchCommerceAddress(
			ParamUtil.getLong(httpServletRequest, "addressId"));
	}

	public Date getDeliveryGroupDate(HttpServletRequest httpServletRequest) {
		return new Date(ParamUtil.getLong(httpServletRequest, "deliveryDate"));
	}

	private final CommerceAddressService _commerceAddressService;

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy