/// <summary> /// Resets the password of the user <param name="userId" />. /// </summary> /// <param name="userId">The id of the user having the password changed.</param> /// <param name="newPassword">The newPassword.</param> /// <param name="mustChangePasswordAtNextLogOn">Whether the password needs to be changed at the next logon.</param> /// <returns>A Task.</returns> internal override Task ResetPassword(string userId, string newPassword, bool mustChangePasswordAtNextLogOn) { ThrowIf.NullOrWhiteSpace(userId, "userId"); ThrowIf.NullOrWhiteSpace(newPassword, "newPassword"); return(Execute(() => SecurityManager.Create(CommerceRuntimeManager.Runtime).ResetPassword(userId, newPassword, mustChangePasswordAtNextLogOn))); }
/// <summary> /// Initializes a new instance of the <see cref="UserToken"/> class. /// </summary> /// <param name="token">The token.</param> /// <param name="schemeName">Name of the authentication scheme for the token.</param> protected UserToken(string token, string schemeName) { ThrowIf.NullOrWhiteSpace(token, "token"); ThrowIf.NullOrWhiteSpace(schemeName, "schemeName"); this.token = token; this.schemeName = schemeName; }
public LocalCertificateRetriever( string certThumbprint, ILoggerFactory loggerFactory ) : base(loggerFactory.CreateLogger <LocalCertificateRetriever>()) { _certThumbprint = ThrowIf.NullOrWhiteSpace(certThumbprint, nameof(certThumbprint)); }
/// <summary> /// Parses XML into commerce list invitations. /// </summary> /// <param name="xml">The XML.</param> /// <returns>The invitations.</returns> private static IEnumerable <CommerceListInvitation> ParseCommerceListInvitations(string xml) { ThrowIf.NullOrWhiteSpace(xml, "xml"); XDocument doc = XDocument.Parse(xml); var invitationElements = doc.Descendants("RetailWishListInvitation"); List <CommerceListInvitation> invitations = new List <CommerceListInvitation>(); foreach (var invitationElement in invitationElements) { CommerceListInvitation invitation = new CommerceListInvitation(); invitation.RecordId = Convert.ToInt64(invitationElement.Attribute("RecId").Value); invitation.Invitee = invitationElement.Attribute("Invitee").Value; invitation.IsSent = Convert.ToBoolean(invitationElement.Attribute("IsSent").Value); invitation.LastRequestDateTime = TransactionServiceClient.ParseDateTimeOffset(invitationElement, "LastRequestDateTime"); invitation.LastSentDateTime = TransactionServiceClient.ParseDateTimeOffset(invitationElement, "LastSentDateTime"); invitation.StatusValue = Convert.ToInt32(invitationElement.Attribute("Status").Value); invitation.Token = invitationElement.Attribute("Token").Value; invitation.InvitationTypeValue = Convert.ToInt32(invitationElement.Attribute("Type").Value); invitations.Add(invitation); } return(invitations); }
/// <summary> /// Gets order history for customer. /// </summary> /// <param name="request">The data service request.</param> /// <returns>The data service response.</returns> private static EntityDataServiceResponse <SalesOrder> GetOrderHistory(GetOrderHistoryDataRequest request) { ThrowIf.Null(request, "request"); ThrowIf.Null(request.RequestContext, "request.RequestContext"); ThrowIf.NullOrWhiteSpace(request.CustomerAccountNumber, "request.CustomerAccountNumber"); ThrowIf.Null(request.QueryResultSettings, "request.QueryResultSettings"); // Build the where clause var query = new SqlPagedQuery(request.QueryResultSettings) { From = OrderHistoryView, Where = RetailTransactionTableSchema.CustomerIdColumn + " = " + CustomerAccountNumberVariableName + " AND " + RetailTransactionTableSchema.CreatedDateTimeColumn + " >= " + StartDateVariableName, OrderBy = RetailTransactionTableSchema.CreatedDateTimeColumn + " DESC" }; query.Parameters[CustomerAccountNumberVariableName] = request.CustomerAccountNumber; query.Parameters[StartDateVariableName] = request.StartDateTime; using (DatabaseContext databaseContext = new DatabaseContext(request.RequestContext)) { PagedResult <SalesOrder> results = databaseContext.ReadEntity <SalesOrder>(query); SalesTransactionDataService.FillSalesOrderMembers(results.Results, true, request.RequestContext); return(new EntityDataServiceResponse <SalesOrder>(results)); } }
/// <summary> /// Retrieves terminal and device association information data from headquarters. /// </summary> /// <param name="orgUnitNumber">The store number.</param> /// <param name="deviceType">The device type value.</param> /// <param name="settings">The query result settings.</param> /// <returns>The paged results of terminal info of the given store.</returns> internal PagedResult <Microsoft.Dynamics.Commerce.Runtime.DataModel.TerminalInfo> GetTerminalInfo(string orgUnitNumber, int deviceType, QueryResultSettings settings) { ThrowIf.NullOrWhiteSpace(orgUnitNumber, "orgUnitNumber"); ThrowIf.Null(settings, "settings"); ThrowIf.Null(settings.Paging, "settings.Paging"); var terminalInfoList = new List <Microsoft.Dynamics.Commerce.Runtime.DataModel.TerminalInfo>(); var data = this.InvokeMethodAllowNullResponse( GetAvailableTerminalsMethodName, new object[] { orgUnitNumber, deviceType, settings.Paging.NumberOfRecordsToFetch, settings.Paging.Skip }); if (data != null) { var xmlTerminalInfoList = (string)data[0]; var availableTerminalInfo = SerializationHelper.DeserializeObjectDataContractFromXml <Serialization.TerminalInfo[]>(xmlTerminalInfoList); if (availableTerminalInfo != null) { terminalInfoList = availableTerminalInfo.Select(terminalInfo => new Microsoft.Dynamics.Commerce.Runtime.DataModel.TerminalInfo() { TerminalId = terminalInfo.TerminalId, DeviceNumber = terminalInfo.DeviceNumber, Name = terminalInfo.Name, DeviceType = terminalInfo.DeviceType, ActivationStatusValue = terminalInfo.ActivationStatusValue }).ToList(); } } return(new PagedResult <Microsoft.Dynamics.Commerce.Runtime.DataModel.TerminalInfo>(terminalInfoList.AsReadOnly(), settings.Paging)); }
/// <summary> /// Accepts the invitation to the commerce list. /// </summary> /// <param name="token">The invitation token.</param> /// <param name="customerId">The identifier of the customer who accepts the invitation.</param> public void AcceptCommerceListInvitation(string token, string customerId) { ThrowIf.NullOrWhiteSpace(token, "token"); ThrowIf.NullOrWhiteSpace(customerId, "customerId"); this.InvokeMethodNoDataReturn(AcceptWishListInvitationMethodName, token, customerId); }
/// <summary> /// Reserves the gift card so it cannot be used from different terminal. /// </summary> /// <param name="giftCardId">Gift card identifier.</param> /// <param name="channelId">Channel identifier.</param> /// <param name="terminalId">Terminal identifier.</param> /// <param name="cardCurrencyCode">Currency code of specified gift card.</param> /// <param name="balance">Gift card balance.</param> public void LockGiftCard(string giftCardId, long channelId, string terminalId, out string cardCurrencyCode, out decimal balance) { ThrowIf.NullOrWhiteSpace(giftCardId, "giftCardId"); ThrowIf.Null(terminalId, "terminalId"); if (channelId <= 0) { throw new ArgumentOutOfRangeException("channelId", "A valid channel identifier must be specified."); } object[] parameters = { giftCardId, string.Empty, // Store is replaced by Channel id. Prameter is left for N-1 support. terminalId, false, // Skip reserve validation is set to validate channelId, }; var data = this.InvokeMethod( ValidateGiftCardMethodName, parameters); // Parse response data cardCurrencyCode = (string)data[0]; balance = (decimal)data[1]; }
private static SingleEntityDataServiceResponse <decimal> GetCustomerLocalPendingBalance(GetCustomerAccountLocalPendingBalanceDataRequest request) { ThrowIf.Null(request, "request"); ThrowIf.NullOrWhiteSpace(request.AccountNumber, "request.AccountNumber"); decimal tenderedAmount = decimal.Zero; decimal depositsAmount = decimal.Zero; ParameterSet parameters = new ParameterSet(); parameters["@nvc_AccountNumber"] = request.AccountNumber; parameters["@nvc_StoreId"] = request.RequestContext.GetOrgUnit().OrgUnitNumber; parameters["@nvc_PosOperation"] = (int)RetailOperation.PayCustomerAccount; parameters["@i_LastCounter"] = request.LastReplicationCounter; parameters["@nvc_DataAreaId"] = request.RequestContext.GetChannelConfiguration().InventLocationDataAreaId; ParameterSet outputParameters = new ParameterSet(); outputParameters["@d_tenderAmount"] = tenderedAmount; outputParameters["@d_depositAmount"] = depositsAmount; using (SqlServerDatabaseContext databaseContext = new SqlServerDatabaseContext(request.RequestContext)) { databaseContext.ExecuteStoredProcedureScalar(LocalPendingTransactionsAmountSprocName, parameters, outputParameters); } tenderedAmount = Convert.ToDecimal(outputParameters["@d_tenderAmount"]); depositsAmount = Convert.ToDecimal(outputParameters["@d_depositAmount"]); return(new SingleEntityDataServiceResponse <decimal>(tenderedAmount - depositsAmount)); }
/// <summary> /// Initializes a new instance of the <see cref="DatabaseConnection"/> class. /// </summary> /// <param name="connectionString">The SQLite connection string.</param> /// <param name="statementCachingSize">The size of the statement cache pool.</param> /// <param name="busyTimeout">The timeout value in milliseconds for waiting on a busy database resource.</param> /// <param name="connectionManager">The connection managed that has the connection pool from which this connection has been initialized.</param> public DatabaseConnection(string connectionString, int statementCachingSize, int busyTimeout, DataAccess.Sqlite.ConnectionManager connectionManager) { ThrowIf.NullOrWhiteSpace(connectionString, "sqlConnection"); if (statementCachingSize < 1) { throw new ArgumentOutOfRangeException("statementCachingSize", "Statement caching size must be positive."); } if (busyTimeout < 0) { throw new ArgumentOutOfRangeException("busyTimeout", "Busy timeout must be greater or equal to 0."); } this.ConnectionString = connectionString; this.statementCacheSize = statementCachingSize; this.busyTimeout = busyTimeout; this.connectionManager = connectionManager; this.SqlConnection = null; this.isDisposed = false; this.inUse = false; this.markedForRemoval = false; this.attachedDatabaseCounter = 0; this.statementCache = new Dictionary <string, SqlStatement>(StringComparer.OrdinalIgnoreCase); }
/// <summary> /// Opens a peripheral. /// </summary> /// <param name="peripheralName">Name of the peripheral.</param> /// <param name="characterSet">The character set.</param> /// <param name="binaryConversion">If set to <c>true</c> [binary conversion].</param> /// <param name="peripheralConfig">Configuration parameters of the peripheral.</param> public void Open(string peripheralName, int characterSet, bool binaryConversion, PeripheralConfiguration peripheralConfig) { ThrowIf.NullOrWhiteSpace(peripheralName, "peripheralName"); ThrowIf.Null(peripheralConfig, "peripheralConfig"); IDictionary <string, object> configurations = peripheralConfig.ExtensionProperties.ToObjectDictionary(); string ip = configurations[PeripheralConfigKey.IpAddress] as string; if (string.IsNullOrWhiteSpace(ip)) { throw new ArgumentException(string.Format("Peripheral configuration parameter is missing: {0}.", PeripheralConfigKey.IpAddress)); } int?port = configurations[PeripheralConfigKey.Port] as int?; if (port == null) { throw new ArgumentException(string.Format("Peripheral configuration parameter is missing: {0}.", PeripheralConfigKey.Port)); } this.ip = ip.Trim(); this.port = (int)port; // Get code page attribute this.codePage = characterSet; if (this.codePage > 0) { this.codePageAttribute = string.Format(CodePageFormat, this.codePage); } else { this.codePageAttribute = string.Empty; // Use printer setting } }
/// <summary> /// Gets a default logistics postal address for India. /// </summary> /// <param name="request">The get warehouse address India data request.</param> /// <returns>Matching address.</returns> /// <remarks> /// Search address as warehouse -> site -> legal entity. /// </remarks> private SingleEntityDataServiceResponse <Address> GetWarehouseAddressIndia(GetWarehouseAddressIndiaDataRequest request) { ThrowIf.Null(request, "request"); ThrowIf.NullOrWhiteSpace(request.WarehouseId, "request.WarehouseId"); IndiaTaxL2CacheDataStoreAccessor level2CacheDataAccessor = this.GetIndiaTaxL2CacheDataStoreAccessor(request.RequestContext); bool found; bool updateL2Cache; Address result = DataManager.GetDataFromCache(() => level2CacheDataAccessor.GetWarehouseAddressIndia(request.WarehouseId), out found, out updateL2Cache); if (!found) { ParameterSet parameters = new ParameterSet(); parameters["@nv_InventLocationId"] = request.WarehouseId; parameters["@nv_InventLocationDataAreaId"] = request.RequestContext.GetChannelConfiguration().InventLocationDataAreaId; using (SqlServerDatabaseContext sqlServerDatabaseContext = new SqlServerDatabaseContext(request)) { result = sqlServerDatabaseContext.ExecuteStoredProcedure <Address>(GetWarehouseAddressIndiaName, parameters).SingleOrDefault(); } updateL2Cache &= result != null; } if (updateL2Cache) { level2CacheDataAccessor.PutWarehouseAddressIndia(request.WarehouseId, result); } return(new SingleEntityDataServiceResponse <Address>(result)); }
/// <summary> /// Gets the shift. /// </summary> /// <param name="request">The request.</param> /// <returns>A single entity data service response.</returns> private SingleEntityDataServiceResponse <Shift> GetShift(GetShiftDataRequest request) { ThrowIf.Null(request, "request"); ThrowIf.NullOrWhiteSpace(request.TerminalId, "request.TerminalId"); long channelId = request.RequestContext.GetPrincipal().ChannelId; // Loads shift. ShiftDataQueryCriteria criteria = new ShiftDataQueryCriteria(); criteria.ChannelId = channelId; criteria.TerminalId = request.TerminalId; criteria.ShiftId = request.ShiftId; criteria.SearchByTerminalId = true; criteria.IncludeSharedShifts = true; GetShiftDataDataRequest dataServiceRequest = new GetShiftDataDataRequest(criteria, QueryResultSettings.SingleRecord); Shift shift = request.RequestContext.Runtime.Execute <EntityDataServiceResponse <Shift> >(dataServiceRequest, request.RequestContext).PagedEntityCollection.FirstOrDefault(); if (shift != null) { // Load shift tender lines. PagedResult <ShiftTenderLine> shiftTenderLines = this.GetShiftEntity <ShiftTenderLine>(string.Empty, ShiftTenderLinesView, request.TerminalId, request.ShiftId, request, queryByPrimaryKey: false); // Load shift account lines. PagedResult <ShiftAccountLine> shiftAccountLines = this.GetShiftEntity <ShiftAccountLine>(string.Empty, ShiftAccountsView, request.TerminalId, request.ShiftId, request, queryByPrimaryKey: false); shift.AccountLines = shiftAccountLines.Results.ToList(); shift.TenderLines = shiftTenderLines.Results.ToList(); } return(new SingleEntityDataServiceResponse <Shift>(shift)); }
/// <summary> /// Clears the pool of connections for a specific connection string. /// </summary> /// <param name="connectionString">The connection string.</param> /// <returns>Returns true if all connections with <paramref name="connectionString"/> were removed from the pool, otherwise false.</returns> public bool ClearPool(string connectionString) { ThrowIf.NullOrWhiteSpace(connectionString, "connectionString"); lock (this.syncLock) { LinkedList <DatabaseConnection> databaseConnections; if (!this.connectionDictionary.TryGetValue(connectionString, out databaseConnections)) { return(true); } bool allDisposed = true; // NOTE: database connections are copied to the array because we are removing them from the same linked list on the enumeration. DatabaseConnection[] databaseConnectionsArray = databaseConnections.ToArray(); foreach (DatabaseConnection databaseConnection in databaseConnectionsArray) { if (databaseConnection.InUse) { databaseConnection.MarkedForRemoval = true; } else { this.RemoveConnectionFromPool(databaseConnection, databaseConnections); } allDisposed &= databaseConnection.IsDisposed; } return(allDisposed); } }
/// <summary> /// Executes a stored procedure. /// </summary> /// <param name="procedureName">The procedure name.</param> /// <param name="parameters">The set of parameters.</param> /// <param name="outputParameters">The set of output parameters.</param> /// <param name="resultCallback">The result callback.</param> /// <param name="returnValue">The procedure result.</param> public void ExecuteStoredProcedure(string procedureName, ParameterSet parameters, ParameterSet outputParameters, Action <IDatabaseResult> resultCallback, out int returnValue) { ThrowIf.NullOrWhiteSpace(procedureName, "procedureName"); ThrowIf.Null(parameters, "parameters"); int?procedureReturnValue = null; if (this.settings != null) { var settingsParameter = new QueryResultSettingsTableType(this.settings); parameters.Add(QueryResultSettingsTableType.ParameterName, settingsParameter.DataTable); } RetryPolicy retryPolicy = this.DatabaseProvider.GetRetryPolicy(); try { retryPolicy.ExecuteAction( () => this.DatabaseProvider.ExecuteStoredProcedure(this.ConnectionManager.Connection, procedureName, parameters, outputParameters, resultCallback, out procedureReturnValue), (policy, retryCount, ex) => RetailLogger.Log.CrtDataAccessTransientExceptionOccurred(policy.RetryCount, policy.RetryInterval, retryCount, ex)); } catch (DatabaseException ex) { throw new StorageException( StorageErrors.Microsoft_Dynamics_Commerce_Runtime_CriticalStorageError, (int)ex.ErrorCode, ex, "Failed to read from the database. See inner exception for details"); } returnValue = procedureReturnValue.GetValueOrDefault(0); }
protected ProxyConnectionInfo( string endpoint, AuthenticationType authType ) { Endpoint = ThrowIf.NullOrWhiteSpace(endpoint, nameof(endpoint)); AuthenticationType = authType; }
/// <summary> /// Changes the password. /// </summary> /// <param name="userId">The user identifier.</param> /// <param name="oldPassword">The current password.</param> /// <param name="newPassword">The new password.</param> /// <returns>A task.</returns> internal override Task ChangePassword(string userId, string oldPassword, string newPassword) { ThrowIf.NullOrWhiteSpace(userId, "userId"); ThrowIf.NullOrWhiteSpace(oldPassword, "oldPassword"); ThrowIf.NullOrWhiteSpace(newPassword, "newPassword"); return(Execute(() => SecurityManager.Create(CommerceRuntimeManager.Runtime).ChangePassword(userId, oldPassword, newPassword))); }
public void NullOrWhiteSpace_StaticMethod_WhenInputIsOnlyWhitespace_ThrowsArgumentException() { string input = " "; var result = ThrowIf.NullOrWhiteSpace(input, nameof(input)); //Expect exception }
public void NullOrWhiteSpace_StaticMethod_WhenInputStringWithAnyNonWhitespace_ReturnsString() { string input = " . "; var result = ThrowIf.NullOrWhiteSpace(input, nameof(input)); Assert.AreSame(input, result); }
/// <summary> /// Unlocks/Releases an issued gift card so that it can now be used. /// </summary> /// <param name="giftCardId">The gift card id.</param> public void UnlockGiftCard(string giftCardId) { ThrowIf.NullOrWhiteSpace(giftCardId, "giftCardId"); this.InvokeMethodNoDataReturn( GiftCardReleaseMethodName, giftCardId); }
/// <summary> /// Voids the gift. /// </summary> /// <param name="giftCardId">Gift card identifier.</param> public void VoidGiftCard(string giftCardId) { ThrowIf.NullOrWhiteSpace(giftCardId, "giftCardId"); this.InvokeMethodNoDataReturn( VoidGiftCardMethodName, giftCardId); }
private static bool TryGetConfigValue( this IConfigurationRoot config, string configName, out string configValue) { ThrowIf.NullOrWhiteSpace(configName, nameof(configName)); configValue = config[configName]; return(!string.IsNullOrEmpty(configValue)); }
/// <summary> /// Gets the products using the specified category identifier. /// </summary> /// <param name="currentChannelId">The channel identifier of the current context.</param> /// <param name="targetChannelId">The channel identifier of the target channel.</param> /// <param name="targetCatalogId">The catalog identifier in the target channel.</param> /// <param name="targetCategoryId">The category identifier in the target channel.</param> /// <param name="skip">The number of records to skip.</param> /// <param name="top">The maximum number of records to return.</param> /// <param name="attributeIds">The comma-separated list of attribute record identifiers to retrieve. Specify '*' to retrieve all attributes.</param> /// <param name="includeProductsFromDescendantCategories">Whether category based product search should return products from all descendant categories.</param> /// <returns>A collection of products under the specified category.</returns> public ReadOnlyCollection <Product> GetProductsByCategory( long currentChannelId, long targetChannelId, long targetCatalogId, long targetCategoryId, long skip, long top, string attributeIds, bool includeProductsFromDescendantCategories) { if (currentChannelId <= 0) { throw new ArgumentOutOfRangeException("currentChannelId", "The current channel identifier is required."); } if (skip < 0 || skip == int.MaxValue) { throw new ArgumentOutOfRangeException("skip"); } if (top < 0) { throw new ArgumentOutOfRangeException("top", "The value must be a positive integer."); } ThrowIf.NullOrWhiteSpace(attributeIds, "attributeIds"); CP.RetailTransactionServiceResponse serviceResponse = this.GetResponseFromMethod( GetProductsByCategoryMethodName, currentChannelId, targetCategoryId, skip + 1, // 1-based in AX top, "ItemId", // order by 1, // sort order false, // return total count string.Empty, // language targetChannelId, targetCatalogId, attributeIds, true, // _includePrice includeProductsFromDescendantCategories); // Check result if (!serviceResponse.Success) { throw new CommunicationException( CommunicationErrors.Microsoft_Dynamics_Commerce_Runtime_HeadquarterCommunicationFailure, string.Format("Invoke method {0} failed: {1}", GetProductsByCategoryMethodName, serviceResponse.Message)); } // Throw if service response does not contain any data. if (serviceResponse.Data == null || serviceResponse.Data.Length == 0) { throw new CommunicationException( CommunicationErrors.Microsoft_Dynamics_Commerce_Runtime_HeadquarterResponseParsingError, "Service response does not contain any data."); } string productsXml = (string)serviceResponse.Data[0]; var products = this.ConvertProductsXmlToProducts(productsXml); return(products); }
public KeyVaultCertificateRetriever( AzureSecretVault certificateVault, string certificateName, ILoggerFactory loggerFactory ) : base(loggerFactory.CreateLogger <KeyVaultCertificateRetriever>()) { _certName = ThrowIf.NullOrWhiteSpace(certificateName, nameof(certificateName)); _vault = ThrowIf.Null(certificateVault, nameof(certificateVault)); }
/// <summary> /// Gets the break category job identifier for the given activity. /// </summary> /// <param name="context">The request context.</param> /// <param name="activity">The activity: <c>LunchBrk</c>, <c>DailyBrks</c>.</param> /// <returns>Returns the activity job identifier.</returns> public static string GetBreakCategoryJobIdByActivity(RequestContext context, string activity) { ThrowIf.Null(context, "context"); ThrowIf.NullOrWhiteSpace(activity, "activity"); var jobIds = GetBreakCategoryJobIdsByActivities(context, new[] { activity }); return(jobIds.SingleOrDefault()); }
/// <summary> /// Instantiates ProxyConnectionInfo with certificate authentication from a local cert /// </summary> /// <param name="endpoint">Proxy Endpoint</param> /// <param name="certThumbprint">Thumbprint for searching local certificate store</param> public ProxyConnectionInfo( string endpoint, string certThumbprint ) : this( endpoint, AuthenticationType.Certificate ) { CertIdentifier = ThrowIf.NullOrWhiteSpace(certThumbprint, nameof(certThumbprint)); }
/// <summary> /// Initializes a new instance of the <see cref="CommerceAuthenticationParameters"/> class. /// </summary> /// <param name="grantType">Type of the grant.</param> /// <param name="clientId">The client identifier.</param> /// <param name="retailOperation">The retail operation.</param> /// <param name="credential">The user credential.</param> public CommerceAuthenticationParameters(string grantType, string clientId, RetailOperation?retailOperation, string credential) { ThrowIf.NullOrWhiteSpace(grantType, "grantType"); ThrowIf.NullOrWhiteSpace(clientId, "clientId"); this.GrantType = grantType; this.ClientId = clientId; this.RetailOperation = retailOperation; this.Credential = credential; }
public KeyVaultConfiguration(string clientId, string clientSecret, string vault) { ClientId = ThrowIf.NullOrWhiteSpace(clientId, nameof(clientId)); ClientSecret = ThrowIf.NullOrWhiteSpace(clientSecret, nameof(clientSecret)); Vault = string.Format( CultureInfo.InvariantCulture, secretUriBase, ThrowIf.NullOrWhiteSpace(vault, nameof(vault)) ); }
/// <summary> /// Verify if related fields in transaction profile are null or empty. /// </summary> private void ValidateTransactionProfile() { ThrowIf.NullOrWhiteSpace(this.transactionServiceProfile.UserId, "TSUserID"); ThrowIf.NullOrWhiteSpace(this.transactionServiceProfile.ServiceHostUrl, "TSServiceHostUrl"); ThrowIf.NullOrWhiteSpace(this.transactionServiceProfile.IssuerUri, "TSIssuerUri"); ThrowIf.NullOrWhiteSpace(this.transactionServiceProfile.IdentityProvider, "TSIdentityProvider"); ThrowIf.NullOrWhiteSpace(this.transactionServiceProfile.IdentityProviderClaim, "TSIdentityProviderClaimType"); ThrowIf.NullOrWhiteSpace(this.transactionServiceProfile.AudienceUrn, "TSAudienceUrn"); ThrowIf.NullOrWhiteSpace(this.transactionServiceProfile.IssuedTokenType, "TSIssuedTokenType"); ThrowIf.NullOrWhiteSpace(this.transactionServiceProfile.LanguageId, "LanguageId"); }
/// <summary> /// Updates client application version in AX. /// </summary> /// <param name="appVersion">The client application version.</param> internal void UpdateApplicationVersion(string appVersion) { string deviceNumber = this.context.GetPrincipal().DeviceNumber; ThrowIf.Null(appVersion, "appVersion"); ThrowIf.NullOrWhiteSpace(deviceNumber, "deviceNumber"); var parameters = new object[] { deviceNumber, appVersion }; Task.Run(() => this.InvokeMethodNoDataReturn(UpdateApplicationVersionMethodName, parameters)); }