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) void
customerChangePassword
(String newDecryptedPassword, Customer customer) void
deleteCustomer
(Map parameters) editCustomer
(Map parameters) editDeleteCustomers
(Map parameters) loadCustomerAdvancedLostPassword
(Map parameters) loadCustomerFromID
(Map parameters) loadCustomerFromResetToken
(Map parameters) loadCustomerFromUserName
(Map parameters) loadCustomerLostPassword
(Map parameters) Loads theCustomer
property of thisCustomerProcesor
from the database given aMap
containing theuserName
.loadCustomersAndCount
(Map parameters) Loads the set of download files that the customer has purchased from the database.int
loadOrderDetails
(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 anOrder
in the database as a saved cart, with a status of "Saved", which a customer can pick up later.boolean
sendCompleteResetPasswordEmail
(Customer customer) boolean
sendLostPasswordAdvancedEmail
(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
initialize
Methods 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 incomingMap
should have at least two keys:userName
anddecryptedPassword
, which will be used for the new account. If successful, thecustomer
property of the currentUser
will be populated with the new account's information. If an account already exists with the sameuserName
, the returnedMap
will 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
- AMap
containing the user name and password for the new customer account.- Returns:
- A
Map
with 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 incomingMap
must have two keys:userName
andpassword
. If the login attempt succeeds, theCustomer
property of the currentUser
will 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 returnedMap
will 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
- AMap
containing the user name and password for the customer attempting to log in.- Returns:
- A
Map
with 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 incomingMap
must have the key:autoLoginToken
. If the login succeeds, theCustomer
property of the currentUser
will be populated with the database information for the customer account. If the autoLoginToken doesn't match an account in the database, the returnedMap
will contain a key named "resultCode" whose value is "errors.invalidLogin".- Parameters:
parameters
- AMap
containing the autoLoginToken for the customer.- Returns:
- A
Map
with a key named "resultCode", equal to "0" if the result is successful. - Throws:
Exception
-
updateAddresses
Updates a customer's address information. The incomingMap
should contain keys corresponding to the delivery address properties ofCustomerAddress
, and the billing address properties ofCustomer
. TheCustomer
property of the current user, and the firstCustomerAddress
in thecustomerAddressCollection
of theCustomer
are modified with the incoming address information. Then the database records for the customer and the customer address are updated insscCustomer
andsscCustomerAddress
.- Parameters:
parameters
- AMap
containing the address information for the current user, which is to be used to update the account.- Returns:
- A
Map
with a key named "resultCode", equal to "0" if the result is successful. - Throws:
Exception
-
updateCustomer
Updates a customer's account information. The incomingMap
should contain keys corresponding to the properties ofCustomer
. TheCustomer
property 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
Map
will 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
- AMap
containing the account information for the current user, which is to be used to update the account.- Returns:
- A
Map
with a key named "resultCode", equal to "0" if the result is successful. - Throws:
Exception
-
loadCustomerLostPassword
Loads theCustomer
property of thisCustomerProcesor
from the database given aMap
containing 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
Map
does not exist in the database, the returnedMap
will 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
- AMap
containing the user name of a given customer.- Returns:
- A
Map
with 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, theCustomer
property of the currentUser
will have itsorderHistory
property populated with information from the database about all of the customer's previous orders in the store.- Returns:
- A
Map
with 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
- AMap
containing a key namedorderNumber
with the order number of a given order.- Returns:
- An
Order
populated 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 thesscProductSetting
table for download files associated with products that the customer has purchased previously.- Returns:
- A
Collection
ofMap
s, one for each file available for download by the customer. - Throws:
Exception
-
saveCart
Saves anOrder
in the database as a saved cart, with a status of "Saved", which a customer can pick up later.- Parameters:
parameters
- AMap
containing arguments, by default null.- Returns:
- A
Map
with 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 thesscOrder
database table with a status of "Saved".- Returns:
- A
Collection
ofOrder
objects 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 thesscOrder
database table with a status of "Saved".- Parameters:
parameters
- AMap
containing a key namedorderID
with the order id of a given order.- Returns:
- A
Map
object containing the results of the reprocessing of the order, or null, if therefreshSaved Carts
setting 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
- AMap
containing a key namedorderID
with 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
- AMap
containing a key namedorderID
with the order id of a given order.- Returns:
- A
Map
object containing the results of the reprocessing of the order, or null, if therefreshReorders
setting 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
-