Version 3.0.370

This commit is contained in:
Anja 2023-08-31 12:20:06 +02:00
parent f5cf9bb22f
commit bdb2dec1c1
233 changed files with 10252 additions and 6779 deletions

View file

@ -6,6 +6,7 @@ using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
using TINK.Model.Connector;
using TINK.Model.Device;
using TINK.Model.Services.CopriApi;
using TINK.MultilingualResources;
using TINK.Repository.Request;
using TINK.Repository.Response;
using TINK.Repository.Response.Stations;
@ -155,21 +156,21 @@ namespace TINK.Repository
public Task<ReservationBookingResponse> DoReserveAsync(string bikeId, Uri operatorUri)
{
throw new System.Exception("Reservierung im Offlinemodus nicht möglich!");
throw new System.Exception(AppResources.ErrorNoWeb);
}
public Task<ReservationCancelReturnResponse> DoCancelReservationAsync(string bikeId, Uri operatorUri)
{
throw new System.Exception("Abbrechen einer Reservierung im Offlinemodus nicht möglich!");
throw new System.Exception(AppResources.ErrorNoWeb);
}
public Task<ReservationBookingResponse> CalculateAuthKeysAsync(string bikeId, Uri operatorUri)
=> throw new System.Exception("Schlosssuche im Offlinemodus nicht möglich!");
=> throw new System.Exception(AppResources.ErrorNoWeb);
public Task<ResponseBase> StartReturningBike(
string bikeId,
Uri operatorUri)
=> throw new System.Exception("Benachrichtigung von start der Rückgabe im Offlinemodus nicht möglich!");
=> throw new System.Exception(AppResources.ErrorNoWeb);
public Task<ReservationBookingResponse> UpdateLockingStateAsync(
string bikeId,
@ -178,10 +179,10 @@ namespace TINK.Repository
LocationDto geolocation,
double batteryLevel,
IVersionInfo versionInfo)
=> throw new System.Exception("Aktualisierung des Schlossstatuses im Offlinemodus nicht möglich!");
=> throw new System.Exception(AppResources.ErrorNoWeb);
public Task<ReservationBookingResponse> DoBookAsync(Uri operatorUri, string bikeId, Guid guid, double batteryPercentage, LockingAction? nextAction = null)
=> throw new System.Exception("Buchung im Offlinemodus nicht möglich!");
=> throw new System.Exception(AppResources.ErrorNoWeb);
/// <summary> Books a bike and starts opening bike. </summary>
/// <param name="bikeId">Id of the bike to book.</param>
@ -190,7 +191,7 @@ namespace TINK.Repository
public Task<ReservationBookingResponse> BookAvailableAndStartOpeningAsync(
string bikeId,
Uri operatorUri)
=> throw new System.Exception("Buchung von verfügbarem Rad mit Start von Schlossöffnen ist im Offlinemodus nicht möglich!");
=> throw new System.Exception(AppResources.ErrorNoWeb);
/// <summary> Books a bike and starts opening bike. </summary>
/// <param name="bikeId">Id of the bike to book.</param>
@ -199,13 +200,13 @@ namespace TINK.Repository
public Task<ReservationBookingResponse> BookReservedAndStartOpeningAsync(
string bikeId,
Uri operatorUri)
=> throw new System.Exception("Buchung von reserviertem Rad mit Start von Schlossöffnen ist im Offlinemodus nicht möglich!");
=> throw new System.Exception(AppResources.ErrorNoWeb);
public Task<DoReturnResponse> DoReturn(
string bikeId,
LocationDto geolocation,
Uri operatorUri)
=> throw new System.Exception("Rückgabe im Offlinemodus nicht möglich!");
=> throw new System.Exception(AppResources.ErrorNoWeb);
/// <summary> Returns a bike and starts closing. </summary>
/// <param name="bikeId">Id of the bike to return.</param>
@ -214,24 +215,24 @@ namespace TINK.Repository
public Task<DoReturnResponse> ReturnAndStartClosingAsync(
string bikeId,
Uri operatorUri)
=> throw new System.Exception("Rückgabe mit Schloss schließen Befehl im Offlinemodus nicht möglich!");
=> throw new System.Exception(AppResources.ErrorNoWeb);
public Task<SubmitFeedbackResponse> DoSubmitFeedback(string bikeId, int? currentChargeBars, string message, bool isBikeBroken, Uri operatorUri) =>
throw new System.Exception("Übermittlung von Feedback im Offlinemodus nicht möglich!");
public Task<SubmitFeedbackResponse> DoSubmitFeedback(string bikeId, int? currentChargeBars, string message, bool isBikeBroken, Uri operatorUri)
=> throw new System.Exception(AppResources.ErrorNoWeb);
/// <summary> Submits mini survey to copri server. </summary>
/// <param name="answers">Collection of answers.</param>
public Task<ResponseBase> DoSubmitMiniSurvey(IDictionary<string, string> answers)
=> throw new System.Exception("Übermittlung von der Miniumfrage im Offlinemodus nicht möglich!");
=> throw new System.Exception(AppResources.ErrorNoWeb);
public Task<AuthorizationResponse> DoAuthorizationAsync(string p_strMailAddress, string p_strPassword, string p_strDeviceId)
{
throw new System.Exception("Anmelden im Offlinemodus nicht möglich!");
throw new System.Exception(AppResources.ErrorNoWeb);
}
public Task<AuthorizationoutResponse> DoAuthoutAsync()
{
throw new System.Exception("Abmelden im Offlinemodus nicht möglich!");
throw new System.Exception(AppResources.ErrorNoWeb);
}
public async Task<BikesAvailableResponse> GetBikesAvailableAsync()

