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

48 lines
1.6 KiB
C#
Raw Normal View History

2022-08-30 15:42:25 +02:00
using Serilog;
using TINK.Repository.Request;
2021-05-13 20:03:07 +02:00
namespace TINK.ViewModel.CopriWebView
{
public class RegisterPageViewModel
{
2022-01-04 18:59:16 +01:00
/// <summary> Holds the merchant id.</summary>
private string MerchantId { get; }
2021-05-13 20:03:07 +02:00
/// <summary> Holds the name of the host.</summary>
private string HostName { get; }
2022-08-30 15:42:25 +02:00
/// <summary>
/// Holds the current ui two letter ISO language name.
/// </summary>
private string UiIsoLanguageName { get; }
/// <param name="uiIsoLangugageName">Two letter ISO language name.</param>
2021-05-13 20:03:07 +02:00
public RegisterPageViewModel(
2022-01-04 18:59:16 +01:00
string merchantId,
2022-08-30 15:42:25 +02:00
string uiIsoLangugageName,
2021-05-13 20:03:07 +02:00
string hostName)
{
HostName = hostName;
2022-08-30 15:42:25 +02:00
UiIsoLanguageName = uiIsoLangugageName;
2022-01-04 18:59:16 +01:00
MerchantId = merchantId;
2022-08-30 15:42:25 +02:00
}
2022-01-04 18:59:16 +01:00
/// <summary>Get Uri of web view for creating account.</summary>
2022-08-30 15:42:25 +02:00
public string Uri
{
get
{
var sessionIdQueryElement = QueryBuilderHelper.GetSessionIdQueryElement("?", MerchantId);
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-08-30 15:42:25 +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
}
}