Search This Blog

Saturday, April 7, 2012

Enacting customer in WCS

This is one of good capability provided by WCS where CSR user or In store user can enact as customer from store front.
WCS provides following two URL for enacting customer

  • RunAsUserSetInSession URL

  • RestoreOriginalUserSetInSession URL
RunAsUserSetInSession URL
This URL allows administrators with the proper authority to run subsequent commands in the same session under a specified customer's identity.
This URL allows administrators with the proper authority to run subsequent commands in the same session under a specified customer's identity. The access control framework checks that the current user belongs to one of the following roles:

  • Customer Service Representative (CSR)

  • Customer Service Supervisor (CSS)

  • Operations Manager

  • Sales Manager

  • Seller


URL structure
Parameter values
langId
The preferred language for the duration of the session; the supported languages for a store are found in the STORELANG table.
URL
The URL to be called when the command completes successfully. The default value is RunAsUserSetInSessionView.
storeId
The reference number of the store to which the user is logging on.
runAsUserId
The registered customer's user ID. This is the customer under whom subsequent requests will run.
Example 1
To switch to a specified customer's user ID (for example, 5) an administrator needs to execute the RunAsUserSetInSession URL with the runAsUserId parameter set to "5". Upon successfully running the RunAsUserSetInSession URL, RunAsUserSetInSessionView gets called. https:// myhostname/webapp/wcs/stores/servlet/RunAsUserSetInSession?runAsUserId=5
Example 2
The following example switches to user ID 5 and calls the specified URL (UserAccountView): https:// myhostname/webapp/wcs/stores/servlet/RunAsUserSetInSession?runAsUserId=5&URL=UserAccountView
Behavior
Ensure that the user who executes the command is of registerType 'A'.
The customer to which the command tries to switch (runAsUserId) is of registerType 'R' (registered user).
Saves the runAsUserId value in the command context to be stored in the session so that in subsequent requests or commands, the runAsUserId value can be restored.
If you have switched to a user ID using the RunAsUserSetInSession URL, you cannot switch to another user ID. You must first call RestoreOriginalUserSetInSession before you can make another RunAsUserSetInSession call.
If you have switched to another user ID, and when running the command, you want to retrieve the original identity, you can make a call to getCallerId on the CommandContext.
Exception conditions
Exception message key
Description
_ERR_MISSING_PARMS
The command throws this exception if the runAsUserId value is not specified.
_ERR_MEMBER_USER_ADMIN_TYPE
The command throws this exception if the current user is not of registerType 'A' (administrator).
_ERR_MEMBER_USER_REGISTERED_TYPE
The command throws this exception if the user that the command tries to switch under is not of registerType 'R' (registered).
If the forUser parameter is specified while the administrator session is populated with a customer's session information, an exception is generated.



RestoreOriginalUserSetInSession URL


This URL resets the session for subsequent commands so they revert back to the original administrator user ID after an administrator has established the runAsUser value in the session by running the RunAsUserSetInSession command.
Parameter values
langId
The preferred language for the duration of the session; the supported languages for a store are found in the STORELANG table.
URL
The URL to be called when the command completes successfully. The default value is RestoreOriginalUserSetInSessionView.
storeId
The reference number of the store.
Example 1
To revert back to the administrator's original user ID, the administrator runs the RestoreOriginalUserSetInSession URL. Upon successfully running this URL, the default view RestoreOriginalUserSetInSessionView is called. https://myhostname/webapp/wcs/stores/servlet/RestoreOriginalUserSetInSession?storeId=11001&URL=AjaxLogonForm&myAcctMain=1
Example 2
Upon successfully running this URL, the specified URL (UserAccountView) is called. https://myhostname/webapp/wcs/stores/servlet/RestoreOriginalUserSetInSession?storeId=11001&URL=AjaxLogonForm&myAcctMain=1
Behavior
Removes the runAsUserId value from the command context such that it is no longer stored in the session. Subsequent requests and commands are run under the original user ID.
If runAsUserId is not set, that is RunAsUserSetInSession was not previously run in the same session, this command leaves the current session unchanged.


By Default CSR or Store agent cannot modify customer current basket, becuase its locked by customer
There are two ways to resolve this locking issue
1. Disable locking
Add following line in WC-Server.xml
orderlockfeature enabled="false"

2. Customize order enacting flow using
User AdvancedOrderEditBeginCmd for taking lock and modify order
Finally User AdvancedOrderEditEndCmd to release lock..

In this duration customer will not be able to modify or place order because lock is with CSR agent.

No comments:

Post a Comment