public void SendPaymentNotification(double totalAmount, double meterAmount, double tipAmount, string authorizationCode, string vehicleNumber, string companyKey) { if (companyKey.HasValue()) { _logger.LogMessage(string.Format("Sending payment notification on external company '{0}'", companyKey)); } var amountString = _resources.FormatPrice(totalAmount); var meterString = _resources.FormatPrice(meterAmount); var tipString = _resources.FormatPrice(tipAmount); // Padded with 32 char because the MDT displays line of 32 char. This will cause to write each string on a new line var line1 = string.Format(_resources.Get("PaymentConfirmationToDriver1")); line1 = line1.PadRight(32, ' '); var line2 = string.Format(_resources.Get("PaymentConfirmationToDriver2"), meterString, tipString); line2 = line2.PadRight(32, ' '); var line3 = string.Format(_resources.Get("PaymentConfirmationToDriver3"), amountString); line3 = line3.PadRight(32, ' '); var line4 = string.IsNullOrWhiteSpace(authorizationCode) ? string.Empty : string.Format(_resources.Get("PaymentConfirmationToDriver4"), authorizationCode); if (!_ibsServiceProvider.Booking(companyKey).SendMessageToDriver(line1 + line2 + line3 + line4, vehicleNumber)) { throw new Exception("Cannot send the payment notification."); } }
public DirectionInfo Get(IbsFareRequest request) { var tripDurationInMinutes = (request.TripDurationInSeconds.HasValue ? (int?)TimeSpan.FromSeconds(request.TripDurationInSeconds.Value).TotalMinutes : null); var defaultVehiculeType = _vehicleTypeDao.GetAll().FirstOrDefault(); var fare = _ibsServiceProvider.Booking().GetFareEstimate( request.PickupLatitude, request.PickupLongitude, request.DropoffLatitude, request.DropoffLongitude, request.PickupZipCode, request.DropoffZipCode, request.AccountNumber, request.CustomerNumber, tripDurationInMinutes, _serverSettings.ServerData.DefaultBookingSettings.ProviderId, request.VehicleType, defaultVehiculeType != null ? defaultVehiculeType.ReferenceDataVehicleId : -1); if (fare.FareEstimate != null) { double distance = fare.Distance ?? 0; return(new DirectionInfo { Distance = distance, Price = fare.FareEstimate, FormattedDistance = _resources.FormatDistance(distance), FormattedPrice = _resources.FormatPrice(fare.FareEstimate) }); } return(new DirectionInfo()); }