Interface CustomerFacade
- All Known Subinterfaces:
ChineseCustomerFacade
- All Known Implementing Classes:
DefaultB2BCustomerFacade,DefaultChineseCustomerFacade,DefaultCustomerFacade,ProfileCustomerFacade
public interface CustomerFacade
Defines an API to perform various customer related operations
-
Method Summary
Modifier and TypeMethodDescriptionvoidchangeGuestToCustomer(String pwd, String orderCode) Create a regular customer from a guest customer who has just completed the guest checkout.voidchangePassword(String oldPassword, String newPassword) Changes current user password.voidChange the current customer's UID.Close Account for current session user.voidcreateGuestUserForAnonymousCheckout(String email, String name) Creates a new guest customer for anonymousCheckout and sets the email and name.voidSends a forgotten password request for the customer specified.Generates a random guidReturns the current session user.Returns the uid of current session user.getUserForUID(String userId) Gets the user for UID.voidupdates the session currency and language to the user settings, assigns the cart to the current user and calculates the cartnextDummyCustomerData(RegisterData registerData) Generate dummy customer data with random customerId to return if user already exists in database.default voidpublishes LoginSuccessEvent to the event systemvoidregister(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(String userId, 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(String token, 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 Details
-
register
void register(RegisterData registerData) throws DuplicateUidException, UnknownIdentifierException, IllegalArgumentException Register a user with given parameters- Parameters:
registerData- the user data the user will be registered with- Throws:
IllegalArgumentException- if required data is missingUnknownIdentifierException- if the title code is invalidDuplicateUidException- if the login is not unique
-
nextDummyCustomerData
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
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:
-
updatePassword
Update 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:
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
Returns the current session user.- Returns:
- current session user data
- Throws:
ConversionException- the conversion exception when exception occurred when converting user
-
getCurrentCustomerUid
String getCurrentCustomerUid()Returns the uid of current session user.- Returns:
- current session user uid
-
changeUid
void changeUid(String newUid, String currentPassword) throws DuplicateUidException, PasswordMismatchException Change 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
Changes 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
Updates current customer's profile with given parameters- Parameters:
customerData- the updated customer data- Throws:
DuplicateUidException- if the login is not unique
-
updateFullProfile
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 -
publishLoginSuccessEvent
default void publishLoginSuccessEvent()publishes LoginSuccessEvent to the event system -
changeGuestToCustomer
Create 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
String generateGUID()Generates a random guid- Returns:
- a unique random guid
-
createGuestUserForAnonymousCheckout
Creates 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
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
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
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:
-