Interface CustomerAccountService

All Known Subinterfaces:
B2BCustomerAccountService, ChineseCustomerAccountService
All Known Implementing Classes:
DefaultB2BCustomerAccountService, DefaultChineseCustomerAccountService, DefaultCustomerAccountService, ProfileCustomerAccountService

public interface CustomerAccountService
Handles customer account management capabilities. Provides methods for registering, verifying users, managing customer addresses, orders and payment information.
  • Method Details

    • createPaymentSubscription

      CreditCardPaymentInfoModel createPaymentSubscription(CustomerModel customerModel, CardInfo cardInfo, BillingInfo billingInfo, String titleCode, String paymentProvider, boolean saveInAccount)
      Creates a payment subscription using specified paymentProvider.
      Parameters:
      customerModel - the customer model to add a new payment subscription cardPaymentInfoModel
      cardInfo - the card details
      billingInfo - the payment address details
      titleCode - the title code of the payment address details. this parameter can be null
      paymentProvider - 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 transactions
      Returns:
      The created payment info holding the card details and the subscription id
    • setDefaultPaymentInfo

      void setDefaultPaymentInfo(CustomerModel customerModel, PaymentInfoModel paymentInfoModel)
      Sets the default paymentInfoModel for the specified customerModel. Both arguments must be set and paymentInfoModel must belong to the specified customerModel.
      Parameters:
      customerModel - the customer model to set default paymentInfoModel
      paymentInfoModel - the payment info model to be set as default
      Throws:
      IllegalArgumentException - the illegal argument exception if any argument is null
    • getCreditCardPaymentInfos

      List<CreditCardPaymentInfoModel> getCreditCardPaymentInfos(CustomerModel customerModel, boolean saved)
      Retrieves the customer's list of credit card payment information.
      Parameters:
      customerModel - the customer model for which to retrieve payment info
      saved - true to retrieve only saved credit card payment information
      Returns:
      the customer's list of credit card payment info
    • getCreditCardPaymentInfoForCode

      CreditCardPaymentInfoModel getCreditCardPaymentInfoForCode(CustomerModel customerModel, String code)
      Retrieves the customer's credit card payment info given its code
      Parameters:
      customerModel - the customer
      code - the code
      Returns:
      The credit card payment info
    • deleteCCPaymentInfo

      void deleteCCPaymentInfo(CustomerModel customerModel, CreditCardPaymentInfoModel creditCardPaymentInfo)
      Delete credit card payment info. Before deleting it is checked if the given payment info belongs to the given customer.
      Parameters:
      customerModel - the customer model that should be the address owner
      creditCardPaymentInfo - payment info model that will be deleted
      Throws:
      IllegalArgumentException - the illegal argument exception is thrown when given payment info does not belong to the given customer or any argument is null
    • unlinkCCPaymentInfo

      @Deprecated(since="6.7", forRemoval=true) void unlinkCCPaymentInfo(CustomerModel customerModel, CreditCardPaymentInfoModel creditCardPaymentInfo)
      Deprecated, for removal: This API element is subject to removal in a future version.
      unlink credit card payment info. Before deleting it is checked if the given payment info belongs to the given customer.
      Parameters:
      customerModel - the customer model that should be the address owner
      creditCardPaymentInfo - payment info model that will be unlinked
      Throws:
      IllegalArgumentException - the illegal argument exception is thrown when given payment info does not belong to the given customer or any argument is null
    • getTitles

      Collection<TitleModel> getTitles()
      Returns all available customer titles in the system.
      Returns:
      the titles
    • getAllAddressEntries

      List<AddressModel> getAllAddressEntries(CustomerModel customerModel)
      Returns all address book entries from the given customer.
      Parameters:
      customerModel - the customer model to retrieve addresses from
      Returns:
      the address book entries of the given user
      Throws:
      IllegalArgumentException - the illegal argument exception if any argument is null
    • getAddressBookEntries

      List<AddressModel> getAddressBookEntries(CustomerModel customerModel)
      Returns all visible address book entries from the given customer.
      Parameters:
      customerModel - the customer model to retrieve addresses from
      Returns:
      the address book entries of the given user
      Throws:
      IllegalArgumentException - the illegal argument exception if any argument is null
    • getAddressBookDeliveryEntries

      List<AddressModel> getAddressBookDeliveryEntries(CustomerModel customerModel)
      Returns all delivery address book entries from the given customer.
      Parameters:
      customerModel - the customer model to retrieve addresses from
      Returns:
      the address book entries of the given user
      Throws:
      IllegalArgumentException - the illegal argument exception if any argument is null
    • getAddressForCode

      AddressModel getAddressForCode(CustomerModel customerModel, String code)
      Get a customer address given its code
      Parameters:
      customerModel - the customer
      code - the address code
      Returns:
      the address
    • getDefaultAddress

      AddressModel getDefaultAddress(CustomerModel customerModel)
      Returns a customer default shipping address
      Parameters:
      customerModel -
      Returns:
      the default customer address or null if no address is set as default
    • saveAddressEntry

      void saveAddressEntry(CustomerModel customerModel, AddressModel addressModel)
      Save 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.
      Parameters:
      customerModel - the customer model to save/reassign address.
      addressModel - the address model to save/create
      Throws:
      IllegalArgumentException - the illegal argument exception if any argument is null
    • deleteAddressEntry

      void deleteAddressEntry(CustomerModel customerModel, AddressModel addressModel)
      Delete address entry. Before deleting it is checked if the given address belongs to the given customer.
      Parameters:
      customerModel - the customer model that should be the address owner
      addressModel - the address model that will be deleted
      Throws:
      IllegalArgumentException - the illegal argument exception is thrown when given address does not belong to the given customer or any argument is null
    • setDefaultAddressEntry

      void setDefaultAddressEntry(CustomerModel customerModel, AddressModel addressModel)
      Sets 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.
      Parameters:
      customerModel - the customer model to set default payment address for
      addressModel - the address model to be set as default one
      Throws:
      IllegalArgumentException - the illegal argument exception if any argument is null
    • clearDefaultAddressEntry

      void clearDefaultAddressEntry(CustomerModel customerModel)
      Clears default address on the given customer
      Parameters:
      customerModel - the customer
    • register

      void register(CustomerModel customerModel, String password) throws DuplicateUidException
      Register a user with given parameters
      Parameters:
      customerModel - the user data the user will be registered with
      password - the user's password
      Throws:
      IllegalArgumentException - if required data is missing
      DuplicateUidException - if the login is not unique
    • updateProfile

      void updateProfile(CustomerModel customerModel, String titleCode, String name, String login) throws DuplicateUidException
      Updates the current user with the given parameters
      Parameters:
      customerModel - the customer to update
      titleCode - the code for the title to set
      name - the full name to set on the customer
      login - the UID to set on the customer
      Throws:
      DuplicateUidException - if the email is not unique
    • changePassword

      void changePassword(UserModel userModel, String oldPassword, String newPassword) throws PasswordMismatchException
      Changes user password.
      Parameters:
      userModel - the user to change the password for
      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
    • forgottenPassword

      void forgottenPassword(CustomerModel customerModel)
      Sends a forgotten password event
      Parameters:
      customerModel - the user
    • updatePassword

      void updatePassword(String token, String newPassword) throws TokenInvalidatedException
      Update the password for the user by decrypting and validating the token.
      Parameters:
      token - the password reset token
      newPassword - the new plain text password
      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
    • getOrderForCode

      OrderModel getOrderForCode(CustomerModel customerModel, String code, BaseStoreModel store)
      Returns the specified order for the supplied user.
      Parameters:
      customerModel - the user to retrieve order for
      code - the code of the order to retrieve
      store - the current store
      Returns:
      the order
    • getOrderList

      List<OrderModel> getOrderList(CustomerModel customerModel, BaseStoreModel store, OrderStatus[] status)
      Returns the order of the supplied user filtering by OrderStatus
      Parameters:
      customerModel - the user to retrieve orders for
      store - the current store
      status - One or more OrderStatuses to include in the result
      Returns:
      the list of orders
    • getOrderList

      SearchPageData<OrderModel> getOrderList(CustomerModel customerModel, BaseStoreModel store, OrderStatus[] status, PageableData pageableData)
      Returns the order of the supplied user filtering by OrderStatus
      Parameters:
      customerModel - the user to retrieve orders for
      store - the current store
      status - One or more OrderStatuses to include in the result
      pageableData - pagination information
      Returns:
      the list of orders
    • getReturnRequestsByCustomerAndStore

      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).
      Parameters:
      customerModel - the CustomerModel to retrieve return requests for
      store - the current BaseStoreModel
      returnStatuses - the ReturnStatus(s) to be included in the result. If null or empty then all statuses are included
      pageableData - pagination information
      Returns:
      the list of ReturnRequestModel
    • changeUid

      void changeUid(String newUid, String currentPassword) throws DuplicateUidException, PasswordMismatchException
      Changes uid for current user
      Parameters:
      newUid - given new uid
      currentPassword - password checked for authorization change
      Throws:
      DuplicateUidException - if the newUid already exists in the system
      PasswordMismatchException - if given currentPassword does not match the store one for the current user
    • getGuestOrderForGUID

      OrderModel getGuestOrderForGUID(String guid, BaseStoreModel store)
      Fetch the OrderModel for the given GUID,Store details and the expiry date for Guest Customers.
      Parameters:
      guid - GUID of the order which was created from the CartModel
      store - BaseStoreModel for the current store which the Guest Customer is accessing.
      Returns:
      the order
    • registerGuestForAnonymousCheckout

      void registerGuestForAnonymousCheckout(CustomerModel customerModel, String password) throws DuplicateUidException
      Registers the Guest customer to session cart for anonymous checkout
      Parameters:
      customerModel -
      password -
      Throws:
      DuplicateUidException
    • getOrderDetailsForGUID

      OrderModel getOrderDetailsForGUID(String guid, BaseStoreModel store)
      Returns the orderModel based on the guid and base store
      Parameters:
      guid -
      store -
      Returns:
      the order
    • convertGuestToCustomer

      void convertGuestToCustomer(String pwd, String orderGUID) throws DuplicateUidException
      Converts a Guest Customer of anonymous checkout to a regular customer
      Parameters:
      pwd -
      orderGUID -
      Throws:
      DuplicateUidException
    • getOrderForCode

      OrderModel getOrderForCode(String code, BaseStoreModel store)
      Returns the orderModel based on order code and base store
      Parameters:
      code -
      store -
      Returns:
      the order
    • closeAccount

      CustomerModel closeAccount(CustomerModel user)
      Close Account for a customer.
      Parameters:
      user - customer whose account is to be closed
      Returns:
      the customer with updated UserModel.DEACTIVATIONDATE attribute
    • setPopulatingConsentsInSessionEnabled

      default void setPopulatingConsentsInSessionEnabled(boolean populatingConsentsInSessionEnabled)
      Sets the populate consents session attribute
      Parameters:
      populatingConsentsInSessionEnabled -