Class VoucherifyApiClient

java.lang.Object
org.bhn.promotion.voucherify.clients.VoucherifyApiClient

@Service public class VoucherifyApiClient extends Object
Client for interacting with Voucherify API to redeem stacked discounts. Handles request creation, headers, logging, and response deserialization.
  • Constructor Details

    • VoucherifyApiClient

      public VoucherifyApiClient()
  • Method Details

    • redeemStackedDiscounts

      public RedeemPromotionResponseDto redeemStackedDiscounts(RedeemPromotionRequestDto requestBody) throws Exception
      Redeems stacked discounts via Voucherify API.
      Parameters:
      requestBody - the redemption request body
      Returns:
      the redemption response body
      Throws:
      Exception - if an error occurs during the API call
    • validateStackedDiscounts

      public ValidationResponseDto validateStackedDiscounts(ValidationRequestDto requestBody) throws Exception
      Validates stacked discounts via Voucherify API.
      Parameters:
      requestBody - the validation request body
      Returns:
      the validation response body
      Throws:
      Exception - if an error occurs during the API call
    • checkEligibility

      Checks eligibility via Voucherify API.
      Parameters:
      requestBody - the eligibility request body
      Returns:
      the eligibility response body
      Throws:
      Exception - if an error occurs during the API call
    • rollbackStackedRedemptions

      public RedemptionRollbackResponseDto rollbackStackedRedemptions(String redemptionId, String reason, RedemptionRollbackRequestDto requestBody) throws Exception
      Rollbacks stacked redemptions via Voucherify API.
      Parameters:
      redemptionId - the redemption ID to rollback
      reason - the rollback reason
      requestBody - the rollback request body
      Returns:
      the rollback response body
      Throws:
      Exception - if an error occurs during the API call
    • fetchRedemptionId

      public List<String> fetchRedemptionId(String voucherCode, String orderId)
      Fetch redemption IDs for a voucher and order. This method NEVER throws exception.