def validate(
        self,
        api_key: str,
        secret: str,
    ):
        """
        The original contents of the Event message must be confirmed by
        refetching it and comparing the fetched data with the original data.

        This function makes an API call to Stripe to redownload the Event data
        and returns whether or not it matches the WebhookEventTrigger data.
        """

        local_data = self.json_body
        if "id" not in local_data or "livemode" not in local_data:
            logger.error(
                '"id" not in json body or "livemode" not in json body(%s)', local_data
            )
            return False

        if self.is_test_event:
            logger.info("Test webhook received and discarded: %s", local_data)
            return False

        validation_method = self.webhook_endpoint.djstripe_validation_method

        if validation_method == WebhookEndpointValidation.none:
            # validation disabled
            warnings.warn("WEBHOOK VALIDATION is disabled.")
            return True
        elif validation_method == WebhookEndpointValidation.verify_signature:
            if settings.DEBUG:
                # In debug mode, allow overriding the webhook secret with
                # the x-djstripe-webhook-secret header.
                # (used for stripe cli webhook forwarding)
                headers = CaseInsensitiveMapping(self.headers)
                local_secret = headers.get("x-djstripe-webhook-secret")
                secret = local_secret or secret
            return self.verify_signature(
                secret=secret, tolerance=self.webhook_endpoint.djstripe_tolerance
            )

        livemode = local_data["livemode"]
        api_key = api_key or djstripe_settings.get_default_api_key(livemode)

        # Retrieve the event using the api_version specified in itself
        remote_data = Event.stripe_class.retrieve(
            id=local_data["id"],
            api_key=api_key,
            stripe_version=local_data["api_version"],
        )

        return local_data["data"] == remote_data["data"]

        The original contents of the Event message must be confirmed by
        refetching it and comparing the fetched data with the original data.

        This function makes an API call to Stripe to redownload the Event data
        and returns whether or not it matches the WebhookEventTrigger data.
        
djstripe/models/webhooks.py