fr.paris.lutece.plugins.stock.service
Interface IPurchaseSessionManager

All Known Implementing Classes:
PurchaseSessionManager

public interface IPurchaseSessionManager

Manager for purchase session. Contains methods for managing the purchase mechanism : - reserve an offer into session - check if purchase is into session just before store it in database - release that

Author:
abataille

Method Summary
 void checkReserved(String sessionId, IPurchaseDTO purchase)
          Check that purchase has been reserved before to save it.
 void clearPurchase(Integer minutes)
          Delete all purchase create more than "minute" minutes ago
 void release(String sessionId, IPurchaseDTO purchase)
          Remove purchase from session
 void releaseAll(String sessionId)
          Remove all active purchases for a session id
 void reserve(String sessionId, IPurchaseDTO purchase)
          Reserves an offer quantity for a session.
 Integer updateQuantityWithSession(Integer quantity, Integer offerId)
          Update offer quantity with quantity in session
 

Method Detail

reserve

void reserve(String sessionId,
             IPurchaseDTO purchase)
             throws PurchaseUnavailable
Reserves an offer quantity for a session. Check if offer is available (quantity remaining in database + purchases in session) and add purchase in session

Parameters:
sessionId - session id
purchase - purchase (offer id, quantity and user)
Throws:
PurchaseUnavailable - exception thrown if purchase is impossible

checkReserved

void checkReserved(String sessionId,
                   IPurchaseDTO purchase)
                   throws PurchaseSessionExpired
Check that purchase has been reserved before to save it.

Parameters:
sessionId - session id
purchase - purchase
Throws:
PurchaseSessionExpired - the purchase session expired

release

void release(String sessionId,
             IPurchaseDTO purchase)
Remove purchase from session

Parameters:
sessionId - session id
purchase - purchase

releaseAll

void releaseAll(String sessionId)
Remove all active purchases for a session id

Parameters:
sessionId - session id

updateQuantityWithSession

Integer updateQuantityWithSession(Integer quantity,
                                  Integer offerId)
Update offer quantity with quantity in session

Parameters:
quantity - the quantity
offerId - the offer id
Returns:
the quantity update

clearPurchase

void clearPurchase(Integer minutes)
Delete all purchase create more than "minute" minutes ago

Parameters:
minutes - the number max of minutes for keeping purchase in session


Copyright © 2014 Mairie de Paris. All Rights Reserved.