public override Gateway.UpdateTripStatusResponse UpdateTripStatus(Gateway.UpdateTripStatusRequest request) { Uri uri; if (!Uri.TryCreate(RootUrl, UriKind.Absolute, out uri)) { return new Gateway.UpdateTripStatusResponse { result = Result.InvalidParameters } } ; Logger.BeginRequest("UpdateTripStatus sent to " + name, request); //Logger.Log("RootURL: " + RootUrl); JsonServiceClient client = new JsonServiceClient(RootUrl); client.Timeout = timeout; GatewayService.TripStatusResponse resp = client.Put <GatewayService.TripStatusResponse>(new GatewayService.TripStatus { access_token = AccessToken, Status = request.status, TripId = request.tripID, DriverLocationLat = request.driverLocation != null ? (double?)request.driverLocation.Lat : null, DriverLocationLng = request.driverLocation != null ? (double?)request.driverLocation.Lng : null, ETA = request.eta }); Gateway.UpdateTripStatusResponse response; response = new Gateway.UpdateTripStatusResponse { result = resp.ResultCode }; Logger.EndRequest(response); return(response); } }
public override Gateway.GetTripStatusResponse GetTripStatus(Gateway.GetTripStatusRequest request) { Uri uri; if (!Uri.TryCreate(RootUrl, UriKind.Absolute, out uri)) { return new Gateway.GetTripStatusResponse { result = Result.InvalidParameters } } ; Logger.BeginRequest("GetTripStatus sent to " + name, request); //Logger.Log("RootURL: " + RootUrl); JsonServiceClient client = new JsonServiceClient(RootUrl); client.Timeout = timeout; GatewayService.TripStatusResponse resp = client.Get <GatewayService.TripStatusResponse>(new GatewayService.TripStatus { access_token = AccessToken, TripId = request.tripID }); GetTripStatusResponse response; if (resp.ResultCode == Result.OK) { response = new Gateway.GetTripStatusResponse { result = Gateway.Result.OK, ETA = resp.ETA, passengerName = resp.PassengerName, driverID = resp.DriverId, driverLocation = resp.DriverLocation, driverInitialLocation = resp.DriverInitialLocation, driverName = resp.DriverName, dropoffTime = resp.DropoffTime, dropoffLocation = resp.DropoffLocation, fleetName = resp.FleetName, fleetID = resp.FleetId, vehicleType = resp.VehicleType, status = resp.Status, partnerName = resp.PartnerName, partnerID = resp.PartnerId, pickupTime = resp.PickupTime, pickupLocation = resp.PickupLocation, distance = resp.Distance, driverRouteDuration = resp.DriverRouteDuration, price = resp.Price }; } else { response = new Gateway.GetTripStatusResponse { result = resp.ResultCode }; } Logger.EndRequest(response); return(response); }
public override Gateway.GetTripStatusResponse GetTripStatus(Gateway.GetTripStatusRequest request) { Logger.BeginRequest("GetTripStatus sent to " + name, request); JsonServiceClient client = new JsonServiceClient(RootUrl); GatewayService.TripStatusResponse resp = client.Get <GatewayService.TripStatusResponse>(new GatewayService.TripStatus { access_token = AccessToken, TripId = request.tripID }); GetTripStatusResponse response; if (resp.ResultCode == Result.OK) { response = new Gateway.GetTripStatusResponse { result = Gateway.Result.OK, ETA = resp.ETA, passengerName = resp.PassengerName, driverID = resp.DriverId, driverLocation = resp.DriverLocation, driverName = resp.DriverName, dropoffTime = resp.DropoffTime, dropoffLocation = resp.DropoffLocation, fleetName = resp.FleetName, fleetID = resp.FleetId, vehicleType = resp.VehicleType, status = resp.Status, partnerName = resp.PartnerName, partnerID = resp.PartnerId, pickupTime = resp.PickupTime, pickupLocation = resp.PickupLocation, distance = resp.Distance, driverRouteDuration = resp.DriverRouteDuration, price = resp.Price }; } else { response = new Gateway.GetTripStatusResponse { result = resp.ResultCode }; } Logger.EndRequest(response); return(response); }
public override Gateway.UpdateTripStatusResponse UpdateTripStatus(Gateway.UpdateTripStatusRequest request) { Logger.BeginRequest("UpdateTripStatus sent to " + name, request); JsonServiceClient client = new JsonServiceClient(RootUrl); GatewayService.TripStatusResponse resp = client.Put <GatewayService.TripStatusResponse>(new GatewayService.TripStatus { access_token = AccessToken, Status = request.status, TripId = request.tripID, DriverLocationLat = request.driverLocation != null ? (double?)request.driverLocation.Lat : null, DriverLocationLng = request.driverLocation != null ? (double?)request.driverLocation.Lng : null, DriverLocationAddress = request.driverLocation != null ? request.driverLocation.Address : null }); Gateway.UpdateTripStatusResponse response; response = new Gateway.UpdateTripStatusResponse { result = resp.ResultCode }; Logger.EndRequest(response); return(response); }