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 Details

    • register

      Register a user with given parameters
      Parameters:
      registerData - the user data the user will be registered with
      Throws:
      IllegalArgumentException - if required data is missing
      UnknownIdentifierException - if the title code is invalid
      DuplicateUidException - 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(String id)
      Sends a forgotten password request for the customer specified. The given id is 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

      void updatePassword(String token, String newPassword) throws TokenInvalidatedException
      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 expired
      TokenInvalidatedException - 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

      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 customer
      currentPassword - current user password to validate user
      Throws:
      PasswordMismatchException - thrown if the password is invalid
      DuplicateUidException - thrown if the newUid is already in use
    • changePassword

      void changePassword(String oldPassword, String newPassword) throws PasswordMismatchException
      Changes current user password. If current session user is anonymous nothing happens.
      Parameters:
      oldPassword - old password to confirm
      newPassword - 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
    • publishLoginSuccessEvent

      default void publishLoginSuccessEvent()
      publishes LoginSuccessEvent to the event system
    • changeGuestToCustomer

      void changeGuestToCustomer(String pwd, String orderCode) throws DuplicateUidException
      Create a regular customer from a guest customer who has just completed the guest checkout.
      Parameters:
      pwd - the new password entered by the user
      orderCode - the order code
      Throws:
      DuplicateUidException - if the login is not unique
    • generateGUID

      String generateGUID()
      Generates a random guid
      Returns:
      a unique random guid
    • createGuestUserForAnonymousCheckout

      void createGuestUserForAnonymousCheckout(String email, String name) throws DuplicateUidException
      Creates a new guest customer for anonymousCheckout and sets the email and name.
      Parameters:
      email - the email address of the anonymous customer
      name - 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 encoding
      currencyEncoding - enable/disable currency encoding
    • getUserForUID

      CustomerData getUserForUID(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.DEACTIVATIONDATE attribute
    • setPassword

      void setPassword(String userId, String newPassword)
      Sets the new password for the user. The given userId is 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 found
      PasswordEncoderNotFoundException - if encoding not found
      See Also: