public int?CreateOrder(Guid orderId, int?providerId, int accountId, string passengerName, string phone, string email, int nbPassengers, int?vehicleTypeId, int?chargeTypeId, string note, DateTime pickupDateTime, IbsAddress pickup, IbsAddress dropoff, string accountNumber, int?customerNumber, string[] prompts, int?[] promptsLength, int defaultVehiculeTypeId, double?tipIncentive, int?tipPercent, string assignVehicleId, Fare fare = null) { throw new NotImplementedException(); }
public IbsHailResponse Hail(Guid orderId, int?providerId, int accountId, string passengerName, string phone, string email, int nbPassengers, int?vehicleTypeId, int?chargeTypeId, string note, DateTime pickupDateTime, IbsAddress pickup, IbsAddress dropoff, string accountNumber, int?customerNumber, string[] prompts, int?[] promptsLength, int defaultVehiculeTypeId, IEnumerable <IbsVehicleCandidate> vehicleCandidates, double?tipIncentive, int?tipPercent, Fare fare = null) { throw new NotImplementedException(); }
private TBookOrder_12 CreateIbsOrderObject(int?providerId, int accountId, string passengerName, string phone, string email, int nbPassengers, int?vehicleTypeId, int?chargeTypeId, string note, DateTime pickupDateTime, IbsAddress pickup, IbsAddress dropoff, string accountNumber, int?customerNumber, string[] prompts, int?[] promptsLength, int defaultVehiculeTypeId, double?tipIncentive, int?tipPercent, string assignVehicleId, Fare fare = default(Fare), Guid?taxiHailOrderId = null) { Logger.LogMessage("BookingWebServiceClient CreateIbsOrderObject : accountID=" + accountId); Logger.LogMessage("BookingWebServiceClient CreateIbsOrderObject : assignVehicleId:" + assignVehicleId); var order = new TBookOrder_12 { GUID = taxiHailOrderId.ToString(), ServiceProviderID = providerId.GetValueOrDefault(), AccountID = accountId, Customer = passengerName, Phone = CleanPhone(phone), AccountNum = accountNumber, EmailBackAdd = email }; if (!_serverSettings.ServerData.HideFareEstimateFromIBS) { order.Fare = Convert.ToDouble(fare.AmountExclTax); order.VAT = Convert.ToDouble(fare.TaxAmount); } order.DispByAuto = _ibsSettings.AutoDispatch; order.Priority = _ibsSettings.OrderPriority ? 1 : 0; order.PickupDate = new TWEBTimeStamp { Year = pickupDateTime.Year, Month = pickupDateTime.Month, Day = pickupDateTime.Day }; order.PickupTime = new TWEBTimeStamp { Hour = pickupDateTime.Hour, Minute = pickupDateTime.Minute, Second = 0, Fractions = 0 }; order.AccountNum = accountNumber; if (accountNumber.HasValue() && customerNumber.HasValue) { order.CustomerNum = customerNumber.Value; } else { order.CustomerNum = -1; } order.ChargeTypeID = chargeTypeId ?? -1; var aptRing = Params.Get(pickup.Apartment, pickup.RingCode).Where(s => s.HasValue()).JoinBy(" / "); order.PickupAddress = new TWEBAddress { StreetPlace = pickup.FullAddress, AptBaz = aptRing, Longitude = pickup.Longitude, Latitude = pickup.Latitude, Postal = pickup.ZipCode }; order.DropoffAddress = dropoff == null ? new TWEBAddress() : new TWEBAddress { StreetPlace = dropoff.FullAddress, AptBaz = dropoff.Apartment, Longitude = dropoff.Longitude, Latitude = dropoff.Latitude, Postal = dropoff.ZipCode }; order.Passengers = nbPassengers; order.VehicleTypeID = vehicleTypeId ?? defaultVehiculeTypeId; order.Note = note; order.ContactPhone = CleanPhone(phone); order.OrderStatus = TWEBOrderStatusValue.wosPost; order.JobOfferPrompt = _serverSettings.ServerData.MessagePromptedToDriver; order.TipPercent = tipPercent ?? _serverSettings.ServerData.DefaultTipPercentage; order.AssignCab = assignVehicleId; var currentCultureInfo = CultureInfo.GetCultureInfo(_serverSettings.ServerData.PriceFormat); if (tipIncentive.HasValue && tipIncentive > 0) { order.JobOfferPrompt = string.Format(currentCultureInfo, "{0} + {1:C} Bonus", order.JobOfferPrompt, tipIncentive); } SetPrompts(order, prompts, promptsLength); return(order); }
public IbsHailResponse Hail(Guid orderId, int?providerId, int accountId, string passengerName, string phone, string email, int nbPassengers, int?vehicleTypeId, int?chargeTypeId, string note, DateTime pickupDateTime, IbsAddress pickup, IbsAddress dropoff, string accountNumber, int?customerNumber, string[] prompts, int?[] promptsLength, int defaultVehiculeTypeId, IEnumerable <IbsVehicleCandidate> vehicleCandidates, double?tipIncentive, int?tipPercent, Fare fare = default(Fare)) { var order = CreateIbsOrderObject(providerId, accountId, passengerName, phone, email, nbPassengers, vehicleTypeId, chargeTypeId, note, pickupDateTime, pickup, dropoff, accountNumber, customerNumber, prompts, promptsLength, defaultVehiculeTypeId, tipIncentive, tipPercent, string.Empty, fare, orderId); var orderKey = new TBookOrderKey(); var vehicleComps = Mapper.Map <TVehicleComp[]>(vehicleCandidates); UseService(service => { Logger.LogMessage("WebService Creating IBS Hail : " + JsonSerializer.SerializeToString(order, typeof(TBookOrder_12))); Logger.LogMessage("WebService Creating IBS Hail pickup : " + JsonSerializer.SerializeToString(order.PickupAddress, typeof(TWEBAddress))); Logger.LogMessage("WebService Creating IBS Hail dest : " + JsonSerializer.SerializeToString(order.DropoffAddress, typeof(TWEBAddress))); orderKey = service.SaveBookOrder_12(UserNameApp, PasswordApp, order, vehicleComps); Logger.LogMessage("WebService Create Hail, orderid received : " + orderKey.OrderID + ", orderGUID received : " + orderKey.GUID); }); return(new IbsHailResponse { OrderKey = new IbsOrderKey { TaxiHailOrderId = orderKey.GUID.HasValue() ? Guid.Parse(orderKey.GUID) : Guid.Empty, IbsOrderId = orderKey.OrderID } }); }
public int?CreateOrder(Guid orderId, int?providerId, int accountId, string passengerName, string phone, string email, int nbPassengers, int?vehicleTypeId, int?chargeTypeId, string note, DateTime pickupDateTime, IbsAddress pickup, IbsAddress dropoff, string accountNumber, int?customerNumber, string[] prompts, int?[] promptsLength, int defaultVehiculeTypeId, double?tipIncentive, int?tipPercent, string assignVehicleId, Fare fare = default(Fare)) { var order = CreateIbsOrderObject(providerId, accountId, passengerName, phone, email, nbPassengers, vehicleTypeId, chargeTypeId, note, pickupDateTime, pickup, dropoff, accountNumber, customerNumber, prompts, promptsLength, defaultVehiculeTypeId, tipIncentive, tipPercent, assignVehicleId, fare, orderId); var orderKey = new TBookOrderKey(); UseService(service => { Logger.LogMessage("WebService Creating IBS Order : " + JsonSerializer.SerializeToString(order, typeof(TBookOrder_10))); Logger.LogMessage("WebService Creating IBS Order pickup : " + JsonSerializer.SerializeToString(order.PickupAddress, typeof(TWEBAddress))); Logger.LogMessage("WebService Creating IBS Order dest : " + JsonSerializer.SerializeToString(order.DropoffAddress, typeof(TWEBAddress))); orderKey.OrderID = service.SaveBookOrder_10(UserNameApp, PasswordApp, order); Logger.LogMessage("WebService Create Order, orderid received : " + orderKey.OrderID); }); var result = new IbsHailResponse { OrderKey = new IbsOrderKey { TaxiHailOrderId = orderKey.GUID.HasValue() ? Guid.Parse(orderKey.GUID) : Guid.Empty, IbsOrderId = orderKey.OrderID } }; return(result.OrderKey.IbsOrderId); }
private IbsHailResponse Hail(Guid orderId, int?providerId, string market, string companyKey, int?companyFleetId, Address pickupAddress, int ibsAccountId, string name, string phone, string email, int passengers, int?vehicleTypeId, int?ibsChargeTypeId, string ibsInformationNote, DateTime pickupDate, IbsAddress ibsPickupAddress, IbsAddress ibsDropOffAddress, string accountNumberString, int?customerNumber, string[] prompts, int?[] promptsLength, int defaultVehicleTypeId, double?tipIncentive, int?tipPercent, Fare fare) { // Query only the avaiable vehicles from the selected company for the order var availableVehicleService = GetAvailableVehiclesServiceClient(market); var availableVehicles = availableVehicleService.GetAvailableVehicles(market, pickupAddress.Latitude, pickupAddress.Longitude) .Where(v => v.FleetId == companyFleetId).ToArray(); if (!availableVehicles.Any()) { // Don't query IBS if we don't find any vehicles return(new IbsHailResponse { OrderKey = new IbsOrderKey { IbsOrderId = -1, TaxiHailOrderId = orderId } }); } var vehicleCandidates = availableVehicles.Select(vehicle => new IbsVehicleCandidate { CandidateType = VehicleCandidateTypes.VctPimId, VehicleId = vehicle.DeviceName, ETADistance = (int?)vehicle.DistanceToArrival ?? 0, ETATime = (int?)vehicle.Eta ?? 0 }); var ibsHailResult = _ibsServiceProvider.Booking(companyKey).Hail( orderId, providerId, ibsAccountId, name, phone, email, passengers, vehicleTypeId, ibsChargeTypeId, ibsInformationNote, pickupDate, ibsPickupAddress, ibsDropOffAddress, accountNumberString, customerNumber, prompts, promptsLength, defaultVehicleTypeId, vehicleCandidates, tipIncentive, tipPercent, fare); // Fetch vehicle candidates (who have accepted the hail request) only if order was successfully created on IBS if (ibsHailResult.OrderKey.IbsOrderId > -1) { // Need to wait for vehicles to receive hail request Thread.Sleep(30000); var candidates = _ibsServiceProvider.Booking(companyKey).GetVehicleCandidates(ibsHailResult.OrderKey); ibsHailResult.VehicleCandidates = candidates; } return(ibsHailResult); }