/// <summary> /// /// <example> /// <code> /// var result = CustomerAccountFactory.ChangePassword(handler : handler, passwordInfo : passwordInfo, accountId : accountId, unlockAccount : unlockAccount, userId : userId, expectedCode: expectedCode, successCode: successCode); /// var optionalCasting = ConvertClass<void/>(result); /// return optionalCasting; /// </code> /// </example> /// </summary> public static void ChangePassword(ServiceClientMessageHandler handler, Mozu.Api.Contracts.Customer.PasswordInfo passwordInfo, int accountId, bool?unlockAccount = null, string userId = null, HttpStatusCode expectedCode = HttpStatusCode.NoContent, HttpStatusCode successCode = HttpStatusCode.NoContent) { SetSdKparameters(); var currentClassName = System.Reflection.MethodInfo.GetCurrentMethod().DeclaringType.Name; var currentMethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; Debug.WriteLine(currentMethodName + '.' + currentMethodName); var apiClient = Mozu.Api.Clients.Commerce.Customer.CustomerAccountClient.ChangePasswordClient( passwordInfo: passwordInfo, accountId: accountId, unlockAccount: unlockAccount, userId: userId); try { apiClient.WithContext(handler.ApiContext).ExecuteAsync(default(CancellationToken)).Wait(); } catch (ApiException ex) { // Custom error handling for test cases can be placed here Exception customException = TestFailException.GetCustomTestException(ex, currentClassName, currentMethodName, expectedCode); if (customException != null) { throw customException; } } var noResponse = ResponseMessageFactory.CheckResponseCodes(apiClient.HttpResponse.StatusCode, expectedCode, successCode) ? (apiClient.Result()) : null; }
/// <summary> /// /// </summary> /// <param name="accountId">Unique identifier of the customer account.</param> /// <param name="unlockAccount">Specifies whether to unlock the specified customer account.</param> /// <param name="userId"></param> /// <param name="passwordInfo">The information required to modify a shopper account password.</param> /// <returns> /// /// </returns> /// <example> /// <code> /// var customeraccount = new CustomerAccount(); /// await customeraccount.ChangePasswordAsync( passwordInfo, accountId, unlockAccount, userId); /// </code> /// </example> public virtual async Task ChangePasswordAsync(Mozu.Api.Contracts.Customer.PasswordInfo passwordInfo, int accountId, bool?unlockAccount = null, string userId = null, CancellationToken ct = default(CancellationToken)) { MozuClient response; var client = Mozu.Api.Clients.Commerce.Customer.CustomerAccountClient.ChangePasswordClient(passwordInfo, accountId, unlockAccount, userId); client.WithContext(_apiContext); response = await client.ExecuteAsync(ct).ConfigureAwait(false); }
/// <summary> /// Modify the password associated with a customer account. /// </summary> /// <param name="accountId">Unique identifier of the customer account.</param> /// <param name="unlockAccount"></param> /// <param name="passwordInfo">The information required to modify a shopper account password.</param> /// <returns> /// /// </returns> /// <example> /// <code> /// var customeraccount = new CustomerAccount(); /// await customeraccount.ChangePasswordAsync( passwordInfo, accountId, unlockAccount); /// </code> /// </example> public virtual async Task ChangePasswordAsync(Mozu.Api.Contracts.Customer.PasswordInfo passwordInfo, int accountId, bool?unlockAccount = null) { MozuClient response; var client = Mozu.Api.Clients.Commerce.Customer.CustomerAccountClient.ChangePasswordClient(passwordInfo, accountId, unlockAccount); client.WithContext(_apiContext); response = await client.ExecuteAsync(); }
/// <summary> /// /// </summary> /// <param name="accountId">Unique identifier of the customer account.</param> /// <param name="unlockAccount">Specifies whether to unlock the specified customer account.</param> /// <param name="userId"></param> /// <param name="passwordInfo">The information required to modify a shopper account password.</param> /// <returns> /// <see cref="Mozu.Api.MozuClient" /> /// </returns> /// <example> /// <code> /// var mozuClient=ChangePassword( passwordInfo, accountId, unlockAccount, userId); ///mozuClient.WithBaseAddress(url).Execute(); /// </code> /// </example> public static MozuClient ChangePasswordClient(Mozu.Api.Contracts.Customer.PasswordInfo passwordInfo, int accountId, bool?unlockAccount = null, string userId = null) { var url = Mozu.Api.Urls.Commerce.Customer.CustomerAccountUrl.ChangePasswordUrl(accountId, unlockAccount, userId); const string verb = "POST"; var mozuClient = new MozuClient() .WithVerb(verb).WithResourceUrl(url) .WithBody <Mozu.Api.Contracts.Customer.PasswordInfo>(passwordInfo); return(mozuClient); }