public override Gateway.QuoteTripResponse QuoteTrip(Gateway.QuoteTripRequest request) { Logger.BeginRequest("QuoteTrip received from " + gateway.GetName(request.clientID), request); Gateway.QuoteTripResponse response = gateway.QuoteTrip(request); Logger.EndRequest(response); return(response); }
public override Gateway.QuoteTripResponse QuoteTrip(Gateway.QuoteTripRequest request) { Logger.BeginRequest("QuoteTrip sent to " + server.name, request); Gateway.QuoteTripResponse response = server.QuoteTrip(request); Logger.EndRequest(response); return(response); }
public override Gateway.QuoteTripResponse QuoteTrip(Gateway.QuoteTripRequest request) { requests++; Gateway.QuoteTripResponse resp = server.QuoteTrip(request); if (resp.result == Gateway.Result.Rejected) rejects++; Gateway.QuoteTripResponse response = new Gateway.QuoteTripResponse { result = resp.result, quotes = resp.quotes }; return response; }
public override Gateway.QuoteTripResponse QuoteTrip(Gateway.QuoteTripRequest request) { Logger.BeginRequest("QuoteTrip sent to " + name, request); GatewayService.Quotes quotes = new GatewayService.Quotes { access_token = AccessToken, PassengerId = request.passengerID, PassengerName = request.passengerName, Luggage = request.luggage, Persons = request.persons, PickupLat = request.pickupLocation.Lat, PickupLng = request.pickupLocation.Lng, PickupTime = request.pickupTime, DropoffLat = request.dropoffLocation == null ? (double?) null : request.dropoffLocation.Lat, DropoffLng = request.dropoffLocation == null ? (double?) null : request.dropoffLocation.Lng, PaymentMethod = request.paymentMethod, VehicleType = request.vehicleType, MaxPrice = request.maxPrice, MinRating = request.minRating, FleetId = request.fleetID, DriverId = request.driverID, }; JsonServiceClient client = new JsonServiceClient(RootUrl); GatewayService.QuotesResponse resp = client.Get<GatewayService.QuotesResponse>(quotes); Gateway.QuoteTripResponse response = new Gateway.QuoteTripResponse { result = resp.ResultCode, quotes = resp.Quotes }; Logger.EndRequest(response); return response; }
public override Gateway.QuoteTripResponse QuoteTrip(Gateway.QuoteTripRequest request) { Logger.BeginRequest("QuoteTrip received from " + tripthru.name, request); Gateway.QuoteTripResponse response = null; { // TDispatch requires that we supply the string address and postal code in addition to the Lng/Lat coordinates Pair<string, string> pickup_address = MapTools.GetReverseGeoLocAddress(request.pickupLocation); Pair<string, string> dropoff_address = MapTools.GetReverseGeoLocAddress(request.dropoffLocation); TDispatchAPI.GetFareRequest createRequest = new TDispatchAPI.GetFareRequest { payment_method = "cash", pickup_location = new TDispatchAPI.Location { lat = request.pickupLocation.Lat, lng = request.pickupLocation.Lng }, pickup_time = request.pickupTime.ToString("yyyy-MM-dd'T'HH:mm:ssK", DateTimeFormatInfo.InvariantInfo), dropoff_location = new TDispatchAPI.Location { lat = request.dropoffLocation.Lat, lng = request.dropoffLocation.Lng } }; // TODO: replace with POST /locations/fare TDispatchAPI.GetFareResponse createResponse = api.GetFare(createRequest); List<Quote> quotes = new List<Quote>(); var price = 0.0; try { price = double.Parse(createResponse.fare.formatted_total_cost.Replace("$", "")); } catch (Exception e) { } quotes.Add(new Quote(partnerID: ID, partnerName: name, fleetID: ID, fleetName: name, price: price, ETA: DateTime.UtcNow + new TimeSpan(1, 0, createResponse.fare.time_to_wait))); response = new Gateway.QuoteTripResponse(quotes, Result.OK); } Logger.EndRequest(response); return response; }
public override Gateway.QuoteTripResponse QuoteTrip(Gateway.QuoteTripRequest request) { Uri uri; if (!Uri.TryCreate(RootUrl, UriKind.Absolute, out uri)) return new Gateway.QuoteTripResponse { result = Result.InvalidParameters }; Logger.BeginRequest("QuoteTrip sent to " + name, request); //Logger.Log("RootURL: " + RootUrl); GatewayService.Quotes quotes = new GatewayService.Quotes { access_token = AccessToken, PassengerId = request.passengerID, PassengerName = request.passengerName, Luggage = request.luggage, Persons = request.persons, PickupLat = request.pickupLocation.Lat, PickupLng = request.pickupLocation.Lng, PickupTime = request.pickupTime, DropoffLat = request.dropoffLocation == null ? (double?) null : request.dropoffLocation.Lat, DropoffLng = request.dropoffLocation == null ? (double?) null : request.dropoffLocation.Lng, PaymentMethod = request.paymentMethod, VehicleType = request.vehicleType, MaxPrice = request.maxPrice, MinRating = request.minRating, FleetId = request.fleetID, DriverId = request.driverID, }; JsonServiceClient client = new JsonServiceClient(RootUrl); client.Timeout = timeout; GatewayService.QuotesResponse resp = client.Get<GatewayService.QuotesResponse>(quotes); Gateway.QuoteTripResponse response = new Gateway.QuoteTripResponse { result = resp.ResultCode, quotes = resp.Quotes }; Logger.EndRequest(response); return response; }