public RemoteParty(CountryCode CountryCode, Party_Id PartyId, Roles Role, BusinessDetails BusinessDetails, AccessToken RemoteAccessToken, URL RemoteVersionsURL, IEnumerable <Version_Id> RemoteVersionIds = null, Version_Id?SelectedVersionId = null, RemoteAccessStatus?RemoteStatus = RemoteAccessStatus.ONLINE, PartyStatus Status = PartyStatus.ENABLED, DateTime?LastUpdated = null) : this(CountryCode, PartyId, Role, BusinessDetails, null, new RemoteAccessInfo[] { new RemoteAccessInfo( RemoteAccessToken, RemoteVersionsURL, RemoteVersionIds, SelectedVersionId, RemoteStatus ) }, Status, LastUpdated) { }
public RemoteParty(CountryCode CountryCode, Party_Id PartyId, Roles Role, BusinessDetails BusinessDetails, IEnumerable <AccessInfo2> AccessInfos, IEnumerable <RemoteAccessInfo> RemoteAccessInfos, PartyStatus Status = PartyStatus.ENABLED, DateTime?LastUpdated = null) { this.Id = RemoteParty_Id.Parse( String.Concat(CountryCode.ToString(), "-", PartyId.ToString(), "_", Role.ToString())); this.CountryCode = CountryCode; this.PartyId = PartyId; this.Role = Role; this.BusinessDetails = BusinessDetails; this.Status = Status; this.LastUpdated = LastUpdated ?? DateTime.UtcNow; this._AccessInfo = AccessInfos.IsNeitherNullNorEmpty() ? new List <AccessInfo2> (AccessInfos) : new List <AccessInfo2>(); this._RemoteAccessInfos = RemoteAccessInfos.IsNeitherNullNorEmpty() ? new List <RemoteAccessInfo>(RemoteAccessInfos) : new List <RemoteAccessInfo>(); CalcSHA256Hash(); }
/// <summary> /// Create a new credentials role. /// </summary> /// <param name="CountryCode">ISO-3166 alpha-2 country code of the country this party is operating in.</param> /// <param name="PartyId">CPO, eMSP (or other role) ID of this party (following the ISO-15118 standard).</param> /// <param name="Role">The type of the role.</param> /// <param name="BusinessDetails">Business details of this party.</param> /// <param name="AllowDowngrades">(Dis-)allow PUTting of object having an earlier 'LastUpdated'-timestamp then already existing objects.</param> public CredentialsRole(CountryCode CountryCode, Party_Id PartyId, Roles Role, BusinessDetails BusinessDetails, Boolean?AllowDowngrades = true) { if (CountryCode.IsNullOrEmpty) { throw new ArgumentNullException(nameof(CountryCode), "The given CountryCode must not be null or empty!"); } if (PartyId.IsNullOrEmpty) { throw new ArgumentNullException(nameof(PartyId), "The given PartyId must not be null or empty!"); } if (BusinessDetails is null) { throw new ArgumentNullException(nameof(BusinessDetails), "The given business details must not be null!"); } this.CountryCode = CountryCode; this.PartyId = PartyId; this.Role = Role; this.BusinessDetails = BusinessDetails; this.AllowDowngrades = AllowDowngrades; }
public RemoteParty(CountryCode CountryCode, Party_Id PartyId, Roles Role, BusinessDetails BusinessDetails, AccessToken AccessToken, AccessStatus AccessStatus = AccessStatus.ALLOWED, PartyStatus Status = PartyStatus.ENABLED, DateTime?LastUpdated = null) : this(CountryCode, PartyId, Role, BusinessDetails, new AccessInfo2[] { new AccessInfo2( AccessToken, AccessStatus ) }, null, Status, LastUpdated) { }
/// <summary> /// Try to parse the given text as a remote party identification. /// </summary> /// <param name="Text">A text representation of a remote party identification.</param> /// <param name="RemotePartyId">The parsed remote party identification.</param> public static Boolean TryParse(String Text, out RemoteParty_Id RemotePartyId) { if (Text.IsNotNullOrEmpty()) { try { var MatchCollection = RemotePartyId_RegEx.Matches(Text); if (MatchCollection.Count == 1 && CountryCode.TryParse(MatchCollection[0].Groups[1].Value, out CountryCode countryCode) && Party_Id.TryParse(MatchCollection[0].Groups[2].Value, out Party_Id partyId) && Enum.TryParse(MatchCollection[0].Groups[3].Value, out Roles role)) { RemotePartyId = new RemoteParty_Id(countryCode, partyId, role); return(true); } } catch (Exception) { } } RemotePartyId = default; return(false); }
/// <summary> /// Create a new remote party identification based on the given string. /// </summary> private RemoteParty_Id(CountryCode CountryCode, Party_Id PartyId, Roles Role) { this.CountryCode = CountryCode; this.PartyId = PartyId; this.Role = Role; this.InternalId = String.Concat(CountryCode, "-", PartyId, "_", Role); }
/// <summary> /// Create new client info. /// </summary> /// <param name="CountryCode">Country code of the country this party is operating in, as used in the credentials exchange.</param> /// <param name="PartyId">CPO or eMSP ID of this party (following the 15118 ISO standard), as used in the credentials exchange.</param> /// <param name="Role">The role of the connected party.</param> /// <param name="Status">Status of the connection to the party.</param> /// <param name="LastUpdated">Optional timestamp when this client info was last updated.</param> public ClientInfo(CountryCode CountryCode, Party_Id PartyId, Roles Role, ConnectionStatus Status, DateTime?LastUpdated = null) { this.CountryCode = CountryCode; this.PartyId = PartyId; this.Role = Role; this.Status = Status; this.LastUpdated = LastUpdated ?? DateTime.UtcNow; }
/// <summary> /// Create a new charging session. /// </summary> public Session(CountryCode CountryCode, Party_Id PartyId, Session_Id Id, DateTime Start, Decimal kWh, CDRToken CDRToken, AuthMethods AuthMethod, Location_Id LocationId, EVSE_UId EVSEUId, Connector_Id ConnectorId, Currency Currency, SessionStatusTypes Status, DateTime?End = null, AuthorizationReference?AuthorizationReference = null, Meter_Id?MeterId = null, EnergyMeter EnergyMeter = null, IEnumerable <TransparencySoftware> TransparencySoftwares = null, IEnumerable <ChargingPeriod> ChargingPeriods = null, Price?TotalCosts = null, DateTime?LastUpdated = null) { this.CountryCode = CountryCode; this.PartyId = PartyId; this.Id = Id; this.Start = Start; this.kWh = kWh; this.CDRToken = CDRToken; this.AuthMethod = AuthMethod; this.LocationId = LocationId; this.EVSEUId = EVSEUId; this.ConnectorId = ConnectorId; this.Currency = Currency; this.Status = Status; this.End = End; this.AuthorizationReference = AuthorizationReference; this.MeterId = MeterId; this.EnergyMeter = EnergyMeter; this.TransparencySoftwares = TransparencySoftwares; this.ChargingPeriods = ChargingPeriods; this.TotalCosts = TotalCosts; this.LastUpdated = LastUpdated ?? DateTime.Now; CalcSHA256Hash(); }
/// <summary> /// Create a new token describing the charging session and its costs, /// how these costs are composed, etc. /// </summary> public Token(CountryCode CountryCode, Party_Id PartyId, Token_Id Id, TokenTypes Type, Contract_Id ContractId, String Issuer, Boolean IsValid, WhitelistTypes WhitelistType, String VisualNumber = null, Group_Id?GroupId = null, Languages?UILanguage = null, ProfileTypes?DefaultProfile = null, EnergyContract?EnergyContract = null, DateTime?LastUpdated = null) { if (Issuer.IsNullOrEmpty()) { throw new ArgumentNullException(nameof(Issuer), "The given issuer must not be null or empty!"); } this.CountryCode = CountryCode; this.PartyId = PartyId; this.Id = Id; this.Type = Type; this.ContractId = ContractId; this.Issuer = Issuer; this.IsValid = IsValid; this.WhitelistType = WhitelistType; this.VisualNumber = VisualNumber; this.GroupId = GroupId; this.UILanguage = UILanguage; this.DefaultProfile = DefaultProfile; this.EnergyContract = EnergyContract; this.LastUpdated = LastUpdated ?? DateTime.Now; CalcSHA256Hash(); }
/// <summary> /// Create a new charging tariff. /// </summary> /// <param name="CountryCode">The ISO-3166 alpha-2 country code of the CPO that 'owns' this session.</param> /// <param name="PartyId">The Id of the CPO that 'owns' this session (following the ISO-15118 standard).</param> /// <param name="Id">The identification of the tariff within the CPOs platform (and suboperator platforms).</param> /// <param name="Currency">ISO 4217 code of the currency used for this tariff.</param> /// <param name="TariffElements">An enumeration of tariff elements.</param> /// /// <param name="TariffType">Defines the type of the tariff.</param> /// <param name="TariffAltText">Multi-language alternative tariff info text.</param> /// <param name="TariffAltURL">URL to a web page that contains an explanation of the tariff information in human readable form.</param> /// <param name="MinPrice">Minimum charging price.</param> /// <param name="MaxPrice">Maximum charging price.</param> /// <param name="Start">The timestamp when this tariff becomes active.</param> /// <param name="End">The timestamp after which this tariff is no longer valid.</param> /// <param name="EnergyMix">Optional details on the energy supplied with this tariff.</param> /// <param name="LastUpdated">Timestamp when this tariff was last updated (or created).</param> public Tariff(CountryCode CountryCode, Party_Id PartyId, Tariff_Id Id, Currency Currency, IEnumerable <TariffElement> TariffElements, TariffTypes?TariffType = null, IEnumerable <DisplayText> TariffAltText = null, URL?TariffAltURL = null, Price?MinPrice = null, Price?MaxPrice = null, DateTime?Start = null, DateTime?End = null, EnergyMix EnergyMix = null, DateTime?LastUpdated = null) { if (!TariffElements.SafeAny()) { throw new ArgumentNullException(nameof(TariffElements), "The given enumeration of tariff elements must not be null or empty!"); } this.CountryCode = CountryCode; this.PartyId = PartyId; this.Id = Id; this.Currency = Currency; this.TariffElements = TariffElements.Distinct(); this.TariffType = TariffType; this.TariffAltText = TariffAltText?.Distinct() ?? new DisplayText[0]; this.TariffAltURL = TariffAltURL; this.MinPrice = MinPrice; this.MaxPrice = MaxPrice; this.Start = Start; this.End = End; this.EnergyMix = EnergyMix; this.LastUpdated = LastUpdated ?? DateTime.Now; CalcSHA256Hash(); }