Exemplo n.º 1
0
        // POST: api/Webhook
        public async Task <IHttpActionResult> Post()
        {
            // Parse the Webhook Notification from the HTTP request
            WebhookNotification notification = await WebhookNotification.FromRequest(Request);

            // Generate an event key to identify the event type. Event keys have the format
            // {ResourceType}.{EventType} or, if no resource type is present, simply {EventType}
            string eventKey = getEventKey(notification);

            // Add case statements for other events that you wish to capture and have
            // subscribed to.
            switch (eventKey)
            {
            case "Loan.Create": onLoanCreated(notification); break;
                //case "Loan.Update": onLoanUpdated(notification); break;
                //case "Loan.Submit": onLoanSubmitted(notification); break;
            }

            // Let the webhook sender know we received and processed the notification
            return(Ok());
        }