Documentation of the CarRentalAgentService

CarRentalAgentService. Method 

Retrieves a car rental Location.

public LocationResponse (
   LocationRequest request
);

Parameters

LocationRequest
A LocationRequest containing the nessessary request data.

Return Value

A LocationResponse containing the requested Location.

Remarks

Use this method to get a car rental Location. A Location is physical geographic point where car rental is offered. In simple words: It's just a car rental office.

Car rental locations are essential for a car rental Reservation. This statement becomes even more obvious when all process responsibilities are taken into account. Locations can/have:

You will get your desired location in response to a GetLocation call. Despite the fact that you will have to provide a location Id defining your requested location, you have two optional settings modifying the degree of detail in your response. If you set WithArrivalLocations to true, you will get all locations which are valid arrivals for requested location. This task becomes very important when so called One Way Rentals are desired.

The second valuable information are the available Equipments provided by the car rental Location. When setting WithEquipments to true, you will get a list of offered equipments of the requested location.

Lastly, you may wnat to retrieve the operation times for a Location by setting WithOperationTimeFrame to true.

Common Use Case Scenarios

Use Case Scenario Resolution Path
Your user has selected a departure location. Now you want to offer him information about the location as well as a list of additional equipments.
  1. Query the departure location having WithEquipments set to true.
Your user requests a one way rental and has selected a departure location. Now you want to offer him a list of possible arrival locations.
  1. Query the departure location having WithArrivalLocations set to true.

List Of defined call-variants

parameters GetLocationP1 GetLocationP2 GetLocationP3
token required required required
languageCode optional optional not applicable
id required required optional
departureDateTime not applicable not applicable optional
arrivalDateTime not applicable not applicable optional
withOperationTimeFrame not applicable optional optional
withEquipments not applicable optional optional
withArrivalLocations not applicable optional optional




Description : This variant returns the location identified by the given id. This variant returns the additional requested data and the location itself, identified by the given id. This variant returns the additional requested data and the location itself, identified by the given id. Thereby the availability is checked for the given departure and arrival dates and times.

List Of Errors Returned

Error Code Description
E_INTERNAL_SERVICE An internal service error occured during the process.
E_TICKET_TOKEN_INVALID The provided token is invalid.

This error occurs if:

  • The token is in invalid format.
  • The token is expired.
  • The token was not found.

E_LOCATION_NOT_FOUND The request location cannot be found.
E_REQUEST_INVALID The performed request is invalid or malformed.

List Of Warnings Returned

Warning Code Description
W_LANGUAGE_NOT_SUPPORTED The requested language code is not supported for localization. Using default language instead.
W_LOCATION_DOES_NOT_PROVIDE_EQUIPMENTS The requested location does not provide additional equipments for car rentals.
W_LOCATION_DOES_NOT_PROVIDE_ARRIVAL_LOCATIONS The requested location does not provide arrival locations for car rentals.

Example

Example: Load and display extended location information

