Class RollbackService
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidhandlePromotionRollbackData(RollbackDTO rollbackDTO) Handles promotion rollback data by sending a message to the configured SQS queue.voidhandlePromotionRollbackFailure(RollbackRequest rollbackRequest, RollbackRedemptionSummary rollbackSummary) Handles promotion rollback failures by sending a message to the configured SQS queue.voidrollbackFailedRedemptions(PromoSummary promoSummary, String orderId) Asynchronously rolls back failed redemptions based on the provided promotion summary and order ID.
-
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
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
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.
-