Interface PunchOutSessionService
- All Known Implementing Classes:
DefaultPunchOutSessionService
public interface PunchOutSessionService
This service handles the basic operations on
PunchOutService instances.-
Method Summary
Modifier and TypeMethodDescriptionvoidactivate(PunchOutSession punchOutSession) Activates aPunchOutSessionfor the current user session.voidcheckAndActivatePunchOutSession(PunchOutSession punchoutSession) Check whether punchoutSession is expired and activate;Retrieves the currently loadedPunchOutSession.Gets the currently active punchOut session.org.springframework.security.oauth2.common.OAuth2AccessTokengetPunchOutTokenByUidAndSid(String uid, String sid) Get punchOut user tokenvoidinitAndActivatePunchOutSession(CXML request) initiates and activates a punchout sessionGet if PunchOut Session Cart is validbooleanisPunchOutSessionExpired(PunchOutSession punchoutSession) Check whether punchoutSession is expiredloadB2BCustomerModel(PunchOutSession punchoutSession) Retrieves the B2BCustomerModel from given Punchout Session.loadPunchOutSession(String punchOutSessionId) Loads and activates aPunchOutSessionby its ID.loadStoredPunchOutSessionModel(String punchOutSessionId) Loads a givenStoredPunchOutSessionModelby sid.retrieveUserId(PunchOutSession punchoutSession) Retrieves the userId from given Punchout Session.voidSaves currentStoredPunchOutSessionModelin the db.voidsetCurrentCartFromPunchOutSetup(String punchOutSessionId) Set the cart for the current session using the cart saved in a given punch out session.voidsetPunchOutSessionCartIsValid(Boolean isValid) Set if PunchOut Session Cart is valid
-
Method Details
-
saveCurrentPunchoutSession
void saveCurrentPunchoutSession()Saves currentStoredPunchOutSessionModelin the db. -
loadStoredPunchOutSessionModel
Loads a givenStoredPunchOutSessionModelby sid.- Parameters:
punchOutSessionId- The sid to search.- Returns:
- The
StoredPunchOutSessionModel, or null if stored session does not exists.
-
activate
Activates aPunchOutSessionfor the current user session.- Parameters:
punchOutSession- the new punchOut session
-
loadPunchOutSession
Loads and activates aPunchOutSessionby its ID.- Parameters:
punchOutSessionId- the punchOut session ID- Returns:
- the newly loaded session
- Throws:
PunchOutSessionNotFoundException- when the session is not found
-
checkAndActivatePunchOutSession
Check whether punchoutSession is expired and activate;- Parameters:
punchoutSession- the punchoutSession to check
-
isPunchOutSessionExpired
Check whether punchoutSession is expired- Parameters:
punchoutSession- the punchOut session- Returns:
- true punchoutSession is expired, false otherwise
-
setCurrentCartFromPunchOutSetup
Set the cart for the current session using the cart saved in a given punch out session. This is necessary as the punchOut provider may use different sessions for sequential calls (e.g.: edit setup request and edit seamless login).
Notice that this should only be called after punch out user is authenticated.- Parameters:
punchOutSessionId- The punch out session ID.
-
getCurrentPunchOutSession
PunchOutSession getCurrentPunchOutSession()Retrieves the currently loadedPunchOutSession.- Returns:
- the punchOut session or
nullif none has been loaded yet
-
setPunchOutSessionCartIsValid
Set if PunchOut Session Cart is valid- Parameters:
isValid-
-
isPunchOutSessionCartValid
Boolean isPunchOutSessionCartValid()Get if PunchOut Session Cart is valid- Returns:
- punchOut session cart is validated ok or not, by default it is null
-
getCurrentPunchOutSessionId
String getCurrentPunchOutSessionId()Gets the currently active punchOut session.- Returns:
- the active punchOut session ID
-
initAndActivatePunchOutSession
initiates and activates a punchout session- Parameters:
request- the cXML request
-
retrieveUserId
Retrieves the userId from given Punchout Session.- Parameters:
punchoutSession- The session of the current punchout user.- Returns:
- The userId, if the information contained in the encryptedText passes the security verification (null
- Throws:
PunchOutException- If some of the required arguments are missing or empty.
-
loadB2BCustomerModel
Retrieves the B2BCustomerModel from given Punchout Session.- Parameters:
punchoutSession- The session of the current punchout user.- Returns:
- B2BCustomerModel by Punchout Session
- Throws:
PunchOutException- If some of the required arguments are missing or empty.
-
getPunchOutTokenByUidAndSid
org.springframework.security.oauth2.common.OAuth2AccessToken getPunchOutTokenByUidAndSid(String uid, String sid) Get punchOut user token- Parameters:
uid- the uid of the customersid- the punchOut session ID- Returns:
- the oauth token
-