Class DefaultCustomerAccountService
java.lang.Object
de.hybris.platform.commerceservices.customer.impl.DefaultCustomerAccountService
- All Implemented Interfaces:
CustomerAccountService
- Direct Known Subclasses:
DefaultB2BCustomerAccountService,DefaultChineseCustomerAccountService,ProfileCustomerAccountService
Default implementation of
CustomerAccountService-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddPaymentInfo(CustomerModel customerModel, PaymentInfoModel paymentInfoModel) protected voidadjustPassword(UserModel currentUser, String newUid, String currentPassword) Adjusts a given current userPrincipalModel.UIDwith a newUid value unless the user with newUid does not exists and password for current user matches given currentPassword.voidchangePassword(UserModel userModel, String oldPassword, String newPassword) Changes user password.voidChanges uid for current userprotected voidcheckUidUniqueness(String newUid) voidclearDefaultAddressEntry(CustomerModel customerModel) Clears default address on the given customercloseAccount(CustomerModel customer) Close Account for a customer.voidconvertGuestToCustomer(String pwd, String orderGUID) Converts a Guest Customer of anonymous checkout to a regular customercreatePaymentSubscription(CustomerModel customerModel, CardInfo cardInfo, BillingInfo billingInfo, String titleCode, String paymentProvider, boolean saveInAccount) Creates a payment subscription using specifiedpaymentProvider.voiddeleteAddressEntry(CustomerModel customerModel, AddressModel addressModel) Delete address entry.voiddeleteCCPaymentInfo(CustomerModel customerModel, CreditCardPaymentInfoModel creditCardPaymentInfo) Delete credit card payment info.protected voidfillValuesForCustomerInfo(CustomerModel customer) voidforgottenPassword(CustomerModel customerModel) Sends a forgotten password eventprotected voidgenerateCustomerId(CustomerModel customerModel) getAddressBookDeliveryEntries(CustomerModel customerModel) Returns all delivery address book entries from the given customer.getAddressBookEntries(CustomerModel customerModel) Returns all visible address book entries from the given customer.getAddressForCode(CustomerModel customerModel, String code) Get a customer address given its codegetAllAddressEntries(CustomerModel customerModel) Returns all address book entries from the given customer.protected BaseSiteServiceprotected BaseStoreServiceprotected CommerceCommonI18NServiceprotected CommerceConsentServiceprotected CommonI18NServiceprotected ConfigurationServicegetCreditCardPaymentInfoForCode(CustomerModel customerModel, String code) Retrieves the customer's credit card payment info given its codegetCreditCardPaymentInfos(CustomerModel customerModel, boolean saved) Retrieves the customer's list of credit card payment information.protected CurrencyModelgetCurrency(CustomerModel customerModel) protected CustomerAccountDaoprotected CustomerEmailResolutionServiceprotected CustomerNameStrategygetDefaultAddress(CustomerModel customerModel) Returns a customer default shipping addressprotected EventServiceprotected FlexibleSearchServicegetGuestOrderForGUID(String guid, BaseStoreModel store) Fetch theOrderModelfor the given GUID,Store details and the expiry date for Guest Customers.protected I18NServiceprotected StringgetMaskedCardNumber(String cardNumber) protected ModelServiceprotected StringgetOrderDetailsForGUID(String guid, BaseStoreModel store) Returns the orderModel based on the guid and base storegetOrderForCode(CustomerModel customerModel, String code, BaseStoreModel store) Deprecated, for removal: This API element is subject to removal in a future version.Since 5.0.getOrderForCode(String code, BaseStoreModel store) Returns the orderModel based on order code and base storegetOrderList(CustomerModel customerModel, BaseStoreModel store, OrderStatus[] status) Returns the order of the supplied user filtering by OrderStatusgetOrderList(CustomerModel customerModel, BaseStoreModel store, OrderStatus[] status, PageableData pageableData) Returns the order of the supplied user filtering by OrderStatusprotected PasswordEncoderServiceprotected Stringprotected PaymentServicegetReturnRequestsByCustomerAndStore(CustomerModel customerModel, BaseStoreModel store, ReturnStatus[] returnStatuses, PageableData pageableData) Returns theReturnRequestModelof the given user filtered by given list ofReturnStatus(s).protected SecureTokenServiceprotected SessionServiceprotected TimeServiceReturns all available customer titles in the system.protected longprotected UserServiceprotected AbstractCommerceUserEventinitializeEvent(AbstractCommerceUserEvent event, CustomerModel customerModel) protected voidinternalSaveCustomer(CustomerModel customerModel) Saves the customer translating model layer exceptions regarding duplicate identifiersprotected List<ConsentTemplateModel>populateAndGetSessionConsentsToRegisteredUser(CustomerModel customerModel, BaseSiteModel baseSiteModel) voidregister(CustomerModel customerModel, String password) Register a user with given parametersprotected voidregisterCustomer(CustomerModel customerModel, String password) voidregisterGuestForAnonymousCheckout(CustomerModel customerModel, String password) Registers the Guest customer to session cart for anonymous checkoutvoidsaveAddressEntry(CustomerModel customerModel, AddressModel addressModel) Save address entry.voidsetBaseSiteService(BaseSiteService siteService) voidsetBaseStoreService(BaseStoreService service) voidsetCommerceCommonI18NService(CommerceCommonI18NService commerceCommonI18NService) voidsetCommerceConsentService(CommerceConsentService commerceConsentService) voidsetCommonI18NService(CommonI18NService commonI18NService) voidsetConfigurationService(ConfigurationService configurationService) voidsetCustomerAccountDao(CustomerAccountDao customerAccountDao) voidsetCustomerEmailResolutionService(CustomerEmailResolutionService customerEmailResolutionService) voidsetCustomerNameStrategy(CustomerNameStrategy customerNameStrategy) voidsetDefaultAddressEntry(CustomerModel customerModel, AddressModel addressModel) Sets the default address entry.voidsetDefaultPaymentInfo(CustomerModel customerModel, PaymentInfoModel paymentInfoModel) Sets the defaultpaymentInfoModelfor the specifiedcustomerModel.voidsetEventService(EventService eventService) voidsetFlexibleSearchService(FlexibleSearchService flexibleSearchService) voidsetI18nService(I18NService i18nService) voidsetModelService(ModelService modelService) voidsetMonthsForOrderExpiry(String monthsForOrderExpiry) voidsetPasswordEncoderService(PasswordEncoderService passwordEncoderService) voidsetPasswordEncoding(String passwordEncoding) voidsetPaymentService(PaymentService paymentService) voidsetPopulatingConsentsInSessionEnabled(boolean populatingConsentsInSessionEnabled) Sets the populate consents session attributevoidsetSecureTokenService(SecureTokenService secureTokenService) voidsetSessionService(SessionService sessionService) voidsetTimeService(TimeService timeService) voidsetTokenValiditySeconds(long tokenValiditySeconds) voidsetTypeService(TypeService typeService) voidsetUserService(UserService userService) voidunlinkCCPaymentInfo(CustomerModel customerModel, CreditCardPaymentInfoModel creditCardPaymentInfo) Deprecated, for removal: This API element is subject to removal in a future version.Since 6.7.voidupdatePassword(String token, String newPassword) Update the password for the user by decrypting and validating the token.voidupdateProfile(CustomerModel customerModel, String titleCode, String name, String login) Updates the current user with the given parameters
-
Constructor Details
-
DefaultCustomerAccountService
public DefaultCustomerAccountService()
-
-
Method Details
-
addPaymentInfo
-
createPaymentSubscription
public CreditCardPaymentInfoModel createPaymentSubscription(CustomerModel customerModel, CardInfo cardInfo, BillingInfo billingInfo, String titleCode, String paymentProvider, boolean saveInAccount) Description copied from interface:CustomerAccountServiceCreates a payment subscription using specifiedpaymentProvider.- Specified by:
createPaymentSubscriptionin interfaceCustomerAccountService- Parameters:
customerModel- the customer model to add a new payment subscriptioncardPaymentInfoModelcardInfo- the card detailsbillingInfo- the payment address detailstitleCode- the title code of the payment address details. this parameter can benullpaymentProvider- the payment provider value specifies provider that will be used to create subscription ID.saveInAccount-trueto save in customer account to reuse the subscription for other transactions- Returns:
- The created payment info holding the card details and the subscription id
-
getCurrency
-
getMaskedCardNumber
-
setDefaultPaymentInfo
Description copied from interface:CustomerAccountServiceSets the defaultpaymentInfoModelfor the specifiedcustomerModel. Both arguments must be set andpaymentInfoModelmust belong to the specifiedcustomerModel.- Specified by:
setDefaultPaymentInfoin interfaceCustomerAccountService- Parameters:
customerModel- the customer model to set defaultpaymentInfoModelpaymentInfoModel- the payment info model to be set as default
-
getCreditCardPaymentInfos
public List<CreditCardPaymentInfoModel> getCreditCardPaymentInfos(CustomerModel customerModel, boolean saved) Description copied from interface:CustomerAccountServiceRetrieves the customer's list of credit card payment information.- Specified by:
getCreditCardPaymentInfosin interfaceCustomerAccountService- Parameters:
customerModel- the customer model for which to retrieve payment infosaved-trueto retrieve only saved credit card payment information- Returns:
- the customer's list of credit card payment info
-
getCreditCardPaymentInfoForCode
public CreditCardPaymentInfoModel getCreditCardPaymentInfoForCode(CustomerModel customerModel, String code) Description copied from interface:CustomerAccountServiceRetrieves the customer's credit card payment info given its code- Specified by:
getCreditCardPaymentInfoForCodein interfaceCustomerAccountService- Parameters:
customerModel- the customercode- the code- Returns:
- The credit card payment info
-
getAllAddressEntries
Description copied from interface:CustomerAccountServiceReturns all address book entries from the given customer.- Specified by:
getAllAddressEntriesin interfaceCustomerAccountService- Parameters:
customerModel- the customer model to retrieve addresses from- Returns:
- the address book entries of the given user
-
getAddressBookEntries
Description copied from interface:CustomerAccountServiceReturns all visible address book entries from the given customer.- Specified by:
getAddressBookEntriesin interfaceCustomerAccountService- Parameters:
customerModel- the customer model to retrieve addresses from- Returns:
- the address book entries of the given user
-
getAddressBookDeliveryEntries
Description copied from interface:CustomerAccountServiceReturns all delivery address book entries from the given customer.- Specified by:
getAddressBookDeliveryEntriesin interfaceCustomerAccountService- Parameters:
customerModel- the customer model to retrieve addresses from- Returns:
- the address book entries of the given user
-
getAddressForCode
Description copied from interface:CustomerAccountServiceGet a customer address given its code- Specified by:
getAddressForCodein interfaceCustomerAccountService- Parameters:
customerModel- the customercode- the address code- Returns:
- the address
-
getDefaultAddress
Description copied from interface:CustomerAccountServiceReturns a customer default shipping address- Specified by:
getDefaultAddressin interfaceCustomerAccountService- Returns:
- the default customer address or null if no address is set as default
-
saveAddressEntry
Description copied from interface:CustomerAccountServiceSave address entry. If the given address model is not saved it will be assigned to the given customer and saved. If address is saved and belongs to other user it will be cloned, assigned to the given customer and the original address will be left as it is.- Specified by:
saveAddressEntryin interfaceCustomerAccountService- Parameters:
customerModel- the customer model to save/reassign address.addressModel- the address model to save/create
-
deleteAddressEntry
Description copied from interface:CustomerAccountServiceDelete address entry. Before deleting it is checked if the given address belongs to the given customer.- Specified by:
deleteAddressEntryin interfaceCustomerAccountService- Parameters:
customerModel- the customer model that should be the address owneraddressModel- the address model that will be deleted
-
deleteCCPaymentInfo
public void deleteCCPaymentInfo(CustomerModel customerModel, CreditCardPaymentInfoModel creditCardPaymentInfo) Description copied from interface:CustomerAccountServiceDelete credit card payment info. Before deleting it is checked if the given payment info belongs to the given customer.- Specified by:
deleteCCPaymentInfoin interfaceCustomerAccountService- Parameters:
customerModel- the customer model that should be the address ownercreditCardPaymentInfo- payment info model that will be deleted
-
unlinkCCPaymentInfo
@Deprecated(since="6.7", forRemoval=true) public void unlinkCCPaymentInfo(CustomerModel customerModel, CreditCardPaymentInfoModel creditCardPaymentInfo) Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:CustomerAccountServiceunlink credit card payment info. Before deleting it is checked if the given payment info belongs to the given customer.- Specified by:
unlinkCCPaymentInfoin interfaceCustomerAccountService- Parameters:
customerModel- the customer model that should be the address ownercreditCardPaymentInfo- payment info model that will be unlinked
-
setDefaultAddressEntry
Description copied from interface:CustomerAccountServiceSets the default address entry. Because customer addresses are not sorted it sets given address as default customer payment address. If the address is not saved it will be created and assigned to the given user. If given address belongs to other user it will be cloned and assigned to the given customer and the original address will be left as it is.- Specified by:
setDefaultAddressEntryin interfaceCustomerAccountService- Parameters:
customerModel- the customer model to set default payment address foraddressModel- the address model to be set as default one
-
clearDefaultAddressEntry
Description copied from interface:CustomerAccountServiceClears default address on the given customer- Specified by:
clearDefaultAddressEntryin interfaceCustomerAccountService- Parameters:
customerModel- the customer
-
getTitles
Description copied from interface:CustomerAccountServiceReturns all available customer titles in the system.- Specified by:
getTitlesin interfaceCustomerAccountService- Returns:
- the titles
-
register
Description copied from interface:CustomerAccountServiceRegister a user with given parameters- Specified by:
registerin interfaceCustomerAccountService- Parameters:
customerModel- the user data the user will be registered withpassword- the user's password- Throws:
DuplicateUidException- if the login is not unique
-
populateAndGetSessionConsentsToRegisteredUser
protected List<ConsentTemplateModel> populateAndGetSessionConsentsToRegisteredUser(CustomerModel customerModel, BaseSiteModel baseSiteModel) -
registerGuestForAnonymousCheckout
public void registerGuestForAnonymousCheckout(CustomerModel customerModel, String password) throws DuplicateUidException Description copied from interface:CustomerAccountServiceRegisters the Guest customer to session cart for anonymous checkout- Specified by:
registerGuestForAnonymousCheckoutin interfaceCustomerAccountService- Throws:
DuplicateUidException
-
updateProfile
public void updateProfile(CustomerModel customerModel, String titleCode, String name, String login) throws DuplicateUidException Description copied from interface:CustomerAccountServiceUpdates the current user with the given parameters- Specified by:
updateProfilein interfaceCustomerAccountService- Parameters:
customerModel- the customer to updatetitleCode- the code for the title to setname- the full name to set on the customerlogin- the UID to set on the customer- Throws:
DuplicateUidException- if the email is not unique
-
changePassword
public void changePassword(UserModel userModel, String oldPassword, String newPassword) throws PasswordMismatchException Description copied from interface:CustomerAccountServiceChanges user password.- Specified by:
changePasswordin interfaceCustomerAccountService- Parameters:
userModel- the user to change the password foroldPassword- old password to confirmnewPassword- new password to set- Throws:
PasswordMismatchException- if the given old password does not match the one stored in the system
-
forgottenPassword
Description copied from interface:CustomerAccountServiceSends a forgotten password event- Specified by:
forgottenPasswordin interfaceCustomerAccountService- Parameters:
customerModel- the user
-
updatePassword
Description copied from interface:CustomerAccountServiceUpdate the password for the user by decrypting and validating the token.- Specified by:
updatePasswordin interfaceCustomerAccountService- Parameters:
token- the password reset tokennewPassword- the new plain text password- Throws:
TokenInvalidatedException- if the token was already used or there is a newer token
-
getOrderForCode
@Deprecated(since="5.0", forRemoval=true) public OrderModel getOrderForCode(CustomerModel customerModel, String code, BaseStoreModel store) Deprecated, for removal: This API element is subject to removal in a future version.Since 5.0.Description copied from interface:CustomerAccountServiceReturns the specified order for the supplied user.- Specified by:
getOrderForCodein interfaceCustomerAccountService- Parameters:
customerModel- the user to retrieve order forcode- the code of the order to retrievestore- the current store- Returns:
- the order
-
getGuestOrderForGUID
Description copied from interface:CustomerAccountServiceFetch theOrderModelfor the given GUID,Store details and the expiry date for Guest Customers.- Specified by:
getGuestOrderForGUIDin interfaceCustomerAccountService- Parameters:
guid- GUID of the order which was created from theCartModelstore-BaseStoreModelfor the current store which the Guest Customer is accessing.- Returns:
- the order
-
getOrderDetailsForGUID
Description copied from interface:CustomerAccountServiceReturns the orderModel based on the guid and base store- Specified by:
getOrderDetailsForGUIDin interfaceCustomerAccountService- Returns:
- the order
-
getOrderList
public List<OrderModel> getOrderList(CustomerModel customerModel, BaseStoreModel store, OrderStatus[] status) Description copied from interface:CustomerAccountServiceReturns the order of the supplied user filtering by OrderStatus- Specified by:
getOrderListin interfaceCustomerAccountService- Parameters:
customerModel- the user to retrieve orders forstore- the current storestatus- One or more OrderStatuses to include in the result- Returns:
- the list of orders
-
getOrderList
public SearchPageData<OrderModel> getOrderList(CustomerModel customerModel, BaseStoreModel store, OrderStatus[] status, PageableData pageableData) Description copied from interface:CustomerAccountServiceReturns the order of the supplied user filtering by OrderStatus- Specified by:
getOrderListin interfaceCustomerAccountService- Parameters:
customerModel- the user to retrieve orders forstore- the current storestatus- One or more OrderStatuses to include in the resultpageableData- pagination information- Returns:
- the list of orders
-
getReturnRequestsByCustomerAndStore
public SearchPageData<ReturnRequestModel> getReturnRequestsByCustomerAndStore(CustomerModel customerModel, BaseStoreModel store, ReturnStatus[] returnStatuses, PageableData pageableData) Description copied from interface:CustomerAccountServiceReturns theReturnRequestModelof the given user filtered by given list ofReturnStatus(s).- Specified by:
getReturnRequestsByCustomerAndStorein interfaceCustomerAccountService- Parameters:
customerModel- theCustomerModelto retrieve return requests forstore- the currentBaseStoreModelreturnStatuses- theReturnStatus(s) to be included in the result. If null or empty then all statuses are includedpageableData- pagination information- Returns:
- the list of
ReturnRequestModel
-
convertGuestToCustomer
Description copied from interface:CustomerAccountServiceConverts a Guest Customer of anonymous checkout to a regular customer- Specified by:
convertGuestToCustomerin interfaceCustomerAccountService- Throws:
DuplicateUidException
-
getOrderForCode
Description copied from interface:CustomerAccountServiceReturns the orderModel based on order code and base store- Specified by:
getOrderForCodein interfaceCustomerAccountService- Returns:
- the order
-
fillValuesForCustomerInfo
- Throws:
DuplicateUidException
-
initializeEvent
protected AbstractCommerceUserEvent initializeEvent(AbstractCommerceUserEvent event, CustomerModel customerModel) -
generateCustomerId
-
internalSaveCustomer
Saves the customer translating model layer exceptions regarding duplicate identifiers- Throws:
DuplicateUidException
-
changeUid
public void changeUid(String newUid, String currentPassword) throws DuplicateUidException, PasswordMismatchException Description copied from interface:CustomerAccountServiceChanges uid for current user- Specified by:
changeUidin interfaceCustomerAccountService- Parameters:
newUid- given new uidcurrentPassword- password checked for authorization change- Throws:
DuplicateUidException- if the newUid already exists in the systemPasswordMismatchException- if given currentPassword does not match the store one for the current user
-
closeAccount
Description copied from interface:CustomerAccountServiceClose Account for a customer.- Specified by:
closeAccountin interfaceCustomerAccountService- Parameters:
customer- customer whose account is to be closed- Returns:
- the customer with updated
UserModel.DEACTIVATIONDATEattribute
-
setPopulatingConsentsInSessionEnabled
public void setPopulatingConsentsInSessionEnabled(boolean populatingConsentsInSessionEnabled) Description copied from interface:CustomerAccountServiceSets the populate consents session attribute- Specified by:
setPopulatingConsentsInSessionEnabledin interfaceCustomerAccountService
-
adjustPassword
protected void adjustPassword(UserModel currentUser, String newUid, String currentPassword) throws PasswordMismatchException Adjusts a given current userPrincipalModel.UIDwith a newUid value unless the user with newUid does not exists and password for current user matches given currentPassword.- Throws:
PasswordMismatchException
-
checkUidUniqueness
- Throws:
DuplicateUidException
-
registerCustomer
protected void registerCustomer(CustomerModel customerModel, String password) throws DuplicateUidException - Throws:
DuplicateUidException
-
getPaymentService
-
setPaymentService
-
getModelService
-
setModelService
-
getI18nService
-
setI18nService
-
getUserService
-
setUserService
-
getPasswordEncoderService
-
setPasswordEncoderService
-
getSecureTokenService
-
setSecureTokenService
-
getTokenValiditySeconds
protected long getTokenValiditySeconds() -
setTokenValiditySeconds
public void setTokenValiditySeconds(long tokenValiditySeconds) -
getCustomerAccountDao
-
setCustomerAccountDao
-
getBaseStoreService
-
setBaseStoreService
-
getBaseSiteService
-
setBaseSiteService
-
getCommonI18NService
-
setCommonI18NService
-
getEventService
-
setEventService
-
getCustomerEmailResolutionService
-
setCustomerEmailResolutionService
public void setCustomerEmailResolutionService(CustomerEmailResolutionService customerEmailResolutionService) -
getPasswordEncoding
-
setPasswordEncoding
-
getFlexibleSearchService
-
setFlexibleSearchService
-
getTypeService
-
setTypeService
-
getCustomerNameStrategy
-
setCustomerNameStrategy
-
getMonthsForOrderExpiry
-
setMonthsForOrderExpiry
-
getTimeService
-
setTimeService
-
getCommerceCommonI18NService
-
setCommerceCommonI18NService
-
getConfigurationService
-
setConfigurationService
-
getCommerceConsentService
-
setCommerceConsentService
-
getSessionService
-
setSessionService
-