Class OrderStorageService

java.lang.Object
org.bhn.promotion.core.service.OrderStorageService

@Service public class OrderStorageService extends Object
Service class responsible for preparing and processing OrderDTO. It prepares the order data, invokes an external API to save the order data, and passes the OrderDTO as a request payload.
  • Constructor Details

    • OrderStorageService

      public OrderStorageService()
  • Method Details

    • processOrderDto

      @Async public void processOrderDto(String flow, PromotionQuoteRequest promotionQuoteRequest, PromoSummary promoSummary, List<RedemptionModel> redemptionModels)
      Asynchronously processes the order by preparing an OrderDTO using the provided flow, PromotionQuoteRequest, PromoSummary, and a list of RedemptionModel. The prepared OrderDTO is then passed to the save method for further processing and persistence. This method logs the start and completion of order processing, and is executed asynchronously.
      Parameters:
      flow - The flow of the order processing.
      promotionQuoteRequest - The request object containing order and promotion details.
      promoSummary - The summary of promotions applied to the order.
      redemptionModels - The list of redemption models applied to the order.
    • processRollback

      @Async public void processRollback(String flow, RollbackRequest rollbackRequest, RollbackRedemptionSummary rollbackSummary, RollbackResponseModel rollbackResponseModel)
      Processes a rollback request by constructing rollback models based on the provided RollbackResponseModel and RollbackRequest, and then persists the rollback data using a RollbackDTO. This method also logs the start and end of the rollback processing for tracking.
      Parameters:
      flow - the name or identifier of the current workflow or flow triggering the rollback
      rollbackRequest - the original rollback request containing context like the order ID
      rollbackSummary - the summary object containing redemption IDs and any rollback errors
      rollbackResponseModel - the response model that contains details to build rollback models