public class DefaultCustomerAccountService extends java.lang.Object implements CustomerAccountService
CustomerAccountService| Constructor and Description |
|---|
DefaultCustomerAccountService() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addPaymentInfo(CustomerModel customerModel,
PaymentInfoModel paymentInfoModel) |
protected void |
adjustPassword(UserModel currentUser,
java.lang.String newUid,
java.lang.String currentPassword)
Adjusts a given current user
PrincipalModel.UID with a newUid value unless the user with newUid does not exists
and password for current user matches given currentPassword. |
void |
changePassword(UserModel userModel,
java.lang.String oldPassword,
java.lang.String newPassword)
Changes user password.
|
void |
changeUid(java.lang.String newUid,
java.lang.String currentPassword)
Changes uid for current user
|
protected void |
checkUidUniqueness(java.lang.String newUid) |
void |
clearDefaultAddressEntry(CustomerModel customerModel)
Clears default address on the given customer
|
CustomerModel |
closeAccount(CustomerModel customer)
Close Account for a customer.
|
void |
convertGuestToCustomer(java.lang.String pwd,
java.lang.String orderGUID)
Converts a Guest Customer of anonymous checkout to a regular customer
|
CreditCardPaymentInfoModel |
createPaymentSubscription(CustomerModel customerModel,
CardInfo cardInfo,
BillingInfo billingInfo,
java.lang.String titleCode,
java.lang.String paymentProvider,
boolean saveInAccount)
Creates a payment subscription using specified
paymentProvider. |
void |
deleteAddressEntry(CustomerModel customerModel,
AddressModel addressModel)
Delete address entry.
|
void |
deleteCCPaymentInfo(CustomerModel customerModel,
CreditCardPaymentInfoModel creditCardPaymentInfo)
Delete credit card payment info.
|
protected void |
fillValuesForCustomerInfo(CustomerModel customer) |
void |
forgottenPassword(CustomerModel customerModel)
Sends a forgotten password event
|
protected void |
generateCustomerId(CustomerModel customerModel) |
java.util.List<AddressModel> |
getAddressBookDeliveryEntries(CustomerModel customerModel)
Returns all delivery address book entries from the given customer.
|
java.util.List<AddressModel> |
getAddressBookEntries(CustomerModel customerModel)
Returns all visible address book entries from the given customer.
|
AddressModel |
getAddressForCode(CustomerModel customerModel,
java.lang.String code)
Get a customer address given its code
|
java.util.List<AddressModel> |
getAllAddressEntries(CustomerModel customerModel)
Returns all address book entries from the given customer.
|
protected BaseSiteService |
getBaseSiteService() |
protected BaseStoreService |
getBaseStoreService() |
protected CommerceCommonI18NService |
getCommerceCommonI18NService() |
protected CommonI18NService |
getCommonI18NService() |
protected ConfigurationService |
getConfigurationService() |
CreditCardPaymentInfoModel |
getCreditCardPaymentInfoForCode(CustomerModel customerModel,
java.lang.String code)
Retrieves the customer's credit card payment info given its code
|
java.util.List<CreditCardPaymentInfoModel> |
getCreditCardPaymentInfos(CustomerModel customerModel,
boolean saved)
Retrieves the customer's list of credit card payment information.
|
protected CurrencyModel |
getCurrency(CustomerModel customerModel) |
protected CustomerAccountDao |
getCustomerAccountDao() |
protected CustomerEmailResolutionService |
getCustomerEmailResolutionService() |
protected CustomerNameStrategy |
getCustomerNameStrategy() |
AddressModel |
getDefaultAddress(CustomerModel customerModel)
Returns a customer default shipping address
|
protected EventService |
getEventService() |
protected FlexibleSearchService |
getFlexibleSearchService() |
OrderModel |
getGuestOrderForGUID(java.lang.String guid,
BaseStoreModel store)
Fetch the
OrderModel for the given GUID,Store details and the expiry date for Guest Customers. |
protected I18NService |
getI18nService() |
protected java.lang.String |
getMaskedCardNumber(java.lang.String cardNumber) |
protected ModelService |
getModelService() |
protected java.lang.String |
getMonthsForOrderExpiry() |
OrderModel |
getOrderDetailsForGUID(java.lang.String guid,
BaseStoreModel store)
Returns the orderModel based on the guid and base store
|
OrderModel |
getOrderForCode(CustomerModel customerModel,
java.lang.String code,
BaseStoreModel store)
Deprecated.
Since 5.0.
|
OrderModel |
getOrderForCode(java.lang.String code,
BaseStoreModel store)
Returns the orderModel based on order code and base store
|
java.util.List<OrderModel> |
getOrderList(CustomerModel customerModel,
BaseStoreModel store,
OrderStatus[] status)
Returns the order of the supplied user filtering by OrderStatus
|
SearchPageData<OrderModel> |
getOrderList(CustomerModel customerModel,
BaseStoreModel store,
OrderStatus[] status,
PageableData pageableData)
Returns the order of the supplied user filtering by OrderStatus
|
protected PasswordEncoderService |
getPasswordEncoderService() |
protected java.lang.String |
getPasswordEncoding() |
protected PaymentService |
getPaymentService() |
SearchPageData<ReturnRequestModel> |
getReturnRequestsByCustomerAndStore(CustomerModel customerModel,
BaseStoreModel store,
ReturnStatus[] returnStatuses,
PageableData pageableData)
Returns the
ReturnRequestModel of the given user filtered by given list of ReturnStatus(s). |
protected SecureTokenService |
getSecureTokenService() |
protected TimeService |
getTimeService() |
java.util.Collection<TitleModel> |
getTitles()
Returns all available customer titles in the system.
|
protected long |
getTokenValiditySeconds() |
TypeService |
getTypeService() |
protected UserService |
getUserService() |
protected AbstractCommerceUserEvent |
initializeEvent(AbstractCommerceUserEvent event,
CustomerModel customerModel) |
protected void |
internalSaveCustomer(CustomerModel customerModel)
Saves the customer translating model layer exceptions regarding duplicate identifiers
|
void |
register(CustomerModel customerModel,
java.lang.String password)
Register a user with given parameters
|
protected void |
registerCustomer(CustomerModel customerModel,
java.lang.String password) |
void |
registerGuestForAnonymousCheckout(CustomerModel customerModel,
java.lang.String password)
Registers the Guest customer to session cart for anonymous checkout
|
void |
saveAddressEntry(CustomerModel customerModel,
AddressModel addressModel)
Save address entry.
|
void |
setBaseSiteService(BaseSiteService siteService) |
void |
setBaseStoreService(BaseStoreService service) |
void |
setCommerceCommonI18NService(CommerceCommonI18NService commerceCommonI18NService) |
void |
setCommonI18NService(CommonI18NService commonI18NService) |
void |
setConfigurationService(ConfigurationService configurationService) |
void |
setCustomerAccountDao(CustomerAccountDao customerAccountDao) |
void |
setCustomerEmailResolutionService(CustomerEmailResolutionService customerEmailResolutionService) |
void |
setCustomerNameStrategy(CustomerNameStrategy customerNameStrategy) |
void |
setDefaultAddressEntry(CustomerModel customerModel,
AddressModel addressModel)
Sets the default address entry.
|
void |
setDefaultPaymentInfo(CustomerModel customerModel,
PaymentInfoModel paymentInfoModel)
Sets the default
paymentInfoModel for the specified customerModel. |
void |
setEventService(EventService eventService) |
void |
setFlexibleSearchService(FlexibleSearchService flexibleSearchService) |
void |
setI18nService(I18NService i18nService) |
void |
setModelService(ModelService modelService) |
void |
setMonthsForOrderExpiry(java.lang.String monthsForOrderExpiry) |
void |
setPasswordEncoderService(PasswordEncoderService passwordEncoderService) |
void |
setPasswordEncoding(java.lang.String passwordEncoding) |
void |
setPaymentService(PaymentService paymentService) |
void |
setSecureTokenService(SecureTokenService secureTokenService) |
void |
setTimeService(TimeService timeService) |
void |
setTokenValiditySeconds(long tokenValiditySeconds) |
void |
setTypeService(TypeService typeService) |
void |
setUserService(UserService userService) |
void |
unlinkCCPaymentInfo(CustomerModel customerModel,
CreditCardPaymentInfoModel creditCardPaymentInfo)
Deprecated.
|
void |
updatePassword(java.lang.String token,
java.lang.String newPassword)
Update the password for the user by decrypting and validating the token.
|
void |
updateProfile(CustomerModel customerModel,
java.lang.String titleCode,
java.lang.String name,
java.lang.String login)
Updates the current user with the given parameters
|
protected void addPaymentInfo(CustomerModel customerModel, PaymentInfoModel paymentInfoModel)
public CreditCardPaymentInfoModel createPaymentSubscription(CustomerModel customerModel, CardInfo cardInfo, BillingInfo billingInfo, java.lang.String titleCode, java.lang.String paymentProvider, boolean saveInAccount)
CustomerAccountServicepaymentProvider.createPaymentSubscription in interface CustomerAccountServicecustomerModel - the customer model to add a new payment subscription cardPaymentInfoModelcardInfo - the card detailsbillingInfo - the payment address detailstitleCode - the title code of the payment address details. this parameter can be nullpaymentProvider - the payment provider value specifies provider that will be used to create subscription ID.saveInAccount - true to save in customer account to reuse the subscription for other transactionsprotected CurrencyModel getCurrency(CustomerModel customerModel)
protected java.lang.String getMaskedCardNumber(java.lang.String cardNumber)
public void setDefaultPaymentInfo(CustomerModel customerModel, PaymentInfoModel paymentInfoModel)
CustomerAccountServicepaymentInfoModel for the specified customerModel. Both arguments must
be set and paymentInfoModel must belong to the specified customerModel.setDefaultPaymentInfo in interface CustomerAccountServicecustomerModel - the customer model to set default paymentInfoModelpaymentInfoModel - the payment info model to be set as defaultpublic java.util.List<CreditCardPaymentInfoModel> getCreditCardPaymentInfos(CustomerModel customerModel, boolean saved)
CustomerAccountServicegetCreditCardPaymentInfos in interface CustomerAccountServicecustomerModel - the customer model for which to retrieve payment infosaved - true to retrieve only saved credit card payment informationpublic CreditCardPaymentInfoModel getCreditCardPaymentInfoForCode(CustomerModel customerModel, java.lang.String code)
CustomerAccountServicegetCreditCardPaymentInfoForCode in interface CustomerAccountServicecustomerModel - the customercode - the codepublic java.util.List<AddressModel> getAllAddressEntries(CustomerModel customerModel)
CustomerAccountServicegetAllAddressEntries in interface CustomerAccountServicecustomerModel - the customer model to retrieve addresses frompublic java.util.List<AddressModel> getAddressBookEntries(CustomerModel customerModel)
CustomerAccountServicegetAddressBookEntries in interface CustomerAccountServicecustomerModel - the customer model to retrieve addresses frompublic java.util.List<AddressModel> getAddressBookDeliveryEntries(CustomerModel customerModel)
CustomerAccountServicegetAddressBookDeliveryEntries in interface CustomerAccountServicecustomerModel - the customer model to retrieve addresses frompublic AddressModel getAddressForCode(CustomerModel customerModel, java.lang.String code)
CustomerAccountServicegetAddressForCode in interface CustomerAccountServicecustomerModel - the customercode - the address codepublic AddressModel getDefaultAddress(CustomerModel customerModel)
CustomerAccountServicegetDefaultAddress in interface CustomerAccountServicepublic void saveAddressEntry(CustomerModel customerModel, AddressModel addressModel)
CustomerAccountServicesaveAddressEntry in interface CustomerAccountServicecustomerModel - the customer model to save/reassign address.addressModel - the address model to save/createpublic void deleteAddressEntry(CustomerModel customerModel, AddressModel addressModel)
CustomerAccountServicedeleteAddressEntry in interface CustomerAccountServicecustomerModel - the customer model that should be the address owneraddressModel - the address model that will be deletedpublic void deleteCCPaymentInfo(CustomerModel customerModel, CreditCardPaymentInfoModel creditCardPaymentInfo)
CustomerAccountServicedeleteCCPaymentInfo in interface CustomerAccountServicecustomerModel - the customer model that should be the address ownercreditCardPaymentInfo - payment info model that will be deleted@Deprecated public void unlinkCCPaymentInfo(CustomerModel customerModel, CreditCardPaymentInfoModel creditCardPaymentInfo)
CustomerAccountService.deleteCCPaymentInfo(CustomerModel, CreditCardPaymentInfoModel)CustomerAccountServiceunlinkCCPaymentInfo in interface CustomerAccountServicecustomerModel - the customer model that should be the address ownercreditCardPaymentInfo - payment info model that will be unlinkedpublic void setDefaultAddressEntry(CustomerModel customerModel, AddressModel addressModel)
CustomerAccountServicesetDefaultAddressEntry in interface CustomerAccountServicecustomerModel - the customer model to set default payment address foraddressModel - the address model to be set as default onepublic void clearDefaultAddressEntry(CustomerModel customerModel)
CustomerAccountServiceclearDefaultAddressEntry in interface CustomerAccountServicecustomerModel - the customerpublic java.util.Collection<TitleModel> getTitles()
CustomerAccountServicegetTitles in interface CustomerAccountServicepublic void register(CustomerModel customerModel, java.lang.String password) throws DuplicateUidException
CustomerAccountServiceregister in interface CustomerAccountServicecustomerModel - the user data the user will be registered withpassword - the user's passwordDuplicateUidException - if the login is not uniquepublic void registerGuestForAnonymousCheckout(CustomerModel customerModel, java.lang.String password) throws DuplicateUidException
CustomerAccountServiceregisterGuestForAnonymousCheckout in interface CustomerAccountServiceDuplicateUidExceptionpublic void updateProfile(CustomerModel customerModel, java.lang.String titleCode, java.lang.String name, java.lang.String login) throws DuplicateUidException
CustomerAccountServiceupdateProfile in interface CustomerAccountServicecustomerModel - 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 customerDuplicateUidException - if the email is not uniquepublic void changePassword(UserModel userModel, java.lang.String oldPassword, java.lang.String newPassword) throws PasswordMismatchException
CustomerAccountServicechangePassword in interface CustomerAccountServiceuserModel - the user to change the password foroldPassword - old password to confirmnewPassword - new password to setPasswordMismatchException - if the given old password does not match the one stored in the systempublic void forgottenPassword(CustomerModel customerModel)
CustomerAccountServiceforgottenPassword in interface CustomerAccountServicecustomerModel - the userpublic void updatePassword(java.lang.String token,
java.lang.String newPassword)
throws TokenInvalidatedException
CustomerAccountServiceupdatePassword in interface CustomerAccountServicetoken - the password reset tokennewPassword - the new plain text passwordTokenInvalidatedException - if the token was already used or there is a newer token@Deprecated public OrderModel getOrderForCode(CustomerModel customerModel, java.lang.String code, BaseStoreModel store)
CustomerAccountServicegetOrderForCode in interface CustomerAccountServicecustomerModel - the user to retrieve order forcode - the code of the order to retrievestore - the current storepublic OrderModel getGuestOrderForGUID(java.lang.String guid, BaseStoreModel store)
CustomerAccountServiceOrderModel for the given GUID,Store details and the expiry date for Guest Customers.getGuestOrderForGUID in interface CustomerAccountServiceguid - GUID of the order which was created from the CartModelstore - BaseStoreModel for the current store which the Guest Customer is accessing.public OrderModel getOrderDetailsForGUID(java.lang.String guid, BaseStoreModel store)
CustomerAccountServicegetOrderDetailsForGUID in interface CustomerAccountServicepublic java.util.List<OrderModel> getOrderList(CustomerModel customerModel, BaseStoreModel store, OrderStatus[] status)
CustomerAccountServicegetOrderList in interface CustomerAccountServicecustomerModel - the user to retrieve orders forstore - the current storestatus - One or more OrderStatuses to include in the resultpublic SearchPageData<OrderModel> getOrderList(CustomerModel customerModel, BaseStoreModel store, OrderStatus[] status, PageableData pageableData)
CustomerAccountServicegetOrderList in interface CustomerAccountServicecustomerModel - the user to retrieve orders forstore - the current storestatus - One or more OrderStatuses to include in the resultpageableData - pagination informationpublic SearchPageData<ReturnRequestModel> getReturnRequestsByCustomerAndStore(CustomerModel customerModel, BaseStoreModel store, ReturnStatus[] returnStatuses, PageableData pageableData)
CustomerAccountServiceReturnRequestModel of the given user filtered by given list of ReturnStatus(s).getReturnRequestsByCustomerAndStore in interface CustomerAccountServicecustomerModel - the CustomerModel to retrieve return requests forstore - the current BaseStoreModelreturnStatuses - the ReturnStatus(s) to be included in the result. If null or empty then all statuses are includedpageableData - pagination informationReturnRequestModelpublic void convertGuestToCustomer(java.lang.String pwd,
java.lang.String orderGUID)
throws DuplicateUidException
CustomerAccountServiceconvertGuestToCustomer in interface CustomerAccountServiceDuplicateUidExceptionpublic OrderModel getOrderForCode(java.lang.String code, BaseStoreModel store)
CustomerAccountServicegetOrderForCode in interface CustomerAccountServiceprotected void fillValuesForCustomerInfo(CustomerModel customer) throws DuplicateUidException
DuplicateUidExceptionprotected AbstractCommerceUserEvent initializeEvent(AbstractCommerceUserEvent event, CustomerModel customerModel)
protected void generateCustomerId(CustomerModel customerModel)
protected void internalSaveCustomer(CustomerModel customerModel) throws DuplicateUidException
DuplicateUidExceptionpublic void changeUid(java.lang.String newUid,
java.lang.String currentPassword)
throws DuplicateUidException,
PasswordMismatchException
CustomerAccountServicechangeUid in interface CustomerAccountServicenewUid - given new uidcurrentPassword - password checked for authorization changeDuplicateUidException - if the newUid already exists in the systemPasswordMismatchException - if given currentPassword does not match the store one for the current userpublic CustomerModel closeAccount(CustomerModel customer)
CustomerAccountServicecloseAccount in interface CustomerAccountServicecustomer - customer whose account is to be closedUserModel.DEACTIVATIONDATE attributeprotected void adjustPassword(UserModel currentUser, java.lang.String newUid, java.lang.String currentPassword) throws PasswordMismatchException
PrincipalModel.UID with a newUid value unless the user with newUid does not exists
and password for current user matches given currentPassword.PasswordMismatchExceptionprotected void checkUidUniqueness(java.lang.String newUid)
throws DuplicateUidException
DuplicateUidExceptionprotected void registerCustomer(CustomerModel customerModel, java.lang.String password) throws DuplicateUidException
DuplicateUidExceptionprotected PaymentService getPaymentService()
public void setPaymentService(PaymentService paymentService)
protected ModelService getModelService()
public void setModelService(ModelService modelService)
protected I18NService getI18nService()
public void setI18nService(I18NService i18nService)
protected UserService getUserService()
public void setUserService(UserService userService)
protected PasswordEncoderService getPasswordEncoderService()
public void setPasswordEncoderService(PasswordEncoderService passwordEncoderService)
protected SecureTokenService getSecureTokenService()
public void setSecureTokenService(SecureTokenService secureTokenService)
protected long getTokenValiditySeconds()
public void setTokenValiditySeconds(long tokenValiditySeconds)
protected CustomerAccountDao getCustomerAccountDao()
public void setCustomerAccountDao(CustomerAccountDao customerAccountDao)
protected BaseStoreService getBaseStoreService()
public void setBaseStoreService(BaseStoreService service)
protected BaseSiteService getBaseSiteService()
public void setBaseSiteService(BaseSiteService siteService)
protected CommonI18NService getCommonI18NService()
public void setCommonI18NService(CommonI18NService commonI18NService)
protected EventService getEventService()
public void setEventService(EventService eventService)
protected CustomerEmailResolutionService getCustomerEmailResolutionService()
public void setCustomerEmailResolutionService(CustomerEmailResolutionService customerEmailResolutionService)
protected java.lang.String getPasswordEncoding()
public void setPasswordEncoding(java.lang.String passwordEncoding)
protected FlexibleSearchService getFlexibleSearchService()
public void setFlexibleSearchService(FlexibleSearchService flexibleSearchService)
public TypeService getTypeService()
public void setTypeService(TypeService typeService)
protected CustomerNameStrategy getCustomerNameStrategy()
public void setCustomerNameStrategy(CustomerNameStrategy customerNameStrategy)
protected java.lang.String getMonthsForOrderExpiry()
public void setMonthsForOrderExpiry(java.lang.String monthsForOrderExpiry)
protected TimeService getTimeService()
public void setTimeService(TimeService timeService)
protected CommerceCommonI18NService getCommerceCommonI18NService()
public void setCommerceCommonI18NService(CommerceCommonI18NService commerceCommonI18NService)
protected ConfigurationService getConfigurationService()
public void setConfigurationService(ConfigurationService configurationService)
Copyright © 2018 SAP SE. All Rights Reserved.