Class VoucherifyConfiguration

java.lang.Object
org.bhn.promotion.voucherify.config.VoucherifyConfiguration

@Configuration @ConditionalOnProperty(name="promo-engine.service.type", havingValue="VOUCHERIFY", matchIfMissing=true) public class VoucherifyConfiguration extends Object

The class contains Voucherify configuration.

  • Constructor Details

    • VoucherifyConfiguration

      public VoucherifyConfiguration(@Value("${promo-engine.service.voucherify.app-id}") String appId, @Value("${promo-engine.service.voucherify.client-secret}") String secretKey, @Value("${promo-engine.service.voucherify.end-point}") String endpoint, @Value("${promo-engine.service.voucherify.api-enabled:false}") boolean voucherifyApiEnabled, @Value("${promo-engine.service.voucherify.max-retries:3}") int maxRetries, @Value("${promo-engine.service.voucherify.retry-threshold-milli-seconds:1000}") long retryThresholdMilliSeconds, @Value("${promo-engine.service.voucherify.eligible-promo-limit:50}") int eligiblePromoLimit, @Value("${promo-engine.service.voucherify.eligible-promo-sorting:BEST_DEAL}") String eligiblePromoSortingType, @Value("${promo-engine.service.voucherify.stackable-promos:false}") boolean isStackablePromos, @Value("${promo-engine.service.voucherify.export.voucher-fields:null}") List<String> voucherFields, @Value("${promo-engine.service.voucherify.export.promo-fields:null}") String promoReportNewFields, @Value("${promo-engine.service.voucherify.export.order-fields:null}") List<String> voucherifyOrderFields, @Value("${promo-engine.service.voucherify.export.promo-order-fields:null}") String promoOrderFields, @Value("${promo-engine.service.voucherify.download.base-url:null}") String voucherifyDownloadBaseUrl, @Value("${promo-engine.service.voucherify.export.webclient.max-memory-size:10}") Integer webClientMaxMemorySize, @Value("${promo-engine.service.voucherify.download.export-url:null}") String voucherifyDownloadUrl, @Value("${promo-engine.service.voucherify.export.sleep-milli-second:100}") long sleepMilliSecond, @Value("${promo-engine.encryption.api-key:null}") String encryptionApiKey, @Value("${promo-engine.service.voucherify.webhook.bulk-voucher-limit:0}") Integer bulkVoucherLimit, @Value("${promo-engine.service.base-url:null}") String promotionServiceBaseUrl, @Value("${promo-engine.service.voucherify.shipping-fee.promotion.product:null}") String shippingFeePromotionProduct, @Value("${promo-engine.iam-service.base-url:null}") String iamBaseTokenUrl, @Value("${promo-engine.iam-service.client-id:null}") String clientId, @Value("${promo-engine.iam-service.client-secret:null}") String clientSecret, @Value("${promo-engine.iam-service.auth-token-url:null}") String iamServiceAuthTokenUrl, @Value("${promo-engine.servicing-graphQl-url:null}") String newUserGraphQLUrl, @Value("${promo-engine.service.voucherify.bulk-affiliate-category-id}") String bulkAffiliateCategoryId, @Value("${promo-engine.service.voucherify.management-id:}") String managementId, @Value("${promo-engine.service.voucherify.management-token:}") String managementToken, @Value("${promo-engine.service.voucherify.project-id:null}") String projectId)
      Constructor to initialize configuration properties for Voucherify.
      Parameters:
      appId - the application ID for Voucherify
      secretKey - the client secret for Voucherify
      endpoint - the endpoint URL for Voucherify API
      voucherifyApiEnabled - flag to enable or disable Voucherify API
      maxRetries - the maximum number of retries for API calls
      eligiblePromoLimit - the maximum number of eligible promotions
      eligiblePromoSortingType - the sorting type for eligible promotions
      isStackablePromos - the sorting type for stackable promotions
      voucherFields - the fields to include in voucher export (can be null).
      promoReportNewFields - the fields for the promotional report (can be null).
      voucherifyOrderFields - the fields to include in order export (can be null).
      promoOrderFields - the fields to include in promo-order export (can be null).
      voucherifyDownloadBaseUrl - the base URL for Voucherify downloads (can be null).
      webClientMaxMemorySize - the maximum memory size for WebClient in MB (default: 10).
      voucherifyDownloadUrl - the URL for Voucherify export downloads (can be null).
      sleepMilliSecond - the sleep time between API calls in milliseconds (default: 100).
      encryptionApiKey - the API key for encryption services (can be null).
      bulkVoucherLimit - The limit for bulk voucher processing in webhook operations.
      shippingFeePromotionProduct - Product is used to manage free shipping product in voucherify
      promotionServiceBaseUrl - Promotion Service Base Url
      projectId - the project ID for Voucherify
  • Method Details

    • apiClient

      @Bean public io.voucherify.client.ApiClient apiClient()
      Provides a configured ApiClient instance for interacting with the Voucherify API.
      Returns:
      the configured ApiClient
    • managementApi

      @Bean public io.voucherify.client.api.ManagementApi managementApi()
    • promotionsApi

      @Bean public io.voucherify.client.api.PromotionsApi promotionsApi()
      Creates a PromotionsApi instance for managing promotions in Voucherify.
      Returns:
      a PromotionsApi instance
    • campaignsApi

      @Bean public io.voucherify.client.api.CampaignsApi campaignsApi()
      Creates a CampaignsApi instance for managing campaigns in Voucherify.
      Returns:
      a CampaignsApi instance
    • vouchersApi

      @Bean public io.voucherify.client.api.VouchersApi vouchersApi()
      Creates a VouchersApi instance for managing vouchers in Voucherify.
      Returns:
      a VouchersApi instance
    • validationRulesApi

      @Bean public io.voucherify.client.api.ValidationRulesApi validationRulesApi()
      Creates a ValidationRulesApi instance for managing validation rules in Voucherify.
      Returns:
      a ValidationRulesApi instance
    • productsApi

      @Bean public io.voucherify.client.api.ProductsApi productsApi()
      Creates a ProductsApi instance for managing products in Voucherify.
      Returns:
      a ProductsApi instance
    • productCollectionsApi

      @Bean public io.voucherify.client.api.ProductCollectionsApi productCollectionsApi()
      Creates a ProductCollectionsApi instance for managing productCollections in Voucherify.
      Returns:
      a ProductsApi instance
    • validationsApi

      @Bean public io.voucherify.client.api.ValidationsApi validationsApi()
      Creates a ValidationsApi instance for managing validations in Voucherify.
      Returns:
      a ValidationsApi instance
    • redemptionsApi

      @Bean public io.voucherify.client.api.RedemptionsApi redemptionsApi()
      Creates a RedemptionsApi instance for managing redemptions in Voucherify.
      Returns:
      a RedemptionsApi instance
    • qualificationsApi

      @Bean public io.voucherify.client.api.QualificationsApi qualificationsApi()
      Creates a QualificationsApi instance for managing qualifications in Voucherify.
      Returns:
      a QualificationsApi instance
    • exportsApi

      @Bean public io.voucherify.client.api.ExportsApi exportsApi()
      Creates a bean for the ExportsApi.
      Returns:
      a new instance of ExportsApi configured with the API client.
    • promotionProductService

      @Bean @Primary public PromotionProductService promotionProductService()
      Creates a primary PromotionProductService bean using VoucherifyClient.
      Returns:
      a PromotionProductService instance
    • voucherifyClient

      @Bean public VoucherifyClient voucherifyClient()
      Creates a VoucherifyClient instance configured with necessary API clients.
      Returns:
      a VoucherifyClient instance
    • voucherifyValidationEngine

      @Bean public ValidationEngine voucherifyValidationEngine()
      Creates a ValidationEngine for managing validation processes in Voucherify.
      Returns:
      a ValidationEngine instance
    • voucherifyQualificationEngine

      @Bean public QualificationEngine voucherifyQualificationEngine()
      Creates a QualificationEngine for managing qualification processes in Voucherify.
      Returns:
      a QualificationEngine instance
    • voucherifyRedemptionEngine

      @Bean public RedemptionEngine voucherifyRedemptionEngine()
      Creates a RedemptionEngine for managing redemption processes in Voucherify.
      Returns:
      a RedemptionEngine instance
    • voucherifyRollbackEngine

      @Bean public RollbackEngine voucherifyRollbackEngine()
      Creates a RollbackEngine for handling rollback operations in Voucherify.
      Returns:
      a RollbackEngine instance
    • promotionEngine

      @Bean @Primary public PromotionEngine promotionEngine()
      Creates a primary PromotionEngine bean for managing promotions in Voucherify.
      Returns:
      a PromotionEngine instance
    • promotionOperation

      @Bean @Primary public PromotionOperation promotionOperation()
      Creates a primary PromotionOperation bean for executing promotion-related operations.
      Returns:
      a PromotionOperation instance
    • inputAdapter

      @Bean @Primary public InputAdapter inputAdapter()
      Creates a primary InputAdapter bean for handling input to the pricing service.
      Returns:
      an InputAdapter instance
    • outputAdapter

      @Bean @Primary public OutputAdapter outputAdapter()
      Creates a primary OutputAdapter bean for handling output from the pricing service.
      Returns:
      an OutputAdapter instance
    • voucherifyCampaignService

      @Bean public VoucherifyCampaignService voucherifyCampaignService()
    • voucherifyValidationService

      @Bean public VoucherifyValidationService voucherifyValidationService()
    • voucherifyPromotionTierService

      @Bean public VoucherifyPromotionTierService voucherifyPromotionTierService()
    • voucherifyVoucherService

      @Bean public VoucherifyVoucherService voucherifyVoucherService()
    • promotionExportService

      @Bean @Primary public PromotionExportService promotionExportService()
      Creates a primary bean for the PromotionExportService.

      This method initializes the VoucherifyPromotionExportService with the necessary dependencies and sets its properties for voucher fields and report fields.

      Returns:
      a configured instance of PromotionExportService.
    • voucherifyProxy

      @Bean public VoucherifyProxy voucherifyProxy()
      Creates a bean for the VoucherifyProxy.

      This method configures the proxy with the download URL and sets up a WebClient with the specified base URL and HTTP headers.

      Returns:
      a configured instance of VoucherifyProxy.
    • promotionServiceProxy

      @Bean public PromotionServiceProxy promotionServiceProxy()
      Creates a PromotionServiceProxy bean that acts as a proxy for interacting with the Promotion Service.
      Returns:
      A new instance of PromotionServiceProxy.
    • newUserGraphQL

      @Bean public NewUserGraphQLProxy newUserGraphQL()
      Creates and returns a NewUserGraphQLProxy bean, configured with the GraphQL URL, RestTemplate, and TokenGenerator for making authenticated GraphQL requests.
      Returns:
      a configured NewUserGraphQLProxy instance
    • voucherifyManagementService

      @Bean public VoucherifyManagementService voucherifyManagementService()
    • voucherifyApiClient

      @Bean public VoucherifyApiClient voucherifyApiClient()