com.liferay.commerce.payment.internal.request.DefaultCommercePaymentRequestProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of com.liferay.commerce.payment.service
Show all versions of com.liferay.commerce.payment.service
Liferay Commerce Payment Service
The newest version!
/**
* SPDX-FileCopyrightText: (c) 2000 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.payment.internal.request;
import com.liferay.commerce.model.CommerceOrder;
import com.liferay.commerce.payment.request.CommercePaymentRequest;
import com.liferay.commerce.payment.request.CommercePaymentRequestProvider;
import com.liferay.commerce.service.CommerceOrderLocalService;
import com.liferay.portal.kernel.exception.PortalException;
import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
/**
* @author Luca Pellizzon
*/
@Component(
property = "commerce.payment.engine.method.key=default",
service = CommercePaymentRequestProvider.class
)
public class DefaultCommercePaymentRequestProvider
implements CommercePaymentRequestProvider {
@Override
public CommercePaymentRequest getCommercePaymentRequest(
String cancelUrl, long commerceOrderId,
HttpServletRequest httpServletRequest, Locale locale,
String returnUrl, String transactionId)
throws PortalException {
CommerceOrder commerceOrder =
_commerceOrderLocalService.getCommerceOrder(commerceOrderId);
return new CommercePaymentRequest(
commerceOrder.getTotal(), cancelUrl, commerceOrderId, locale,
returnUrl, transactionId);
}
@Reference
private CommerceOrderLocalService _commerceOrderLocalService;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy