Class VoucherifyPromotionTierService

java.lang.Object
org.bhn.promotion.voucherify.service.VoucherifyPromotionTierService

@Service public class VoucherifyPromotionTierService extends Object
This class contains all methods related to Voucherify Promotion Tier Service
  • Constructor Details

    • VoucherifyPromotionTierService

      public VoucherifyPromotionTierService()
  • Method Details

    • getPromotion

      public PromotionTierModel getPromotion(String promotionId)
      Retrieves a PromotionTierModel for the specified promotion ID.
      Parameters:
      promotionId - the ID of the promotion tier to be retrieved. Must not be null.
      Returns:
      a PromotionTierModel containing the details of the requested promotion tier, or an error model if the ID is invalid or an exception occurs.
    • addPromotionToCampaign

      public PromotionTierModel addPromotionToCampaign(String campaignId, @Valid @Valid PromotionTierModel promotionTierModel)
      This method invokes voucherify api and Adds Promotion Tier to campaign
      Parameters:
      campaignId - String Campaign Id
      promotionTierModel - PromotionTierModel Add Promotion Tier Request
      Returns:
      PromotionTierModel Add Promotion Tier Response
    • updatePromotion

      public PromotionTierModel updatePromotion(@Valid @Valid PromotionTierModel promotionTierModel)
      This method invokes voucherify api and Updates Promotion Tier
      Parameters:
      promotionTierModel - PromotionTierModel Update Promotion Tier Request
      Returns:
      PromotionTierModel Update Promotion Tier Response
    • getPromotionTier

      public io.voucherify.client.model.PromotionsTiersGetResponseBody getPromotionTier(String promotionId) throws VoucherifyApiException
      Retrieves the details of a specific promotion tier using the provided promotion ID.
      Parameters:
      promotionId - the ID of the promotion tier to be retrieved.
      Returns:
      a PromotionsTiersGetResponseBody containing the details of the requested promotion tier.
      Throws:
      VoucherifyApiException - if an error occurs while retrieving the promotion tier, such as an invalid promotion ID.
    • createOrUpdatePromotionTier

      public void createOrUpdatePromotionTier(WebhookRequest.WebhookModel.BaseModel promotionTier, PimcorePromotionModel pimcorePromotionModel) throws VoucherifyApiException
      Creates or updates a PimcorePromotionModel based on the provided WebhookRequest.WebhookModel.BaseModel response.
      Parameters:
      promotionTier - the WebhookRequest.WebhookModel.BaseModel containing the promotion tier information.
      pimcorePromotionModel - the PimcorePromotionModel to be updated with promotion details.
      Throws:
      VoucherifyApiException - if an error occurs while retrieving the promotion tier or processing validation rules.
    • enableOrDisablePromotionTier

      public void enableOrDisablePromotionTier(WebhookRequest.WebhookModel.BaseModel promotionTier, PimcorePromotionModel pimcorePromotionModel)
      Enables or disables a promotion based on the provided WebhookRequest.WebhookModel.BaseModel.
      Parameters:
      promotionTier - the WebhookRequest.WebhookModel.BaseModel containing the promotion tier information.
      pimcorePromotionModel - the PimcorePromotionModel to be updated with the promotion's active status.
    • updatePromotionTierBudgetWithPartialRefundAmount

      public void updatePromotionTierBudgetWithPartialRefundAmount(String promotionId, BigDecimal partialRefundAmount) throws VoucherifyApiException, io.voucherify.client.ApiException
      Updates the promotion tier budget with the given partial refund amount. The method retrieves the promotion tier details, checks if validation rule assignments exist, and then updates the budget for each validation rule.
      Parameters:
      promotionId - The ID of the promotion whose budget is being updated.
      partialRefundAmount - The partial refund amount to be deducted from the promotion tier budget.
      Throws:
      VoucherifyApiException - If there is an issue with the Voucherify API call.
      io.voucherify.client.ApiException - If there is a general API exception.
    • updatePromotionTier

      public io.voucherify.client.model.PromotionsTiersUpdateResponseBody updatePromotionTier(String promotionId, io.voucherify.client.model.PromotionsTiersUpdateRequestBody requestBody)
      This method invokes voucherify api and Updates Promotion Tier
      Parameters:
      promotionId - String Promotion Id
      requestBody - PromotionsTiersUpdateRequestBody Update Promotion Tier Request
      Returns:
      PromotionsTiersUpdateResponseBody Update Promotion Tier Response
    • updatePromotionTierBudgetWithOverdraftAmount

      public void updatePromotionTierBudgetWithOverdraftAmount(String promotionId, BigDecimal overdraftAmount) throws VoucherifyApiException, io.voucherify.client.ApiException
      Updates the promotion tier budget with the given overdraft amount. The method retrieves the promotion tier details, checks if validation rule assignments exist, and then updates the budget for each validation rule.
      Parameters:
      promotionId - The ID of the promotion whose budget is being updated.
      overdraftAmount - The overdraft amount to be added to the promotion tier budget.
      Throws:
      VoucherifyApiException - If there is an issue with the Voucherify API call.
      io.voucherify.client.ApiException - If there is a general API exception.