mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-06-22 05:47:28 +02:00
Version 3.0.338
This commit is contained in:
parent
573fe77e12
commit
0468955d49
751 changed files with 62747 additions and 60672 deletions
|
@ -2,18 +2,18 @@
|
|||
|
||||
namespace TINK.Repository.Response
|
||||
{
|
||||
[DataContract]
|
||||
public class AuthorizationResponse : ResponseBase
|
||||
{
|
||||
[DataMember]
|
||||
public int debuglevel { get; private set; }
|
||||
[DataContract]
|
||||
public class AuthorizationResponse : ResponseBase
|
||||
{
|
||||
[DataMember]
|
||||
public int debuglevel { get; private set; }
|
||||
|
||||
/// <summary> Holds the group of the bike (TINK, Konrad, ...).</summary>
|
||||
[DataMember]
|
||||
public string[] user_group { get; private set; }
|
||||
/// <summary> Holds the group of the bike (TINK, Konrad, ...).</summary>
|
||||
[DataMember]
|
||||
public string[] user_group { get; private set; }
|
||||
|
||||
/// <summary> Holds value of 0 if agb were not acknowledged.</summary>
|
||||
[DataMember]
|
||||
public string agb_checked { get; private set; }
|
||||
}
|
||||
/// <summary> Holds value of 0 if agb were not acknowledged.</summary>
|
||||
[DataMember]
|
||||
public string agb_checked { get; private set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
namespace TINK.Repository.Response
|
||||
{
|
||||
[DataContract]
|
||||
public class AuthorizationoutResponse : ResponseBase
|
||||
{
|
||||
}
|
||||
[DataContract]
|
||||
public class AuthorizationoutResponse : ResponseBase
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,15 +2,15 @@
|
|||
|
||||
namespace TINK.Repository.Response
|
||||
{
|
||||
[DataContract]
|
||||
public class BikeInfoAvailable : BikeInfoBase
|
||||
{
|
||||
/// <summary>Mini survey for bikes which were rented before and for which feedback is pending.</summary>
|
||||
[DataMember]
|
||||
public MiniSurveyResponse user_miniquery { get; private set; }
|
||||
[DataContract]
|
||||
public class BikeInfoAvailable : BikeInfoBase
|
||||
{
|
||||
/// <summary>Mini survey for bikes which were rented before and for which feedback is pending.</summary>
|
||||
[DataMember]
|
||||
public MiniSurveyResponse user_miniquery { get; private set; }
|
||||
|
||||
/// <summary> Information about Co2- saving for bikes which were rented before and for which feedback is pending.</summary>
|
||||
[DataMember]
|
||||
public string co2saving { get; private set; }
|
||||
}
|
||||
/// <summary> Information about Co2- saving for bikes which were rented before and for which feedback is pending.</summary>
|
||||
[DataMember]
|
||||
public string co2saving { get; private set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,105 +2,105 @@
|
|||
|
||||
namespace TINK.Repository.Response
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds info about a single bike.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class BikeInfoBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Id of the bike.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string bike { get; private set; }
|
||||
/// <summary>
|
||||
/// Holds info about a single bike.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class BikeInfoBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Id of the bike.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string bike { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Position of the bike.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Position gps { get; private set; }
|
||||
/// <summary>
|
||||
/// Position of the bike.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Position gps { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Id of the station.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string station { get; private set; }
|
||||
/// <summary>
|
||||
/// Id of the station.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string station { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Holds the localized (german) description of the bike.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string description { get; private set; }
|
||||
/// <summary>
|
||||
/// Holds the localized (german) description of the bike.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string description { get; private set; }
|
||||
|
||||
/// <summary> Holds the group of the bike.</summary>
|
||||
/// <remarks>
|
||||
/// Copri returns values "TINK", "Konrad".
|
||||
/// </remarks>
|
||||
[DataMember]
|
||||
public string[] bike_group { get; private set; }
|
||||
/// <summary> Holds the group of the bike.</summary>
|
||||
/// <remarks>
|
||||
/// Copri returns values "TINK", "Konrad".
|
||||
/// </remarks>
|
||||
[DataMember]
|
||||
public string[] bike_group { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Rental state.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string state { get; private set; }
|
||||
/// <summary>
|
||||
/// Rental state.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string state { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Holds the uri where to reserve/ rent the bike.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string uri_operator { get; private set; }
|
||||
/// <summary>
|
||||
/// Holds the uri where to reserve/ rent the bike.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string uri_operator { get; private set; }
|
||||
|
||||
/// <summary> Holds whether bike is equipped with computer or if bike is a lock bike.</summary>
|
||||
/// <remarks>
|
||||
/// <table>
|
||||
/// <tr><th>Value </th><th>Type of bike </th><th>Member to extract info.</th></tr>
|
||||
/// <tr><td>LOCK </td><td>Bike with manual lock. </td><td>TextToTypeHelper.GetIsNonBikeComputerBike</td></tr>
|
||||
/// <tr><td>BC </td><td>Bike with a bord computer. </td><td></td></tr>
|
||||
/// <tr><td>Ilockit </td><td>Bike with a bluetooth lock.</td><td></td></tr>
|
||||
/// <tr><td>sigo </td><td>Sigo bike.</td><td></td></tr>
|
||||
/// </table>
|
||||
/// </remarks>
|
||||
[DataMember]
|
||||
public string system { get; private set; }
|
||||
/// <summary> Holds whether bike is equipped with computer or if bike is a lock bike.</summary>
|
||||
/// <remarks>
|
||||
/// <table>
|
||||
/// <tr><th>Value </th><th>Type of bike </th><th>Member to extract info.</th></tr>
|
||||
/// <tr><td>LOCK </td><td>Bike with manual lock. </td><td>TextToTypeHelper.GetIsNonBikeComputerBike</td></tr>
|
||||
/// <tr><td>BC </td><td>Bike with a bord computer. </td><td></td></tr>
|
||||
/// <tr><td>Ilockit </td><td>Bike with a bluetooth lock.</td><td></td></tr>
|
||||
/// <tr><td>sigo </td><td>Sigo bike.</td><td></td></tr>
|
||||
/// </table>
|
||||
/// </remarks>
|
||||
[DataMember]
|
||||
public string system { get; private set; }
|
||||
|
||||
#if !NOTARIFFDESCRIPTION
|
||||
/// <summary> Holds the tariff information for a bike. </summary>
|
||||
/// <remarks> This member is obsolete. Use <cref="rental_description"> instead.</cref></remarks>
|
||||
[DataMember]
|
||||
public TariffDescription tariff_description { get; private set; }
|
||||
/// <summary> Holds the tariff information for a bike. </summary>
|
||||
/// <remarks> This member is obsolete. Use <cref="rental_description"> instead.</cref></remarks>
|
||||
[DataMember]
|
||||
public TariffDescription tariff_description { get; private set; }
|
||||
|
||||
/// <summary> Holds the rental information for a bike. </summary>
|
||||
[DataMember]
|
||||
public RentalDescription rental_description { get; private set; }
|
||||
/// <summary> Holds the rental information for a bike. </summary>
|
||||
[DataMember]
|
||||
public RentalDescription rental_description { get; private set; }
|
||||
#endif
|
||||
[DataMember]
|
||||
/// <summary> Describes type of the bike.</summary>
|
||||
public BikeType bike_type { get; private set; }
|
||||
[DataMember]
|
||||
/// <summary> Describes type of the bike.</summary>
|
||||
public BikeType bike_type { get; private set; }
|
||||
|
||||
/// <summary> Loading state of motor battery in % ]0..100[. </summary>
|
||||
[DataMember]
|
||||
public string bike_charge { get; private set; }
|
||||
/// <summary> Loading state of motor battery in % ]0..100[. </summary>
|
||||
[DataMember]
|
||||
public string bike_charge { get; private set; }
|
||||
|
||||
/// <summary> Locking state of the bike. </summary>
|
||||
[DataMember]
|
||||
public string lock_state { get; private set; }
|
||||
/// <summary> Locking state of the bike. </summary>
|
||||
[DataMember]
|
||||
public string lock_state { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
/// <summary> Full advertisement name.</summary>
|
||||
public string Ilockit_ID { get; private set; }
|
||||
[DataMember]
|
||||
/// <summary> Full advertisement name.</summary>
|
||||
public string Ilockit_ID { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
/// <summary> Full advertisement name.</summary>
|
||||
public string Ilockit_GUID { get; private set; }
|
||||
[DataMember]
|
||||
/// <summary> Full advertisement name.</summary>
|
||||
public string Ilockit_GUID { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Textual description of response.
|
||||
/// </summary>
|
||||
/// <returns>Object as text.</returns>
|
||||
public new string ToString()
|
||||
{
|
||||
return $"Bike {bike}{(station != null ? $", at station {station}" : string.Empty)}{(!string.IsNullOrEmpty(description) ? $", {description}" : string.Empty)}{(!string.IsNullOrEmpty(state) ? $", status={state}" : string.Empty)}.";
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Textual description of response.
|
||||
/// </summary>
|
||||
/// <returns>Object as text.</returns>
|
||||
public new string ToString()
|
||||
{
|
||||
return $"Bike {bike}{(station != null ? $", at station {station}" : string.Empty)}{(!string.IsNullOrEmpty(description) ? $", {description}" : string.Empty)}{(!string.IsNullOrEmpty(state) ? $", status={state}" : string.Empty)}.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,31 +2,31 @@
|
|||
|
||||
namespace TINK.Repository.Response
|
||||
{
|
||||
[DataContract]
|
||||
public class BikeInfoReservedOrBooked : BikeInfoBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Date from when bike was reserved from/ booked from.
|
||||
/// Format: 2017-11-28 11:01:51.637747+01
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string start_time { get; private set; }
|
||||
[DataContract]
|
||||
public class BikeInfoReservedOrBooked : BikeInfoBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Date from when bike was reserved from/ booked from.
|
||||
/// Format: 2017-11-28 11:01:51.637747+01
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string start_time { get; private set; }
|
||||
|
||||
/// <summary> Booking code if bike is BC-bike.</summary>
|
||||
[DataMember]
|
||||
public string timeCode { get; private set; }
|
||||
/// <summary> Booking code if bike is BC-bike.</summary>
|
||||
[DataMember]
|
||||
public string timeCode { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
/// <summary> Seed used to generate key for connecting to bluetooth lock.</summary>
|
||||
public string K_seed { get; private set; }
|
||||
[DataMember]
|
||||
/// <summary> Seed used to generate key for connecting to bluetooth lock.</summary>
|
||||
public string K_seed { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
/// <summary> Key for connect to bluetooth lock as user.</summary>
|
||||
public string K_u { get; private set; }
|
||||
[DataMember]
|
||||
/// <summary> Key for connect to bluetooth lock as user.</summary>
|
||||
public string K_u { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
/// <summary> Key for connect to bluetooth lock as admin.</summary>
|
||||
public string K_a { get; private set; }
|
||||
[DataMember]
|
||||
/// <summary> Key for connect to bluetooth lock as admin.</summary>
|
||||
public string K_a { get; private set; }
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,84 +2,84 @@
|
|||
|
||||
namespace TINK.Repository.Response
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds info about a single bike.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class BikeType
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds the engine.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class Engine
|
||||
{
|
||||
/// <summary>
|
||||
/// Manufacturer: ...
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string manufacturer { get; private set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Holds info about a single bike.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class BikeType
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds the engine.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class Engine
|
||||
{
|
||||
/// <summary>
|
||||
/// Manufacturer: ...
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string manufacturer { get; private set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Holds the engine.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class Battery
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds the current charging level in bars.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string charge_current_bars { get; private set; }
|
||||
/// <summary>
|
||||
/// Holds the engine.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class Battery
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds the current charging level in bars.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string charge_current_bars { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Holds the current charging level of the battery in percent.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string charge_current_percent { get; private set; }
|
||||
/// <summary>
|
||||
/// Holds the current charging level of the battery in percent.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string charge_current_percent { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Holds the maximum chargeing level of the battery in bars.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string charge_max_bars { get; private set; }
|
||||
/// <summary>
|
||||
/// Holds the maximum chargeing level of the battery in bars.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string charge_max_bars { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Holds whether backend is aware of battery charging level.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string backend_accessible { get; private set; }
|
||||
/// <summary>
|
||||
/// Holds whether backend is aware of battery charging level.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string backend_accessible { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Holds whether to display battery level or not.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string hidden { get; private set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Holds whether to display battery level or not.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string hidden { get; private set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Category of the bike. Possible entries: "city", "cargo", ...
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string category { get; private set; }
|
||||
/// <summary>
|
||||
/// Category of the bike. Possible entries: "city", "cargo", ...
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string category { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Count of wheels. There are trikes (3 wheels) and two wheeled bikes.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string wheels { get; private set; }
|
||||
/// <summary>
|
||||
/// Count of wheels. There are trikes (3 wheels) and two wheeled bikes.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string wheels { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Holds engine information. .
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Engine engine { get; private set; }
|
||||
/// <summary>
|
||||
/// Holds engine information. .
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Engine engine { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Holds battery information .
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Battery battery { get; private set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Holds battery information .
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Battery battery { get; private set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,16 +3,16 @@ using System.Runtime.Serialization;
|
|||
|
||||
namespace TINK.Repository.Response
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds the information about all bikes and is used for deserialization of copri answer.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class BikesAvailableResponse : ResponseBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Dictionary of bikes.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Dictionary<string, BikeInfoAvailable> bikes { get; private set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Holds the information about all bikes and is used for deserialization of copri answer.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class BikesAvailableResponse : ResponseBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Dictionary of bikes.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Dictionary<string, BikeInfoAvailable> bikes { get; private set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,12 +3,12 @@ using System.Runtime.Serialization;
|
|||
|
||||
namespace TINK.Repository.Response
|
||||
{
|
||||
public class BikesReservedOccupiedResponse : ResponseBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Dictionary of bikes.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Dictionary<string, BikeInfoReservedOrBooked> bikes_occupied { get; private set; }
|
||||
}
|
||||
public class BikesReservedOccupiedResponse : ResponseBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Dictionary of bikes.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Dictionary<string, BikeInfoReservedOrBooked> bikes_occupied { get; private set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
namespace TINK.Repository.Response
|
||||
{
|
||||
[DataContract]
|
||||
public class CopriVersion
|
||||
{
|
||||
[DataMember]
|
||||
public string copri_version { get; private set; }
|
||||
}
|
||||
[DataContract]
|
||||
public class CopriVersion
|
||||
{
|
||||
[DataMember]
|
||||
public string copri_version { get; private set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
namespace TINK.Repository.Response
|
||||
{
|
||||
public class DoReturnResponse : BikesReservedOccupiedResponse
|
||||
{
|
||||
/// <summary> Mini survey.</summary>
|
||||
[DataMember]
|
||||
public MiniSurveyResponse user_miniquery { get; private set; }
|
||||
public class DoReturnResponse : BikesReservedOccupiedResponse
|
||||
{
|
||||
/// <summary> Mini survey.</summary>
|
||||
[DataMember]
|
||||
public MiniSurveyResponse user_miniquery { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
public string co2saving { get; private set; }
|
||||
}
|
||||
[DataMember]
|
||||
public string co2saving { get; private set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,26 +2,26 @@
|
|||
|
||||
namespace TINK.Repository.Response
|
||||
{
|
||||
public static class JsonConvertRethrow
|
||||
{
|
||||
/// <summary>
|
||||
/// Deserializes COPRI responses in a consitent way for entire app.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of object to serialize to.</typeparam>
|
||||
/// <param name="response">JSON to deserialize.</param>
|
||||
/// <returns>Deserialized object.</returns>
|
||||
public static T DeserializeObject<T>(string response)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.DeserializeObject<T>(response);
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
throw new DeserializationException(ex);
|
||||
}
|
||||
}
|
||||
public static class JsonConvertRethrow
|
||||
{
|
||||
/// <summary>
|
||||
/// Deserializes COPRI responses in a consitent way for entire app.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of object to serialize to.</typeparam>
|
||||
/// <param name="response">JSON to deserialize.</param>
|
||||
/// <returns>Deserialized object.</returns>
|
||||
public static T DeserializeObject<T>(string response)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.DeserializeObject<T>(response);
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
throw new DeserializationException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static string SerializeObject(object value) => Newtonsoft.Json.JsonConvert.SerializeObject(value);
|
||||
}
|
||||
public static string SerializeObject(object value) => Newtonsoft.Json.JsonConvert.SerializeObject(value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,16 +2,16 @@
|
|||
|
||||
namespace TINK.Repository.Response
|
||||
{
|
||||
/// <summary> Holds information about map area to display.</summary>
|
||||
[DataContract]
|
||||
public class MapSpan
|
||||
{
|
||||
/// <summary> Center position of the map. </summary>
|
||||
[DataMember]
|
||||
public Position center { get; private set; }
|
||||
/// <summary> Holds information about map area to display.</summary>
|
||||
[DataContract]
|
||||
public class MapSpan
|
||||
{
|
||||
/// <summary> Center position of the map. </summary>
|
||||
[DataMember]
|
||||
public Position center { get; private set; }
|
||||
|
||||
/// <summary> Radius to the map area. </summary>
|
||||
[DataMember]
|
||||
public string radius { get; private set; }
|
||||
}
|
||||
/// <summary> Radius to the map area. </summary>
|
||||
[DataMember]
|
||||
public string radius { get; private set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,32 +3,32 @@ using System.Runtime.Serialization;
|
|||
|
||||
namespace TINK.Repository.Response
|
||||
{
|
||||
[DataContract]
|
||||
public class MiniSurveyResponse
|
||||
{
|
||||
[DataContract]
|
||||
public class Question
|
||||
{
|
||||
[DataMember]
|
||||
public string quest_text { get; private set; }
|
||||
[DataContract]
|
||||
public class MiniSurveyResponse
|
||||
{
|
||||
[DataContract]
|
||||
public class Question
|
||||
{
|
||||
[DataMember]
|
||||
public string quest_text { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
public string type { get; private set; }
|
||||
[DataMember]
|
||||
public string type { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
public Dictionary<string, string> query { get; private set; }
|
||||
}
|
||||
[DataMember]
|
||||
public Dictionary<string, string> query { get; private set; }
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public string title { get; private set; }
|
||||
[DataMember]
|
||||
public string title { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
public string subtitle { get; private set; }
|
||||
[DataMember]
|
||||
public string subtitle { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
public string footer { get; private set; }
|
||||
[DataMember]
|
||||
public string footer { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
public Dictionary<string, Question> questions { get; private set; }
|
||||
}
|
||||
[DataMember]
|
||||
public Dictionary<string, Question> questions { get; private set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,16 +2,16 @@
|
|||
|
||||
namespace TINK.Repository.Response
|
||||
{
|
||||
/// <summary> Holds position info. </summary>
|
||||
[DataContract]
|
||||
public class Position
|
||||
{
|
||||
/// <summary> Latitude position (bike, station, map center...). </summary>
|
||||
[DataMember]
|
||||
public string latitude { get; private set; }
|
||||
/// <summary> Holds position info. </summary>
|
||||
[DataContract]
|
||||
public class Position
|
||||
{
|
||||
/// <summary> Latitude position (bike, station, map center...). </summary>
|
||||
[DataMember]
|
||||
public string latitude { get; private set; }
|
||||
|
||||
/// <summary> Longitude position (bike, station, map center...). </summary>
|
||||
[DataMember]
|
||||
public string longitude { get; private set; }
|
||||
}
|
||||
/// <summary> Longitude position (bike, station, map center...). </summary>
|
||||
[DataMember]
|
||||
public string longitude { get; private set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,39 +3,39 @@ using System.Runtime.Serialization;
|
|||
|
||||
namespace TINK.Repository.Response
|
||||
{
|
||||
/// <summary>
|
||||
/// Successor of TarifDescription- object.
|
||||
/// Manages tariff- and rental info.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class RentalDescription
|
||||
{
|
||||
/// <summary>
|
||||
/// Name of the tariff.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string name { get; private set; }
|
||||
/// <summary>
|
||||
/// Successor of TarifDescription- object.
|
||||
/// Manages tariff- and rental info.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class RentalDescription
|
||||
{
|
||||
/// <summary>
|
||||
/// Name of the tariff.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string name { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Id of the tariff.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string id { get; private set; }
|
||||
/// <summary>
|
||||
/// Id of the tariff.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string id { get; private set; }
|
||||
|
||||
/// <summary> Holds tariff entires to show to user.</summary>
|
||||
[DataMember]
|
||||
public Dictionary<
|
||||
string /* Key of tariff object for sorting purposes*/,
|
||||
string[] /* Holds two Elements: first element is the description of the element (example: "Max Gebühr"), second is the value (example: "9.00 € / Tag")*/>
|
||||
tarif_elements
|
||||
{ get; private set; }
|
||||
/// <summary> Holds tariff entires to show to user.</summary>
|
||||
[DataMember]
|
||||
public Dictionary<
|
||||
string /* Key of tariff object for sorting purposes*/,
|
||||
string[] /* Holds two Elements: first element is the description of the element (example: "Max Gebühr"), second is the value (example: "9.00 € / Tag")*/>
|
||||
tarif_elements
|
||||
{ get; private set; }
|
||||
|
||||
/// <summary> Holds tariff entires to show to user.</summary>
|
||||
[DataMember]
|
||||
public Dictionary<
|
||||
string /* Key of info object for sorting purposes*/,
|
||||
string[] /* Holds two Elements: first element is the key of the element (example: "Tracking"), second is the value (example: "Ich stimme der Speicherung (Tracking) meiner Fahrstrecke ....")*/>
|
||||
rental_info
|
||||
{ get; private set; }
|
||||
}
|
||||
/// <summary> Holds tariff entires to show to user.</summary>
|
||||
[DataMember]
|
||||
public Dictionary<
|
||||
string /* Key of info object for sorting purposes*/,
|
||||
string[] /* Holds two Elements: first element is the key of the element (example: "Tracking"), second is the value (example: "Ich stimme der Speicherung (Tracking) meiner Fahrstrecke ....")*/>
|
||||
rental_info
|
||||
{ get; private set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
|
||||
namespace TINK.Repository.Response
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds the information about a booking request and is used for deserialization of copri answer.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class ReservationBookingResponse : BikesReservedOccupiedResponse
|
||||
{
|
||||
/// <summary> Booking code for BC- bikes. </summary>
|
||||
[DataMember]
|
||||
public string timeCode { get; private set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Holds the information about a booking request and is used for deserialization of copri answer.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class ReservationBookingResponse : BikesReservedOccupiedResponse
|
||||
{
|
||||
/// <summary> Booking code for BC- bikes. </summary>
|
||||
[DataMember]
|
||||
public string timeCode { get; private set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
namespace TINK.Repository.Response
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds the information about a cancel booking request and is used for deserialization of copri answer.
|
||||
/// </summary>
|
||||
public class ReservationCancelReturnResponse : BikesReservedOccupiedResponse
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// Holds the information about a cancel booking request and is used for deserialization of copri answer.
|
||||
/// </summary>
|
||||
public class ReservationCancelReturnResponse : BikesReservedOccupiedResponse
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,56 +2,56 @@
|
|||
|
||||
namespace TINK.Repository.Response
|
||||
{
|
||||
[DataContract]
|
||||
public class ResponseBase : CopriVersion
|
||||
{
|
||||
[DataMember]
|
||||
public string response_state { get; private set; }
|
||||
[DataContract]
|
||||
public class ResponseBase : CopriVersion
|
||||
{
|
||||
[DataMember]
|
||||
public string response_state { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
public string response { get; private set; }
|
||||
[DataMember]
|
||||
public string response { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
public string response_text { get; private set; }
|
||||
[DataMember]
|
||||
public string response_text { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
public string authcookie { get; private set; }
|
||||
[DataMember]
|
||||
public string authcookie { get; private set; }
|
||||
|
||||
/// <summary> Message shown to user.</summary>
|
||||
[DataMember]
|
||||
public string merchant_message { get; private set; }
|
||||
/// <summary> Message shown to user.</summary>
|
||||
[DataMember]
|
||||
public string merchant_message { get; private set; }
|
||||
|
||||
/// <summary> Initial map display area.</summary>
|
||||
[DataMember]
|
||||
public MapSpan init_map { get; private set; }
|
||||
/// <summary> Initial map display area.</summary>
|
||||
[DataMember]
|
||||
public MapSpan init_map { get; private set; }
|
||||
|
||||
/// <summary> Url of page holding agb info. </summary>
|
||||
[DataMember]
|
||||
public string agb_html { get; private set; }
|
||||
/// <summary> Url of page holding agb info. </summary>
|
||||
[DataMember]
|
||||
public string agb_html { get; private set; }
|
||||
|
||||
/// <summary> Url of page holding instructions how to rent bikes. </summary>
|
||||
[DataMember]
|
||||
public string bike_info_html { get; private set; }
|
||||
/// <summary> Url of page holding instructions how to rent bikes. </summary>
|
||||
[DataMember]
|
||||
public string bike_info_html { get; private set; }
|
||||
|
||||
/// <summary> Url of page holding privacy info. </summary>
|
||||
[DataMember]
|
||||
public string privacy_html { get; private set; }
|
||||
/// <summary> Url of page holding privacy info. </summary>
|
||||
[DataMember]
|
||||
public string privacy_html { get; private set; }
|
||||
|
||||
/// <summary> Url of page holding impress info. </summary>
|
||||
[DataMember]
|
||||
public string impress_html { get; private set; }
|
||||
/// <summary> Url of page holding impress info. </summary>
|
||||
[DataMember]
|
||||
public string impress_html { get; private set; }
|
||||
|
||||
/// <summary> Url of page holding tariff info. </summary>
|
||||
[DataMember]
|
||||
public string tariff_info_html { get; private set; }
|
||||
/// <summary> Url of page holding tariff info. </summary>
|
||||
[DataMember]
|
||||
public string tariff_info_html { get; private set; }
|
||||
|
||||
/// <summary> Textual description of response. </summary>
|
||||
public new string ToString()
|
||||
{
|
||||
return $"Response state is \"{response_state ?? string.Empty}\", " +
|
||||
$"auth cookie is \"{authcookie ?? string.Empty}\" and response is \"{response_text ?? string.Empty}\", " +
|
||||
$"code \"{response ?? string.Empty}\"" +
|
||||
$"response text \"{response_text ?? string.Empty}\".";
|
||||
}
|
||||
}
|
||||
/// <summary> Textual description of response. </summary>
|
||||
public new string ToString()
|
||||
{
|
||||
return $"Response state is \"{response_state ?? string.Empty}\", " +
|
||||
$"auth cookie is \"{authcookie ?? string.Empty}\" and response is \"{response_text ?? string.Empty}\", " +
|
||||
$"code \"{response ?? string.Empty}\"" +
|
||||
$"response text \"{response_text ?? string.Empty}\".";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,24 +2,24 @@
|
|||
|
||||
namespace TINK.Repository.Response
|
||||
{
|
||||
[DataContract]
|
||||
public class ResponseContainer<T>
|
||||
{
|
||||
[DataMember]
|
||||
public T shareejson { get; private set; }
|
||||
[DataContract]
|
||||
public class ResponseContainer<T>
|
||||
{
|
||||
[DataMember]
|
||||
public T shareejson { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Serializes object to string.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override string ToString()
|
||||
{
|
||||
if (shareejson == null)
|
||||
{
|
||||
return "Response container does not hold no entry.";
|
||||
}
|
||||
/// <summary>
|
||||
/// Serializes object to string.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override string ToString()
|
||||
{
|
||||
if (shareejson == null)
|
||||
{
|
||||
return "Response container does not hold no entry.";
|
||||
}
|
||||
|
||||
return shareejson.ToString();
|
||||
}
|
||||
}
|
||||
return shareejson.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,253 +4,253 @@ using TINK.Repository.Exception;
|
|||
|
||||
namespace TINK.Repository.Response
|
||||
{
|
||||
public static class ResponseHelper
|
||||
{
|
||||
public const string RESPONSE_OK = "OK";
|
||||
public static class ResponseHelper
|
||||
{
|
||||
public const string RESPONSE_OK = "OK";
|
||||
|
||||
/// <summary> Holds the description of the action return bike. </summary>
|
||||
public const string RESPONSE_AUTHCOOKIE_EXPRIED = "Failure 1001:";
|
||||
/// <summary> Holds the description of the action return bike. </summary>
|
||||
public const string RESPONSE_AUTHCOOKIE_EXPRIED = "Failure 1001:";
|
||||
|
||||
/// <summary> Holds the description of the action logout. </summary>
|
||||
public const string BIKES_LOGOUT_ACTIONTEXT = "Abmeldung fehlgeschlagen.";
|
||||
/// <summary> Holds the description of the action logout. </summary>
|
||||
public const string BIKES_LOGOUT_ACTIONTEXT = "Abmeldung fehlgeschlagen.";
|
||||
|
||||
/// <summary> Holds the description of the action get stations available. </summary>
|
||||
public const string STATIONS_AVAILABLE_ACTIONTEXT = "Abfrage der verfügbaren Stationen fehlgeschlagen.";
|
||||
/// <summary> Holds the description of the action get stations available. </summary>
|
||||
public const string STATIONS_AVAILABLE_ACTIONTEXT = "Abfrage der verfügbaren Stationen fehlgeschlagen.";
|
||||
|
||||
/// <summary> Holds the description of the action get bikes available. </summary>
|
||||
public const string BIKES_AVAILABLE_ACTIONTEXT = "Abfrage der verfügbaren Fahrräder fehlgeschlagen.";
|
||||
/// <summary> Holds the description of the action get bikes available. </summary>
|
||||
public const string BIKES_AVAILABLE_ACTIONTEXT = "Abfrage der verfügbaren Fahrräder fehlgeschlagen.";
|
||||
|
||||
/// <summary> Holds the description of the action get bikes occupied. </summary>
|
||||
public const string BIKES_OCCUPIED_ACTIONTEXT = "Abfrage der reservierten/ gebuchten Fahrräder fehlgeschlagen.";
|
||||
/// <summary> Holds the description of the action get bikes occupied. </summary>
|
||||
public const string BIKES_OCCUPIED_ACTIONTEXT = "Abfrage der reservierten/ gebuchten Fahrräder fehlgeschlagen.";
|
||||
|
||||
/// <summary> Holds the description of the action cancel reservation. </summary>
|
||||
public const string BIKES_CANCELREQUEST_ACTIONTEXT = "Aufheben der Reservierung fehlgeschlagen.";
|
||||
/// <summary> Holds the description of the action cancel reservation. </summary>
|
||||
public const string BIKES_CANCELREQUEST_ACTIONTEXT = "Aufheben der Reservierung fehlgeschlagen.";
|
||||
|
||||
/// <summary> Holds the description of the action return bike. </summary>
|
||||
public const string BIKES_RETURNBIKE_ACTIONTEXT = "Rückgabe des Rads fehlgeschlagen.";
|
||||
/// <summary> Holds the description of the action return bike. </summary>
|
||||
public const string BIKES_RETURNBIKE_ACTIONTEXT = "Rückgabe des Rads fehlgeschlagen.";
|
||||
|
||||
/// <summary>
|
||||
/// Checks if log in response is ok.
|
||||
/// </summary>
|
||||
/// <param name="response">Response to check whether it is valid.</param>
|
||||
/// <param name="mail">Mail addess used to create details error message in case log in response is invalid.</param>
|
||||
/// <returns></returns>
|
||||
public static AuthorizationResponse GetIsResponseOk(this AuthorizationResponse response, string mail)
|
||||
{
|
||||
if (response == null)
|
||||
{
|
||||
throw new InvalidResponseException<AuthorizationResponse>("Anmeldung fehlgeschlagen.", null);
|
||||
}
|
||||
/// <summary>
|
||||
/// Checks if log in response is ok.
|
||||
/// </summary>
|
||||
/// <param name="response">Response to check whether it is valid.</param>
|
||||
/// <param name="mail">Mail addess used to create details error message in case log in response is invalid.</param>
|
||||
/// <returns></returns>
|
||||
public static AuthorizationResponse GetIsResponseOk(this AuthorizationResponse response, string mail)
|
||||
{
|
||||
if (response == null)
|
||||
{
|
||||
throw new InvalidResponseException<AuthorizationResponse>("Anmeldung fehlgeschlagen.", null);
|
||||
}
|
||||
|
||||
if (response.response_state.ToUpper() == InvalidAuthorizationResponseException.AUTH_FAILURE_STATUS_MESSAGE_UPPERCASE)
|
||||
{
|
||||
throw new InvalidAuthorizationResponseException(mail, response);
|
||||
}
|
||||
else if (!response.response_state.Trim().ToUpper().StartsWith(RESPONSE_OK))
|
||||
{
|
||||
throw new InvalidResponseException<AuthorizationResponse>($"Anmeldung {mail} fehlgeschlagen.\r\nServer Antwort: {response.response_text}", response);
|
||||
}
|
||||
if (response.response_state.ToUpper() == InvalidAuthorizationResponseException.AUTH_FAILURE_STATUS_MESSAGE_UPPERCASE)
|
||||
{
|
||||
throw new InvalidAuthorizationResponseException(mail, response);
|
||||
}
|
||||
else if (!response.response_state.Trim().ToUpper().StartsWith(RESPONSE_OK))
|
||||
{
|
||||
throw new InvalidResponseException<AuthorizationResponse>($"Anmeldung {mail} fehlgeschlagen.\r\nServer Antwort: {response.response_text}", response);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if log out response is ok.
|
||||
/// </summary>
|
||||
/// <param name="p_oResponse">Response to check whether it is valid.</param>
|
||||
/// <returns></returns>
|
||||
public static AuthorizationoutResponse GetIsResponseOk(this AuthorizationoutResponse p_oResponse)
|
||||
{
|
||||
if (AuthcookieNotDefinedException.IsAuthcookieNotDefined(p_oResponse, BIKES_LOGOUT_ACTIONTEXT, out AuthcookieNotDefinedException exception))
|
||||
{
|
||||
throw exception;
|
||||
}
|
||||
/// <summary>
|
||||
/// Checks if log out response is ok.
|
||||
/// </summary>
|
||||
/// <param name="p_oResponse">Response to check whether it is valid.</param>
|
||||
/// <returns></returns>
|
||||
public static AuthorizationoutResponse GetIsResponseOk(this AuthorizationoutResponse p_oResponse)
|
||||
{
|
||||
if (AuthcookieNotDefinedException.IsAuthcookieNotDefined(p_oResponse, BIKES_LOGOUT_ACTIONTEXT, out AuthcookieNotDefinedException exception))
|
||||
{
|
||||
throw exception;
|
||||
}
|
||||
|
||||
GetIsResponseOk(p_oResponse, BIKES_LOGOUT_ACTIONTEXT);
|
||||
GetIsResponseOk(p_oResponse, BIKES_LOGOUT_ACTIONTEXT);
|
||||
|
||||
if (p_oResponse.authcookie != "1")
|
||||
{
|
||||
throw new InvalidResponseException<AuthorizationoutResponse>(
|
||||
BIKES_LOGOUT_ACTIONTEXT,
|
||||
p_oResponse);
|
||||
}
|
||||
if (p_oResponse.authcookie != "1")
|
||||
{
|
||||
throw new InvalidResponseException<AuthorizationoutResponse>(
|
||||
BIKES_LOGOUT_ACTIONTEXT,
|
||||
p_oResponse);
|
||||
}
|
||||
|
||||
return p_oResponse;
|
||||
}
|
||||
return p_oResponse;
|
||||
}
|
||||
|
||||
/// <summary>Gets if a call to reserve bike succeeded or not by checking a booking response.</summary>
|
||||
/// <param name="bikeId">Id of bike which should be booked.</param>
|
||||
/// <param name="sessionCookie">Sessiong cookie of logged in user.</param>
|
||||
/// <param name="bookingResponse">Response to check.</param>
|
||||
/// <returns></returns>
|
||||
public static BikeInfoReservedOrBooked GetIsReserveResponseOk(
|
||||
this ReservationBookingResponse bookingResponse,
|
||||
string bikeId)
|
||||
{
|
||||
GetIsResponseOk(bookingResponse, string.Format(AppResources.ExceptionTextReservationBikeFailedGeneral, bikeId));
|
||||
/// <summary>Gets if a call to reserve bike succeeded or not by checking a booking response.</summary>
|
||||
/// <param name="bikeId">Id of bike which should be booked.</param>
|
||||
/// <param name="sessionCookie">Sessiong cookie of logged in user.</param>
|
||||
/// <param name="bookingResponse">Response to check.</param>
|
||||
/// <returns></returns>
|
||||
public static BikeInfoReservedOrBooked GetIsReserveResponseOk(
|
||||
this ReservationBookingResponse bookingResponse,
|
||||
string bikeId)
|
||||
{
|
||||
GetIsResponseOk(bookingResponse, string.Format(AppResources.ExceptionTextReservationBikeFailedGeneral, bikeId));
|
||||
|
||||
if (BookingDeclinedException.IsBookingDeclined(bookingResponse.response_state, out BookingDeclinedException exception))
|
||||
{
|
||||
throw exception;
|
||||
}
|
||||
if (BookingDeclinedException.IsBookingDeclined(bookingResponse.response_state, out BookingDeclinedException exception))
|
||||
{
|
||||
throw exception;
|
||||
}
|
||||
|
||||
// Get bike which has to be booked.
|
||||
var bikeInfoRequestedOccupied = bookingResponse?.bikes_occupied?.Values?.FirstOrDefault(x => x.bike == bikeId);
|
||||
if (bikeInfoRequestedOccupied == null)
|
||||
{
|
||||
throw new System.Exception(string.Format(
|
||||
AppResources.ExceptionTextReservationBikeFailedUnavailalbe,
|
||||
bikeId,
|
||||
!string.IsNullOrWhiteSpace(bookingResponse?.response_text) ? $"\r\n{bookingResponse.response_text}" : string.Empty));
|
||||
}
|
||||
// Get bike which has to be booked.
|
||||
var bikeInfoRequestedOccupied = bookingResponse?.bikes_occupied?.Values?.FirstOrDefault(x => x.bike == bikeId);
|
||||
if (bikeInfoRequestedOccupied == null)
|
||||
{
|
||||
throw new System.Exception(string.Format(
|
||||
AppResources.ExceptionTextReservationBikeFailedUnavailalbe,
|
||||
bikeId,
|
||||
!string.IsNullOrWhiteSpace(bookingResponse?.response_text) ? $"\r\n{bookingResponse.response_text}" : string.Empty));
|
||||
}
|
||||
|
||||
return bikeInfoRequestedOccupied;
|
||||
}
|
||||
return bikeInfoRequestedOccupied;
|
||||
}
|
||||
|
||||
/// <summary> Gets if a booking call succeeded or not by checking a booking response. </summary>
|
||||
/// <param name="bikeId">Id of bike which should be booked.</param>
|
||||
/// <param name="bookingResponse">Response to check.</param>
|
||||
/// <returns></returns>
|
||||
public static BikeInfoReservedOrBooked GetIsBookingResponseOk(
|
||||
this ReservationBookingResponse bookingResponse,
|
||||
string bikeId)
|
||||
{
|
||||
GetIsResponseOk(bookingResponse, string.Format(AppResources.ExceptionTextRentingBikeFailedGeneral, bikeId));
|
||||
/// <summary> Gets if a booking call succeeded or not by checking a booking response. </summary>
|
||||
/// <param name="bikeId">Id of bike which should be booked.</param>
|
||||
/// <param name="bookingResponse">Response to check.</param>
|
||||
/// <returns></returns>
|
||||
public static BikeInfoReservedOrBooked GetIsBookingResponseOk(
|
||||
this ReservationBookingResponse bookingResponse,
|
||||
string bikeId)
|
||||
{
|
||||
GetIsResponseOk(bookingResponse, string.Format(AppResources.ExceptionTextRentingBikeFailedGeneral, bikeId));
|
||||
|
||||
// Get bike which has to be booked.
|
||||
var bikeInfoRequestedOccupied = bookingResponse?.bikes_occupied?.Values?.FirstOrDefault(x => x.bike == bikeId);
|
||||
if (bikeInfoRequestedOccupied == null)
|
||||
{
|
||||
throw new System.Exception(string.Format(
|
||||
AppResources.ExceptionTextRentingBikeFailedUnavailalbe,
|
||||
bikeId,
|
||||
!string.IsNullOrWhiteSpace(bookingResponse?.response_text) ? $"\r\n{bookingResponse.response_text}" : string.Empty));
|
||||
}
|
||||
// Get bike which has to be booked.
|
||||
var bikeInfoRequestedOccupied = bookingResponse?.bikes_occupied?.Values?.FirstOrDefault(x => x.bike == bikeId);
|
||||
if (bikeInfoRequestedOccupied == null)
|
||||
{
|
||||
throw new System.Exception(string.Format(
|
||||
AppResources.ExceptionTextRentingBikeFailedUnavailalbe,
|
||||
bikeId,
|
||||
!string.IsNullOrWhiteSpace(bookingResponse?.response_text) ? $"\r\n{bookingResponse.response_text}" : string.Empty));
|
||||
}
|
||||
|
||||
return bikeInfoRequestedOccupied;
|
||||
}
|
||||
return bikeInfoRequestedOccupied;
|
||||
}
|
||||
|
||||
/// <summary> Gets if request is ok.</summary>
|
||||
/// <param name="response">Response to verify.</param>
|
||||
/// <param name="textOfAction">Text describing request which is shown if validation fails.</param>
|
||||
/// <returns>Verified response.</returns>
|
||||
public static BikesReservedOccupiedResponse GetIsResponseOk(this BikesReservedOccupiedResponse response, string textOfAction)
|
||||
{
|
||||
if (response == null || response.response_state == null)
|
||||
{
|
||||
throw new InvalidResponseException<BikesReservedOccupiedResponse>(textOfAction, null);
|
||||
}
|
||||
/// <summary> Gets if request is ok.</summary>
|
||||
/// <param name="response">Response to verify.</param>
|
||||
/// <param name="textOfAction">Text describing request which is shown if validation fails.</param>
|
||||
/// <returns>Verified response.</returns>
|
||||
public static BikesReservedOccupiedResponse GetIsResponseOk(this BikesReservedOccupiedResponse response, string textOfAction)
|
||||
{
|
||||
if (response == null || response.response_state == null)
|
||||
{
|
||||
throw new InvalidResponseException<BikesReservedOccupiedResponse>(textOfAction, null);
|
||||
}
|
||||
|
||||
if (AuthcookieNotDefinedException.IsAuthcookieNotDefined(response, textOfAction, out AuthcookieNotDefinedException exception))
|
||||
{
|
||||
throw exception;
|
||||
}
|
||||
if (AuthcookieNotDefinedException.IsAuthcookieNotDefined(response, textOfAction, out AuthcookieNotDefinedException exception))
|
||||
{
|
||||
throw exception;
|
||||
}
|
||||
|
||||
if (response.response_state.Trim().ToUpper().StartsWith(RESPONSE_AUTHCOOKIE_EXPRIED.ToUpper()))
|
||||
{
|
||||
throw new AuthcookieNotDefinedException(
|
||||
$"{textOfAction}\r\n{AppResources.ExceptionTextSessionExpired}",
|
||||
response);
|
||||
}
|
||||
if (response.response_state.Trim().ToUpper().StartsWith(RESPONSE_AUTHCOOKIE_EXPRIED.ToUpper()))
|
||||
{
|
||||
throw new AuthcookieNotDefinedException(
|
||||
$"{textOfAction}\r\n{AppResources.ExceptionTextSessionExpired}",
|
||||
response);
|
||||
}
|
||||
|
||||
GetIsResponseOk((ResponseBase)response, textOfAction);
|
||||
GetIsResponseOk((ResponseBase)response, textOfAction);
|
||||
|
||||
return response;
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
/// <summary> Gets if request is ok.</summary>
|
||||
/// <param name="response">Response to verify.</param>
|
||||
/// <param name="textOfAction">Text describing request which is shown if validation fails.</param>
|
||||
/// <returns>Verified response.</returns>
|
||||
public static T GetIsResponseOk<T>(this T response, string textOfAction) where T : ResponseBase
|
||||
{
|
||||
if (response == null || response.response_state == null)
|
||||
{
|
||||
throw new InvalidResponseException<T>(textOfAction, null);
|
||||
}
|
||||
/// <summary> Gets if request is ok.</summary>
|
||||
/// <param name="response">Response to verify.</param>
|
||||
/// <param name="textOfAction">Text describing request which is shown if validation fails.</param>
|
||||
/// <returns>Verified response.</returns>
|
||||
public static T GetIsResponseOk<T>(this T response, string textOfAction) where T : ResponseBase
|
||||
{
|
||||
if (response == null || response.response_state == null)
|
||||
{
|
||||
throw new InvalidResponseException<T>(textOfAction, null);
|
||||
}
|
||||
|
||||
if (AuthcookieNotDefinedException.IsAuthcookieNotDefined(response, textOfAction, out AuthcookieNotDefinedException exception))
|
||||
{
|
||||
throw exception;
|
||||
}
|
||||
if (AuthcookieNotDefinedException.IsAuthcookieNotDefined(response, textOfAction, out AuthcookieNotDefinedException exception))
|
||||
{
|
||||
throw exception;
|
||||
}
|
||||
|
||||
if (!response.response_state.Trim().ToUpper().StartsWith(RESPONSE_OK))
|
||||
{
|
||||
throw new InvalidResponseException<T>(
|
||||
$"{textOfAction}\r\nServer Antwort: {response.response_text}",
|
||||
response);
|
||||
}
|
||||
if (!response.response_state.Trim().ToUpper().StartsWith(RESPONSE_OK))
|
||||
{
|
||||
throw new InvalidResponseException<T>(
|
||||
$"{textOfAction}\r\nServer Antwort: {response.response_text}",
|
||||
response);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
/// <summary> Gets if cancel or booking request is ok.</summary>
|
||||
/// <param name="cancelBookingResponse">Response to verify.</param>
|
||||
/// <param name="textOfAction">Text describing request which is shown if validation fails.</param>
|
||||
/// <param name="bikeId">Id of bike.</param>
|
||||
/// <returns>Verified response.</returns>
|
||||
public static ReservationCancelReturnResponse GetIsCancelReservationResponseOk(
|
||||
this ReservationCancelReturnResponse cancelBookingResponse,
|
||||
string bikeId)
|
||||
{
|
||||
GetIsResponseOk<ResponseBase>(cancelBookingResponse, BIKES_CANCELREQUEST_ACTIONTEXT);
|
||||
/// <summary> Gets if cancel or booking request is ok.</summary>
|
||||
/// <param name="cancelBookingResponse">Response to verify.</param>
|
||||
/// <param name="textOfAction">Text describing request which is shown if validation fails.</param>
|
||||
/// <param name="bikeId">Id of bike.</param>
|
||||
/// <returns>Verified response.</returns>
|
||||
public static ReservationCancelReturnResponse GetIsCancelReservationResponseOk(
|
||||
this ReservationCancelReturnResponse cancelBookingResponse,
|
||||
string bikeId)
|
||||
{
|
||||
GetIsResponseOk<ResponseBase>(cancelBookingResponse, BIKES_CANCELREQUEST_ACTIONTEXT);
|
||||
|
||||
// Get bike which has to be booked.
|
||||
var l_oBikeInfo = cancelBookingResponse?.bikes_occupied?.Values?.FirstOrDefault(x => x.bike == bikeId);
|
||||
if (l_oBikeInfo != null)
|
||||
{
|
||||
throw new ReturnBikeException(
|
||||
cancelBookingResponse,
|
||||
$"{BIKES_CANCELREQUEST_ACTIONTEXT} Aufruf wurde erfolgreich ausgeführt, aber Rad ist noch in Liste der reservierten Räder enthalten.");
|
||||
}
|
||||
// Get bike which has to be booked.
|
||||
var l_oBikeInfo = cancelBookingResponse?.bikes_occupied?.Values?.FirstOrDefault(x => x.bike == bikeId);
|
||||
if (l_oBikeInfo != null)
|
||||
{
|
||||
throw new ReturnBikeException(
|
||||
cancelBookingResponse,
|
||||
$"{BIKES_CANCELREQUEST_ACTIONTEXT} Aufruf wurde erfolgreich ausgeführt, aber Rad ist noch in Liste der reservierten Räder enthalten.");
|
||||
}
|
||||
|
||||
return cancelBookingResponse;
|
||||
}
|
||||
return cancelBookingResponse;
|
||||
}
|
||||
|
||||
/// <summary> Gets if return bike request is ok.</summary>
|
||||
/// <param name="returnBikeResponse">Response to verify.</param>
|
||||
/// <param name="textOfAction">Text describing request which is shown if validation fails.</param>
|
||||
/// <param name="bikeId">Id of bike.</param>
|
||||
/// <returns>Verified response.</returns>
|
||||
public static DoReturnResponse GetIsReturnBikeResponseOk(
|
||||
this DoReturnResponse returnBikeResponse,
|
||||
string bikeId)
|
||||
{
|
||||
// Check if bike is at station.
|
||||
if (NotAtStationException.IsNotAtStation(returnBikeResponse.response_state.ToUpper(), out NotAtStationException notAtStationException))
|
||||
{
|
||||
throw notAtStationException;
|
||||
}
|
||||
/// <summary> Gets if return bike request is ok.</summary>
|
||||
/// <param name="returnBikeResponse">Response to verify.</param>
|
||||
/// <param name="textOfAction">Text describing request which is shown if validation fails.</param>
|
||||
/// <param name="bikeId">Id of bike.</param>
|
||||
/// <returns>Verified response.</returns>
|
||||
public static DoReturnResponse GetIsReturnBikeResponseOk(
|
||||
this DoReturnResponse returnBikeResponse,
|
||||
string bikeId)
|
||||
{
|
||||
// Check if bike is at station.
|
||||
if (NotAtStationException.IsNotAtStation(returnBikeResponse.response_state.ToUpper(), out NotAtStationException notAtStationException))
|
||||
{
|
||||
throw notAtStationException;
|
||||
}
|
||||
|
||||
// Check if GPS data was send to copri.
|
||||
if (NoGPSDataException.IsNoGPSData(returnBikeResponse.response_state.ToUpper(), out NoGPSDataException noGPSDataException))
|
||||
{
|
||||
throw noGPSDataException;
|
||||
}
|
||||
// Check if GPS data was send to copri.
|
||||
if (NoGPSDataException.IsNoGPSData(returnBikeResponse.response_state.ToUpper(), out NoGPSDataException noGPSDataException))
|
||||
{
|
||||
throw noGPSDataException;
|
||||
}
|
||||
|
||||
GetIsResponseOk<ResponseBase>(returnBikeResponse, BIKES_RETURNBIKE_ACTIONTEXT);
|
||||
GetIsResponseOk<ResponseBase>(returnBikeResponse, BIKES_RETURNBIKE_ACTIONTEXT);
|
||||
|
||||
// Get bike which has to be booked.
|
||||
var l_oBikeInfo = returnBikeResponse?.bikes_occupied?.Values?.FirstOrDefault(x => x.bike == bikeId);
|
||||
if (l_oBikeInfo != null)
|
||||
{
|
||||
throw new ReturnBikeException(
|
||||
returnBikeResponse,
|
||||
$"{BIKES_RETURNBIKE_ACTIONTEXT} Aufruf wurde erfolgreich ausgeführt, aber Rad ist noch in Liste der gemieteten Räder enthalten.");
|
||||
}
|
||||
// Get bike which has to be booked.
|
||||
var l_oBikeInfo = returnBikeResponse?.bikes_occupied?.Values?.FirstOrDefault(x => x.bike == bikeId);
|
||||
if (l_oBikeInfo != null)
|
||||
{
|
||||
throw new ReturnBikeException(
|
||||
returnBikeResponse,
|
||||
$"{BIKES_RETURNBIKE_ACTIONTEXT} Aufruf wurde erfolgreich ausgeführt, aber Rad ist noch in Liste der gemieteten Räder enthalten.");
|
||||
}
|
||||
|
||||
return returnBikeResponse;
|
||||
}
|
||||
return returnBikeResponse;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the response for bikes occupied request with no bikes reserved.
|
||||
/// </summary>
|
||||
/// <param name="p_strSesstionCookie"></param>
|
||||
/// <returns></returns>
|
||||
public static BikesReservedOccupiedResponse GetBikesOccupiedNone(string p_strSesstionCookie = null)
|
||||
{
|
||||
var l_oJson = CopriCallsMonkeyStore.BIKESOCCUPIED.Replace(@"""authcookie"": """"", @"""authcookie"": """ + (p_strSesstionCookie ?? string.Empty) + @"""");
|
||||
return CopriCallsStatic.DeserializeResponse(@"{ ""shareejson"" : " + l_oJson + "}", (version) => new BikesReservedOccupiedResponse());
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the response for bikes occupied request with no bikes reserved.
|
||||
/// </summary>
|
||||
/// <param name="p_strSesstionCookie"></param>
|
||||
/// <returns></returns>
|
||||
public static BikesReservedOccupiedResponse GetBikesOccupiedNone(string p_strSesstionCookie = null)
|
||||
{
|
||||
var l_oJson = CopriCallsMonkeyStore.BIKESOCCUPIED.Replace(@"""authcookie"": """"", @"""authcookie"": """ + (p_strSesstionCookie ?? string.Empty) + @"""");
|
||||
return CopriCallsStatic.DeserializeResponse(@"{ ""shareejson"" : " + l_oJson + "}", (version) => new BikesReservedOccupiedResponse());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,67 +3,67 @@ using System.Runtime.Serialization;
|
|||
|
||||
namespace TINK.Repository.Response
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds the information about all stations and is used for deserialization of copri answer.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class StationsAvailableResponse : ResponseBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds info about a single station.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class StationInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds info about opertor data.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class OperatorData
|
||||
{
|
||||
[DataMember]
|
||||
public string operator_name { get; private set; }
|
||||
/// <summary>
|
||||
/// Holds the information about all stations and is used for deserialization of copri answer.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class StationsAvailableResponse : ResponseBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds info about a single station.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class StationInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds info about opertor data.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class OperatorData
|
||||
{
|
||||
[DataMember]
|
||||
public string operator_name { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
public string operator_phone { get; private set; }
|
||||
[DataMember]
|
||||
public string operator_phone { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
public string operator_hours { get; private set; }
|
||||
[DataMember]
|
||||
public string operator_hours { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
public string operator_email { get; private set; }
|
||||
[DataMember]
|
||||
public string operator_email { get; private set; }
|
||||
|
||||
|
||||
[DataMember]
|
||||
public string operator_color { get; private set; }
|
||||
}
|
||||
[DataMember]
|
||||
public string operator_color { get; private set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unique id of the station.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string station { get; private set; }
|
||||
/// <summary>
|
||||
/// Unique id of the station.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string station { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
public string[] station_group { get; private set; }
|
||||
[DataMember]
|
||||
public string[] station_group { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
public string description { get; private set; }
|
||||
[DataMember]
|
||||
public string description { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Position of the station.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Position gps { get; private set; }
|
||||
/// <summary>
|
||||
/// Position of the station.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Position gps { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
public OperatorData operator_data { get; private set; }
|
||||
}
|
||||
[DataMember]
|
||||
public OperatorData operator_data { get; private set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dictionary of bikes.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Dictionary<string, StationInfo> stations { get; private set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Dictionary of bikes.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Dictionary<string, StationInfo> stations { get; private set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
namespace TINK.Repository.Response
|
||||
{
|
||||
public class SubmitFeedbackResponse : ResponseBase
|
||||
{
|
||||
}
|
||||
public class SubmitFeedbackResponse : ResponseBase
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,58 +2,58 @@
|
|||
|
||||
namespace TINK.Repository.Response
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds tariff info for a single bike.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
/// <summary>
|
||||
/// Holds tariff info for a single bike.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
#if USCSHARP9
|
||||
public record TariffDescription
|
||||
#else
|
||||
public class TariffDescription
|
||||
public class TariffDescription
|
||||
#endif
|
||||
{
|
||||
/// <summary>
|
||||
/// Name of the tariff.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string name { get; private set; }
|
||||
{
|
||||
/// <summary>
|
||||
/// Name of the tariff.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string name { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of the tariff.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string number { get; private set; }
|
||||
/// <summary>
|
||||
/// Number of the tariff.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string number { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Costs per hour in euro.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string eur_per_hour { get; private set; }
|
||||
/// <summary>
|
||||
/// Costs per hour in euro.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string eur_per_hour { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Costs of the abo per month.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string abo_eur_per_month { get; private set; }
|
||||
/// <summary>
|
||||
/// Costs of the abo per month.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string abo_eur_per_month { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Costs per hour in euro.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string free_hours { get; private set; }
|
||||
/// <summary>
|
||||
/// Costs per hour in euro.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string free_hours { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Maximum fee per day.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string max_eur_per_day { get; private set; }
|
||||
/// <summary>
|
||||
/// Maximum fee per day.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string max_eur_per_day { get; private set; }
|
||||
|
||||
/// <summary> Info about operator agb as HTML (i.g. text and hyperlink). </summary>
|
||||
[DataMember]
|
||||
public string operator_agb { get; private set; }
|
||||
/// <summary> Info about operator agb as HTML (i.g. text and hyperlink). </summary>
|
||||
[DataMember]
|
||||
public string operator_agb { get; private set; }
|
||||
|
||||
/// <summary> Text which informs users about GPS tracking if tracking is on. </summary>
|
||||
[DataMember]
|
||||
public string track_info { get; private set; }
|
||||
}
|
||||
/// <summary> Text which informs users about GPS tracking if tracking is on. </summary>
|
||||
[DataMember]
|
||||
public string track_info { get; private set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
|
||||
namespace TINK.Repository.Response
|
||||
{
|
||||
[DataContract]
|
||||
public class VersionindependentResponse
|
||||
{
|
||||
private CopriVersion _shareejson;
|
||||
[DataContract]
|
||||
public class VersionindependentResponse
|
||||
{
|
||||
private CopriVersion _shareejson;
|
||||
|
||||
/// <summary> Root element for versions 4.0 and older. </summary>
|
||||
[DataMember]
|
||||
public CopriVersion tinkjson { get; private set; }
|
||||
/// <summary> Root element for versions 4.0 and older. </summary>
|
||||
[DataMember]
|
||||
public CopriVersion tinkjson { get; private set; }
|
||||
|
||||
/// <summary> Root element from 4.1 and later. </summary>
|
||||
[DataMember]
|
||||
public CopriVersion shareejson
|
||||
{
|
||||
get => _shareejson ?? tinkjson;
|
||||
private set { _shareejson = value; }
|
||||
}
|
||||
}
|
||||
/// <summary> Root element from 4.1 and later. </summary>
|
||||
[DataMember]
|
||||
public CopriVersion shareejson
|
||||
{
|
||||
get => _shareejson ?? tinkjson;
|
||||
private set { _shareejson = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue