Class DefaultCheckoutFacade
- java.lang.Object
-
- de.hybris.platform.commercefacades.order.impl.DefaultCheckoutFacade
-
- All Implemented Interfaces:
CheckoutFacade
- Direct Known Subclasses:
DefaultAcceleratorCheckoutFacade,DefaultCheckoutFacade
public class DefaultCheckoutFacade extends java.lang.Object implements CheckoutFacade
Default implementation ofCheckoutFacade
-
-
Constructor Summary
Constructors Constructor Description DefaultCheckoutFacade()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidafterPlaceOrder(CartModel cartModel, OrderModel orderModel)booleanauthorizePayment(java.lang.String securityCode)Authorize payment for the order.protected voidbeforePlaceOrder(CartModel cartModel)protected booleancheckIfCurrentUserIsTheCartUser()booleancontainsTaxValues()Checks that cart or any of cart entries has TaxValuesprotected DeliveryModeDataconvert(DeliveryModeModel deliveryModeModel)protected CommerceCheckoutParametercreateCommerceCheckoutParameter(CartModel cart, boolean enableHooks)protected AddressModelcreateDeliveryAddressModel(AddressData addressData, CartModel cartModel)CCPaymentInfoDatacreatePaymentSubscription(CCPaymentInfoData paymentInfoData)Create new payment subscription.protected Converter<AddressModel,AddressData>getAddressConverter()AddressDatagetAddressDataForId(java.lang.String addressId, boolean visibleAddressesOnly)Looks up addresses in the customer address bookprotected Populator<AddressData,AddressModel>getAddressReversePopulator()protected BaseStoreServicegetBaseStoreService()java.util.List<CountryData>getBillingCountries()Deprecated.since 1808.protected Converter<CardType,CardTypeData>getCardTypeConverter()protected CartModelgetCart()protected CartFacadegetCartFacade()protected <T extends CartService>
TgetCartService()CartDatagetCheckoutCart()Method gets checkout cart, if any exist.protected CheckoutCustomerStrategygetCheckoutCustomerStrategy()protected CommerceCardTypeServicegetCommerceCardTypeService()protected CommerceCheckoutServicegetCommerceCheckoutService()protected CommonI18NServicegetCommonI18NService()java.util.List<CountryData>getCountries(CountryType countryType)Get countries.protected Converter<CountryModel,CountryData>getCountryConverter()protected Converter<CreditCardPaymentInfoModel,CCPaymentInfoData>getCreditCardPaymentInfoConverter()protected CustomerModelgetCurrentUserForCheckout()protected CustomerAccountServicegetCustomerAccountService()protected AddressDatagetDeliveryAddress()AddressDatagetDeliveryAddressForCode(java.lang.String code)Get the delivery address with the specified codeprotected AddressModelgetDeliveryAddressModelForCode(java.lang.String code)java.util.List<CountryData>getDeliveryCountries()Deprecated.since 1808.protected DeliveryModeDatagetDeliveryMode()protected Converter<DeliveryModeModel,DeliveryModeData>getDeliveryModeConverter()protected DeliveryServicegetDeliveryService()protected EnumerationServicegetEnumerationService()protected ModelServicegetModelService()protected Converter<OrderModel,OrderData>getOrderConverter()protected CCPaymentInfoDatagetPaymentDetails()protected java.lang.StringgetPaymentProvider()protected PriceDataFactorygetPriceDataFactory()java.util.List<CardTypeData>getSupportedCardTypes()Get supported payment card typesjava.util.List<AddressData>getSupportedDeliveryAddresses(boolean visibleAddressesOnly)Get the list of supported delivery addresses.java.util.List<? extends DeliveryModeData>getSupportedDeliveryModes()Get the supported delivery modes for the cart.protected UserServicegetUserService()protected Converter<ZoneDeliveryModeModel,ZoneDeliveryModeData>getZoneDeliveryModeConverter()booleanhasCheckoutCart()Check if checkout cart exist.protected booleanhasItemsMatchingPredicate(java.util.function.Predicate<AbstractOrderEntryModel> predicate)booleanhasPickUpItems()Checks if at least one entry in the cart is a pickup entrybooleanhasShippingItems()Checks if at least one entry in the cart is for shippingprotected booleanisSupportedDeliveryMode(java.lang.String deliveryModeCode, CartModel cartModel)OrderDataplaceOrder()Place orderprotected OrderModelplaceOrder(CartModel cartModel)voidprepareCartForCheckout()Prepares cart for checkoutbooleanremoveDeliveryAddress()Removes delivery address from session cart.booleanremoveDeliveryMode()Removes the delivery mode on the cartvoidsetAddressConverter(Converter<AddressModel,AddressData> addressConverter)voidsetAddressReversePopulator(Populator<AddressData,AddressModel> addressReversePopulator)voidsetBaseStoreService(BaseStoreService baseStoreService)voidsetCardTypeConverter(Converter<CardType,CardTypeData> cardTypeConverter)voidsetCartFacade(CartFacade cartFacade)voidsetCartService(CartService cartService)booleansetCheapestDeliveryModeForCheckout()Sets the cheapest delivery mode in the cart when calledvoidsetCheckoutCustomerStrategy(CheckoutCustomerStrategy checkoutCustomerStrategy)voidsetCommerceCardTypeService(CommerceCardTypeService commerceCardTypeService)voidsetCommerceCheckoutService(CommerceCheckoutService commerceCheckoutService)voidsetCommonI18NService(CommonI18NService commonI18NService)voidsetCountryConverter(Converter<CountryModel,CountryData> countryConverter)voidsetCreditCardPaymentInfoConverter(Converter<CreditCardPaymentInfoModel,CCPaymentInfoData> creditCardPaymentInfoConverter)voidsetCustomerAccountService(CustomerAccountService customerAccountService)booleansetDefaultDeliveryAddressForCheckout()Sets the defaultAddress info on the cart with if current user has a default address infobooleansetDefaultPaymentInfoForCheckout()Sets the defaultPayment info on the cart if the current user has a default payment infobooleansetDeliveryAddress(AddressData addressData)Set the delivery address on the cart.booleansetDeliveryAddressIfAvailable()Set delivery address if customer has a default delivery address and is valid for the cartbooleansetDeliveryMode(java.lang.String deliveryModeCode)Set the delivery mode on the cart Checks if the deliveryMode code is supported.voidsetDeliveryModeConverter(Converter<DeliveryModeModel,DeliveryModeData> deliveryModeConverter)booleansetDeliveryModeIfAvailable()Set cheapest delivery mode if the cart has one or more supported delivery modesvoidsetDeliveryService(DeliveryService deliveryService)voidsetEnumerationService(EnumerationService enumerationService)voidsetModelService(ModelService modelService)voidsetOrderConverter(Converter<OrderModel,OrderData> orderConverter)booleansetPaymentDetails(java.lang.String paymentInfoId)Set Payment Details on the cartbooleansetPaymentInfoIfAvailable()Set payment details if the customer has a default payment detailsvoidsetPriceDataFactory(PriceDataFactory priceDataFactory)voidsetUserService(UserService userService)voidsetZoneDeliveryModeConverter(Converter<ZoneDeliveryModeModel,ZoneDeliveryModeData> zoneDeliveryModeConverter)
-
-
-
Method Detail
-
hasCheckoutCart
public boolean hasCheckoutCart()
Description copied from interface:CheckoutFacadeCheck if checkout cart exist.- Specified by:
hasCheckoutCartin interfaceCheckoutFacade- Returns:
- true if cart exists
-
getCheckoutCart
public CartData getCheckoutCart()
Description copied from interface:CheckoutFacadeMethod gets checkout cart, if any exist.- Specified by:
getCheckoutCartin interfaceCheckoutFacade- Returns:
- cart data if cart exists
-
getCart
protected CartModel getCart()
-
getSupportedDeliveryAddresses
public java.util.List<AddressData> getSupportedDeliveryAddresses(boolean visibleAddressesOnly)
Description copied from interface:CheckoutFacadeGet the list of supported delivery addresses.- Specified by:
getSupportedDeliveryAddressesin interfaceCheckoutFacade- Parameters:
visibleAddressesOnly- include only the visible addresses- Returns:
- the supported delivery addresses
-
getDeliveryAddressForCode
public AddressData getDeliveryAddressForCode(java.lang.String code)
Description copied from interface:CheckoutFacadeGet the delivery address with the specified code- Specified by:
getDeliveryAddressForCodein interfaceCheckoutFacade- Parameters:
code- the code- Returns:
- the delivery address
-
getDeliveryAddressModelForCode
protected AddressModel getDeliveryAddressModelForCode(java.lang.String code)
-
createDeliveryAddressModel
protected AddressModel createDeliveryAddressModel(AddressData addressData, CartModel cartModel)
-
getDeliveryAddress
protected AddressData getDeliveryAddress()
-
setDeliveryAddress
public boolean setDeliveryAddress(AddressData addressData)
Description copied from interface:CheckoutFacadeSet the delivery address on the cart.- Specified by:
setDeliveryAddressin interfaceCheckoutFacade- Parameters:
addressData- the address, If null the delivery address is removed from the session cart.- Returns:
- true if operation succeeded
-
getSupportedDeliveryModes
public java.util.List<? extends DeliveryModeData> getSupportedDeliveryModes()
Description copied from interface:CheckoutFacadeGet the supported delivery modes for the cart.- Specified by:
getSupportedDeliveryModesin interfaceCheckoutFacade- Returns:
- the collection of supported delivery modes
-
setDeliveryAddressIfAvailable
public boolean setDeliveryAddressIfAvailable()
Description copied from interface:CheckoutFacadeSet delivery address if customer has a default delivery address and is valid for the cart- Specified by:
setDeliveryAddressIfAvailablein interfaceCheckoutFacade- Returns:
- true if successful
-
setDeliveryModeIfAvailable
public boolean setDeliveryModeIfAvailable()
Description copied from interface:CheckoutFacadeSet cheapest delivery mode if the cart has one or more supported delivery modes- Specified by:
setDeliveryModeIfAvailablein interfaceCheckoutFacade- Returns:
- true if successful
-
setPaymentInfoIfAvailable
public boolean setPaymentInfoIfAvailable()
Description copied from interface:CheckoutFacadeSet payment details if the customer has a default payment details- Specified by:
setPaymentInfoIfAvailablein interfaceCheckoutFacade- Returns:
- true if successful
-
getDeliveryMode
protected DeliveryModeData getDeliveryMode()
-
setDeliveryMode
public boolean setDeliveryMode(java.lang.String deliveryModeCode)
Description copied from interface:CheckoutFacadeSet the delivery mode on the cart Checks if the deliveryMode code is supported. If the code is not supported it does not get set and a false is returned.- Specified by:
setDeliveryModein interfaceCheckoutFacade- Parameters:
deliveryModeCode- the delivery mode- Returns:
- true if successful
-
isSupportedDeliveryMode
protected boolean isSupportedDeliveryMode(java.lang.String deliveryModeCode, CartModel cartModel)
-
convert
protected DeliveryModeData convert(DeliveryModeModel deliveryModeModel)
-
getDeliveryCountries
@Deprecated(since="1808") public java.util.List<CountryData> getDeliveryCountries()
Deprecated.since 1808. Please useCheckoutFacade.getCountries(CountryType)instead.Description copied from interface:CheckoutFacadeGet the supported delivery countries. The list is sorted alphabetically.- Specified by:
getDeliveryCountriesin interfaceCheckoutFacade- Returns:
- list of supported delivery countries.
-
getBillingCountries
@Deprecated(since="1808") public java.util.List<CountryData> getBillingCountries()
Deprecated.since 1808. Please useCheckoutFacade.getCountries(CountryType)instead.Description copied from interface:CheckoutFacadeGet the supported billing countries. The list is sorted alphabetically.- Specified by:
getBillingCountriesin interfaceCheckoutFacade- Returns:
- list of supported billing countries.
-
getCountries
public java.util.List<CountryData> getCountries(CountryType countryType)
Description copied from interface:CheckoutFacadeGet countries.- Specified by:
getCountriesin interfaceCheckoutFacade- Parameters:
countryType- If the value of type equals to shipping, then return shipping countries. If the value of type equals to billing, then return billing countries. If the value of type is not given, return all countries. The list is sorted alphabetically.- Returns:
- list of countries.
-
containsTaxValues
public boolean containsTaxValues()
Description copied from interface:CheckoutFacadeChecks that cart or any of cart entries has TaxValues- Specified by:
containsTaxValuesin interfaceCheckoutFacade- Returns:
- true if the cart or its entries has TaxValues
-
getPaymentDetails
protected CCPaymentInfoData getPaymentDetails()
-
setPaymentDetails
public boolean setPaymentDetails(java.lang.String paymentInfoId)
Description copied from interface:CheckoutFacadeSet Payment Details on the cart- Specified by:
setPaymentDetailsin interfaceCheckoutFacade- Parameters:
paymentInfoId- the ID of the payment info to set as the default payment- Returns:
- true if operation succeeded
-
getSupportedCardTypes
public java.util.List<CardTypeData> getSupportedCardTypes()
Description copied from interface:CheckoutFacadeGet supported payment card types- Specified by:
getSupportedCardTypesin interfaceCheckoutFacade- Returns:
- list of supported card types
-
createPaymentSubscription
public CCPaymentInfoData createPaymentSubscription(CCPaymentInfoData paymentInfoData)
Description copied from interface:CheckoutFacadeCreate new payment subscription. Pass in a CCPaymentInfoData containing the customer's card details. A new payment subscription will be created, and the sorted card details will be returned in a new CCPaymentInfoData.- Specified by:
createPaymentSubscriptionin interfaceCheckoutFacade- Parameters:
paymentInfoData- the data instance containing the customers cart details- Returns:
- the newly created payment info data
-
authorizePayment
public boolean authorizePayment(java.lang.String securityCode)
Description copied from interface:CheckoutFacadeAuthorize payment for the order. The order must have a subscription payment details set on it before the payment can be authorized.- Specified by:
authorizePaymentin interfaceCheckoutFacade- Parameters:
securityCode- the 3 or 4 number CV2 or CVV security code- Returns:
- true if successful
-
placeOrder
public OrderData placeOrder() throws InvalidCartException
Description copied from interface:CheckoutFacadePlace order- Specified by:
placeOrderin interfaceCheckoutFacade- Returns:
- orderData representing the order
- Throws:
InvalidCartException- is thrown by underlyingCartValidator
-
beforePlaceOrder
protected void beforePlaceOrder(CartModel cartModel)
-
placeOrder
protected OrderModel placeOrder(CartModel cartModel) throws InvalidCartException
- Throws:
InvalidCartException
-
afterPlaceOrder
protected void afterPlaceOrder(CartModel cartModel, OrderModel orderModel)
-
removeDeliveryAddress
public boolean removeDeliveryAddress()
Description copied from interface:CheckoutFacadeRemoves delivery address from session cart.- Specified by:
removeDeliveryAddressin interfaceCheckoutFacade- Returns:
- true if delivery address was removed from cart
-
removeDeliveryMode
public boolean removeDeliveryMode()
Description copied from interface:CheckoutFacadeRemoves the delivery mode on the cart- Specified by:
removeDeliveryModein interfaceCheckoutFacade- Returns:
- true if successfully removed.
-
getAddressDataForId
public AddressData getAddressDataForId(java.lang.String addressId, boolean visibleAddressesOnly)
Description copied from interface:CheckoutFacadeLooks up addresses in the customer address book- Specified by:
getAddressDataForIdin interfaceCheckoutFacade- Parameters:
addressId- The PK of an addressvisibleAddressesOnly- If true checks visible addresses in the address book- Returns:
- A address from the address book with a matching id
-
prepareCartForCheckout
public void prepareCartForCheckout()
Description copied from interface:CheckoutFacadePrepares cart for checkout- Specified by:
prepareCartForCheckoutin interfaceCheckoutFacade
-
setDefaultDeliveryAddressForCheckout
public boolean setDefaultDeliveryAddressForCheckout()
Description copied from interface:CheckoutFacadeSets the defaultAddress info on the cart with if current user has a default address info- Specified by:
setDefaultDeliveryAddressForCheckoutin interfaceCheckoutFacade- Returns:
- true if successful
-
setDefaultPaymentInfoForCheckout
public boolean setDefaultPaymentInfoForCheckout()
Description copied from interface:CheckoutFacadeSets the defaultPayment info on the cart if the current user has a default payment info- Specified by:
setDefaultPaymentInfoForCheckoutin interfaceCheckoutFacade- Returns:
- true if successful
-
setCheapestDeliveryModeForCheckout
public boolean setCheapestDeliveryModeForCheckout()
Description copied from interface:CheckoutFacadeSets the cheapest delivery mode in the cart when called- Specified by:
setCheapestDeliveryModeForCheckoutin interfaceCheckoutFacade- Returns:
- boolean if successful
-
hasShippingItems
public boolean hasShippingItems()
Description copied from interface:CheckoutFacadeChecks if at least one entry in the cart is for shipping- Specified by:
hasShippingItemsin interfaceCheckoutFacade- Returns:
- true if at least one shipping entry is found in the cart
-
hasPickUpItems
public boolean hasPickUpItems()
Description copied from interface:CheckoutFacadeChecks if at least one entry in the cart is a pickup entry- Specified by:
hasPickUpItemsin interfaceCheckoutFacade- Returns:
- true if even one pickup entry is found in the cart
-
hasItemsMatchingPredicate
protected boolean hasItemsMatchingPredicate(java.util.function.Predicate<AbstractOrderEntryModel> predicate)
-
checkIfCurrentUserIsTheCartUser
protected boolean checkIfCurrentUserIsTheCartUser()
-
getPaymentProvider
protected java.lang.String getPaymentProvider()
-
getCurrentUserForCheckout
protected CustomerModel getCurrentUserForCheckout()
-
createCommerceCheckoutParameter
protected CommerceCheckoutParameter createCommerceCheckoutParameter(CartModel cart, boolean enableHooks)
-
getCartFacade
protected CartFacade getCartFacade()
-
setCartFacade
public void setCartFacade(CartFacade cartFacade)
-
getCartService
protected <T extends CartService> T getCartService()
-
setCartService
public void setCartService(CartService cartService)
-
getAddressConverter
protected Converter<AddressModel,AddressData> getAddressConverter()
-
setAddressConverter
public void setAddressConverter(Converter<AddressModel,AddressData> addressConverter)
-
getAddressReversePopulator
protected Populator<AddressData,AddressModel> getAddressReversePopulator()
-
setAddressReversePopulator
public void setAddressReversePopulator(Populator<AddressData,AddressModel> addressReversePopulator)
-
getDeliveryService
protected DeliveryService getDeliveryService()
-
setDeliveryService
public void setDeliveryService(DeliveryService deliveryService)
-
getUserService
protected UserService getUserService()
-
setUserService
public void setUserService(UserService userService)
-
getPriceDataFactory
protected PriceDataFactory getPriceDataFactory()
-
setPriceDataFactory
public void setPriceDataFactory(PriceDataFactory priceDataFactory)
-
getCommerceCheckoutService
protected CommerceCheckoutService getCommerceCheckoutService()
-
setCommerceCheckoutService
public void setCommerceCheckoutService(CommerceCheckoutService commerceCheckoutService)
-
getEnumerationService
protected EnumerationService getEnumerationService()
-
setEnumerationService
public void setEnumerationService(EnumerationService enumerationService)
-
getCommerceCardTypeService
protected CommerceCardTypeService getCommerceCardTypeService()
-
setCommerceCardTypeService
public void setCommerceCardTypeService(CommerceCardTypeService commerceCardTypeService)
-
getCustomerAccountService
protected CustomerAccountService getCustomerAccountService()
-
setCustomerAccountService
public void setCustomerAccountService(CustomerAccountService customerAccountService)
-
getCreditCardPaymentInfoConverter
protected Converter<CreditCardPaymentInfoModel,CCPaymentInfoData> getCreditCardPaymentInfoConverter()
-
setCreditCardPaymentInfoConverter
public void setCreditCardPaymentInfoConverter(Converter<CreditCardPaymentInfoModel,CCPaymentInfoData> creditCardPaymentInfoConverter)
-
getDeliveryModeConverter
protected Converter<DeliveryModeModel,DeliveryModeData> getDeliveryModeConverter()
-
setDeliveryModeConverter
public void setDeliveryModeConverter(Converter<DeliveryModeModel,DeliveryModeData> deliveryModeConverter)
-
getZoneDeliveryModeConverter
protected Converter<ZoneDeliveryModeModel,ZoneDeliveryModeData> getZoneDeliveryModeConverter()
-
setZoneDeliveryModeConverter
public void setZoneDeliveryModeConverter(Converter<ZoneDeliveryModeModel,ZoneDeliveryModeData> zoneDeliveryModeConverter)
-
getOrderConverter
protected Converter<OrderModel,OrderData> getOrderConverter()
-
setOrderConverter
public void setOrderConverter(Converter<OrderModel,OrderData> orderConverter)
-
getModelService
protected ModelService getModelService()
-
setModelService
public void setModelService(ModelService modelService)
-
getCommonI18NService
protected CommonI18NService getCommonI18NService()
-
setCommonI18NService
public void setCommonI18NService(CommonI18NService commonI18NService)
-
getBaseStoreService
protected BaseStoreService getBaseStoreService()
-
setBaseStoreService
public void setBaseStoreService(BaseStoreService baseStoreService)
-
getCardTypeConverter
protected Converter<CardType,CardTypeData> getCardTypeConverter()
-
setCardTypeConverter
public void setCardTypeConverter(Converter<CardType,CardTypeData> cardTypeConverter)
-
getCheckoutCustomerStrategy
protected CheckoutCustomerStrategy getCheckoutCustomerStrategy()
-
setCheckoutCustomerStrategy
public void setCheckoutCustomerStrategy(CheckoutCustomerStrategy checkoutCustomerStrategy)
-
getCountryConverter
protected Converter<CountryModel,CountryData> getCountryConverter()
-
setCountryConverter
public void setCountryConverter(Converter<CountryModel,CountryData> countryConverter)
-
-