[C#]
LocationRequest rq = new LocationRequest();
rq.Ticket = this.serviceTicket;
rq.Operation.Target = OperationTarget.Production;

// get everything
rq.LanguageCode = "EN";
rq.WithArrivalLocations = true;
rq.WithEquipments = true;
rq.WithOperationTimeFrame = true;

LocationResponse rs = this.service.GetLocation(this.selectedDepartureLocationId);
Location loc = rs.Location;

// write info
Console.WriteLine("Loaded Location {0} with Id {1}.", loc.Name, loc.Id);
Console.WriteLine("-------------------------------------------------------");

Console.WriteLine("1. Geographic position:");
Console.WriteLine("   Country                : {0}", loc.CountryCode);
Console.WriteLine("   WGS Latitude           : {0}", loc.GeoCoordinates.Latitude);
Console.WriteLine("   WGS Longitude          : {0}", loc.GeoCoordinates.Longitude);
Console.WriteLine("");

Console.WriteLine("2. Address:");
Console.WriteLine("   Street                 : {0}", loc.Address.Street);
Console.WriteLine("   ZipCode / City         : {0} / {1}", loc.Address.ZipCode, loc.Address.City);
Console.WriteLine("   Country                 : {0}", loc.Address.CountryCode);
Console.WriteLine("");

Console.WriteLine("3. Operation Time (Opening Hours):");
DayOfWeek[] baseDays = new DayOfWeek[] {    DayOfWeek.Monday, 
                                            DayOfWeek.Tuesday, 
                                            DayOfWeek.Wednesday, 
                                            DayOfWeek.Thursday, 
                                            DayOfWeek.Friday, 
                                            DayOfWeek.Saturday, 
                                            DayOfWeek.Sunday };

foreach (OperationTime locOpTime in loc.OperationTimeFrame.OperationTime)
{
    DayOfWeek[] listOfDays = new DayOfWeek[6];
    baseDays.CopyTo(listOfDays);
    
    foreach (DayOfWeek day in listOfDays) 
    {
        if (!locOpTime.DayOfWeek.Contains(day))
        {
            listOfDays.Remove(day);
        }
        
        if (listOfDays.Length > 2) 
        {
            Console.WriteLine(
                                "   {0} - {1} from {2} until {3}", 
                                listOfDays[0].ToString(), 
                                listOfDays[listOfDays.Length - 1].ToString(), 
                                DateTime.Parse(locOpTime.StartTime).ToShortTimeString(),
                                DateTime.Parse(locOpTime.EndTime).ToShortTimeString()
                            );
                                                                
        }
        else if (listOfDays.Length == 2)
        {
            Console.WriteLine(
                                "   {0}, {1} from {2} until {3}", 
                                listOfDays[0].ToString(), 
                                listOfDays[1].ToString(), 
                                DateTime.Parse(locOpTime.StartTime).ToShortTimeString(),
                                DateTime.Parse(locOpTime.EndTime).ToShortTimeString()
                            );
        }
        else
        {
            Console.WriteLine(
                                "   {0} from {1} until {2}", 
                                listOfDays[0].ToString(), 
                                DateTime.Parse(locOpTime.StartTime).ToShortTimeString(),
                                DateTime.Parse(locOpTime.EndTime).ToShortTimeString()
                            );
        }
    }
}
Console.WriteLine("");

Console.WriteLine("4. Services (availability info):");
Console.WriteLine("   Airport                : {0}", loc.HasAirportService ? "Yes" : "No");
Console.WriteLine("   Counter                : {0}", loc.HasCounterService ? "Yes" : "No");
Console.WriteLine("   Deliveries             : {0}", loc.HasDeliveryService ? "Yes" : "No");
Console.WriteLine("   Oneways                : {0}", loc.HasOnewayService ? "Yes" : "No");
Console.WriteLine("");

Console.WriteLine("5. Services (extended info):");
foreach (LocationService locService in loc.LocationService) 
{
    Console.Write("   {0}, has Id {1}, and ", locService.Name, locService.Id);
    switch (locService.InformationRequirement)
    {
        case Requirement.Required:
            Console.WriteLine("requires additional information for fulfillment.");
            break;
        case Requirement.Optional:
            Console.WriteLine("welcomes any additional information for fulfillment, although not required.");
            break;
        case Requirement.NotApplicable:
        case Requirement.None:
            Console.WriteLine("does not require any information.");
            break;
    }
}
Console.WriteLine("");

Console.WriteLine("6. Equipments:");
foreach (Equipment locEquip in loc.Equipment) 
{
    Console.WriteLine("   {0}, has Id {1}, and Code {2}", locEquip.Name, locEquip.Id, locEquip.Code);
}
Console.WriteLine("");

Console.WriteLine("7. Allowed Arrivals:");
foreach (Location locArrival in loc.ArrivalLocation) 
{
    Console.WriteLine("   {0} with Id {1}", locArrival.Name, locArrival.Id);
}
Console.WriteLine("");

See Also

CarRentalAgentService Class | SunnyCars.Services.Osi.WsReservation Namespace