View file

@ -1,4 +1,4 @@
using TINK.MultilingualResources;
using TINK.MultilingualResources;
namespace TINK.Repository.Exception
{
@ -7,7 +7,7 @@ namespace TINK.Repository.Exception
/// <summary>Constructs a authorization exceptions. </summary>
/// <param name="mail">Mail address to create a detailed error message.</param>
public InvalidAuthorizationResponseException(string mail, Response.ResponseBase response) :
base(string.Format(AppResources.ErrorMessageInvalidAuthorizationResponseException, mail), response)
base(string.Format(AppResources.ErrorAccountInvalidAuthorization, mail), response)
{
}

View file

@ -1,17 +1,11 @@
using TINK.MultilingualResources;
using TINK.MultilingualResources;
namespace TINK.Repository.Exception
{
public class WebConnectFailureException : CommunicationException
{
/// <summary>
/// Returns a hint to fix communication problem.
/// </summary>
public static string GetHintToPossibleExceptionsReasons
=> AppResources.ExceptionTextWebConnectFailureException;
/// <summary>
/// Constructs a communication exeption object.
/// Constructs a communication exception object.
/// </summary>
/// <param name="message"></param>
/// <param name="exception"></param>

View file

@ -128,13 +128,23 @@ namespace TINK.Repository.Request
/// <summary> Copri locking states</summary>
public enum lock_state
{
/// <summary> Request to backend to close lock in context of pausing ride.</summary>
locking,
/// <summary> Lock is closed.</summary>
locked,
/// <summary> Request to backend to close lock either in context of resuming ride or starting a rental.</summary>
unlocking,
/// <summary> Lock is open.</summary>
unlocked,
/// <summary> Lock is unknown state.</summary>
unspecific,
}
/// <summary> Holds lockation info.</summary>
/// <summary> Holds location info.</summary>
public class LocationDto
{
public double Latitude { get; private set; }

View file

@ -33,7 +33,7 @@ namespace TINK.Repository.Request
}
/// <summary> Gets the smart device parameters. </summary>
/// <returns>in a format which is urlencode invariant.</returns>
/// <returns>in a format which is url encode invariant.</returns>
public static string GetSmartDeviceParameters(this ISmartDevice smartDevice)
=> smartDevice != null
? $"{(!string.IsNullOrEmpty(smartDevice.Manufacturer) ? $"&user_device_manufacturer={WebUtility.UrlEncode(smartDevice.Manufacturer)}" : string.Empty)}" +
@ -42,5 +42,28 @@ namespace TINK.Repository.Request
$"{(!string.IsNullOrEmpty(smartDevice.VersionText) ? $"&user_device_version={WebUtility.UrlEncode(smartDevice.VersionText)}" : string.Empty)}" +
$"{(!string.IsNullOrEmpty(smartDevice.Identifier) ? $"&user_device_id={WebUtility.UrlEncode(smartDevice.Identifier)}" : string.Empty)}"
: string.Empty;
/// <summary>
/// Converts from one locking state enum to another.
/// </summary>
/// <param name="state">Locking state to convert.</param>
/// <returns>Target state.</returns>
public static lock_state? GetLockState(this Model.Bikes.BikeInfoNS.BluetoothLock.LockingState state)
{
switch (state)
{
case Model.Bikes.BikeInfoNS.BluetoothLock.LockingState.Open:
return lock_state.unlocked;
case Model.Bikes.BikeInfoNS.BluetoothLock.LockingState.Closed:
return lock_state.locked;
case Model.Bikes.BikeInfoNS.BluetoothLock.LockingState.UnknownFromHardwareError:
return lock_state.unspecific;
default:
return null;
}
}
}
}

View file

@ -40,7 +40,6 @@ namespace TINK.Repository.Response
[DataMember]
public string co2saving { get; private set; }
/// <summary>
/// Holds information about the returned bike.
/// </summary>

View file

@ -87,7 +87,7 @@ namespace TINK.Repository.Response
this ReservationBookingResponse bookingResponse,
string bikeId)
{
GetIsResponseOk(bookingResponse, string.Format(AppResources.ExceptionTextReservationBikeFailedGeneral, bikeId));
GetIsResponseOk(bookingResponse, string.Format(AppResources.ErrorReservingBike, bikeId));
if (BookingDeclinedException.IsBookingDeclined(bookingResponse.response_state, out BookingDeclinedException exception))
{
@ -99,7 +99,7 @@ namespace TINK.Repository.Response
if (bikeInfoRequestedOccupied == null)
{
throw new System.Exception(string.Format(
AppResources.ExceptionTextReservationBikeFailedUnavailalbe,
AppResources.ErrorReservingBikeUnavailalbe,
bikeId,
!string.IsNullOrWhiteSpace(bookingResponse?.response_text) ? $"\r\n{bookingResponse.response_text}" : string.Empty));
}
@ -115,14 +115,14 @@ namespace TINK.Repository.Response
this ReservationBookingResponse bookingResponse,
string bikeId)
{
GetIsResponseOk(bookingResponse, string.Format(AppResources.ExceptionTextRentingBikeFailedGeneral, bikeId));
GetIsResponseOk(bookingResponse, string.Format(AppResources.ErrorRentingBike, 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,
AppResources.ErrorRentingBikeUnavailalbe,
bikeId,
!string.IsNullOrWhiteSpace(bookingResponse?.response_text) ? $"\r\n{bookingResponse.response_text}" : string.Empty));
}
@ -149,7 +149,7 @@ namespace TINK.Repository.Response
if (response.response_state.Trim().ToUpper().StartsWith(RESPONSE_AUTHCOOKIE_EXPRIED.ToUpper()))
{
throw new AuthcookieNotDefinedException(
$"{textOfAction}\r\n{AppResources.ExceptionTextSessionExpired}",
$"{textOfAction}\r\n{AppResources.ErrorAccountInvalidAuthorization}",
response);
}