Interface PunchOutSessionService

All Known Implementing Classes:
DefaultPunchOutSessionService

public interface PunchOutSessionService
This service handles the basic operations on PunchOutService instances.
  • Method Details

    • saveCurrentPunchoutSession

      void saveCurrentPunchoutSession()
      Saves current StoredPunchOutSessionModel in the db.
    • loadStoredPunchOutSessionModel

      StoredPunchOutSessionModel loadStoredPunchOutSessionModel(String punchOutSessionId)
      Loads a given StoredPunchOutSessionModel by sid.
      Parameters:
      punchOutSessionId - The sid to search.
      Returns:
      The StoredPunchOutSessionModel, or null if stored session does not exists.
    • activate

      void activate(PunchOutSession punchOutSession)
      Activates a PunchOutSession for the current user session.
      Parameters:
      punchOutSession - the new punchOut session
    • loadPunchOutSession

      PunchOutSession loadPunchOutSession(String punchOutSessionId)
      Loads and activates a PunchOutSession by its ID.
      Parameters:
      punchOutSessionId - the punchOut session ID
      Returns:
      the newly loaded session
      Throws:
      PunchOutSessionNotFoundException - when the session is not found
    • checkAndActivatePunchOutSession

      void checkAndActivatePunchOutSession(PunchOutSession punchoutSession)
      Check whether punchoutSession is expired and activate;
      Parameters:
      punchoutSession - the punchoutSession to check
    • isPunchOutSessionExpired

      boolean isPunchOutSessionExpired(PunchOutSession punchoutSession)
      Check whether punchoutSession is expired
      Parameters:
      punchoutSession - the punchOut session
      Returns:
      true punchoutSession is expired, false otherwise
    • setCurrentCartFromPunchOutSetup

      void setCurrentCartFromPunchOutSetup(String punchOutSessionId)
      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 loaded PunchOutSession.
      Returns:
      the punchOut session or null if none has been loaded yet
    • setPunchOutSessionCartIsValid

      void setPunchOutSessionCartIsValid(Boolean isValid)
      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

      void initAndActivatePunchOutSession(CXML request)
      initiates and activates a punchout session
      Parameters:
      request - the cXML request
    • retrieveUserId

      String retrieveUserId(PunchOutSession punchoutSession) throws PunchOutException
      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

      B2BCustomerModel loadB2BCustomerModel(PunchOutSession punchoutSession) throws PunchOutException
      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 customer
      sid - the punchOut session ID
      Returns:
      the oauth token