3.0.267 merged

This commit is contained in:
Oliver Hauff 2022-01-04 18:54:03 +01:00
parent b6fb6394db
commit 67999ef4ae
171 changed files with 6473 additions and 1093 deletions

View file

@ -15,6 +15,7 @@ using TINK.Model.Station.Operator;
using Xamarin.Forms;
using System.Linq;
using TINK.Model.MiniSurvey;
using TINK.Services.CopriApi;
namespace TINK.Model.Connector
{
@ -78,6 +79,14 @@ namespace TINK.Model.Connector
return stations;
}
/// <summary>
/// Gets general data from COPRI response.
/// </summary>
/// <param name="response">Response to get data from.</param>
/// <returns>General data object initialized form COPRI response.</returns>
public static GeneralData GetGeneralData(this ResponseBase response)
=> new GeneralData(response.merchant_message, response.GetCopriVersion());
/// <summary> Gets account object from login response.</summary>
/// <param name="merchantId">Needed to extract cookie from autorization response.</param>
/// <param name="loginResponse">Response to get session cookie and debug level from.</param>
@ -512,22 +521,28 @@ namespace TINK.Model.Connector
};
}
/// <summary> Creates a survey object from response.</summary>
/// <summary> Creates a booking finished object from response.</summary>
/// <param name="response">Response to create survey object from.</param>
public static MiniSurveyModel Create(this ReservationCancelReturnResponse response)
public static BookingFinishedModel Create(this DoReturnResponse response)
{
if (response?.user_miniquery == null)
var bookingFinished = new BookingFinishedModel
{
return new MiniSurveyModel();
Co2Saving = response?.co2saving
};
if (response?.user_miniquery == null)
{
return bookingFinished;
}
var miniquery = response.user_miniquery;
var survey = new MiniSurveyModel
{
Title = miniquery.title,
Subtitle = miniquery.subtitle,
Footer = miniquery.footer
};
bookingFinished.MiniSurvey = new MiniSurveyModel
{
Title = miniquery.title,
Subtitle = miniquery.subtitle,
Footer = miniquery.footer
};
foreach (var question in miniquery?.questions?.OrderBy(x => x.Key) ?? new Dictionary<string, MiniSurveyResponse.Question>().OrderBy(x => x.Key))
{
@ -538,12 +553,12 @@ namespace TINK.Model.Connector
continue;
}
survey.Questions.Add(
bookingFinished.MiniSurvey.Questions.Add(
question.Key,
new MiniSurveyModel.QuestionModel());
}
return survey;
return bookingFinished;
}
}
}