Interface CustomerFacade
-
- All Known Subinterfaces:
ChineseCustomerFacade
- All Known Implementing Classes:
DefaultB2BCustomerFacade,DefaultChineseCustomerFacade,DefaultCustomerFacade,ProfileCustomerFacade
public interface CustomerFacadeDefines an API to perform various customer related operations
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidchangeGuestToCustomer(java.lang.String pwd, java.lang.String orderCode)Create a regular customer from a guest customer who has just completed the guest checkout.voidchangePassword(java.lang.String oldPassword, java.lang.String newPassword)Changes current user password.voidchangeUid(java.lang.String newUid, java.lang.String currentPassword)Change the current customer's UID.CustomerDatacloseAccount()Close Account for current session user.voidcreateGuestUserForAnonymousCheckout(java.lang.String email, java.lang.String name)Creates a new guest customer for anonymousCheckout and sets the email and name.voidforgottenPassword(java.lang.String id)Sends a forgotten password request for the customer specified.java.lang.StringgenerateGUID()Generates a random guidCustomerDatagetCurrentCustomer()Returns the current session user.java.lang.StringgetCurrentCustomerUid()Returns the uid of current session user.CustomerDatagetUserForUID(java.lang.String userId)Gets the user for UID.voidloginSuccess()updates the session currency and language to the user settings, assigns the cart to the current user and calculates the cartCustomerDatanextDummyCustomerData(RegisterData registerData)Generate dummy customer data with random customerId to return if user already exists in database.voidregister(RegisterData registerData)Register a user with given parametersvoidrememberMeLoginSuccessWithUrlEncoding(boolean languageEncoding, boolean currencyEncoding)This method will be used by rememberMeServices when there is encoding attributes for language and currency.voidsetPassword(java.lang.String userId, java.lang.String newPassword)Sets the new password for the user.voidupdateCartWithGuestForAnonymousCheckout(CustomerData guestCustomerData)Guest customer which is created for anonymous checkout will be the cart user.voidupdateFullProfile(CustomerData customerData)Updates current customer's profile with given parametersvoidupdatePassword(java.lang.String token, java.lang.String newPassword)Update the password for the user by decrypting and validating the token.voidupdateProfile(CustomerData customerData)Updates current customer's profile with given parameters
-
-
-
Method Detail
-
register
void register(RegisterData registerData) throws DuplicateUidException, UnknownIdentifierException, java.lang.IllegalArgumentException
Register a user with given parameters- Parameters:
registerData- the user data the user will be registered with- Throws:
java.lang.IllegalArgumentException- if required data is missingUnknownIdentifierException- if the title code is invalidDuplicateUidException- if the login is not unique
-
nextDummyCustomerData
CustomerData nextDummyCustomerData(RegisterData registerData)
Generate dummy customer data with random customerId to return if user already exists in database. * @param registerData data provided by user during registration- Returns:
-
forgottenPassword
void forgottenPassword(java.lang.String id)
Sends a forgotten password request for the customer specified. The givenidis one of the unique identifiers that is used to recognize the customer in matching strategies.- Parameters:
id- the id of the customer to send the forgotten password mail for.- Throws:
UnknownIdentifierException- if the customer cannot be found for the id specified- See Also:
DefaultUserMatchingService
-
updatePassword
void updatePassword(java.lang.String token, java.lang.String newPassword) throws TokenInvalidatedExceptionUpdate the password for the user by decrypting and validating the token.- Parameters:
token- the token to identify the the customer to reset the password for.newPassword- the new password to set- Throws:
java.lang.IllegalArgumentException- If the new password is empty or the token is invalid or expiredTokenInvalidatedException- if the token was already used or there is a newer token
-
getCurrentCustomer
CustomerData getCurrentCustomer() throws ConversionException
Returns the current session user.- Returns:
- current session user data
- Throws:
ConversionException- the conversion exception when exception occurred when converting user
-
getCurrentCustomerUid
java.lang.String getCurrentCustomerUid()
Returns the uid of current session user.- Returns:
- current session user uid
-
changeUid
void changeUid(java.lang.String newUid, java.lang.String currentPassword) throws DuplicateUidException, PasswordMismatchExceptionChange the current customer's UID. The current password is required for 2 reasons, firstly to validate that the current visitor is actually the customer, secondly the password hash may be salted with the UID and therefore if the UID is changed then the password needs to be re-hashed.- Parameters:
newUid- the new UID for the current customercurrentPassword- current user password to validate user- Throws:
PasswordMismatchException- thrown if the password is invalidDuplicateUidException- thrown if the newUid is already in use
-
changePassword
void changePassword(java.lang.String oldPassword, java.lang.String newPassword) throws PasswordMismatchExceptionChanges current user password. If current session user is anonymous nothing happens.- Parameters:
oldPassword- old password to confirmnewPassword- new password to set- Throws:
PasswordMismatchException- if the given old password does not match the one stored in the system
-
updateProfile
void updateProfile(CustomerData customerData) throws DuplicateUidException
Updates current customer's profile with given parameters- Parameters:
customerData- the updated customer data- Throws:
DuplicateUidException- if the login is not unique
-
updateFullProfile
void updateFullProfile(CustomerData customerData) throws DuplicateUidException
Updates current customer's profile with given parameters- Parameters:
customerData- the updated customer data- Throws:
DuplicateUidException- if the login is not unique
-
loginSuccess
void loginSuccess()
updates the session currency and language to the user settings, assigns the cart to the current user and calculates the cart
-
changeGuestToCustomer
void changeGuestToCustomer(java.lang.String pwd, java.lang.String orderCode) throws DuplicateUidExceptionCreate a regular customer from a guest customer who has just completed the guest checkout.- Parameters:
pwd- the new password entered by the userorderCode- the order code- Throws:
DuplicateUidException- if the login is not unique
-
generateGUID
java.lang.String generateGUID()
Generates a random guid- Returns:
- a unique random guid
-
createGuestUserForAnonymousCheckout
void createGuestUserForAnonymousCheckout(java.lang.String email, java.lang.String name) throws DuplicateUidExceptionCreates a new guest customer for anonymousCheckout and sets the email and name.- Parameters:
email- the email address of the anonymous customername- the name of the anonymous customer- Throws:
DuplicateUidException
-
updateCartWithGuestForAnonymousCheckout
void updateCartWithGuestForAnonymousCheckout(CustomerData guestCustomerData)
Guest customer which is created for anonymous checkout will be the cart user. The session user will remain anonymous.- Parameters:
guestCustomerData- customer data to update the cart with
-
rememberMeLoginSuccessWithUrlEncoding
void rememberMeLoginSuccessWithUrlEncoding(boolean languageEncoding, boolean currencyEncoding)This method will be used by rememberMeServices when there is encoding attributes for language and currency.- Parameters:
languageEncoding- enable/disable language encodingcurrencyEncoding- enable/disable currency encoding
-
getUserForUID
CustomerData getUserForUID(java.lang.String userId)
Gets the user for UID.- Parameters:
userId- the user id- Returns:
- the user for UID
-
closeAccount
CustomerData closeAccount()
Close Account for current session user.- Returns:
- the customer with updated
UserModel.DEACTIVATIONDATEattribute
-
setPassword
void setPassword(java.lang.String userId, java.lang.String newPassword)Sets the new password for the user. The givenuserIdis one of the unique identifiers that is used to recognize the user in matching strategies.- Parameters:
userId- id used to identify the user.newPassword- new password for the user- Throws:
UnknownIdentifierException- if user not foundPasswordEncoderNotFoundException- if encoding not found- See Also:
DefaultUserMatchingService
-
-