sharee.bike-App/SharedBusinessLogic/ViewModel/CopriWebView/RegisterPageViewModel.cs

48 lines
1.3 KiB
C#
Raw Normal View History

2022-08-30 15:42:25 +02:00
using Serilog;
2024-04-09 12:53:23 +02:00
using ShareeBike.Repository.Request;
2021-05-13 20:03:07 +02:00
2024-04-09 12:53:23 +02:00
namespace ShareeBike.ViewModel.CopriWebView
2021-05-13 20:03:07 +02:00
{
2022-09-06 16:08:19 +02:00
public class RegisterPageViewModel
{
/// <summary> Holds the merchant id.</summary>
private string MerchantId { get; }
2022-01-04 18:59:16 +01:00
2022-09-06 16:08:19 +02:00
/// <summary> Holds the name of the host.</summary>
private string HostName { get; }
2021-05-13 20:03:07 +02:00
2022-09-06 16:08:19 +02:00
/// <summary>
/// Holds the current ui two letter ISO language name.
/// </summary>
private string UiIsoLanguageName { get; }
2022-08-30 15:42:25 +02:00
2022-09-06 16:08:19 +02:00
/// <param name="uiIsoLangugageName">Two letter ISO language name.</param>
public RegisterPageViewModel(
string merchantId,
string uiIsoLangugageName,
string hostName)
{
HostName = hostName;
UiIsoLanguageName = uiIsoLangugageName;
MerchantId = merchantId;
}
2022-08-30 15:42:25 +02:00
2022-09-06 16:08:19 +02:00
/// <summary>Get Uri of web view for creating account.</summary>
public string Uri
{
get
{
var sessionIdQueryElement = QueryBuilderHelper.GetSessionIdQueryElement("?", MerchantId);
2022-08-30 15:42:25 +02:00
2022-09-06 16:08:19 +02:00
string GetUriText()
=> !string.IsNullOrEmpty(sessionIdQueryElement)
? $"https://{HostName}/app/Account/1.%20Kundendaten{sessionIdQueryElement}{QueryBuilderHelper.GetLanguageQueryElement("&", UiIsoLanguageName)}"
: $"https://{HostName}/app/Account/1.%20Kundendaten";
2021-05-13 20:03:07 +02:00
2022-09-06 16:08:19 +02:00
Log.ForContext<RegisterPageViewModel>().Debug($"Request to open url {GetUriText()} to get privacy info.");
return GetUriText();
}
}
}
2021-05-13 20:03:07 +02:00
}