Locale change is a long running process. We will retrieve the current locale and state of last "set" request at the same time. If the last request is not finished, we will show the state rather than the actual locale name.
This commit is contained in:
Xiangzhi Sheng 2017-01-05 15:17:39 +08:00
Родитель 6072c24185
Коммит 9ab28838b6
49 изменённых файлов: 2577 добавлений и 61 удалений

Просмотреть файл

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.WindowsAzure.Storage.Table;
using Microsoft.WindowsAzure.Storage.Table;
namespace Microsoft.Azure.Devices.Applications.RemoteMonitoring.Common.Models
{
@ -22,7 +17,7 @@ namespace Microsoft.Azure.Devices.Applications.RemoteMonitoring.Common.Models
public string Iccid { get; set; }
public string ProviderName { get; set; }
public string LastSetLocaleServiceRequestId { get; set; }
}
public enum IccidRegistrationKey

Просмотреть файл

@ -2,22 +2,23 @@
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using System.Web.Script.Serialization;
using DCP_eUICC_V2;
using DeviceManagement.Infrustructure.Connectivity.Builders;
using DeviceManagement.Infrustructure.Connectivity.DeviceReconnect;
using DeviceManagement.Infrustructure.Connectivity.EricssonApiService;
using DeviceManagement.Infrustructure.Connectivity.EricssonSubscriptionService;
using DeviceManagement.Infrustructure.Connectivity.EricssonTrafficManagment;
using DeviceManagement.Infrustructure.Connectivity.Exceptions;
using DeviceManagement.Infrustructure.Connectivity.Models.Jasper;
using DeviceManagement.Infrustructure.Connectivity.Models.Other;
using DeviceManagement.Infrustructure.Connectivity.Models.Security;
using DeviceManagement.Infrustructure.Connectivity.Models.TerminalDevice;
using resource = DeviceManagement.Infrustructure.Connectivity.EricssonSubscriptionService.resource;
using System.Net.Http;
using System.Text;
using DeviceManagement.Infrustructure.Connectivity.Models.Jasper;
using System.Web.Script.Serialization;
using System.Net.Http.Headers;
using DeviceManagement.Infrustructure.Connectivity.Exceptions;
namespace DeviceManagement.Infrustructure.Connectivity.Clients
{
@ -99,7 +100,7 @@ namespace DeviceManagement.Infrustructure.Connectivity.Clients
}
}
catch (Exception exception)
catch
{
return terminal;
}
@ -284,6 +285,70 @@ namespace DeviceManagement.Infrustructure.Connectivity.Clients
return true;
}
/// <summary>
/// Get current locale name and available locale names
/// </summary>
/// <param name="iccid">ICCID</param>
/// <param name="availableLocaleNames">Available locale names</param>
/// <returns>Current locale name</returns>
public string GetLocale(string iccid, out IEnumerable<string> availableLocaleNames)
{
var euicc = GetEuicc(iccid);
string localeTableId = euicc.LocalizationTableId.ToString();
availableLocaleNames = new EuiccLocalesApiHandler().getLocales(localeTableId).Select(l => l.Name);
return euicc.LocaleName ?? string.Empty;
}
/// <summary>
/// Set locale
/// </summary>
/// <param name="iccid">ICCID</param>
/// <param name="localeName">Desired locale name</param>
/// <returns>True if succeeded, otherwise false</returns>
public string SetLocale(string iccid, string localeName)
{
var euicc = GetEuicc(iccid);
string localeTableId = euicc.LocalizationTableId.ToString();
var locales = new EuiccLocalesApiHandler().getLocales(localeTableId);
var locale = locales.First(l => l.Name == localeName);
var request = new EuiccLocalizationApiHandler().localize(euicc.EuiccId, locale.Id, localeTableId);
return request?.ServiceRequestId;
}
private EuiccV1 GetEuicc(string iccid)
{
var credential = _credentialProvider.Provide();
var loginCredentials = new LoginApiHandler(
credential.BaseUrl + "/dcpapi/rest",
"06000147", // Hard-coded companyId. To be replaced by the real ID provided by mobile operator
credential.Username,
credential.Password,
false);
var client = EricssonServiceBuilder.GetSubscriptionManagementClient(credential);
var response = client.QuerySimResource_v2(new QuerySimResource_v2
{
resource = new resource
{
id = iccid,
type = "icc"
}
});
var subscription = new SubscriptionApiHandler().get(response.simResource.First().imsi);
return new EuiccApiHandler().get(subscription.EuiccId);
}
public string GetLastSetLocaleServiceRequestState(string serviceRequestId)
{
return new ServiceRequestApiHandler().get(serviceRequestId)?.ServiceRequestState;
}
private bool isAnActiveState(subscriptionStatus status)
{
switch (status)

Просмотреть файл

@ -0,0 +1,137 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RestSharp;
using RestSharp.Authenticators;
using Newtonsoft.Json;
using System.Net;
namespace DCP_eUICC_V2
{
// Each action need to inherith
public abstract class ApiHandler
{
// Properties
protected static string userName = string.Empty;
protected static string passWord = string.Empty;
protected static string baseAddress = string.Empty;
protected static string companyId = string.Empty;
public static bool simulatedApiCalls = false;
protected static RestClient ApiRestClient;
protected IRestResponse response = null;
protected static LoginV1 LoginCredentials;
public Error Error = null;
protected static DateTime loginTokenExpirationTime = DateTime.MinValue.AddYears(2);
// Constructors
public ApiHandler() { }
public ApiHandler(string baseaddress, string companyid, string username, string password, bool simulateApiCalls) : this()
{
ApiHandler.baseAddress = baseaddress;
ApiHandler.companyId = companyid;
ApiHandler.userName = username;
ApiHandler.passWord = password;
ApiHandler.ApiRestClient = new RestClient(baseaddress);
ApiHandler.simulatedApiCalls = simulateApiCalls;
}
//Sends an API request and checks for errors
protected virtual bool send(RestRequest request)
{
// Make sure that we have logincredentials
if (ApiHandler.LoginCredentials == null)
ApiHandler.LoginCredentials = new LoginV1();
// Check if we are logged in, try to login or renew if needed - if failure then exit
LoginApiHandler myLoginApiHandler = new LoginApiHandler(ApiHandler.baseAddress, ApiHandler.companyId, ApiHandler.userName, ApiHandler.passWord, ApiHandler.simulatedApiCalls);
if (!myLoginApiHandler.isLoggedIn())
return this.isApiError();
else
return this.sendWithoutLogin(request);
}
//Sends an API request and checks for errors
protected virtual bool sendWithoutLogin(RestRequest request)
{
// Initialize default values prior to the API call
this.Error = null;
this.response = null;
// Add header parameters
if ((LoginCredentials != null) && (LoginCredentials.Token != null) && (LoginCredentials.Token.Length > 0))
request.AddHeader("X-Access-Token", ApiHandler.LoginCredentials.Token);
// Send an API request and check the response for success
//- if not successful then the property 'Error' contains info
try
{
//this.response = this.ApiRestClient.Execute(request);
this.response = ApiHandler.ApiRestClient.Execute(request);
}
catch (Exception ex)
{
this.Error = new Error() { Code = 0, HttpStatus = 0, Message = string.Format("Exception:\t{0}", ex.Message) };
return false;
}
return this.isApiError();
}
// Checks for API errors - provide error message in 'Error' property
protected bool isApiError()
{
// Check if we have a response value
if (this.response != null)
{
// Check for success or different kinds of errors
switch (this.response.ResponseStatus)
{
case ResponseStatus.Completed:
{
switch (this.response.StatusCode)
{
case HttpStatusCode.OK:
return true;
case HttpStatusCode.BadRequest:
case HttpStatusCode.InternalServerError:
case HttpStatusCode.ServiceUnavailable:
case HttpStatusCode.Unauthorized:
this.Error = new Error();
Error = JsonConvert.DeserializeObject<Error>(response.Content);
break;
default:
this.Error = new Error() { Code = 0, HttpStatus = (int)response.StatusCode, Message = System.Enum.GetName(typeof(System.Net.HttpStatusCode), response.StatusCode) };
break;
}
}
break;
case ResponseStatus.Aborted:
this.Error = new Error() { Code = 0, HttpStatus = 0, Message = "API call aborted" };
break;
case ResponseStatus.TimedOut:
this.Error = new Error() { Code = 0, HttpStatus = 0, Message = "API call timeout" };
break;
case ResponseStatus.Error:
case ResponseStatus.None:
default:
this.Error = new Error() { Code = 0, HttpStatus = 0, Message = "Connectivity fault" };
break;
}
}
else
this.Error = new Error() { Code = 0, HttpStatus = 0, Message = "No content" };
// Return the result value
return false;
}
// Maybe later re-define the standard 'ToString() method
public override string ToString()
{
return base.ToString();
}
}
}

Просмотреть файл

@ -0,0 +1,46 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using RestSharp;
namespace DCP_eUICC_V2
{
// Implements an API call
public class CompanyApiHandler : ApiHandler
{
// Api Action
public List<CompanyV1> getCompanies()
{
// Check if simulated environment or real API
if (ApiHandler.simulatedApiCalls)
{
// Simulated API call
List<CompanyV1> myList = new List<CompanyV1>();
myList.Add(new CompanyV1() { Id = "Id1", Name = "Company 1" });
myList.Add(new CompanyV1() { Id = "Id2", Name = "Company 2" });
myList.Add(new CompanyV1() { Id = "Id3", Name = "Company 3" });
return myList;
}
else
{
// Real API call
// Prepare the API request
RestRequest request = new RestRequest("/allowedCompanies", Method.GET);
request.AddHeader("Accept", "application/vnd.dcp-v1+json");
request.AddQueryParameter("companyId", ApiHandler.companyId);
// Call the API and take care of the response
if (this.send(request))
// Successful API request
return JsonConvert.DeserializeObject<List<CompanyV1>>(response.Content);
else
// API call failed, error info found in the Error object
return null;
}
}
}
}

Просмотреть файл

@ -0,0 +1,41 @@
using RestSharp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DCP_eUICC_V2
{
class EchoApiHandler : ApiHandler
{
// Constructor
public EchoApiHandler(string baseaddress) : base(baseaddress, string.Empty, string.Empty, string.Empty, ApiHandler.simulatedApiCalls) { }
// Api Action
public string echo(string echomessage)
{
// Check if simulated environment or real API
if (ApiHandler.simulatedApiCalls)
// Simulated API call
return echomessage;
else
{
// Real API call
// Prepare the API request
RestRequest request = new RestRequest("/monitor/echo/{msg}", Method.GET);
request.AddUrlSegment("msg", echomessage);
request.AddHeader("Accept", "text/plain");
// Call the API and take care of the response
if (this.sendWithoutLogin(request))
// Successful API request
return this.response.Content;
else
// API call failed, error info found in the Error object
return string.Empty;
}
}
}
}

Просмотреть файл

@ -0,0 +1,50 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using RestSharp;
namespace DCP_eUICC_V2
{
// Implements an API call
public class EuiccAgreementsApiHandler : ApiHandler
{
// Properties
//public EuiccAgreementList euiccAgreements = null; // Populated after a successful API call
// Api Action
public EuiccAgreementListV1 getAgreements()
{
// Check if simulated environment or real API
if (ApiHandler.simulatedApiCalls)
{
// Simulated API call
EuiccAgreementListV1 myList = new EuiccAgreementListV1();
myList.EuiccAgreements = new List<EuiccAgreementV1>();
myList.EuiccAgreements.Add(new EuiccAgreementV1() { FormSpecification = new FormSpecificationV1(), Id = "Id1", LeadOperator = "Telia", Name = "Telia", ProfileSpecifications = new List<ProfileSpecification>() });
myList.ServiceContracts = new List<ServiceContractV1>();
myList.ServiceContracts.Add(new ServiceContractV1() { Id = "Id1", Description = "ServiceContract01", Name = "SC 01", SubscriptionPackages = new List<SubscriptionPackageV1>() });
return myList;
}
else
{
// Real API call
// Prepare the API request
RestRequest request = new RestRequest("/euiccAgreements", Method.GET);
request.AddHeader("Accept", "application/vnd.dcp-v1+json");
request.AddQueryParameter("companyId", ApiHandler.companyId);
// Call the API and take care of the response
if (this.send(request))
// Successful API request
return JsonConvert.DeserializeObject<EuiccAgreementListV1>(response.Content);
else
// API call failed, error info found in the Error object
return null;
}
}
}
}

Просмотреть файл

@ -0,0 +1,77 @@
using System.Collections.Generic;
using Newtonsoft.Json;
using RestSharp;
namespace DCP_eUICC_V2
{
// Implements an API call that retrieves Login Credentials etc.
public class EuiccApiHandler : ApiHandler
{
// Mock data: Current locale setting
static public Dictionary<string, string> _localeBinds = new Dictionary<string, string>();
// Api Action
public EuiccV1 get(string eUICCid)
{
// Check if simulated environment or real API
if (ApiHandler.simulatedApiCalls)
{
// Simulated API call
EuiccV1 myEuicc = new EuiccV1()
{
EuiccId = "999870A0B0C0D0E0F100973000012678",
CompanyId = "97000002",
CompanyName = "Grundfos",
State = "LOCALIZED",
Label = null,
LocaleName = "France",
BootstrapIcc = "99987100973000012678",
EnabledIcc = "99987100973000012678",
BootstrapCompanyId = "97000002",
LocalizationTableId = 10040
};
List<EuiccSubscriptionV1> myEuiccSubscriptions = new List<EuiccSubscriptionV1>();
List<EuiccLocaleV1> myLocales = new List<EuiccLocaleV1>();
myLocales.Add(new EuiccLocaleV1() { Id = "FR01", Name = "France" });
myLocales.Add(new EuiccLocaleV1() { Id = "FR02", Name = "France2" });
myEuiccSubscriptions.Add(new EuiccSubscriptionV1()
{
Imsi = "100973000012678",
State = "ACTIVE",
OperatorId = "97000001",
OperatorName = "Telia",
Msisdn = "200973000012678",
Iccid = "99987100973000012678",
LocaleList = myLocales,
});
myEuicc.Subscriptions = myEuiccSubscriptions;
// Mock code: use mocked locale
string localeName;
if (_localeBinds.TryGetValue(eUICCid, out localeName))
{
myEuicc.LocaleName = localeName;
}
return myEuicc;
}
else
{
// Real API call
// Prepare the API request
RestRequest request = new RestRequest("/euiccs/{id}", Method.GET);
request.AddUrlSegment("id", eUICCid);
request.AddHeader("Accept", "application/vnd.dcp-v1+json");
// Call the API and take care of the response
if (this.send(request))
// Successful API request
return JsonConvert.DeserializeObject<EuiccV1>(this.response.Content);
else
// API call failed, error info found in the Error object
return null;
}
}
}
}

Просмотреть файл

@ -0,0 +1,49 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using RestSharp;
namespace DCP_eUICC_V2
{
// Implements an API call
public class EuiccLocalesApiHandler : ApiHandler
{
// Api Action
public List<EuiccLocaleV1> getLocales(string localizationTableId)
{
// Check if simulated environment or real API
if (ApiHandler.simulatedApiCalls)
{
// Simulated API call
List<EuiccLocaleV1> myLocaleList = new List<EuiccLocaleV1>();
myLocaleList.Add(new EuiccLocaleV1() { Id = "FR01", Name = "France" });
myLocaleList.Add(new EuiccLocaleV1() { Id = "FR02", Name = "France2" });
myLocaleList.Add(new EuiccLocaleV1() { Id = "SE01", Name = "Sweden" });
myLocaleList.Add(new EuiccLocaleV1() { Id = "DK01", Name = "Denmark" });
myLocaleList.Add(new EuiccLocaleV1() { Id = "CH01", Name = "China" });
myLocaleList.Add(new EuiccLocaleV1() { Id = "SP01", Name = "Spain" });
return myLocaleList;
}
else
{
// Real API call
// Prepare the API request
RestRequest request = new RestRequest("/locales", Method.GET);
request.AddHeader("Accept", "application/vnd.dcp-v1+json");
request.AddQueryParameter("localizationTableId", localizationTableId);
// Call the API and take care of the response
if (this.send(request))
// Successful API request
return JsonConvert.DeserializeObject<List<EuiccLocaleV1>>(response.Content);
else
// API call failed, error info found in the Error object
return null;
}
}
}
}

Просмотреть файл

@ -0,0 +1,57 @@
using System.Linq;
using Newtonsoft.Json;
using RestSharp;
namespace DCP_eUICC_V2
{
// Implements an API call that retrieves Login Credentials etc.
public class EuiccLocalizationApiHandler : ApiHandler
{
// Api Action
public ServiceRequestV1 localize(string eUICCid, string localeId, string localizationTableId)
{
// Check if simulated environment or real API
if (ApiHandler.simulatedApiCalls)
{
// Mock code: save locale setting
var locales = new EuiccLocalesApiHandler().getLocales(localizationTableId);
var localeName = locales.FirstOrDefault(l => l.Id == localeId)?.Name ?? string.Empty;
EuiccApiHandler._localeBinds[eUICCid] = localeName;
// Simulated API call
return new ServiceRequestV1()
{
CompanyId = "97000002",
CompanyName = "Grundfos",
CreatedBy = "user@grundfos.com",
LastUpdated = new Instant() { Nano = 779000000, EpochSecond = 1480599693 },
ServiceRequestId = "REQ0001",
ServiceRequestState = "In progress",
ServiceRequestType = string.Empty,
Size = 0,
TimeCreated = new Instant() { Nano = 779000000, EpochSecond = 1480599693 }
};
}
else
{
// Real API call
// Prepare the API request
RestRequest request = new RestRequest("/euiccs/{id}/localization", Method.POST);
request.AddUrlSegment("id", eUICCid);
request.AddQueryParameter("localeId", localeId);
request.AddQueryParameter("localizationTableId", localizationTableId);
request.AddQueryParameter("companyId", ApiHandler.companyId);
request.AddHeader("Accept", "application/vnd.dcp-v1+json");
// Call the API and take care of the response
if (this.send(request))
// Successful API request
return JsonConvert.DeserializeObject<ServiceRequestV1>(response.Content);
else
// API call failed, error info found in the Error object
return null;
}
}
}
}

Просмотреть файл

@ -0,0 +1,166 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using RestSharp;
using System.Threading.Tasks;
using System.Threading;
namespace DCP_eUICC_V2
{
// Implements an API call
public class LoginApiHandler : ApiHandler
{
// Some constants for the keepAliveTask
const int DefaultDelay = 1; // Seconds
const int MaxDelay = 5 * 60; // Seconds
const int TokenExpirationTimeMargin = 5; // Seconds
const int TokenReissueTimeMargin = TokenExpirationTimeMargin + 5; // Seconds
// Constructors
public LoginApiHandler(string baseaddress, string companyid, string username, string password, bool simulateApi) : base(baseaddress, companyid, username, password, simulateApi) { }
// This task tries to login to API and then regularly keep it alive
private Task KeepAliveTask()
{
// Set a start delay value
int backoffdelay = 1;
// Loop forever, i.e. until calling process goes out of scope
while (true)
{
// Try to login
if (!this.login())
{ // Login failed, back-off and wait and then try again
Console.WriteLine("Loging failed!");
// Calculate a delay value
if (backoffdelay < MaxDelay)
backoffdelay *= 2;
// Sleep (milliseconds)
Thread.Sleep(backoffdelay * 1000);
}
else
{ // Login succeeded
Console.WriteLine("Loging Succeded!");
// Reset the backoff delay value
backoffdelay = 1;
// Wait almost the timeout value
long myExpirationtime = 0;
if (ApiHandler.LoginCredentials.ExpirationTime != null)
{
// Calcualte a value to use
myExpirationtime = (long)ApiHandler.LoginCredentials.ExpirationTime - (1000 * TokenExpirationTimeMargin);
// Handle the case that 'Sleep' only takes 'int' and not long
while (myExpirationtime > 0)
{
// Check for valid 'int' value for the sleep function
if (myExpirationtime > int.MaxValue)
{
// Sleep (milliseconds)
Thread.Sleep(int.MaxValue);
// Subtract the delay value
myExpirationtime -= int.MaxValue;
}
else
{
// Sleep (milliseconds)
Thread.Sleep((int)myExpirationtime);
// We are done - Reset the delay value
myExpirationtime = 0;
}
}
}
}
}
}
// Checks if we are logged, in otherwise tries to login
public bool isLoggedIn()
{
// Keep track of the time now
DateTime timestampNow = DateTime.UtcNow;
// Check if we need to login, if so try to login
if (timestampNow > ApiHandler.loginTokenExpirationTime.AddSeconds(-TokenExpirationTimeMargin))
return this.login();
// Check if we need to reisse a new token
if (timestampNow > ApiHandler.loginTokenExpirationTime.AddSeconds(-TokenReissueTimeMargin))
return this.tokenReissue();
// Token is still valid, return
return true;
}
// Api Action
private bool login()
{
// Prepare the API request
RestRequest request = new RestRequest("/login", Method.POST);
request.RequestFormat = DataFormat.Json;
request.AddBody(new LoginSendBody() { email = ApiHandler.userName, password = ApiHandler.passWord });
request.AddHeader("Accept", "application/vnd.dcp-v1+json");
// Call the API and take care of the response
if (this.sendWithoutLogin(request))
{
// Successful API request
ApiHandler.LoginCredentials = JsonConvert.DeserializeObject<LoginV1>(response.Content);
ApiHandler.loginTokenExpirationTime = DateTime.UtcNow.AddMilliseconds((long)ApiHandler.LoginCredentials.ExpirationTime);
return true;
}
else
// API call failed, error info found in the Error object
return false;
}
// Api Action
private bool tokenReissue()
{
// Prepare the API request
RestRequest request = new RestRequest("/token-reissue", Method.POST);
request.AddHeader("Accept", "application/vnd.dcp-v1+json");
//request.RequestFormat = DataFormat.Json;
//request.AddBody(new LoginSendBody());
// Call the API and take care of the response
if (this.sendWithoutLogin(request))
{
// Successful API request
ApiHandler.LoginCredentials = JsonConvert.DeserializeObject<LoginV1>(response.Content);
ApiHandler.loginTokenExpirationTime = DateTime.UtcNow.AddMilliseconds((long)ApiHandler.LoginCredentials.ExpirationTime);
return true;
}
else
// API call failed, error info found in the Error object
return false;
}
// Class that models a POST BODY for login
private class LoginSendBody
{
// Properties
public string email;
public string password;
// Constructor
public LoginSendBody()
{
this.email = ApiHandler.userName;
this.password = ApiHandler.passWord;
}
}
}
}

Просмотреть файл

@ -0,0 +1,31 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using RestSharp;
namespace DCP_eUICC_V2
{
// Implements an API call that retrieves Login Credentials etc.
public class ServiceRequestApiHandler : ApiHandler
{
// Api Action
public ServiceRequestV1 get(string servicerequestid)
{
// Prepare the API request
RestRequest request = new RestRequest("/serviceRequests/{id}", Method.GET);
request.AddUrlSegment("id", servicerequestid);
request.AddHeader("Accept", "application/vnd.dcp-v1+json");
// Call the API and take care of the response
if (this.send(request))
// Successful API request
return JsonConvert.DeserializeObject<ServiceRequestV1>(this.response.Content);
else
// API call failed, error info found in the Error object
return null;
}
}
}

Просмотреть файл

@ -0,0 +1,69 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using RestSharp;
namespace DCP_eUICC_V2
{
// Implements an API call that retrieves Login Credentials etc.
public class SubscriptionApiHandler : ApiHandler
{
// Api Action
public SubscriptionV1 get(string imsi)
{
// Check if simulated environment or real API
if (ApiHandler.simulatedApiCalls)
// Simulated API call
return new SubscriptionV1()
{
Imsi = "100973000012678",
State = "ACTIVE",
OperatorId = "97000001",
OperatorName = "Telia",
Msisdn = "200973000012678",
Iccid = "99987100973000012678",
LocaleList = null,
Label = null,
CompanyId = "97000002",
CompanyName = "Grundfos",
Pin1 = "1234",
Pin2 = "4321",
Puk1 = "12345678",
Puk2 = "87654321",
Region = null,
PbrExitDate = null,
InstallationDate = new Instant() { Nano = 779000000, EpochSecond = 1480599693 },
Specification = "Specification 01",
SpecificationType = "PROFILE_SPECIFICATION",
ArpAssignMentDate = null,
ArpName = null,
EuiccId = "999870A0B0C0D0E0F100973000012678"
};
else
{
// Real API call
// Prepare the API request
RestRequest request = new RestRequest("/subscriptions/{id}", Method.GET);
request.AddUrlSegment("id", imsi);
request.AddHeader("Accept", "application/vnd.dcp-v1+json");
// Call the API and take care of the response
if (this.send(request))
// Successful API request
return JsonConvert.DeserializeObject<SubscriptionV1>(this.response.Content);
else
// API call failed, error info found in the Error object
return null;
}
}
}
}

Просмотреть файл

@ -0,0 +1,21 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace DCP_eUICC_V2
{
// Model Class Extensions
public partial class SubscriptionV1
{
public bool isEuicc()
{
if (ApiHandler.simulatedApiCalls)
return true;
else
return (this.EuiccId != null);
}
}
}

Просмотреть файл

@ -0,0 +1,217 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace DCP_eUICC_V2
{
/// <summary>
/// Model for subscription
/// </summary>
[DataContract]
//public class SubscriptionV1 {
public partial class SubscriptionV1
{
/// <summary>
/// Gets or Sets Imsi
/// </summary>
[DataMember(Name = "imsi", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "imsi")]
public string Imsi { get; set; }
/// <summary>
/// Gets or Sets State
/// </summary>
[DataMember(Name = "state", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "state")]
public string State { get; set; }
/// <summary>
/// Gets or Sets OperatorId
/// </summary>
[DataMember(Name = "operatorId", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "operatorId")]
public string OperatorId { get; set; }
/// <summary>
/// Gets or Sets OperatorName
/// </summary>
[DataMember(Name = "operatorName", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "operatorName")]
public string OperatorName { get; set; }
/// <summary>
/// Gets or Sets Msisdn
/// </summary>
[DataMember(Name = "msisdn", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "msisdn")]
public string Msisdn { get; set; }
/// <summary>
/// Gets or Sets Iccid
/// </summary>
[DataMember(Name = "iccid", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "iccid")]
public string Iccid { get; set; }
/// <summary>
/// Gets or Sets LocaleList
/// </summary>
[DataMember(Name = "localeList", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "localeList")]
public List<EuiccLocaleV1> LocaleList { get; set; }
/// <summary>
/// Gets or Sets Label
/// </summary>
[DataMember(Name = "label", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "label")]
public string Label { get; set; }
/// <summary>
/// Gets or Sets CompanyId
/// </summary>
[DataMember(Name = "companyId", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "companyId")]
public string CompanyId { get; set; }
/// <summary>
/// Gets or Sets CompanyName
/// </summary>
[DataMember(Name = "companyName", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "companyName")]
public string CompanyName { get; set; }
/// <summary>
/// Gets or Sets Pin1
/// </summary>
[DataMember(Name = "pin1", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "pin1")]
public string Pin1 { get; set; }
/// <summary>
/// Gets or Sets Pin2
/// </summary>
[DataMember(Name = "pin2", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "pin2")]
public string Pin2 { get; set; }
/// <summary>
/// Gets or Sets Puk1
/// </summary>
[DataMember(Name = "puk1", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "puk1")]
public string Puk1 { get; set; }
/// <summary>
/// Gets or Sets Puk2
/// </summary>
[DataMember(Name = "puk2", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "puk2")]
public string Puk2 { get; set; }
/// <summary>
/// Gets or Sets Region
/// </summary>
[DataMember(Name = "region", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "region")]
public string Region { get; set; }
/// <summary>
/// Gets or Sets PbrExitDate
/// </summary>
[DataMember(Name = "pbrExitDate", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "pbrExitDate")]
public Instant PbrExitDate { get; set; }
/// <summary>
/// Gets or Sets InstallationDate
/// </summary>
[DataMember(Name = "installationDate", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "installationDate")]
public Instant InstallationDate { get; set; }
/// <summary>
/// Gets or Sets Specification
/// </summary>
[DataMember(Name = "specification", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "specification")]
public string Specification { get; set; }
/// <summary>
/// Gets or Sets SpecificationType
/// </summary>
[DataMember(Name = "specificationType", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "specificationType")]
public string SpecificationType { get; set; }
/// <summary>
/// Gets or Sets ArpAssignMentDate
/// </summary>
[DataMember(Name = "arpAssignMentDate", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "arpAssignMentDate")]
public Instant ArpAssignMentDate { get; set; }
/// <summary>
/// Gets or Sets ArpName
/// </summary>
[DataMember(Name = "arpName", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "arpName")]
public string ArpName { get; set; }
/// <summary>
/// Gets or Sets EuiccId
/// </summary>
[DataMember(Name = "euiccId", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "euiccId")]
public string EuiccId { get; set; }
/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
var sb = new StringBuilder();
sb.Append("class SubscriptionV1 {\n");
sb.Append(" Imsi: ").Append(Imsi).Append("\n");
sb.Append(" State: ").Append(State).Append("\n");
sb.Append(" OperatorId: ").Append(OperatorId).Append("\n");
sb.Append(" OperatorName: ").Append(OperatorName).Append("\n");
sb.Append(" Msisdn: ").Append(Msisdn).Append("\n");
sb.Append(" Iccid: ").Append(Iccid).Append("\n");
sb.Append(" LocaleList: ").Append(LocaleList).Append("\n");
sb.Append(" Label: ").Append(Label).Append("\n");
sb.Append(" CompanyId: ").Append(CompanyId).Append("\n");
sb.Append(" CompanyName: ").Append(CompanyName).Append("\n");
sb.Append(" Pin1: ").Append(Pin1).Append("\n");
sb.Append(" Pin2: ").Append(Pin2).Append("\n");
sb.Append(" Puk1: ").Append(Puk1).Append("\n");
sb.Append(" Puk2: ").Append(Puk2).Append("\n");
sb.Append(" Region: ").Append(Region).Append("\n");
sb.Append(" PbrExitDate: ").Append(PbrExitDate).Append("\n");
sb.Append(" InstallationDate: ").Append(InstallationDate).Append("\n");
sb.Append(" Specification: ").Append(Specification).Append("\n");
sb.Append(" SpecificationType: ").Append(SpecificationType).Append("\n");
sb.Append(" ArpAssignMentDate: ").Append(ArpAssignMentDate).Append("\n");
sb.Append(" ArpName: ").Append(ArpName).Append("\n");
sb.Append(" EuiccId: ").Append(EuiccId).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Get the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
}
}

Просмотреть файл

@ -0,0 +1,52 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace DCP_eUICC_V2 {
/// <summary>
/// Company model
/// </summary>
[DataContract]
public class CompanyV1 {
/// <summary>
/// Gets or Sets Id
/// </summary>
[DataMember(Name="id", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "id")]
public string Id { get; set; }
/// <summary>
/// Gets or Sets Name
/// </summary>
[DataMember(Name="name", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }
/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class CompanyV1 {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" Name: ").Append(Name).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Get the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
}
}

Просмотреть файл

@ -0,0 +1,54 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace DCP_eUICC_V2 {
/// <summary>
/// Login request model
/// </summary>
[DataContract]
public class CredentialsV1 {
/// <summary>
/// User email
/// </summary>
/// <value>User email</value>
[DataMember(Name="email", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "email")]
public string Email { get; set; }
/// <summary>
/// User password
/// </summary>
/// <value>User password</value>
[DataMember(Name="password", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "password")]
public string Password { get; set; }
/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class CredentialsV1 {\n");
sb.Append(" Email: ").Append(Email).Append("\n");
sb.Append(" Password: ").Append(Password).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Get the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
}
}

Просмотреть файл

@ -0,0 +1,63 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace DCP_eUICC_V2 {
/// <summary>
/// Error response model
/// </summary>
[DataContract]
public class Error {
/// <summary>
/// Error code
/// </summary>
/// <value>Error code</value>
[DataMember(Name="code", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "code")]
public int? Code { get; set; }
/// <summary>
/// Response HTTP status
/// </summary>
/// <value>Response HTTP status</value>
[DataMember(Name="httpStatus", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "httpStatus")]
public int? HttpStatus { get; set; }
/// <summary>
/// Error message
/// </summary>
/// <value>Error message</value>
[DataMember(Name="message", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "message")]
public string Message { get; set; }
/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class Error {\n");
sb.Append(" Code: ").Append(Code).Append("\n");
sb.Append(" HttpStatus: ").Append(HttpStatus).Append("\n");
sb.Append(" Message: ").Append(Message).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Get the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
}
}

Просмотреть файл

@ -0,0 +1,52 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace DCP_eUICC_V2 {
/// <summary>
/// Euicc agreement list response model
/// </summary>
[DataContract]
public class EuiccAgreementListV1 {
/// <summary>
/// Gets or Sets EuiccAgreements
/// </summary>
[DataMember(Name="euiccAgreements", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "euiccAgreements")]
public List<EuiccAgreementV1> EuiccAgreements { get; set; }
/// <summary>
/// Gets or Sets ServiceContracts
/// </summary>
[DataMember(Name="serviceContracts", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "serviceContracts")]
public List<ServiceContractV1> ServiceContracts { get; set; }
/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class EuiccAgreementListV1 {\n");
sb.Append(" EuiccAgreements: ").Append(EuiccAgreements).Append("\n");
sb.Append(" ServiceContracts: ").Append(ServiceContracts).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Get the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
}
}

Просмотреть файл

@ -0,0 +1,76 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace DCP_eUICC_V2 {
/// <summary>
/// EuiccAgreement response model
/// </summary>
[DataContract]
public class EuiccAgreementV1 {
/// <summary>
/// Gets or Sets Id
/// </summary>
[DataMember(Name="id", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "id")]
public string Id { get; set; }
/// <summary>
/// Gets or Sets Name
/// </summary>
[DataMember(Name="name", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }
/// <summary>
/// Gets or Sets FormSpecification
/// </summary>
[DataMember(Name="formSpecification", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "formSpecification")]
public FormSpecificationV1 FormSpecification { get; set; }
/// <summary>
/// Gets or Sets LeadOperator
/// </summary>
[DataMember(Name="leadOperator", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "leadOperator")]
public string LeadOperator { get; set; }
/// <summary>
/// Gets or Sets ProfileSpecifications
/// </summary>
[DataMember(Name="profileSpecifications", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "profileSpecifications")]
public List<ProfileSpecification> ProfileSpecifications { get; set; }
/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class EuiccAgreementV1 {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" Name: ").Append(Name).Append("\n");
sb.Append(" FormSpecification: ").Append(FormSpecification).Append("\n");
sb.Append(" LeadOperator: ").Append(LeadOperator).Append("\n");
sb.Append(" ProfileSpecifications: ").Append(ProfileSpecifications).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Get the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
}
}

Просмотреть файл

@ -0,0 +1,52 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace DCP_eUICC_V2 {
/// <summary>
/// Euicc locale response model
/// </summary>
[DataContract]
public class EuiccLocaleV1 {
/// <summary>
/// Gets or Sets Id
/// </summary>
[DataMember(Name="id", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "id")]
public string Id { get; set; }
/// <summary>
/// Gets or Sets Name
/// </summary>
[DataMember(Name="name", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }
/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class EuiccLocaleV1 {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" Name: ").Append(Name).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Get the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
}
}

Просмотреть файл

@ -0,0 +1,92 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace DCP_eUICC_V2 {
/// <summary>
/// Model for minimal subscription information when fetching euicc information
/// </summary>
[DataContract]
public class EuiccSubscriptionV1 {
/// <summary>
/// Gets or Sets Imsi
/// </summary>
[DataMember(Name="imsi", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "imsi")]
public string Imsi { get; set; }
/// <summary>
/// Gets or Sets State
/// </summary>
[DataMember(Name="state", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "state")]
public string State { get; set; }
/// <summary>
/// Gets or Sets OperatorId
/// </summary>
[DataMember(Name="operatorId", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "operatorId")]
public string OperatorId { get; set; }
/// <summary>
/// Gets or Sets OperatorName
/// </summary>
[DataMember(Name="operatorName", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "operatorName")]
public string OperatorName { get; set; }
/// <summary>
/// Gets or Sets Msisdn
/// </summary>
[DataMember(Name="msisdn", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "msisdn")]
public string Msisdn { get; set; }
/// <summary>
/// Gets or Sets Iccid
/// </summary>
[DataMember(Name="iccid", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "iccid")]
public string Iccid { get; set; }
/// <summary>
/// Gets or Sets LocaleList
/// </summary>
[DataMember(Name="localeList", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "localeList")]
public List<EuiccLocaleV1> LocaleList { get; set; }
/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class EuiccSubscriptionV1 {\n");
sb.Append(" Imsi: ").Append(Imsi).Append("\n");
sb.Append(" State: ").Append(State).Append("\n");
sb.Append(" OperatorId: ").Append(OperatorId).Append("\n");
sb.Append(" OperatorName: ").Append(OperatorName).Append("\n");
sb.Append(" Msisdn: ").Append(Msisdn).Append("\n");
sb.Append(" Iccid: ").Append(Iccid).Append("\n");
sb.Append(" LocaleList: ").Append(LocaleList).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Get the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
}
}

Просмотреть файл

@ -0,0 +1,124 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace DCP_eUICC_V2 {
/// <summary>
/// Euicc response model
/// </summary>
[DataContract]
public class EuiccV1 {
/// <summary>
/// Gets or Sets Subscriptions
/// </summary>
[DataMember(Name="subscriptions", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "subscriptions")]
public List<EuiccSubscriptionV1> Subscriptions { get; set; }
/// <summary>
/// Gets or Sets EuiccId
/// </summary>
[DataMember(Name="euiccId", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "euiccId")]
public string EuiccId { get; set; }
/// <summary>
/// Gets or Sets CompanyId
/// </summary>
[DataMember(Name="companyId", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "companyId")]
public string CompanyId { get; set; }
/// <summary>
/// Gets or Sets CompanyName
/// </summary>
[DataMember(Name="companyName", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "companyName")]
public string CompanyName { get; set; }
/// <summary>
/// Gets or Sets State
/// </summary>
[DataMember(Name="state", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "state")]
public string State { get; set; }
/// <summary>
/// Gets or Sets Label
/// </summary>
[DataMember(Name="label", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "label")]
public string Label { get; set; }
/// <summary>
/// Gets or Sets LocaleName
/// </summary>
[DataMember(Name="localeName", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "localeName")]
public string LocaleName { get; set; }
/// <summary>
/// Gets or Sets BootstrapIcc
/// </summary>
[DataMember(Name="bootstrapIcc", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "bootstrapIcc")]
public string BootstrapIcc { get; set; }
/// <summary>
/// Gets or Sets EnabledIcc
/// </summary>
[DataMember(Name="enabledIcc", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "enabledIcc")]
public string EnabledIcc { get; set; }
/// <summary>
/// Gets or Sets BootstrapCompanyId
/// </summary>
[DataMember(Name="bootstrapCompanyId", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "bootstrapCompanyId")]
public string BootstrapCompanyId { get; set; }
/// <summary>
/// Gets or Sets LocalizationTableId
/// </summary>
[DataMember(Name="localizationTableId", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "localizationTableId")]
public long? LocalizationTableId { get; set; }
/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class EuiccV1 {\n");
sb.Append(" Subscriptions: ").Append(Subscriptions).Append("\n");
sb.Append(" EuiccId: ").Append(EuiccId).Append("\n");
sb.Append(" CompanyId: ").Append(CompanyId).Append("\n");
sb.Append(" CompanyName: ").Append(CompanyName).Append("\n");
sb.Append(" State: ").Append(State).Append("\n");
sb.Append(" Label: ").Append(Label).Append("\n");
sb.Append(" LocaleName: ").Append(LocaleName).Append("\n");
sb.Append(" BootstrapIcc: ").Append(BootstrapIcc).Append("\n");
sb.Append(" EnabledIcc: ").Append(EnabledIcc).Append("\n");
sb.Append(" BootstrapCompanyId: ").Append(BootstrapCompanyId).Append("\n");
sb.Append(" LocalizationTableId: ").Append(LocalizationTableId).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Get the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
}
}

Просмотреть файл

@ -0,0 +1,76 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace DCP_eUICC_V2 {
/// <summary>
/// FormSpecification response model
/// </summary>
[DataContract]
public class FormSpecificationV1 {
/// <summary>
/// Gets or Sets Description
/// </summary>
[DataMember(Name="description", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "description")]
public string Description { get; set; }
/// <summary>
/// Gets or Sets EarliestDeliveryDate
/// </summary>
[DataMember(Name="earliestDeliveryDate", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "earliestDeliveryDate")]
public int? EarliestDeliveryDate { get; set; }
/// <summary>
/// Gets or Sets LowOrderThreshold
/// </summary>
[DataMember(Name="lowOrderThreshold", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "lowOrderThreshold")]
public int? LowOrderThreshold { get; set; }
/// <summary>
/// Gets or Sets MinimumOrderVolume
/// </summary>
[DataMember(Name="minimumOrderVolume", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "minimumOrderVolume")]
public int? MinimumOrderVolume { get; set; }
/// <summary>
/// Gets or Sets OrderIncrement
/// </summary>
[DataMember(Name="orderIncrement", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "orderIncrement")]
public int? OrderIncrement { get; set; }
/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class FormSpecificationV1 {\n");
sb.Append(" Description: ").Append(Description).Append("\n");
sb.Append(" EarliestDeliveryDate: ").Append(EarliestDeliveryDate).Append("\n");
sb.Append(" LowOrderThreshold: ").Append(LowOrderThreshold).Append("\n");
sb.Append(" MinimumOrderVolume: ").Append(MinimumOrderVolume).Append("\n");
sb.Append(" OrderIncrement: ").Append(OrderIncrement).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Get the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
}
}

Просмотреть файл

@ -0,0 +1,52 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace DCP_eUICC_V2 {
/// <summary>
///
/// </summary>
[DataContract]
public class Instant {
/// <summary>
/// Gets or Sets Nano
/// </summary>
[DataMember(Name="nano", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "nano")]
public int? Nano { get; set; }
/// <summary>
/// Gets or Sets EpochSecond
/// </summary>
[DataMember(Name="epochSecond", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "epochSecond")]
public long? EpochSecond { get; set; }
/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class Instant {\n");
sb.Append(" Nano: ").Append(Nano).Append("\n");
sb.Append(" EpochSecond: ").Append(EpochSecond).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Get the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
}
}

Просмотреть файл

@ -0,0 +1,63 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace DCP_eUICC_V2 {
/// <summary>
/// eUICC label update request model
/// </summary>
[DataContract]
public class LabelUpdateV1 {
/// <summary>
/// Company id of the requester
/// </summary>
/// <value>Company id of the requester</value>
[DataMember(Name="companyId", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "companyId")]
public string CompanyId { get; set; }
/// <summary>
/// Updated label or omitted for clearing the label
/// </summary>
/// <value>Updated label or omitted for clearing the label</value>
[DataMember(Name="label", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "label")]
public string Label { get; set; }
/// <summary>
/// One or more 32 hexadecimal digit eUICC IDs
/// </summary>
/// <value>One or more 32 hexadecimal digit eUICC IDs</value>
[DataMember(Name="euiccIds", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "euiccIds")]
public List<string> EuiccIds { get; set; }
/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class LabelUpdateV1 {\n");
sb.Append(" CompanyId: ").Append(CompanyId).Append("\n");
sb.Append(" Label: ").Append(Label).Append("\n");
sb.Append(" EuiccIds: ").Append(EuiccIds).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Get the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
}
}

Просмотреть файл

@ -0,0 +1,68 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace DCP_eUICC_V2 {
/// <summary>
/// Login response model
/// </summary>
[DataContract]
public class LoginV1 {
/// <summary>
/// Gets or Sets Message
/// </summary>
[DataMember(Name="message", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "message")]
public string Message { get; set; }
/// <summary>
/// Gets or Sets ExpirationTime
/// </summary>
[DataMember(Name="expirationTime", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "expirationTime")]
public long? ExpirationTime { get; set; }
/// <summary>
/// Gets or Sets UserId
/// </summary>
[DataMember(Name="userId", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "userId")]
public string UserId { get; set; }
/// <summary>
/// Gets or Sets Token
/// </summary>
[DataMember(Name="token", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "token")]
public string Token { get; set; }
/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class LoginV1 {\n");
sb.Append(" Message: ").Append(Message).Append("\n");
sb.Append(" ExpirationTime: ").Append(ExpirationTime).Append("\n");
sb.Append(" UserId: ").Append(UserId).Append("\n");
sb.Append(" Token: ").Append(Token).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Get the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
}
}

Просмотреть файл

@ -0,0 +1,52 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace DCP_eUICC_V2 {
/// <summary>
/// ProfileSpecification response model
/// </summary>
[DataContract]
public class ProfileSpecification {
/// <summary>
/// Gets or Sets Id
/// </summary>
[DataMember(Name="id", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "id")]
public string Id { get; set; }
/// <summary>
/// Gets or Sets Description
/// </summary>
[DataMember(Name="description", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "description")]
public string Description { get; set; }
/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class ProfileSpecification {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" Description: ").Append(Description).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Get the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
}
}

Просмотреть файл

@ -0,0 +1,68 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace DCP_eUICC_V2 {
/// <summary>
/// ServiceContract response model
/// </summary>
[DataContract]
public class ServiceContractV1 {
/// <summary>
/// Gets or Sets Id
/// </summary>
[DataMember(Name="id", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "id")]
public string Id { get; set; }
/// <summary>
/// Gets or Sets Description
/// </summary>
[DataMember(Name="description", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "description")]
public string Description { get; set; }
/// <summary>
/// Gets or Sets Name
/// </summary>
[DataMember(Name="name", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }
/// <summary>
/// Gets or Sets SubscriptionPackages
/// </summary>
[DataMember(Name="subscriptionPackages", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "subscriptionPackages")]
public List<SubscriptionPackageV1> SubscriptionPackages { get; set; }
/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class ServiceContractV1 {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" Description: ").Append(Description).Append("\n");
sb.Append(" Name: ").Append(Name).Append("\n");
sb.Append(" SubscriptionPackages: ").Append(SubscriptionPackages).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Get the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
}
}

Просмотреть файл

@ -0,0 +1,61 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace DCP_eUICC_V2 {
/// <summary>
/// Service request response model
/// </summary>
[DataContract]
public class ServiceRequestResponseV1 {
/// <summary>
/// Gets or Sets ServiceRequestId
/// </summary>
[DataMember(Name="serviceRequestId", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "serviceRequestId")]
public string ServiceRequestId { get; set; }
/// <summary>
/// Gets or Sets Success
/// </summary>
[DataMember(Name="success", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "success")]
public bool? Success { get; set; }
/// <summary>
/// Error message in case of unsuccesfull service request
/// </summary>
/// <value>Error message in case of unsuccesfull service request</value>
[DataMember(Name="errorMessage", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "errorMessage")]
public string ErrorMessage { get; set; }
/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class ServiceRequestResponseV1 {\n");
sb.Append(" ServiceRequestId: ").Append(ServiceRequestId).Append("\n");
sb.Append(" Success: ").Append(Success).Append("\n");
sb.Append(" ErrorMessage: ").Append(ErrorMessage).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Get the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
}
}

Просмотреть файл

@ -0,0 +1,108 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace DCP_eUICC_V2 {
/// <summary>
/// ServiceRequest response model
/// </summary>
[DataContract]
public class ServiceRequestV1 {
/// <summary>
/// Gets or Sets ServiceRequestId
/// </summary>
[DataMember(Name="serviceRequestId", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "serviceRequestId")]
public string ServiceRequestId { get; set; }
/// <summary>
/// Gets or Sets ServiceRequestType
/// </summary>
[DataMember(Name="serviceRequestType", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "serviceRequestType")]
public string ServiceRequestType { get; set; }
/// <summary>
/// Gets or Sets ServiceRequestState
/// </summary>
[DataMember(Name="serviceRequestState", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "serviceRequestState")]
public string ServiceRequestState { get; set; }
/// <summary>
/// Gets or Sets CreatedBy
/// </summary>
[DataMember(Name="createdBy", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "createdBy")]
public string CreatedBy { get; set; }
/// <summary>
/// Gets or Sets CompanyId
/// </summary>
[DataMember(Name="companyId", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "companyId")]
public string CompanyId { get; set; }
/// <summary>
/// Gets or Sets CompanyName
/// </summary>
[DataMember(Name="companyName", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "companyName")]
public string CompanyName { get; set; }
/// <summary>
/// Gets or Sets TimeCreated
/// </summary>
[DataMember(Name="timeCreated", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "timeCreated")]
public Instant TimeCreated { get; set; }
/// <summary>
/// Gets or Sets LastUpdated
/// </summary>
[DataMember(Name="lastUpdated", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "lastUpdated")]
public Instant LastUpdated { get; set; }
/// <summary>
/// Gets or Sets Size
/// </summary>
[DataMember(Name="size", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "size")]
public int? Size { get; set; }
/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class ServiceRequestV1 {\n");
sb.Append(" ServiceRequestId: ").Append(ServiceRequestId).Append("\n");
sb.Append(" ServiceRequestType: ").Append(ServiceRequestType).Append("\n");
sb.Append(" ServiceRequestState: ").Append(ServiceRequestState).Append("\n");
sb.Append(" CreatedBy: ").Append(CreatedBy).Append("\n");
sb.Append(" CompanyId: ").Append(CompanyId).Append("\n");
sb.Append(" CompanyName: ").Append(CompanyName).Append("\n");
sb.Append(" TimeCreated: ").Append(TimeCreated).Append("\n");
sb.Append(" LastUpdated: ").Append(LastUpdated).Append("\n");
sb.Append(" Size: ").Append(Size).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Get the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
}
}

Просмотреть файл

@ -0,0 +1,60 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace DCP_eUICC_V2 {
/// <summary>
/// SubscriptionPackage response model
/// </summary>
[DataContract]
public class SubscriptionPackageV1 {
/// <summary>
/// Gets or Sets Id
/// </summary>
[DataMember(Name="id", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "id")]
public string Id { get; set; }
/// <summary>
/// Gets or Sets Description
/// </summary>
[DataMember(Name="description", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "description")]
public string Description { get; set; }
/// <summary>
/// Gets or Sets Name
/// </summary>
[DataMember(Name="name", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }
/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class SubscriptionPackageV1 {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" Description: ").Append(Description).Append("\n");
sb.Append(" Name: ").Append(Name).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Get the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
}
}

Просмотреть файл

@ -0,0 +1,68 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace DCP_eUICC_V2 {
/// <summary>
/// Token reissue response model
/// </summary>
[DataContract]
public class TokenReissueV1 {
/// <summary>
/// Gets or Sets Message
/// </summary>
[DataMember(Name="message", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "message")]
public string Message { get; set; }
/// <summary>
/// Gets or Sets ExpirationTime
/// </summary>
[DataMember(Name="expirationTime", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "expirationTime")]
public long? ExpirationTime { get; set; }
/// <summary>
/// Gets or Sets UserId
/// </summary>
[DataMember(Name="userId", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "userId")]
public string UserId { get; set; }
/// <summary>
/// Gets or Sets Token
/// </summary>
[DataMember(Name="token", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "token")]
public string Token { get; set; }
/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class TokenReissueV1 {\n");
sb.Append(" Message: ").Append(Message).Append("\n");
sb.Append(" ExpirationTime: ").Append(ExpirationTime).Append("\n");
sb.Append(" UserId: ").Append(UserId).Append("\n");
sb.Append(" Token: ").Append(Token).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Get the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
}
}

Просмотреть файл

@ -33,13 +33,44 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Compile Include="DCP_eUICC_V2\ApiHandlers\ApiHandler.cs" />
<Compile Include="DCP_eUICC_V2\ApiHandlers\CompanyApiHandler.cs" />
<Compile Include="DCP_eUICC_V2\ApiHandlers\EchoApiHandler.cs" />
<Compile Include="DCP_eUICC_V2\ApiHandlers\EuiccAgreementsApiHandler.cs" />
<Compile Include="DCP_eUICC_V2\ApiHandlers\EuiccApiHandler.cs" />
<Compile Include="DCP_eUICC_V2\ApiHandlers\EuiccLocalesApiHandler.cs" />
<Compile Include="DCP_eUICC_V2\ApiHandlers\EuiccLocalizationApiHandler.cs" />
<Compile Include="DCP_eUICC_V2\ApiHandlers\LoginApiHandler.cs" />
<Compile Include="DCP_eUICC_V2\ApiHandlers\ServiceRequestApiHandler.cs" />
<Compile Include="DCP_eUICC_V2\ApiHandlers\SubscriptionsApiHandler.cs" />
<Compile Include="Builders\EricssonServiceBuilder.cs" />
<Compile Include="Builders\JasperServiceBuilder.cs" />
<Compile Include="Clients\SubscriptionStatusFactory.cs" />
<Compile Include="Constants\JasperApiConstants.cs" />
<Compile Include="Exceptions\CellularConnectivityException.cs" />
<Compile Include="Argument.cs" />
<Compile Include="DCP_eUICC_V2\ModelExtensions\SubscriptionExtension.cs" />
<Compile Include="DCP_eUICC_V2\ModelExtensions\SubscriptionV1.cs" />
<Compile Include="DCP_eUICC_V2\Models\CompanyV1.cs" />
<Compile Include="DCP_eUICC_V2\Models\CredentialsV1.cs" />
<Compile Include="Models\Ericsson\EricssonCredentials.cs" />
<Compile Include="DCP_eUICC_V2\Models\Error.cs" />
<Compile Include="DCP_eUICC_V2\Models\EuiccAgreementListV1.cs" />
<Compile Include="DCP_eUICC_V2\Models\EuiccAgreementV1.cs" />
<Compile Include="DCP_eUICC_V2\Models\EuiccLocaleV1.cs" />
<Compile Include="DCP_eUICC_V2\Models\EuiccSubscriptionV1.cs" />
<Compile Include="DCP_eUICC_V2\Models\EuiccV1.cs" />
<Compile Include="DCP_eUICC_V2\Models\FormSpecificationV1.cs" />
<Compile Include="DCP_eUICC_V2\Models\Instant.cs" />
<Compile Include="DCP_eUICC_V2\Models\LabelUpdateV1.cs" />
<Compile Include="DCP_eUICC_V2\Models\LoginV1.cs" />
<Compile Include="DCP_eUICC_V2\Models\ProfileSpecification.cs" />
<Compile Include="DCP_eUICC_V2\Models\ServiceContractV1.cs" />
<Compile Include="DCP_eUICC_V2\Models\ServiceRequestResponseV1.cs" />
<Compile Include="DCP_eUICC_V2\Models\ServiceRequestV1.cs" />
<Compile Include="DCP_eUICC_V2\Models\SubscriptionPackageV1.cs" />
<Compile Include="DCP_eUICC_V2\Models\TokenReissueV1.cs" />
<Compile Include="Models\Other\LocalizationModel.cs" />
<Compile Include="Models\Other\SubscriptionPackage.cs" />
<Compile Include="Models\Constants\ApiRegistrationProviderTypes.cs" />
<Compile Include="Models\Jasper\JasperCredentials.cs" />
@ -477,6 +508,14 @@
</WebReferenceUrl>
</ItemGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="RestSharp, Version=105.2.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\RestSharp.105.2.3\lib\net451\RestSharp.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.EnterpriseServices" />

Просмотреть файл

@ -0,0 +1,11 @@
using System.Collections.Generic;
namespace DeviceManagement.Infrustructure.Connectivity.Models.Other
{
public class LocalizationModel
{
public string Context { get; set; }
public string CurrentLocale { get; set; }
public IEnumerable<string> AvailableLocales { get; set; }
}
}

Просмотреть файл

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using DeviceManagement.Infrustructure.Connectivity.Clients;
using DeviceManagement.Infrustructure.Connectivity.Models.Constants;
@ -260,6 +259,72 @@ namespace DeviceManagement.Infrustructure.Connectivity.Services
return isValid;
}
/// <summary>
/// Get current locale name and available locale names
/// </summary>
/// <param name="iccid">ICCID</param>
/// <param name="availableLocaleNames">Available locale names</param>
/// <returns>Current locale name</returns>
public string GetLocale(string iccid, out IEnumerable<string> availableLocaleNames)
{
var registrationProvider = _credentialProvider.Provide().ApiRegistrationProvider;
switch (registrationProvider)
{
case ApiRegistrationProviderTypes.Jasper:
throw new NotSupportedException();
case ApiRegistrationProviderTypes.Ericsson:
var client = new EricssonCellularClient(_credentialProvider);
return client.GetLocale(iccid, out availableLocaleNames);
default:
throw new IndexOutOfRangeException($"Could not find a service for '{registrationProvider.ToString()}' provider");
}
}
/// <summary>
/// Set locale
/// </summary>
/// <param name="iccid">ICCID</param>
/// <param name="localeName">Desired locale name</param>
/// <returns>True if succeeded, otherwise false</returns>
public string SetLocale(string iccid, string localeName)
{
var registrationProvider = _credentialProvider.Provide().ApiRegistrationProvider;
switch (registrationProvider)
{
case ApiRegistrationProviderTypes.Jasper:
throw new NotSupportedException();
case ApiRegistrationProviderTypes.Ericsson:
var client = new EricssonCellularClient(_credentialProvider);
return client.SetLocale(iccid, localeName);
default:
throw new IndexOutOfRangeException($"Could not find a service for '{registrationProvider.ToString()}' provider");
}
}
public string GetLastSetLocaleServiceRequestState(string serviceRequestId)
{
var registrationProvider = _credentialProvider.Provide().ApiRegistrationProvider;
switch (registrationProvider)
{
case ApiRegistrationProviderTypes.Jasper:
throw new NotSupportedException();
case ApiRegistrationProviderTypes.Ericsson:
var client = new EricssonCellularClient(_credentialProvider);
return client.GetLastSetLocaleServiceRequestState(serviceRequestId);
default:
throw new IndexOutOfRangeException($"Could not find a service for '{registrationProvider.ToString()}' provider");
}
}
private List<SimState> getAvailableSimStates()
{
return new List<SimState>()
@ -293,6 +358,5 @@ namespace DeviceManagement.Infrustructure.Connectivity.Services
}
};
}
}
}

Просмотреть файл

@ -21,5 +21,8 @@ namespace DeviceManagement.Infrustructure.Connectivity.Services
bool UpdateSubscriptionPackage(string iccid, string updatedPackage);
bool ReconnectTerminal(string iccid);
Task<bool> SendSms(string iccid, string msisdn, string smsText);
string GetLocale(string iccid, out IEnumerable<string> availableLocaleNames);
string SetLocale(string iccid, string localeName);
string GetLastSetLocaleServiceRequestState(string serviceRequestId);
}
}

Просмотреть файл

@ -1,3 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net451" />
<package id="RestSharp" version="105.2.3" targetFramework="net451" />
</packages>

Просмотреть файл

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;
using DeviceManagement.Infrustructure.Connectivity.Models.TerminalDevice;
using Microsoft.Azure.Devices.Applications.RemoteMonitoring.Common.Models;
@ -15,5 +11,7 @@ namespace Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Infr
bool DeleteIccidTableEntity(IccidTableEntity iccidTableEntity);
bool DeleteAllIccids();
IList<Iccid> GetIccids();
string GetLastSetLocaleServiceRequestId(string iccid);
void SetLastSetLocaleServiceRequestId(string iccid, string serviceRequestId);
}
}

Просмотреть файл

@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DeviceManagement.Infrustructure.Connectivity.Models.TerminalDevice;
using Microsoft.Azure.Devices.Applications.RemoteMonitoring.Common.Configurations;
using Microsoft.Azure.Devices.Applications.RemoteMonitoring.Common.Helpers;
@ -12,7 +10,7 @@ using Microsoft.WindowsAzure.Storage.Table;
namespace Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Infrastructure.Repository
{
public class IccidRepository: IIccidRepository
public class IccidRepository : IIccidRepository
{
private const string ICCID_TABLE_NAME = "IccidTable";
private readonly IAzureTableStorageClient _azureTableStorageClient;
@ -78,5 +76,30 @@ namespace Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Infr
var queryResponse = _azureTableStorageClient.ExecuteQuery(query);
return (from iccid in queryResponse select new Iccid(iccid.Iccid)).ToList();
}
public string GetLastSetLocaleServiceRequestId(string iccid)
{
return Find(iccid)?.LastSetLocaleServiceRequestId;
}
public void SetLastSetLocaleServiceRequestId(string iccid, string serviceRequestId)
{
var entity = Find(iccid);
if (entity != null)
{
entity.LastSetLocaleServiceRequestId = serviceRequestId;
_azureTableStorageClient.Execute(TableOperation.InsertOrReplace(entity));
}
}
private IccidTableEntity Find(string iccid)
{
var query = new TableQuery<IccidTableEntity>().Where(TableQuery.CombineFilters(
TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, IccidRegistrationKey.Default.ToString()),
TableOperators.And,
TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.Equal, iccid)));
return _azureTableStorageClient.ExecuteQuery(query).SingleOrDefault();
}
}
}

Просмотреть файл

@ -1810,4 +1810,12 @@
<data name="ApiRegistrationInfoTextEricsson" xml:space="preserve">
<value>To activate the integration to view and control your Ericsson IoT account devices through IoT Suite please enter the following credentials:</value>
</data>
<data name="CellularInformationLocaleLabel" xml:space="preserve">
<value>Locale</value>
<comment>Label</comment>
</data>
<data name="CellularInformationNotLocaledOption" xml:space="preserve">
<value>-- select a locale --</value>
<comment>Dropdown label.</comment>
</data>
</root>

Просмотреть файл

@ -637,6 +637,24 @@ namespace GlobalResources {
}
}
/// <summary>
/// Looks up a localized string similar to Locale.
/// </summary>
public static string CellularInformationLocaleLabel {
get {
return ResourceManager.GetString("CellularInformationLocaleLabel", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to -- select a locale --.
/// </summary>
public static string CellularInformationNotLocaledOption {
get {
return ResourceManager.GetString("CellularInformationNotLocaledOption", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Rate Plan.
/// </summary>

Просмотреть файл

@ -2,11 +2,8 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web.Mvc;
using DeviceManagement.Infrustructure.Connectivity;
using DeviceManagement.Infrustructure.Connectivity.Exceptions;
using DeviceManagement.Infrustructure.Connectivity.Models.TerminalDevice;
using GlobalResources;
@ -21,7 +18,6 @@ using Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Infrastr
using Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Web.Helpers;
using Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Web.Models;
using Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Web.Security;
using Newtonsoft.Json;
namespace Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Web.Controllers
{
@ -398,7 +394,7 @@ namespace Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Web.
private async Task<CellularActionUpdateResponseModel> processActionRequests(DeviceModel device, List<CellularActionModel> actions)
{
var iccid = device.SystemProperties.ICCID;
var terminal = _cellularExtensions.GetSingleTerminalDetails(new Iccid(iccid));
var terminal = _cellularExtensions.GetSingleTerminalDetails(new Iccid(iccid));
var completedActions = new List<CellularActionModel>();
var failedActions = new List<CellularActionModel>();
var exceptions = new List<ErrorModel>();
@ -410,30 +406,28 @@ namespace Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Web.
switch (action.Type)
{
case CellularActionType.UpdateStatus:
{
success = _cellularExtensions.UpdateSimState(iccid, action.Value);
break;
}
case CellularActionType.UpdateSubscriptionPackage:
{
success = _cellularExtensions.UpdateSubscriptionPackage(iccid, action.Value);
break;
}
case CellularActionType.UpdateLocale:
success = _cellularExtensions.SetLocale(iccid, action.Value);
break;
case CellularActionType.ReconnectDevice:
{
success = _cellularExtensions.ReconnectDevice(iccid);
break;
}
case CellularActionType.SendSms:
{
success = await _cellularExtensions.SendSms(iccid, action.Value);
break;
}
default:
{
failedActions.Add(action);
break;
}
}
}
catch (Exception exception)
@ -456,20 +450,46 @@ namespace Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Web.
FailedActions = failedActions,
Exceptions = exceptions
};
}
private SimInformationViewModel generateSimInformationViewModel(string iccid, CellularActionUpdateResponseModel actionResponstModel = null)
{
var viewModel = new SimInformationViewModel();
viewModel.TerminalDevice = _cellularExtensions.GetSingleTerminalDetails(new Iccid(iccid));
viewModel.SessionInfo = _cellularExtensions.GetSingleSessionInfo(new Iccid(iccid)).LastOrDefault() ??
new SessionInfo();
viewModel.SessionInfo = _cellularExtensions.GetSingleSessionInfo(new Iccid(iccid)).LastOrDefault() ?? new SessionInfo();
var apiProviderDetails = _apiRegistrationRepository.RecieveDetails();
viewModel.ApiRegistrationProvider = Convert.ToString(apiProviderDetails.ApiRegistrationProvider);
viewModel.AvailableSimStates = _cellularExtensions.GetValidTargetSimStates(iccid, viewModel.TerminalDevice.Status);
viewModel.AvailableSubscriptionPackages = _cellularExtensions.GetAvailableSubscriptionPackages(iccid, viewModel.TerminalDevice.RatePlan);
try
{
viewModel.AvailableSubscriptionPackages = _cellularExtensions.GetAvailableSubscriptionPackages(iccid, viewModel.TerminalDevice.RatePlan);
}
catch
{
// [WORKAROUND] GetAvailableSubscriptionPackages does not work
viewModel.AvailableSubscriptionPackages = new List<DeviceManagement.Infrustructure.Connectivity.Models.Other.SubscriptionPackage>();
}
viewModel.CellularActionUpdateResponse = actionResponstModel;
try
{
IEnumerable<string> availableLocaleNames;
string lastServiceRequestState;
string currentLocaleName = _cellularExtensions.GetLocale(iccid, out availableLocaleNames);
viewModel.CurrentLocaleName = currentLocaleName;
viewModel.AvailableLocaleNames = availableLocaleNames;
}
catch
{
viewModel.CurrentLocaleName = string.Empty;
viewModel.AvailableLocaleNames = new List<string>();
}
viewModel.LastServiceRequestState = _cellularExtensions.GetLastSetLocaleServiceRequestState(iccid);
return viewModel;
}
}

Просмотреть файл

@ -8,7 +8,6 @@ using DeviceManagement.Infrustructure.Connectivity.Models.TerminalDevice;
using DeviceManagement.Infrustructure.Connectivity.Services;
using Microsoft.Azure.Devices.Applications.RemoteMonitoring.Common.Models;
using Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Infrastructure.Repository;
using Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Web.Models;
namespace Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Web.Helpers
{
@ -21,7 +20,7 @@ namespace Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Web.
{
if (cellularService == null)
{
throw new ArgumentNullException(nameof(cellularService));
throw new ArgumentNullException(nameof(cellularService));
}
_cellularService = cellularService;
_iccidRepository = iccidRepository;
@ -44,8 +43,8 @@ namespace Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Web.
public IEnumerable<string> GetListOfAvailableIccids(IList<DeviceModel> devices, string providerName)
{
var fullIccidList = providerName == ApiRegistrationProviderTypes.Ericsson ?
_iccidRepository.GetIccids().Select(e => e.Id) :
var fullIccidList = providerName == ApiRegistrationProviderTypes.Ericsson ?
_iccidRepository.GetIccids().Select(e => e.Id) :
_cellularService.GetTerminals().Select(i => i.Id);
var usedIccidList = GetUsedIccidList(devices).Select(i => i.Id);
@ -114,10 +113,44 @@ namespace Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Web.
return await _cellularService.SendSms(iccid, terminal.Msisdn.Id, smsText);
}
public string GetLocale(string iccid, out IEnumerable<string> availableLocaleNames)
{
return _cellularService.GetLocale(iccid, out availableLocaleNames);
}
public bool SetLocale(string iccid, string localeName)
{
var serviceRequestId = _cellularService.SetLocale(iccid, localeName);
if (!string.IsNullOrWhiteSpace(serviceRequestId))
{
_iccidRepository.SetLastSetLocaleServiceRequestId(iccid, serviceRequestId);
return true;
}
else
{
return false;
}
}
public string GetLastSetLocaleServiceRequestState(string iccid)
{
var serviceRequestId = _iccidRepository.GetLastSetLocaleServiceRequestId(iccid);
if (!string.IsNullOrWhiteSpace(serviceRequestId))
{
return _cellularService.GetLastSetLocaleServiceRequestState(serviceRequestId);
}
else
{
return null;
}
}
private IEnumerable<Iccid> GetUsedIccidList(IList<DeviceModel> devices)
{
return (from device in devices
where device.DeviceProperties?.DeviceID != null &&
where device.DeviceProperties?.DeviceID != null &&
device.SystemProperties?.ICCID != null
select new Iccid(device.SystemProperties.ICCID)
).ToList();

Просмотреть файл

@ -3,7 +3,6 @@ using System.Threading.Tasks;
using DeviceManagement.Infrustructure.Connectivity.Models.Other;
using DeviceManagement.Infrustructure.Connectivity.Models.TerminalDevice;
using Microsoft.Azure.Devices.Applications.RemoteMonitoring.Common.Models;
using Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Web.Models;
namespace Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Web.Helpers
{
@ -23,5 +22,8 @@ namespace Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Web.
bool UpdateSubscriptionPackage(string iccid, string updatedPackage);
bool ReconnectDevice(string iccid);
Task<bool> SendSms(string iccid, string smsText);
string GetLocale(string iccid, out IEnumerable<string> availableLocaleNames);
bool SetLocale(string iccid, string localeName);
string GetLastSetLocaleServiceRequestState(string iccid);
}
}

Просмотреть файл

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Web.Models
{
@ -15,9 +12,10 @@ namespace Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Web.
public enum CellularActionType
{
UpdateStatus=1,
UpdateSubscriptionPackage=2,
ReconnectDevice=3,
SendSms=4
UpdateStatus = 1,
UpdateSubscriptionPackage = 2,
ReconnectDevice = 3,
SendSms = 4,
UpdateLocale = 5
}
}

Просмотреть файл

@ -1,7 +1,6 @@
using System.Collections.Generic;
using DeviceManagement.Infrustructure.Connectivity.Models.Other;
using DeviceManagement.Infrustructure.Connectivity.Models.TerminalDevice;
using Microsoft.Azure.Devices.Applications.RemoteMonitoring.Common.Models;
namespace Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Web.Models
{
@ -10,9 +9,12 @@ namespace Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Web.
public string DeviceId { get; set; }
public Terminal TerminalDevice { get; set; }
public SessionInfo SessionInfo { get; set; }
public string ApiRegistrationProvider { get; set;}
public string ApiRegistrationProvider { get; set; }
public List<SimState> AvailableSimStates { get; set; }
public List<SubscriptionPackage> AvailableSubscriptionPackages { get; set; }
public CellularActionUpdateResponseModel CellularActionUpdateResponse { get; set; }
public string CurrentLocaleName { get; set; }
public IEnumerable<string> AvailableLocaleNames { get; set; }
public string LastServiceRequestState { get; set; }
}
}

Просмотреть файл

@ -14,7 +14,8 @@ IoTApp.createModule("IoTApp.CellularActions", function () {
reconnectDevice: "ReconnectDevice",
sendSms: "SendSms",
updateStatus: "UpdateStatus",
updateSubscriptionPackage: "UpdateSubscriptionPackage"
updateSubscriptionPackage: "UpdateSubscriptionPackage",
updateLocale: "UpdateLocale"
}
self.htmlElementIds = {
reconnectDevice: "#reconnectDevice",

Просмотреть файл

@ -14,6 +14,7 @@ IoTApp.createModule("IoTApp.CellularInformation", function () {
self.htmlElementIds = {
simStateSelect: "#simStateSelect",
subscriptionPackageSelect: "#subscriptionPackageSelect",
localeSelect: "#localeSelect",
saveCellularInformation: "#saveCellularInformation",
editCellularInformation: "#editCellularInformation",
cancelEditCellularInformation: "#cancelEditCellularInformation",
@ -29,6 +30,7 @@ IoTApp.createModule("IoTApp.CellularInformation", function () {
var resetInputsToInitial = function() {
$(self.htmlElementIds.simStateSelect).val(self.initialCellActionSettings.simStatus);
$(self.htmlElementIds.subscriptionPackageSelect).val(self.initialCellActionSettings.subscriptionPackage);
$(self.htmlElementIds.localeSelect).val(self.initialCellActionSettings.locale);
}
/**
@ -40,6 +42,7 @@ IoTApp.createModule("IoTApp.CellularInformation", function () {
if (disabled) {
$(self.htmlElementIds.simStateSelect).attr("disabled", "disabled");
$(self.htmlElementIds.subscriptionPackageSelect).attr("disabled", "disabled");
$(self.htmlElementIds.localeSelect).attr("disabled", "disabled");
$(self.htmlElementIds.saveCellularInformation).hide();
$(self.htmlElementIds.cancelEditCellularInformation).hide();
$(self.htmlElementIds.editCellularInformation).show();
@ -47,6 +50,7 @@ IoTApp.createModule("IoTApp.CellularInformation", function () {
} else {
$(self.htmlElementIds.simStateSelect).removeAttr("disabled");
$(self.htmlElementIds.subscriptionPackageSelect).removeAttr("disabled");
$(self.htmlElementIds.localeSelect).removeAttr("disabled");
$(self.htmlElementIds.saveCellularInformation).show();
$(self.htmlElementIds.cancelEditCellularInformation).show();
$(self.htmlElementIds.editCellularInformation).hide();
@ -62,10 +66,12 @@ IoTApp.createModule("IoTApp.CellularInformation", function () {
var retrieveActionFormValues = function () {
var simStatus = $(self.htmlElementIds.simStateSelect).val();
var subscriptionPackage = $(self.htmlElementIds.subscriptionPackageSelect).val();
debugger
var locale = $(self.htmlElementIds.localeSelect).val();
return {
subscriptionPackage: subscriptionPackage,
simStatus: simStatus
simStatus: simStatus,
locale: locale
}
}
@ -93,6 +99,13 @@ IoTApp.createModule("IoTApp.CellularInformation", function () {
value: currentFormValues.simStatus
});
}
if (currentFormValues.locale != self.initialCellActionSettings.locale) {
cellularCellularActionRequestModel.cellularActions.push({
type: self.actionTypes.updateLocale,
previousValue: self.initialCellActionSettings.locale,
value: currentFormValues.locale
});
}
cellularCellularActionRequestModel.deviceId = self.deviceId;
return cellularCellularActionRequestModel;
}

Просмотреть файл

@ -27,6 +27,25 @@
}
</select>
<p>
<strong>@Strings.CellularInformationLocaleLabel</strong>
</p>
<select id="localeSelect" class="form_input select_box space_below" disabled>
@if (Model.LastServiceRequestState != null) // ToDo: Show actual locale valee for "Completed" state
{
<option disabled selected value>@Model.LastServiceRequestState</option>
}
else if (!Model.AvailableLocaleNames.Contains(Model.CurrentLocaleName))
{
<option disabled selected value>@Strings.CellularInformationNotLocaledOption</option>
}
@foreach (var localeName in Model.AvailableLocaleNames)
{
<option value="@localeName" selected=@(localeName == Model.CurrentLocaleName)>@localeName</option>
}
</select>
<div id="updateCellularInformationResults">
@if (Model.CellularActionUpdateResponse != null)
{