Interface CustomerProcessor
- All Superinterfaces:
BusinessObject,BusinessProcessor
- All Known Implementing Classes:
BasicCustomerProcessor
When the application needs to create an instance that implements
CustomerProcessor,
BusinessObjectFactory
finds the name of the Java class to instantiate from the
"customerProcessorImplementer" setting in the
appComponents.properties file.
The default "customerProcessorImplementer" is
BasicCustomerProcessor.
- Author:
- David Tobey
-
Method Summary
Modifier and TypeMethodDescriptionaddCustomer(Map parameters) voidcustomerChangePassword(String newDecryptedPassword, Customer customer) voiddeleteCustomer(Map parameters) editCustomer(Map parameters) editDeleteCustomers(Map parameters) loadCustomerAdvancedLostPassword(Map parameters) loadCustomerFromID(Map parameters) loadCustomerFromResetToken(Map parameters) loadCustomerFromUserName(Map parameters) loadCustomerLostPassword(Map parameters) Loads theCustomerproperty of thisCustomerProcesorfrom the database given aMapcontaining theuserName.loadCustomersAndCount(Map parameters) Loads the set of download files that the customer has purchased from the database.intloadOrderDetails(Map parameters) Loads all of the database information corresponding to a given order number for a given customer.Loads a customer's order history from the database.loadPreviousOrder(Map parameters) Loads a previously placed order for a customer from the database, assigning it as the customer's current cart.loadSavedCart(Map parameters) Loads a saved cart for a customer from the database, assigning it as the customer's current cart.Loads a customer's list of saved carts from the database.processAutoLogin(Map parameters) Processes an automatic login given a user's autoLoginToken.processChangePassword(String currentDecryptedPassword, String newDecryptedPassword) processLogin(Map parameters) Processes a login attempt given a user name and password.processRegister(Map parameters) Processes a request to register or add a new customer account into the system.removeSavedCart(Map parameters) Removes a saved cart for a customer from the database, changing the order record to a status of "Saved".resetPassword(String token, String newPassword) Saves anOrderin the database as a saved cart, with a status of "Saved", which a customer can pick up later.booleansendCompleteResetPasswordEmail(Customer customer) booleansendLostPasswordAdvancedEmail(Customer customer) updateAddresses(Map parameters) Updates a customer's address information.updateCustomer(Map parameters) Updates a customer's account information.validateCustomer(Customer customer) Methods inherited from interface com.softslate.commerce.businessobjects.core.BusinessObject
initializeMethods inherited from interface com.softslate.commerce.businessobjects.core.BusinessProcessor
getAppComponents, getAppSettings, getBusinessObjectFactory, getDaoFactory, getEventBus, getInjector, getSettings, getUser, setAppComponents, setAppSettings, setBusinessObjectFactory, setDaoFactory, setEventBus, setInjector, setSettings, setUser, utils
-
Method Details
-
processRegister
Processes a request to register or add a new customer account into the system. The incomingMapshould have at least two keys:userNameanddecryptedPassword, which will be used for the new account. If successful, thecustomerproperty of the currentUserwill be populated with the new account's information. If an account already exists with the sameuserName, the returnedMapwill contain a key named "resultCode" whose value is "errors.userAlreadyLoggedIn". This code is used in the Struts layer to look up the error message.- Parameters:
parameters- AMapcontaining the user name and password for the new customer account.- Returns:
- A
Mapwith a key named "resultCode", equal to "0" if the result is successful. - Throws:
Exception
-
processLogin
Processes a login attempt given a user name and password. The incomingMapmust have two keys:userNameandpassword. If the login attempt succeeds, theCustomerproperty of the currentUserwill be populated with the database information for the customer account. If the user name and password don't match an account in the database, the returnedMapwill contain a key named "resultCode" whose value is "errors.invalidLogin". This code is used in the Struts layer to look up the error message.- Parameters:
parameters- AMapcontaining the user name and password for the customer attempting to log in.- Returns:
- A
Mapwith a key named "resultCode", equal to "0" if the result is successful. - Throws:
Exception
-
processAutoLogin
Processes an automatic login given a user's autoLoginToken. The incomingMapmust have the key:autoLoginToken. If the login succeeds, theCustomerproperty of the currentUserwill be populated with the database information for the customer account. If the autoLoginToken doesn't match an account in the database, the returnedMapwill contain a key named "resultCode" whose value is "errors.invalidLogin".- Parameters:
parameters- AMapcontaining the autoLoginToken for the customer.- Returns:
- A
Mapwith a key named "resultCode", equal to "0" if the result is successful. - Throws:
Exception
-
updateAddresses
Updates a customer's address information. The incomingMapshould contain keys corresponding to the delivery address properties ofCustomerAddress, and the billing address properties ofCustomer. TheCustomerproperty of the current user, and the firstCustomerAddressin thecustomerAddressCollectionof theCustomerare modified with the incoming address information. Then the database records for the customer and the customer address are updated insscCustomerandsscCustomerAddress.- Parameters:
parameters- AMapcontaining the address information for the current user, which is to be used to update the account.- Returns:
- A
Mapwith a key named "resultCode", equal to "0" if the result is successful. - Throws:
Exception
-
updateCustomer
Updates a customer's account information. The incomingMapshould contain keys corresponding to the properties ofCustomer. TheCustomerproperty of the current user is modified with the account information contained in the incomingMap. Then the database record for the customer is updated. Used to process a changed user name and password.If the incoming user name is already used by a different customer, the returned
Mapwill contain a key named "resultCode" whose value is "errors.userNameNotUnique". This code is used in the Struts layer to look up the error message.- Parameters:
parameters- AMapcontaining the account information for the current user, which is to be used to update the account.- Returns:
- A
Mapwith a key named "resultCode", equal to "0" if the result is successful. - Throws:
Exception
-
loadCustomerLostPassword
Loads theCustomerproperty of thisCustomerProcesorfrom the database given aMapcontaining theuserName. Used in the lost password form, when a customer must be retrieved from database without a password.If the application is set to use one-way encryption for customer passwords, this method will generate a random password and update the customer's record with it.
If the customer corresponding to the user name in the
Mapdoes not exist in the database, the returnedMapwill contain a key named "resultCode" whose value is "errors.userNameNotFound". This code is used in the Struts layer to look up the error message.- Parameters:
parameters- AMapcontaining the user name of a given customer.- Returns:
- A
Mapwith a key named "resultCode", equal to "0" if the result is successful. - Throws:
Exception
-
loadOrderHistory
Loads a customer's order history from the database. If successful, theCustomerproperty of the currentUserwill have itsorderHistoryproperty populated with information from the database about all of the customer's previous orders in the store.- Returns:
- A
Mapwith a key named "resultCode", equal to "0" if the result is successful. - Throws:
Exception
-
loadOrderDetails
Loads all of the database information corresponding to a given order number for a given customer. Used to retrieve the order details for a customer viewing his or her order history.- Parameters:
parameters- AMapcontaining a key namedorderNumberwith the order number of a given order.- Returns:
- An
Orderpopulated with information from the database. - Throws:
Exception
-
loadDownloadFiles
Loads the set of download files that the customer has purchased from the database. The set of files is determined by querying thesscProductSettingtable for download files associated with products that the customer has purchased previously.- Returns:
- A
CollectionofMaps, one for each file available for download by the customer. - Throws:
Exception
-
saveCart
Saves anOrderin the database as a saved cart, with a status of "Saved", which a customer can pick up later.- Parameters:
parameters- AMapcontaining arguments, by default null.- Returns:
- A
Mapwith a key named "resultCode", equal to "0" if the result is successful. - Throws:
Exception
-
loadSavedCarts
Loads a customer's list of saved carts from the database. Saved carts are stored as incomplete orders in thesscOrderdatabase table with a status of "Saved".- Returns:
- A
CollectionofOrderobjects representing the customer's saved carts. - Throws:
Exception
-
loadSavedCart
Loads a saved cart for a customer from the database, assigning it as the customer's current cart. Saved carts are stored as incomplete orders in thesscOrderdatabase table with a status of "Saved".- Parameters:
parameters- AMapcontaining a key namedorderIDwith the order id of a given order.- Returns:
- A
Mapobject containing the results of the reprocessing of the order, or null, if therefreshSaved Cartssetting is false. - Throws:
Exception
-
removeSavedCart
Removes a saved cart for a customer from the database, changing the order record to a status of "Saved".- Parameters:
parameters- AMapcontaining a key namedorderIDwith the order id of a given order.- Returns:
- null in this implementation.
- Throws:
Exception
-
loadPreviousOrder
Loads a previously placed order for a customer from the database, assigning it as the customer's current cart.- Parameters:
parameters- AMapcontaining a key namedorderIDwith the order id of a given order.- Returns:
- A
Mapobject containing the results of the reprocessing of the order, or null, if therefreshReorderssetting is false - Throws:
Exception
-
loadCustomersAndCount
- Throws:
Exception
-
addCustomer
- Throws:
Exception
-
validateCustomer
- Throws:
Exception
-
loadCustomerFromID
- Throws:
Exception
-
editCustomer
- Throws:
Exception
-
loadCustomerFromUserName
- Throws:
Exception
-
editDeleteCustomers
- Throws:
Exception
-
deleteCustomer
- Throws:
Exception
-
loadMaxCustomerID
- Throws:
Exception
-
loadCustomerAdvancedLostPassword
- Throws:
Exception
-
loadCustomerFromResetToken
- Throws:
Exception
-
resetPassword
- Throws:
Exception
-
processChangePassword
Map processChangePassword(String currentDecryptedPassword, String newDecryptedPassword) throws Exception - Throws:
Exception
-
customerChangePassword
- Throws:
Exception
-
sendLostPasswordAdvancedEmail
- Throws:
Exception
-
sendCompleteResetPasswordEmail
- Throws:
Exception
-
refreshCustomerFromDatabase
- Throws:
Exception
-