Example #1
0
        public async Task OTPCallback(string subscriptionId, OpenTripPlannerResponse route)
        {
            var sub = await _travelServiceContext.Subscriptions.FindAsync(subscriptionId);

            if (null == sub)
            {
                return;
            }
            route.Id = sub.RouteId;
            await _directionsCache.PutAsync(sub.RouteId, route.ToPlan());

            var cl = new HttpClient();
            await cl.PostAsync(sub.Callback, new StringContent(
                                   JsonConvert.SerializeObject(new DirectionsUpdate()
            {
                Id = sub.RouteId
            }), Encoding.UTF8, "application/json"));
        }
        public async Task <IActionResult> Otp(string id, [FromBody] OpenTripPlannerResponse res)
        {
            await _subscriptionService.OTPCallback(id, res);

            return(Ok());
        }