Exemplo n.º 1
0
        public async Task Invoke(HttpContext httpContext, IWebHookHandlerRegistry webHookHandlerRegistry,
                                 IWebHookEventFactory webHookEventFactory, WebHookEventValidator validator)
        {
            var webHookEvent = await webHookEventFactory.Create(httpContext);

            var result = await validator.ValidateAsync(webHookEvent);

            if (!result.IsValid)
            {
                httpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden;
                return;
            }

            await webHookHandlerRegistry.Handle(webHookEvent);
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Hooks(WebHookEvent webHookEvent)
        {
            await _webHookHandlerRegistry.Handle(webHookEvent);

            return(Ok());
        }