Class VoucherifyPromotionTierService
java.lang.Object
org.bhn.promotion.voucherify.service.VoucherifyPromotionTierService
This class contains all methods related to Voucherify Promotion Tier Service
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddPromotionToCampaign(String campaignId, @Valid PromotionTierModel promotionTierModel) This method invokes voucherify api and Adds Promotion Tier to campaignvoidcreateOrUpdatePromotionTier(WebhookRequest.WebhookModel.BaseModel promotionTier, PimcorePromotionModel pimcorePromotionModel) Creates or updates aPimcorePromotionModelbased on the providedWebhookRequest.WebhookModel.BaseModelresponse.voidenableOrDisablePromotionTier(WebhookRequest.WebhookModel.BaseModel promotionTier, PimcorePromotionModel pimcorePromotionModel) Enables or disables a promotion based on the providedWebhookRequest.WebhookModel.BaseModel.getPromotion(String promotionId) Retrieves aPromotionTierModelfor the specified promotion ID.io.voucherify.client.model.PromotionsTiersGetResponseBodygetPromotionTier(String promotionId) Retrieves the details of a specific promotion tier using the provided promotion ID.updatePromotion(@Valid PromotionTierModel promotionTierModel) This method invokes voucherify api and Updates Promotion Tierio.voucherify.client.model.PromotionsTiersUpdateResponseBodyupdatePromotionTier(String promotionId, io.voucherify.client.model.PromotionsTiersUpdateRequestBody requestBody) This method invokes voucherify api and Updates Promotion TiervoidupdatePromotionTierBudgetWithOverdraftAmount(String promotionId, BigDecimal overdraftAmount) Updates the promotion tier budget with the given overdraft amount.voidupdatePromotionTierBudgetWithPartialRefundAmount(String promotionId, BigDecimal partialRefundAmount) Updates the promotion tier budget with the given partial refund amount.
-
Constructor Details
-
VoucherifyPromotionTierService
public VoucherifyPromotionTierService()
-
-
Method Details
-
getPromotion
Retrieves aPromotionTierModelfor the specified promotion ID.- Parameters:
promotionId- the ID of the promotion tier to be retrieved. Must not be null.- Returns:
- a
PromotionTierModelcontaining 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-StringCampaign IdpromotionTierModel-PromotionTierModelAdd Promotion Tier Request- Returns:
PromotionTierModelAdd Promotion Tier Response
-
updatePromotion
This method invokes voucherify api and Updates Promotion Tier- Parameters:
promotionTierModel-PromotionTierModelUpdate Promotion Tier Request- Returns:
PromotionTierModelUpdate 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
PromotionsTiersGetResponseBodycontaining 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 aPimcorePromotionModelbased on the providedWebhookRequest.WebhookModel.BaseModelresponse.- Parameters:
promotionTier- theWebhookRequest.WebhookModel.BaseModelcontaining the promotion tier information.pimcorePromotionModel- thePimcorePromotionModelto 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 providedWebhookRequest.WebhookModel.BaseModel.- Parameters:
promotionTier- theWebhookRequest.WebhookModel.BaseModelcontaining the promotion tier information.pimcorePromotionModel- thePimcorePromotionModelto 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-StringPromotion IdrequestBody-PromotionsTiersUpdateRequestBodyUpdate Promotion Tier Request- Returns:
PromotionsTiersUpdateResponseBodyUpdate 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.
-