/// <summary> /// Updates one or more properties of a shopper wish list defined for a customer account. /// <example> /// <code> /// var result = WishlistFactory.UpdateWishlist(handler : handler, wishlist : wishlist, wishlistId : wishlistId, responseFields : responseFields, expectedCode: expectedCode, successCode: successCode); /// var optionalCasting = ConvertClass<Wishlist/>(result); /// return optionalCasting; /// </code> /// </example> /// </summary> public static Mozu.Api.Contracts.CommerceRuntime.Wishlists.Wishlist UpdateWishlist(ServiceClientMessageHandler handler, Mozu.Api.Contracts.CommerceRuntime.Wishlists.Wishlist wishlist, string wishlistId, string responseFields = null, HttpStatusCode expectedCode = HttpStatusCode.OK, HttpStatusCode successCode = HttpStatusCode.OK) { 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.WishlistClient.UpdateWishlistClient( wishlist: wishlist, wishlistId: wishlistId, responseFields: responseFields); try { apiClient.WithContext(handler.ApiContext).Execute(); } 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; } return(null); } return(ResponseMessageFactory.CheckResponseCodes(apiClient.HttpResponse.StatusCode, expectedCode, successCode) ? (apiClient.Result()) : null); }
public void Add_Shopper() { var customerHandler = new MozuDataConnector.Domain.Handlers.CustomerHandler(_apiContext.TenantId, _apiContext.SiteId, _apiContext.MasterCatalogId); var filter = "ExternalId eq " + "'m00349'"; var account = customerHandler.GetCustomerAccounts(0, 1, null, filter).Result; if (account.Count() == 0) { var customerAccountAndAuthInfo = new Mozu.Api.Contracts.Customer.CustomerAccountAndAuthInfo() { Account = new Mozu.Api.Contracts.Customer.CustomerAccount() { AcceptsMarketing = false, CompanyOrOrganization = "Candles Unlimited Inc.", EmailAddress = "*****@*****.**", ExternalId = "m0037", FirstName = "Alice", LastName = "Wick", IsActive = true, IsAnonymous = false, LocaleCode = "en-US", TaxExempt = false, IsLocked = false, UserName = "******", Contacts = new System.Collections.Generic .List <Mozu.Api.Contracts.Customer.CustomerContact>() { new Mozu.Api.Contracts.Customer.CustomerContact() { Email = "*****@*****.**", FirstName = "Alice", LastNameOrSurname = "Wick", Label = "Mrs.", PhoneNumbers = new Mozu.Api.Contracts.Core.Phone() { Mobile = "555-555-0001" }, Address = new Mozu.Api.Contracts.Core.Address() { Address1 = "One Lightning Bug Way", AddressType = "Residentail", CityOrTown = "Austin", CountryCode = "US", PostalOrZipCode = "78702", StateOrProvince = "TX" }, Types = new System.Collections.Generic .List <Mozu.Api.Contracts.Customer.ContactType>() { new Mozu.Api.Contracts.Customer.ContactType() { IsPrimary = true, Name = "Billing" } } }, new Mozu.Api.Contracts.Customer.CustomerContact() { Email = "*****@*****.**", FirstName = "Paul", LastNameOrSurname = "Wick", Label = "Mr.", PhoneNumbers = new Mozu.Api.Contracts.Core.Phone() { Mobile = "555-555-0002" }, Address = new Mozu.Api.Contracts.Core.Address() { Address1 = "1300 Comanche Trail", AddressType = "Residentail", CityOrTown = "San Marcos", CountryCode = "US", PostalOrZipCode = "78666", StateOrProvince = "TX" }, Types = new System.Collections.Generic .List <Mozu.Api.Contracts.Customer.ContactType>() { new Mozu.Api.Contracts.Customer.ContactType() { IsPrimary = true, Name = "Shipping" } } }, } }, Password = "******", IsImport = true }; var credit = new Mozu.Api.Contracts.Customer.Credit.Credit() { Code = "credit0001", ActivationDate = System.DateTime.Now, CreditType = "StoreCredit", CurrencyCode = "USD", CurrentBalance = 50m, ExpirationDate = null, InitialBalance = 50m }; var wishList = new Mozu.Api.Contracts.CommerceRuntime.Wishlists.Wishlist() { IsImport = true, Name = "wishlist-001", Items = new List <Mozu.Api.Contracts.CommerceRuntime.Wishlists.WishlistItem>() { new Mozu.Api.Contracts.CommerceRuntime.Wishlists.WishlistItem() { Product = new Mozu.Api.Contracts.CommerceRuntime.Products.Product() { ProductCode = "LUC-SCF-001" } } } }; var newAccount = customerHandler.AddCustomerAccount(customerAccountAndAuthInfo, credit, wishList).Result; } }
/// <summary> /// Updates one or more properties of a shopper wish list defined for a customer account. /// </summary> /// <param name="responseFields">Use this field to include those fields which are not included by default.</param> /// <param name="wishlistId">Unique identifier of the wish list.</param> /// <param name="wishlist">Properties of a shopper wish list defined for a site, associated with a customer account.</param> /// <returns> /// <see cref="Mozu.Api.Contracts.CommerceRuntime.Wishlists.Wishlist"/> /// </returns> /// <example> /// <code> /// var wishlist = new Wishlist(); /// var wishlist = await wishlist.UpdateWishlistAsync( wishlist, wishlistId, responseFields); /// </code> /// </example> public virtual async Task <Mozu.Api.Contracts.CommerceRuntime.Wishlists.Wishlist> UpdateWishlistAsync(Mozu.Api.Contracts.CommerceRuntime.Wishlists.Wishlist wishlist, string wishlistId, string responseFields = null) { MozuClient <Mozu.Api.Contracts.CommerceRuntime.Wishlists.Wishlist> response; var client = Mozu.Api.Clients.Commerce.WishlistClient.UpdateWishlistClient(wishlist, wishlistId, responseFields); client.WithContext(_apiContext); response = await client.ExecuteAsync(); return(await response.ResultAsync()); }
public virtual Mozu.Api.Contracts.CommerceRuntime.Wishlists.Wishlist UpdateWishlist(Mozu.Api.Contracts.CommerceRuntime.Wishlists.Wishlist wishlist, string wishlistId, string responseFields = null) { MozuClient <Mozu.Api.Contracts.CommerceRuntime.Wishlists.Wishlist> response; var client = Mozu.Api.Clients.Commerce.WishlistClient.UpdateWishlistClient(wishlist, wishlistId, responseFields); client.WithContext(_apiContext); response = client.Execute(); return(response.Result()); }
/// <summary> /// /// </summary> /// <param name="responseFields">Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.</param> /// <param name="wishlistId">Unique identifier of the wish list.</param> /// <param name="wishlist">Properties of a shopper wish list defined for a site, associated with a customer account.</param> /// <returns> /// <see cref="Mozu.Api.MozuClient" />{<see cref="Mozu.Api.Contracts.CommerceRuntime.Wishlists.Wishlist"/>} /// </returns> /// <example> /// <code> /// var mozuClient=UpdateWishlist( wishlist, wishlistId, responseFields); /// var wishlistClient = mozuClient.WithBaseAddress(url).Execute().Result(); /// </code> /// </example> public static MozuClient <Mozu.Api.Contracts.CommerceRuntime.Wishlists.Wishlist> UpdateWishlistClient(Mozu.Api.Contracts.CommerceRuntime.Wishlists.Wishlist wishlist, string wishlistId, string responseFields = null) { var url = Mozu.Api.Urls.Commerce.WishlistUrl.UpdateWishlistUrl(wishlistId, responseFields); const string verb = "PUT"; var mozuClient = new MozuClient <Mozu.Api.Contracts.CommerceRuntime.Wishlists.Wishlist>() .WithVerb(verb).WithResourceUrl(url) .WithBody <Mozu.Api.Contracts.CommerceRuntime.Wishlists.Wishlist>(wishlist); return(mozuClient); }
/// <summary> /// /// </summary> /// <param name="responseFields">Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.</param> /// <param name="wishlistId">Unique identifier of the wish list.</param> /// <param name="wishlist">Properties of a shopper wish list defined for a site, associated with a customer account.</param> /// <returns> /// <see cref="Mozu.Api.Contracts.CommerceRuntime.Wishlists.Wishlist"/> /// </returns> /// <example> /// <code> /// var wishlist = new Wishlist(); /// var wishlist = await wishlist.UpdateWishlistAsync( wishlist, wishlistId, responseFields); /// </code> /// </example> public virtual async Task <Mozu.Api.Contracts.CommerceRuntime.Wishlists.Wishlist> UpdateWishlistAsync(Mozu.Api.Contracts.CommerceRuntime.Wishlists.Wishlist wishlist, string wishlistId, string responseFields = null, CancellationToken ct = default(CancellationToken)) { MozuClient <Mozu.Api.Contracts.CommerceRuntime.Wishlists.Wishlist> response; var client = Mozu.Api.Clients.Commerce.WishlistClient.UpdateWishlistClient(wishlist, wishlistId, responseFields); client.WithContext(_apiContext); response = await client.ExecuteAsync(ct).ConfigureAwait(false); return(await response.ResultAsync()); }