Class RollbackService

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

@Service public class RollbackService extends Object
Service responsible for handling rollback operations and sending rollback failure messages to SQS.

This service provides methods to process rollback requests and send relevant information to a specified SQS queue in case of failures. It supports handling both V3 rollback requests and RollbackDTO objects.

  • Constructor Details

    • RollbackService

      public RollbackService()
  • Method Details

    • handlePromotionRollbackFailure

      public void handlePromotionRollbackFailure(RollbackRequest rollbackRequest, RollbackRedemptionSummary rollbackSummary)
      Handles promotion rollback failures by sending a message to the configured SQS queue.

      This method checks if the provided rollback request is valid and of the correct API version. If so, it maps the request to a V3 format and sends it to the SQS queue. Any exceptions encountered during this process are logged.

      Parameters:
      rollbackRequest - The rollback request containing details of the promotion rollback.
      rollbackSummary - The summary of the rollback redemption (not used in this implementation).
    • handlePromotionRollbackData

      public void handlePromotionRollbackData(RollbackDTO rollbackDTO)
      Handles promotion rollback data by sending a message to the configured SQS queue.

      This method checks if the provided RollbackDTO is valid. If so, it wraps the DTO in a message wrapper and sends it to the SQS queue. Any exceptions encountered during this process are logged.

      Parameters:
      rollbackDTO - The RollbackDTO containing details of the promotion rollback.
    • rollbackFailedRedemptions

      @Async public void rollbackFailedRedemptions(PromoSummary promoSummary, String orderId)
      Asynchronously rolls back failed redemptions based on the provided promotion summary and order ID.

      This method checks if the promotion summary contains a valid redemption ID. If so, it creates a rollback request and attempts to perform the rollback using the rollback retry service. The outcome of the rollback operation is logged, including any errors encountered.

      Parameters:
      promoSummary - The summary of the promotion containing redemption details.
      orderId - The ID of the order associated with the redemption.