Class EventValidationUtil

java.lang.Object
com.skava.marketplace.util.EventValidationUtil

public class EventValidationUtil extends Object
This utility class is used for validating webhook events.
  • Constructor Details

    • EventValidationUtil

      @Autowired public EventValidationUtil(JsonReaderResourceUtil jsonReaderResourceUtil)
      Constructor for EventValidationUtil.
      Parameters:
      jsonReaderResourceUtil - utility for reading JSON resources
  • Method Details

    • validateWebhooksEvent

      public Boolean validateWebhooksEvent(List<WebhooksConfig> webhooksConfigList) throws IOException
      Validates the events in the provided list of WebhooksConfig objects. It reads a JSON file to get a map of valid events and their priorities. Then, it checks if each event in the WebhooksConfig objects is present in the map. If an event is not found in the map, it returns true, indicating that the configuration contains an invalid event. If all events are found in the map, it returns false.
      Parameters:
      webhooksConfigList - list of WebhooksConfig objects to validate
      Returns:
      true if an invalid event is found, false otherwise
      Throws:
      IOException - if there is an error reading the JSON file