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 Summary
Modifier and TypeMethodDescriptionvoidchangePassword(UserModel userModel, String oldPassword, String newPassword) Changes user password.voidChanges uid for current uservoidclearDefaultAddressEntry(CustomerModel customerModel) Clears default address on the given customercloseAccount(CustomerModel user) Close Account for a customer.voidconvertGuestToCustomer(String pwd, String orderGUID) Converts a Guest Customer of anonymous checkout to a regular customercreatePaymentSubscription(CustomerModel customerModel, CardInfo cardInfo, BillingInfo billingInfo, String titleCode, String paymentProvider, boolean saveInAccount) Creates a payment subscription using specifiedpaymentProvider.voiddeleteAddressEntry(CustomerModel customerModel, AddressModel addressModel) Delete address entry.voiddeleteCCPaymentInfo(CustomerModel customerModel, CreditCardPaymentInfoModel creditCardPaymentInfo) Delete credit card payment info.voidforgottenPassword(CustomerModel customerModel) Sends a forgotten password eventgetAddressBookDeliveryEntries(CustomerModel customerModel) Returns all delivery address book entries from the given customer.getAddressBookEntries(CustomerModel customerModel) Returns all visible address book entries from the given customer.getAddressForCode(CustomerModel customerModel, String code) Get a customer address given its codegetAllAddressEntries(CustomerModel customerModel) Returns all address book entries from the given customer.getCreditCardPaymentInfoForCode(CustomerModel customerModel, String code) Retrieves the customer's credit card payment info given its codegetCreditCardPaymentInfos(CustomerModel customerModel, boolean saved) Retrieves the customer's list of credit card payment information.getDefaultAddress(CustomerModel customerModel) Returns a customer default shipping addressgetGuestOrderForGUID(String guid, BaseStoreModel store) Fetch theOrderModelfor the given GUID,Store details and the expiry date for Guest Customers.getOrderDetailsForGUID(String guid, BaseStoreModel store) Returns the orderModel based on the guid and base storegetOrderForCode(CustomerModel customerModel, String code, BaseStoreModel store) Returns the specified order for the supplied user.getOrderForCode(String code, BaseStoreModel store) Returns the orderModel based on order code and base storegetOrderList(CustomerModel customerModel, BaseStoreModel store, OrderStatus[] status) Returns the order of the supplied user filtering by OrderStatusgetOrderList(CustomerModel customerModel, BaseStoreModel store, OrderStatus[] status, PageableData pageableData) Returns the order of the supplied user filtering by OrderStatusgetReturnRequestsByCustomerAndStore(CustomerModel customerModel, BaseStoreModel store, ReturnStatus[] returnStatuses, PageableData pageableData) Returns theReturnRequestModelof the given user filtered by given list ofReturnStatus(s).Returns all available customer titles in the system.voidregister(CustomerModel customerModel, String password) Register a user with given parametersvoidregisterGuestForAnonymousCheckout(CustomerModel customerModel, String password) Registers the Guest customer to session cart for anonymous checkoutvoidsaveAddressEntry(CustomerModel customerModel, AddressModel addressModel) Save address entry.voidsetDefaultAddressEntry(CustomerModel customerModel, AddressModel addressModel) Sets the default address entry.voidsetDefaultPaymentInfo(CustomerModel customerModel, PaymentInfoModel paymentInfoModel) Sets the defaultpaymentInfoModelfor the specifiedcustomerModel.default voidsetPopulatingConsentsInSessionEnabled(boolean populatingConsentsInSessionEnabled) Sets the populate consents session attributevoidunlinkCCPaymentInfo(CustomerModel customerModel, CreditCardPaymentInfoModel creditCardPaymentInfo) Deprecated, for removal: This API element is subject to removal in a future version.Since 6.7.voidupdatePassword(String token, String newPassword) Update the password for the user by decrypting and validating the token.voidupdateProfile(CustomerModel customerModel, String titleCode, String name, String login) Updates the current user with the given parameters
-
Method Details
-
createPaymentSubscription
CreditCardPaymentInfoModel createPaymentSubscription(CustomerModel customerModel, CardInfo cardInfo, BillingInfo billingInfo, String titleCode, String paymentProvider, boolean saveInAccount) Creates a payment subscription using specifiedpaymentProvider.- Parameters:
customerModel- the customer model to add a new payment subscriptioncardPaymentInfoModelcardInfo- the card detailsbillingInfo- the payment address detailstitleCode- the title code of the payment address details. this parameter can benullpaymentProvider- the payment provider value specifies provider that will be used to create subscription ID.saveInAccount-trueto 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
Sets the defaultpaymentInfoModelfor the specifiedcustomerModel. Both arguments must be set andpaymentInfoModelmust belong to the specifiedcustomerModel.- Parameters:
customerModel- the customer model to set defaultpaymentInfoModelpaymentInfoModel- 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 infosaved-trueto 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 customercode- 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 ownercreditCardPaymentInfo- 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 ownercreditCardPaymentInfo- 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
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
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
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
Get a customer address given its code- Parameters:
customerModel- the customercode- the address code- Returns:
- the address
-
getDefaultAddress
Returns a customer default shipping address- Parameters:
customerModel-- Returns:
- the default customer address or null if no address is set as default
-
saveAddressEntry
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
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 owneraddressModel- 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
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 foraddressModel- the address model to be set as default one- Throws:
IllegalArgumentException- the illegal argument exception if any argument is null
-
clearDefaultAddressEntry
Clears default address on the given customer- Parameters:
customerModel- the customer
-
register
Register a user with given parameters- Parameters:
customerModel- the user data the user will be registered withpassword- the user's password- Throws:
IllegalArgumentException- if required data is missingDuplicateUidException- 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 updatetitleCode- the code for the title to setname- the full name to set on the customerlogin- 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 foroldPassword- old password to confirmnewPassword- new password to set- Throws:
PasswordMismatchException- if the given old password does not match the one stored in the system
-
forgottenPassword
Sends a forgotten password event- Parameters:
customerModel- the user
-
updatePassword
Update the password for the user by decrypting and validating the token.- Parameters:
token- the password reset tokennewPassword- the new plain text password- 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
-
getOrderForCode
Returns the specified order for the supplied user.- Parameters:
customerModel- the user to retrieve order forcode- the code of the order to retrievestore- 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 forstore- the current storestatus- 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 forstore- the current storestatus- One or more OrderStatuses to include in the resultpageableData- pagination information- Returns:
- the list of orders
-
getReturnRequestsByCustomerAndStore
SearchPageData<ReturnRequestModel> getReturnRequestsByCustomerAndStore(CustomerModel customerModel, BaseStoreModel store, ReturnStatus[] returnStatuses, PageableData pageableData) Returns theReturnRequestModelof the given user filtered by given list ofReturnStatus(s).- Parameters:
customerModel- theCustomerModelto retrieve return requests forstore- the currentBaseStoreModelreturnStatuses- theReturnStatus(s) to be included in the result. If null or empty then all statuses are includedpageableData- 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 uidcurrentPassword- password checked for authorization change- Throws:
DuplicateUidException- if the newUid already exists in the systemPasswordMismatchException- if given currentPassword does not match the store one for the current user
-
getGuestOrderForGUID
Fetch theOrderModelfor the given GUID,Store details and the expiry date for Guest Customers.- Parameters:
guid- GUID of the order which was created from theCartModelstore-BaseStoreModelfor 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
Returns the orderModel based on the guid and base store- Parameters:
guid-store-- Returns:
- the order
-
convertGuestToCustomer
Converts a Guest Customer of anonymous checkout to a regular customer- Parameters:
pwd-orderGUID-- Throws:
DuplicateUidException
-
getOrderForCode
Returns the orderModel based on order code and base store- Parameters:
code-store-- Returns:
- the order
-
closeAccount
Close Account for a customer.- Parameters:
user- customer whose account is to be closed- Returns:
- the customer with updated
UserModel.DEACTIVATIONDATEattribute
-
setPopulatingConsentsInSessionEnabled
default void setPopulatingConsentsInSessionEnabled(boolean populatingConsentsInSessionEnabled) Sets the populate consents session attribute- Parameters:
populatingConsentsInSessionEnabled-
-