From 46bda8c25c1534196d41a72617435988ab364c1d Mon Sep 17 00:00:00 2001 From: Eugeny Tatarincev Date: Wed, 6 Jun 2018 11:40:37 +0200 Subject: [PATCH] Changed logic equality logic https://github.com/VirtoCommerce/vc-storefront-core/issues/116 --- VirtoCommerce.Storefront.Model/Address.cs | 22 +- .../AutoRestClients/CartModuleApi.cs | 1601 ++++++++++++++++- .../AutoRestClients/CustomerModuleApi.cs | 20 +- .../Domain/Cart/CartBuilder.cs | 22 +- 4 files changed, 1570 insertions(+), 95 deletions(-) diff --git a/VirtoCommerce.Storefront.Model/Address.cs b/VirtoCommerce.Storefront.Model/Address.cs index 68fd4f4bc..21a32b3bb 100644 --- a/VirtoCommerce.Storefront.Model/Address.cs +++ b/VirtoCommerce.Storefront.Model/Address.cs @@ -1,6 +1,4 @@ -using System; using System.Collections.Generic; -using System.Linq; using System.ComponentModel.DataAnnotations; using VirtoCommerce.Storefront.Model.Common; @@ -34,5 +32,25 @@ public override string ToString() var retVal = string.Join(" ", FirstName, LastName, Organization, Line1, City, RegionName, PostalCode, CountryName); return retVal; } + + protected override IEnumerable GetEqualityComponents() + { + //Key and Name properties don't participate in equality + yield return Type; + yield return Organization; + yield return CountryCode; + yield return CountryName; + yield return PostalCode; + yield return Zip; + yield return Line1; + yield return Line2; + yield return RegionId; + yield return RegionName; + yield return FirstName; + yield return MiddleName; + yield return LastName; + yield return Phone; + yield return Email; + } } } diff --git a/VirtoCommerce.Storefront/AutoRestClients/CartModuleApi.cs b/VirtoCommerce.Storefront/AutoRestClients/CartModuleApi.cs index d312a6650..3f6139a61 100644 --- a/VirtoCommerce.Storefront/AutoRestClients/CartModuleApi.cs +++ b/VirtoCommerce.Storefront/AutoRestClients/CartModuleApi.cs @@ -1618,6 +1618,148 @@ public CartModule(VirtoCommerceCartRESTAPIdocumentation client) return _result; } + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> GetAvailableShippingRatesByContextWithHttpMessagesAsync(ShippingEvaluationContext context, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (context == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "context"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("context", context); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetAvailableShippingRatesByContext", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/carts/availshippingrates").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(context != null) + { + _requestContent = SafeJsonConvert.SerializeObject(context, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// /// @@ -3036,6 +3178,24 @@ public partial interface ICartModule /// Thrown when a required parameter is null /// Task>> GetAvailableShippingRatesWithHttpMessagesAsync(string cartId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> GetAvailableShippingRatesByContextWithHttpMessagesAsync(ShippingEvaluationContext context, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// /// @@ -3500,6 +3660,32 @@ public static IList GetAvailableShippingRates(this ICartModule ope } } + /// + /// The operations group for this extension method. + /// + /// + /// + public static IList GetAvailableShippingRatesByContext(this ICartModule operations, ShippingEvaluationContext context) + { + return operations.GetAvailableShippingRatesByContextAsync(context).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task> GetAvailableShippingRatesByContextAsync(this ICartModule operations, ShippingEvaluationContext context, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetAvailableShippingRatesByContextWithHttpMessagesAsync(context, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// The operations group for this extension method. /// @@ -3803,9 +3989,10 @@ public Address() /// Initializes a new instance of the Address class. /// /// Possible values include: 'Billing', - /// 'Shipping', 'BillingAndShipping' - public Address(string addressType = default(string), string name = default(string), string organization = default(string), string countryCode = default(string), string countryName = default(string), string city = default(string), string postalCode = default(string), string zip = default(string), string line1 = default(string), string line2 = default(string), string regionId = default(string), string regionName = default(string), string firstName = default(string), string middleName = default(string), string lastName = default(string), string phone = default(string), string email = default(string)) + /// 'Shipping', 'Pickup', 'BillingAndShipping' + public Address(string key = default(string), string addressType = default(string), string name = default(string), string organization = default(string), string countryCode = default(string), string countryName = default(string), string city = default(string), string postalCode = default(string), string zip = default(string), string line1 = default(string), string line2 = default(string), string regionId = default(string), string regionName = default(string), string firstName = default(string), string middleName = default(string), string lastName = default(string), string phone = default(string), string email = default(string)) { + Key = key; AddressType = addressType; Name = name; Organization = organization; @@ -3831,9 +4018,14 @@ public Address() /// partial void CustomInit(); + /// + /// + [JsonProperty(PropertyName = "key")] + public string Key { get; set; } + /// /// Gets or sets possible values include: 'Billing', 'Shipping', - /// 'BillingAndShipping' + /// 'Pickup', 'BillingAndShipping' /// [JsonProperty(PropertyName = "addressType")] public string AddressType { get; set; } @@ -5778,24 +5970,68 @@ namespace VirtoCommerce.Storefront.AutoRestClients.CartModuleApi.Models using VirtoCommerce.Storefront.AutoRestClients; using VirtoCommerce.Storefront.AutoRestClients.CartModuleApi; - public partial class DynamicExpression + public partial class ConstructorInfo { /// - /// Initializes a new instance of the DynamicExpression class. + /// Initializes a new instance of the ConstructorInfo class. /// - public DynamicExpression() + public ConstructorInfo() { CustomInit(); } /// - /// Initializes a new instance of the DynamicExpression class. - /// - public DynamicExpression(string id = default(string), IList availableChildren = default(IList), IList children = default(IList)) + /// Initializes a new instance of the ConstructorInfo class. + /// + /// Possible values include: 'Constructor', + /// 'Event', 'Field', 'Method', 'Property', 'TypeInfo', 'Custom', + /// 'NestedType', 'All' + /// Possible values include: + /// 'CodeTypeMask', 'IL', 'Native', 'OPTIL', 'Runtime', 'ManagedMask', + /// 'Unmanaged', 'Managed', 'ForwardRef', 'PreserveSig', + /// 'InternalCall', 'Synchronized', 'NoInlining', 'AggressiveInlining', + /// 'NoOptimization', 'MaxMethodImplVal' + /// Possible values include: + /// 'MemberAccessMask', 'PrivateScope', 'Private', 'FamANDAssem', + /// 'Assembly', 'Family', 'FamORAssem', 'Public', 'Static', 'Final', + /// 'Virtual', 'HideBySig', 'CheckAccessOnOverride', + /// 'VtableLayoutMask', 'ReuseSlot', 'NewSlot', 'Abstract', + /// 'SpecialName', 'PinvokeImpl', 'UnmanagedExport', 'RTSpecialName', + /// 'ReservedMask', 'HasSecurity', 'RequireSecObject' + /// Possible values include: + /// 'Standard', 'VarArgs', 'Any', 'HasThis', 'ExplicitThis' + public ConstructorInfo(string memberType = default(string), string methodImplementationFlags = default(string), object methodHandle = default(object), string attributes = default(string), string callingConvention = default(string), bool? isGenericMethodDefinition = default(bool?), bool? containsGenericParameters = default(bool?), bool? isGenericMethod = default(bool?), bool? isSecurityCritical = default(bool?), bool? isSecuritySafeCritical = default(bool?), bool? isSecurityTransparent = default(bool?), bool? isPublic = default(bool?), bool? isPrivate = default(bool?), bool? isFamily = default(bool?), bool? isAssembly = default(bool?), bool? isFamilyAndAssembly = default(bool?), bool? isFamilyOrAssembly = default(bool?), bool? isStatic = default(bool?), bool? isFinal = default(bool?), bool? isVirtual = default(bool?), bool? isHideBySig = default(bool?), bool? isAbstract = default(bool?), bool? isSpecialName = default(bool?), bool? isConstructor = default(bool?), string name = default(string), string declaringType = default(string), string reflectedType = default(string), IList customAttributes = default(IList), int? metadataToken = default(int?), object module = default(object)) { - Id = id; - AvailableChildren = availableChildren; - Children = children; + MemberType = memberType; + MethodImplementationFlags = methodImplementationFlags; + MethodHandle = methodHandle; + Attributes = attributes; + CallingConvention = callingConvention; + IsGenericMethodDefinition = isGenericMethodDefinition; + ContainsGenericParameters = containsGenericParameters; + IsGenericMethod = isGenericMethod; + IsSecurityCritical = isSecurityCritical; + IsSecuritySafeCritical = isSecuritySafeCritical; + IsSecurityTransparent = isSecurityTransparent; + IsPublic = isPublic; + IsPrivate = isPrivate; + IsFamily = isFamily; + IsAssembly = isAssembly; + IsFamilyAndAssembly = isFamilyAndAssembly; + IsFamilyOrAssembly = isFamilyOrAssembly; + IsStatic = isStatic; + IsFinal = isFinal; + IsVirtual = isVirtual; + IsHideBySig = isHideBySig; + IsAbstract = isAbstract; + IsSpecialName = isSpecialName; + IsConstructor = isConstructor; + Name = name; + DeclaringType = declaringType; + ReflectedType = reflectedType; + CustomAttributes = customAttributes; + MetadataToken = metadataToken; + Module = module; CustomInit(); } @@ -5805,100 +6041,1081 @@ public DynamicExpression() partial void CustomInit(); /// + /// Gets possible values include: 'Constructor', 'Event', 'Field', + /// 'Method', 'Property', 'TypeInfo', 'Custom', 'NestedType', 'All' /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } + [JsonProperty(PropertyName = "memberType")] + public string MemberType { get; private set; } /// + /// Gets possible values include: 'CodeTypeMask', 'IL', 'Native', + /// 'OPTIL', 'Runtime', 'ManagedMask', 'Unmanaged', 'Managed', + /// 'ForwardRef', 'PreserveSig', 'InternalCall', 'Synchronized', + /// 'NoInlining', 'AggressiveInlining', 'NoOptimization', + /// 'MaxMethodImplVal' /// - [JsonProperty(PropertyName = "availableChildren")] - public IList AvailableChildren { get; set; } + [JsonProperty(PropertyName = "methodImplementationFlags")] + public string MethodImplementationFlags { get; private set; } /// /// - [JsonProperty(PropertyName = "children")] - public IList Children { get; set; } + [JsonProperty(PropertyName = "methodHandle")] + public object MethodHandle { get; private set; } - } -} -// Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. + /// + /// Gets possible values include: 'MemberAccessMask', 'PrivateScope', + /// 'Private', 'FamANDAssem', 'Assembly', 'Family', 'FamORAssem', + /// 'Public', 'Static', 'Final', 'Virtual', 'HideBySig', + /// 'CheckAccessOnOverride', 'VtableLayoutMask', 'ReuseSlot', + /// 'NewSlot', 'Abstract', 'SpecialName', 'PinvokeImpl', + /// 'UnmanagedExport', 'RTSpecialName', 'ReservedMask', 'HasSecurity', + /// 'RequireSecObject' + /// + [JsonProperty(PropertyName = "attributes")] + public string Attributes { get; private set; } -namespace VirtoCommerce.Storefront.AutoRestClients.CartModuleApi.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - using VirtoCommerce.Storefront; - using VirtoCommerce.Storefront.AutoRestClients; - using VirtoCommerce.Storefront.AutoRestClients.CartModuleApi; + /// + /// Gets possible values include: 'Standard', 'VarArgs', 'Any', + /// 'HasThis', 'ExplicitThis' + /// + [JsonProperty(PropertyName = "callingConvention")] + public string CallingConvention { get; private set; } - public partial class ConditionExpressionTree - { /// - /// Initializes a new instance of the ConditionExpressionTree class. /// - public ConditionExpressionTree() - { - CustomInit(); - } + [JsonProperty(PropertyName = "isGenericMethodDefinition")] + public bool? IsGenericMethodDefinition { get; private set; } /// - /// Initializes a new instance of the ConditionExpressionTree class. /// - public ConditionExpressionTree(string id = default(string), IList availableChildren = default(IList), IList children = default(IList)) - { - Id = id; - AvailableChildren = availableChildren; - Children = children; - CustomInit(); - } + [JsonProperty(PropertyName = "containsGenericParameters")] + public bool? ContainsGenericParameters { get; private set; } /// - /// An initialization method that performs custom operations like setting defaults /// - partial void CustomInit(); + [JsonProperty(PropertyName = "isGenericMethod")] + public bool? IsGenericMethod { get; private set; } /// /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } + [JsonProperty(PropertyName = "isSecurityCritical")] + public bool? IsSecurityCritical { get; private set; } /// /// - [JsonProperty(PropertyName = "availableChildren")] - public IList AvailableChildren { get; set; } + [JsonProperty(PropertyName = "isSecuritySafeCritical")] + public bool? IsSecuritySafeCritical { get; private set; } /// /// - [JsonProperty(PropertyName = "children")] - public IList Children { get; set; } + [JsonProperty(PropertyName = "isSecurityTransparent")] + public bool? IsSecurityTransparent { get; private set; } - } -} -// Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. + /// + /// + [JsonProperty(PropertyName = "isPublic")] + public bool? IsPublic { get; private set; } -namespace VirtoCommerce.Storefront.AutoRestClients.CartModuleApi.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; + /// + /// + [JsonProperty(PropertyName = "isPrivate")] + public bool? IsPrivate { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "isFamily")] + public bool? IsFamily { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "isAssembly")] + public bool? IsAssembly { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "isFamilyAndAssembly")] + public bool? IsFamilyAndAssembly { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "isFamilyOrAssembly")] + public bool? IsFamilyOrAssembly { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "isStatic")] + public bool? IsStatic { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "isFinal")] + public bool? IsFinal { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "isVirtual")] + public bool? IsVirtual { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "isHideBySig")] + public bool? IsHideBySig { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "isAbstract")] + public bool? IsAbstract { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "isSpecialName")] + public bool? IsSpecialName { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "isConstructor")] + public bool? IsConstructor { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "declaringType")] + public string DeclaringType { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "reflectedType")] + public string ReflectedType { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "customAttributes")] + public IList CustomAttributes { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "metadataToken")] + public int? MetadataToken { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "module")] + public object Module { get; private set; } + + } +} +// Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace VirtoCommerce.Storefront.AutoRestClients.CartModuleApi.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + using VirtoCommerce.Storefront; + using VirtoCommerce.Storefront.AutoRestClients; + using VirtoCommerce.Storefront.AutoRestClients.CartModuleApi; + + public partial class CustomAttributeTypedArgument + { + /// + /// Initializes a new instance of the CustomAttributeTypedArgument + /// class. + /// + public CustomAttributeTypedArgument() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CustomAttributeTypedArgument + /// class. + /// + public CustomAttributeTypedArgument(string argumentType = default(string), object value = default(object)) + { + ArgumentType = argumentType; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "argumentType")] + public string ArgumentType { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "value")] + public object Value { get; private set; } + + } +} +// Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace VirtoCommerce.Storefront.AutoRestClients.CartModuleApi.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + using VirtoCommerce.Storefront; + using VirtoCommerce.Storefront.AutoRestClients; + using VirtoCommerce.Storefront.AutoRestClients.CartModuleApi; + + public partial class CustomAttributeNamedArgument + { + /// + /// Initializes a new instance of the CustomAttributeNamedArgument + /// class. + /// + public CustomAttributeNamedArgument() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CustomAttributeNamedArgument + /// class. + /// + public CustomAttributeNamedArgument(MemberInfo memberInfo = default(MemberInfo), CustomAttributeTypedArgument typedValue = default(CustomAttributeTypedArgument), string memberName = default(string), bool? isField = default(bool?)) + { + MemberInfo = memberInfo; + TypedValue = typedValue; + MemberName = memberName; + IsField = isField; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "memberInfo")] + public MemberInfo MemberInfo { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "typedValue")] + public CustomAttributeTypedArgument TypedValue { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "memberName")] + public string MemberName { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "isField")] + public bool? IsField { get; private set; } + + } +} +// Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace VirtoCommerce.Storefront.AutoRestClients.CartModuleApi.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + using VirtoCommerce.Storefront; + using VirtoCommerce.Storefront.AutoRestClients; + using VirtoCommerce.Storefront.AutoRestClients.CartModuleApi; + + public partial class CustomAttributeData + { + /// + /// Initializes a new instance of the CustomAttributeData class. + /// + public CustomAttributeData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CustomAttributeData class. + /// + public CustomAttributeData(string attributeType = default(string), ConstructorInfo constructor = default(ConstructorInfo), IList constructorArguments = default(IList), IList namedArguments = default(IList)) + { + AttributeType = attributeType; + Constructor = constructor; + ConstructorArguments = constructorArguments; + NamedArguments = namedArguments; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "attributeType")] + public string AttributeType { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "constructor")] + public ConstructorInfo Constructor { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "constructorArguments")] + public IList ConstructorArguments { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "namedArguments")] + public IList NamedArguments { get; private set; } + + } +} +// Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace VirtoCommerce.Storefront.AutoRestClients.CartModuleApi.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + using VirtoCommerce.Storefront; + using VirtoCommerce.Storefront.AutoRestClients; + using VirtoCommerce.Storefront.AutoRestClients.CartModuleApi; + + public partial class MemberInfo + { + /// + /// Initializes a new instance of the MemberInfo class. + /// + public MemberInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MemberInfo class. + /// + /// Possible values include: 'Constructor', + /// 'Event', 'Field', 'Method', 'Property', 'TypeInfo', 'Custom', + /// 'NestedType', 'All' + public MemberInfo(string memberType = default(string), string name = default(string), string declaringType = default(string), string reflectedType = default(string), IList customAttributes = default(IList), int? metadataToken = default(int?), object module = default(object)) + { + MemberType = memberType; + Name = name; + DeclaringType = declaringType; + ReflectedType = reflectedType; + CustomAttributes = customAttributes; + MetadataToken = metadataToken; + Module = module; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets possible values include: 'Constructor', 'Event', 'Field', + /// 'Method', 'Property', 'TypeInfo', 'Custom', 'NestedType', 'All' + /// + [JsonProperty(PropertyName = "memberType")] + public string MemberType { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "declaringType")] + public string DeclaringType { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "reflectedType")] + public string ReflectedType { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "customAttributes")] + public IList CustomAttributes { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "metadataToken")] + public int? MetadataToken { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "module")] + public object Module { get; private set; } + + } +} +// Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace VirtoCommerce.Storefront.AutoRestClients.CartModuleApi.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + using VirtoCommerce.Storefront; + using VirtoCommerce.Storefront.AutoRestClients; + using VirtoCommerce.Storefront.AutoRestClients.CartModuleApi; + + public partial class ParameterInfo + { + /// + /// Initializes a new instance of the ParameterInfo class. + /// + public ParameterInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ParameterInfo class. + /// + /// Possible values include: 'None', 'In', + /// 'Out', 'Lcid', 'Retval', 'Optional', 'ReservedMask', 'HasDefault', + /// 'HasFieldMarshal', 'Reserved3', 'Reserved4' + public ParameterInfo(string parameterType = default(string), string name = default(string), bool? hasDefaultValue = default(bool?), object defaultValue = default(object), object rawDefaultValue = default(object), int? position = default(int?), string attributes = default(string), MemberInfo member = default(MemberInfo), bool? isIn = default(bool?), bool? isOut = default(bool?), bool? isLcid = default(bool?), bool? isRetval = default(bool?), bool? isOptional = default(bool?), int? metadataToken = default(int?), IList customAttributes = default(IList)) + { + ParameterType = parameterType; + Name = name; + HasDefaultValue = hasDefaultValue; + DefaultValue = defaultValue; + RawDefaultValue = rawDefaultValue; + Position = position; + Attributes = attributes; + Member = member; + IsIn = isIn; + IsOut = isOut; + IsLcid = isLcid; + IsRetval = isRetval; + IsOptional = isOptional; + MetadataToken = metadataToken; + CustomAttributes = customAttributes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "parameterType")] + public string ParameterType { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "hasDefaultValue")] + public bool? HasDefaultValue { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "defaultValue")] + public object DefaultValue { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "rawDefaultValue")] + public object RawDefaultValue { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "position")] + public int? Position { get; private set; } + + /// + /// Gets possible values include: 'None', 'In', 'Out', 'Lcid', + /// 'Retval', 'Optional', 'ReservedMask', 'HasDefault', + /// 'HasFieldMarshal', 'Reserved3', 'Reserved4' + /// + [JsonProperty(PropertyName = "attributes")] + public string Attributes { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "member")] + public MemberInfo Member { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "isIn")] + public bool? IsIn { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "isOut")] + public bool? IsOut { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "isLcid")] + public bool? IsLcid { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "isRetval")] + public bool? IsRetval { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "isOptional")] + public bool? IsOptional { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "metadataToken")] + public int? MetadataToken { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "customAttributes")] + public IList CustomAttributes { get; private set; } + + } +} +// Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace VirtoCommerce.Storefront.AutoRestClients.CartModuleApi.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + using VirtoCommerce.Storefront; + using VirtoCommerce.Storefront.AutoRestClients; + using VirtoCommerce.Storefront.AutoRestClients.CartModuleApi; + + public partial class MethodInfo + { + /// + /// Initializes a new instance of the MethodInfo class. + /// + public MethodInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MethodInfo class. + /// + /// Possible values include: 'Constructor', + /// 'Event', 'Field', 'Method', 'Property', 'TypeInfo', 'Custom', + /// 'NestedType', 'All' + /// Possible values include: + /// 'CodeTypeMask', 'IL', 'Native', 'OPTIL', 'Runtime', 'ManagedMask', + /// 'Unmanaged', 'Managed', 'ForwardRef', 'PreserveSig', + /// 'InternalCall', 'Synchronized', 'NoInlining', 'AggressiveInlining', + /// 'NoOptimization', 'MaxMethodImplVal' + /// Possible values include: + /// 'MemberAccessMask', 'PrivateScope', 'Private', 'FamANDAssem', + /// 'Assembly', 'Family', 'FamORAssem', 'Public', 'Static', 'Final', + /// 'Virtual', 'HideBySig', 'CheckAccessOnOverride', + /// 'VtableLayoutMask', 'ReuseSlot', 'NewSlot', 'Abstract', + /// 'SpecialName', 'PinvokeImpl', 'UnmanagedExport', 'RTSpecialName', + /// 'ReservedMask', 'HasSecurity', 'RequireSecObject' + /// Possible values include: + /// 'Standard', 'VarArgs', 'Any', 'HasThis', 'ExplicitThis' + public MethodInfo(string memberType = default(string), string returnType = default(string), ParameterInfo returnParameter = default(ParameterInfo), object returnTypeCustomAttributes = default(object), string methodImplementationFlags = default(string), object methodHandle = default(object), string attributes = default(string), string callingConvention = default(string), bool? isGenericMethodDefinition = default(bool?), bool? containsGenericParameters = default(bool?), bool? isGenericMethod = default(bool?), bool? isSecurityCritical = default(bool?), bool? isSecuritySafeCritical = default(bool?), bool? isSecurityTransparent = default(bool?), bool? isPublic = default(bool?), bool? isPrivate = default(bool?), bool? isFamily = default(bool?), bool? isAssembly = default(bool?), bool? isFamilyAndAssembly = default(bool?), bool? isFamilyOrAssembly = default(bool?), bool? isStatic = default(bool?), bool? isFinal = default(bool?), bool? isVirtual = default(bool?), bool? isHideBySig = default(bool?), bool? isAbstract = default(bool?), bool? isSpecialName = default(bool?), bool? isConstructor = default(bool?), string name = default(string), string declaringType = default(string), string reflectedType = default(string), IList customAttributes = default(IList), int? metadataToken = default(int?), object module = default(object)) + { + MemberType = memberType; + ReturnType = returnType; + ReturnParameter = returnParameter; + ReturnTypeCustomAttributes = returnTypeCustomAttributes; + MethodImplementationFlags = methodImplementationFlags; + MethodHandle = methodHandle; + Attributes = attributes; + CallingConvention = callingConvention; + IsGenericMethodDefinition = isGenericMethodDefinition; + ContainsGenericParameters = containsGenericParameters; + IsGenericMethod = isGenericMethod; + IsSecurityCritical = isSecurityCritical; + IsSecuritySafeCritical = isSecuritySafeCritical; + IsSecurityTransparent = isSecurityTransparent; + IsPublic = isPublic; + IsPrivate = isPrivate; + IsFamily = isFamily; + IsAssembly = isAssembly; + IsFamilyAndAssembly = isFamilyAndAssembly; + IsFamilyOrAssembly = isFamilyOrAssembly; + IsStatic = isStatic; + IsFinal = isFinal; + IsVirtual = isVirtual; + IsHideBySig = isHideBySig; + IsAbstract = isAbstract; + IsSpecialName = isSpecialName; + IsConstructor = isConstructor; + Name = name; + DeclaringType = declaringType; + ReflectedType = reflectedType; + CustomAttributes = customAttributes; + MetadataToken = metadataToken; + Module = module; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets possible values include: 'Constructor', 'Event', 'Field', + /// 'Method', 'Property', 'TypeInfo', 'Custom', 'NestedType', 'All' + /// + [JsonProperty(PropertyName = "memberType")] + public string MemberType { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "returnType")] + public string ReturnType { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "returnParameter")] + public ParameterInfo ReturnParameter { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "returnTypeCustomAttributes")] + public object ReturnTypeCustomAttributes { get; private set; } + + /// + /// Gets possible values include: 'CodeTypeMask', 'IL', 'Native', + /// 'OPTIL', 'Runtime', 'ManagedMask', 'Unmanaged', 'Managed', + /// 'ForwardRef', 'PreserveSig', 'InternalCall', 'Synchronized', + /// 'NoInlining', 'AggressiveInlining', 'NoOptimization', + /// 'MaxMethodImplVal' + /// + [JsonProperty(PropertyName = "methodImplementationFlags")] + public string MethodImplementationFlags { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "methodHandle")] + public object MethodHandle { get; private set; } + + /// + /// Gets possible values include: 'MemberAccessMask', 'PrivateScope', + /// 'Private', 'FamANDAssem', 'Assembly', 'Family', 'FamORAssem', + /// 'Public', 'Static', 'Final', 'Virtual', 'HideBySig', + /// 'CheckAccessOnOverride', 'VtableLayoutMask', 'ReuseSlot', + /// 'NewSlot', 'Abstract', 'SpecialName', 'PinvokeImpl', + /// 'UnmanagedExport', 'RTSpecialName', 'ReservedMask', 'HasSecurity', + /// 'RequireSecObject' + /// + [JsonProperty(PropertyName = "attributes")] + public string Attributes { get; private set; } + + /// + /// Gets possible values include: 'Standard', 'VarArgs', 'Any', + /// 'HasThis', 'ExplicitThis' + /// + [JsonProperty(PropertyName = "callingConvention")] + public string CallingConvention { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "isGenericMethodDefinition")] + public bool? IsGenericMethodDefinition { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "containsGenericParameters")] + public bool? ContainsGenericParameters { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "isGenericMethod")] + public bool? IsGenericMethod { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "isSecurityCritical")] + public bool? IsSecurityCritical { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "isSecuritySafeCritical")] + public bool? IsSecuritySafeCritical { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "isSecurityTransparent")] + public bool? IsSecurityTransparent { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "isPublic")] + public bool? IsPublic { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "isPrivate")] + public bool? IsPrivate { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "isFamily")] + public bool? IsFamily { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "isAssembly")] + public bool? IsAssembly { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "isFamilyAndAssembly")] + public bool? IsFamilyAndAssembly { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "isFamilyOrAssembly")] + public bool? IsFamilyOrAssembly { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "isStatic")] + public bool? IsStatic { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "isFinal")] + public bool? IsFinal { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "isVirtual")] + public bool? IsVirtual { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "isHideBySig")] + public bool? IsHideBySig { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "isAbstract")] + public bool? IsAbstract { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "isSpecialName")] + public bool? IsSpecialName { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "isConstructor")] + public bool? IsConstructor { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "declaringType")] + public string DeclaringType { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "reflectedType")] + public string ReflectedType { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "customAttributes")] + public IList CustomAttributes { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "metadataToken")] + public int? MetadataToken { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "module")] + public object Module { get; private set; } + + } +} +// Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace VirtoCommerce.Storefront.AutoRestClients.CartModuleApi.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + using VirtoCommerce.Storefront; + using VirtoCommerce.Storefront.AutoRestClients; + using VirtoCommerce.Storefront.AutoRestClients.CartModuleApi; + + public partial class FuncIEvaluationContextBoolean + { + /// + /// Initializes a new instance of the FuncIEvaluationContextBoolean + /// class. + /// + public FuncIEvaluationContextBoolean() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FuncIEvaluationContextBoolean + /// class. + /// + public FuncIEvaluationContextBoolean(MethodInfo method = default(MethodInfo), object target = default(object)) + { + Method = method; + Target = target; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "method")] + public MethodInfo Method { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "target")] + public object Target { get; private set; } + + } +} +// Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace VirtoCommerce.Storefront.AutoRestClients.CartModuleApi.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + using VirtoCommerce.Storefront; + using VirtoCommerce.Storefront.AutoRestClients; + using VirtoCommerce.Storefront.AutoRestClients.CartModuleApi; + + public partial class DynamicExpression + { + /// + /// Initializes a new instance of the DynamicExpression class. + /// + public DynamicExpression() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DynamicExpression class. + /// + public DynamicExpression(string id = default(string), IList availableChildren = default(IList), IList children = default(IList)) + { + Id = id; + AvailableChildren = availableChildren; + Children = children; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// + [JsonProperty(PropertyName = "availableChildren")] + public IList AvailableChildren { get; set; } + + /// + /// + [JsonProperty(PropertyName = "children")] + public IList Children { get; set; } + + } +} +// Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace VirtoCommerce.Storefront.AutoRestClients.CartModuleApi.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + using VirtoCommerce.Storefront; + using VirtoCommerce.Storefront.AutoRestClients; + using VirtoCommerce.Storefront.AutoRestClients.CartModuleApi; + + public partial class ConditionExpressionTree + { + /// + /// Initializes a new instance of the ConditionExpressionTree class. + /// + public ConditionExpressionTree() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ConditionExpressionTree class. + /// + public ConditionExpressionTree(string id = default(string), IList availableChildren = default(IList), IList children = default(IList)) + { + Id = id; + AvailableChildren = availableChildren; + Children = children; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// + [JsonProperty(PropertyName = "availableChildren")] + public IList AvailableChildren { get; set; } + + /// + /// + [JsonProperty(PropertyName = "children")] + public IList Children { get; set; } + + } +} +// Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +namespace VirtoCommerce.Storefront.AutoRestClients.CartModuleApi.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; using System.Threading.Tasks; using VirtoCommerce.Storefront; using VirtoCommerce.Storefront.AutoRestClients; @@ -5917,7 +7134,7 @@ public PricelistAssignment() /// /// Initializes a new instance of the PricelistAssignment class. /// - public PricelistAssignment(string catalogId = default(string), string pricelistId = default(string), Pricelist pricelist = default(Pricelist), string name = default(string), string description = default(string), int? priority = default(int?), System.DateTime? startDate = default(System.DateTime?), System.DateTime? endDate = default(System.DateTime?), string conditionExpression = default(string), string predicateVisualTreeSerialized = default(string), object condition = default(object), ConditionExpressionTree dynamicExpression = default(ConditionExpressionTree), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) + public PricelistAssignment(string catalogId = default(string), string pricelistId = default(string), Pricelist pricelist = default(Pricelist), string name = default(string), string description = default(string), int? priority = default(int?), System.DateTime? startDate = default(System.DateTime?), System.DateTime? endDate = default(System.DateTime?), string conditionExpression = default(string), string predicateVisualTreeSerialized = default(string), FuncIEvaluationContextBoolean condition = default(FuncIEvaluationContextBoolean), ConditionExpressionTree dynamicExpression = default(ConditionExpressionTree), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { CatalogId = catalogId; PricelistId = pricelistId; @@ -5997,7 +7214,7 @@ public PricelistAssignment() /// /// [JsonProperty(PropertyName = "condition")] - public object Condition { get; set; } + public FuncIEvaluationContextBoolean Condition { get; set; } /// /// @@ -6263,6 +7480,105 @@ public Price() // Changes may cause incorrect behavior and will be lost if the code is // regenerated. +namespace VirtoCommerce.Storefront.AutoRestClients.CartModuleApi.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + using VirtoCommerce.Storefront; + using VirtoCommerce.Storefront.AutoRestClients; + using VirtoCommerce.Storefront.AutoRestClients.CartModuleApi; + + public partial class FulfillmentCenter + { + /// + /// Initializes a new instance of the FulfillmentCenter class. + /// + public FulfillmentCenter() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FulfillmentCenter class. + /// + public FulfillmentCenter(string name = default(string), string description = default(string), string geoLocation = default(string), Address address = default(Address), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) + { + Name = name; + Description = description; + GeoLocation = geoLocation; + Address = address; + CreatedDate = createdDate; + ModifiedDate = modifiedDate; + CreatedBy = createdBy; + ModifiedBy = modifiedBy; + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// + [JsonProperty(PropertyName = "geoLocation")] + public string GeoLocation { get; set; } + + /// + /// + [JsonProperty(PropertyName = "address")] + public Address Address { get; set; } + + /// + /// + [JsonProperty(PropertyName = "createdDate")] + public System.DateTime? CreatedDate { get; set; } + + /// + /// + [JsonProperty(PropertyName = "modifiedDate")] + public System.DateTime? ModifiedDate { get; set; } + + /// + /// + [JsonProperty(PropertyName = "createdBy")] + public string CreatedBy { get; set; } + + /// + /// + [JsonProperty(PropertyName = "modifiedBy")] + public string ModifiedBy { get; set; } + + /// + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + } +} +// Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + namespace VirtoCommerce.Storefront.AutoRestClients.CartModuleApi.Models { using Microsoft.Rest; @@ -6294,13 +7610,14 @@ public InventoryInfo() /// /// Possible values include: 'Disabled', /// 'Enabled', 'Ignored' - public InventoryInfo(System.DateTime? createdDate = default(System.DateTime?), string createdBy = default(string), System.DateTime? modifiedDate = default(System.DateTime?), string modifiedBy = default(string), string fulfillmentCenterId = default(string), string productId = default(string), long? inStockQuantity = default(long?), long? reservedQuantity = default(long?), long? reorderMinQuantity = default(long?), long? preorderQuantity = default(long?), long? backorderQuantity = default(long?), bool? allowBackorder = default(bool?), bool? allowPreorder = default(bool?), long? inTransit = default(long?), System.DateTime? preorderAvailabilityDate = default(System.DateTime?), System.DateTime? backorderAvailabilityDate = default(System.DateTime?), string status = default(string)) + public InventoryInfo(System.DateTime? createdDate = default(System.DateTime?), string createdBy = default(string), System.DateTime? modifiedDate = default(System.DateTime?), string modifiedBy = default(string), string fulfillmentCenterId = default(string), FulfillmentCenter fulfillmentCenter = default(FulfillmentCenter), string productId = default(string), long? inStockQuantity = default(long?), long? reservedQuantity = default(long?), long? reorderMinQuantity = default(long?), long? preorderQuantity = default(long?), long? backorderQuantity = default(long?), bool? allowBackorder = default(bool?), bool? allowPreorder = default(bool?), long? inTransit = default(long?), System.DateTime? preorderAvailabilityDate = default(System.DateTime?), System.DateTime? backorderAvailabilityDate = default(System.DateTime?), string status = default(string)) { CreatedDate = createdDate; CreatedBy = createdBy; ModifiedDate = modifiedDate; ModifiedBy = modifiedBy; FulfillmentCenterId = fulfillmentCenterId; + FulfillmentCenter = fulfillmentCenter; ProductId = productId; InStockQuantity = inStockQuantity; ReservedQuantity = reservedQuantity; @@ -6346,6 +7663,11 @@ public InventoryInfo() [JsonProperty(PropertyName = "fulfillmentCenterId")] public string FulfillmentCenterId { get; set; } + /// + /// + [JsonProperty(PropertyName = "fulfillmentCenter")] + public FulfillmentCenter FulfillmentCenter { get; set; } + /// /// [JsonProperty(PropertyName = "productId")] @@ -7229,7 +8551,7 @@ public LineItem() /// /// Initializes a new instance of the LineItem class. /// - public LineItem(string productId = default(string), CatalogProduct product = default(CatalogProduct), string catalogId = default(string), string categoryId = default(string), string sku = default(string), string productType = default(string), string name = default(string), int? quantity = default(int?), string fulfillmentLocationCode = default(string), string shipmentMethodCode = default(string), bool? requiredShipping = default(bool?), string thumbnailImageUrl = default(string), string imageUrl = default(string), bool? isGift = default(bool?), string currency = default(string), string languageCode = default(string), string note = default(string), bool? isReccuring = default(bool?), bool? taxIncluded = default(bool?), double? volumetricWeight = default(double?), string weightUnit = default(string), double? weight = default(double?), string measureUnit = default(string), double? height = default(double?), double? length = default(double?), double? width = default(double?), string validationType = default(string), bool? isReadOnly = default(bool?), string priceId = default(string), Price price = default(Price), double? listPrice = default(double?), double? listPriceWithTax = default(double?), double? salePrice = default(double?), double? salePriceWithTax = default(double?), double? placedPrice = default(double?), double? placedPriceWithTax = default(double?), double? extendedPrice = default(double?), double? extendedPriceWithTax = default(double?), double? discountAmount = default(double?), double? discountAmountWithTax = default(double?), double? discountTotal = default(double?), double? discountTotalWithTax = default(double?), double? fee = default(double?), double? feeWithTax = default(double?), IList discounts = default(IList), string taxType = default(string), double? taxTotal = default(double?), double? taxPercentRate = default(double?), IList taxDetails = default(IList), string objectType = default(string), IList dynamicProperties = default(IList), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) + public LineItem(string productId = default(string), CatalogProduct product = default(CatalogProduct), string catalogId = default(string), string categoryId = default(string), string sku = default(string), string productType = default(string), string name = default(string), int? quantity = default(int?), string fulfillmentCenterId = default(string), string fulfillmentCenterName = default(string), string fulfillmentLocationCode = default(string), string shipmentMethodCode = default(string), bool? requiredShipping = default(bool?), string thumbnailImageUrl = default(string), string imageUrl = default(string), bool? isGift = default(bool?), string currency = default(string), string languageCode = default(string), string note = default(string), bool? isReccuring = default(bool?), bool? taxIncluded = default(bool?), double? volumetricWeight = default(double?), string weightUnit = default(string), double? weight = default(double?), string measureUnit = default(string), double? height = default(double?), double? length = default(double?), double? width = default(double?), string validationType = default(string), bool? isReadOnly = default(bool?), string priceId = default(string), Price price = default(Price), double? listPrice = default(double?), double? listPriceWithTax = default(double?), double? salePrice = default(double?), double? salePriceWithTax = default(double?), double? placedPrice = default(double?), double? placedPriceWithTax = default(double?), double? extendedPrice = default(double?), double? extendedPriceWithTax = default(double?), double? discountAmount = default(double?), double? discountAmountWithTax = default(double?), double? discountTotal = default(double?), double? discountTotalWithTax = default(double?), double? fee = default(double?), double? feeWithTax = default(double?), IList discounts = default(IList), string taxType = default(string), double? taxTotal = default(double?), double? taxPercentRate = default(double?), IList taxDetails = default(IList), string objectType = default(string), IList dynamicProperties = default(IList), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { ProductId = productId; Product = product; @@ -7239,6 +8561,8 @@ public LineItem() ProductType = productType; Name = name; Quantity = quantity; + FulfillmentCenterId = fulfillmentCenterId; + FulfillmentCenterName = fulfillmentCenterName; FulfillmentLocationCode = fulfillmentLocationCode; ShipmentMethodCode = shipmentMethodCode; RequiredShipping = requiredShipping; @@ -7335,6 +8659,16 @@ public LineItem() [JsonProperty(PropertyName = "quantity")] public int? Quantity { get; set; } + /// + /// + [JsonProperty(PropertyName = "fulfillmentCenterId")] + public string FulfillmentCenterId { get; set; } + + /// + /// + [JsonProperty(PropertyName = "fulfillmentCenterName")] + public string FulfillmentCenterName { get; set; } + /// /// [JsonProperty(PropertyName = "fulfillmentLocationCode")] @@ -7610,7 +8944,7 @@ public Payment() /// /// Initializes a new instance of the Payment class. /// - public Payment(string outerId = default(string), string currency = default(string), string paymentGatewayCode = default(string), double? amount = default(double?), Address billingAddress = default(Address), double? price = default(double?), double? priceWithTax = default(double?), double? total = default(double?), double? totalWithTax = default(double?), double? discountAmount = default(double?), double? discountAmountWithTax = default(double?), string taxType = default(string), double? taxTotal = default(double?), double? taxPercentRate = default(double?), IList discounts = default(IList), IList taxDetails = default(IList), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) + public Payment(string outerId = default(string), string currency = default(string), string paymentGatewayCode = default(string), double? amount = default(double?), Address billingAddress = default(Address), double? price = default(double?), double? priceWithTax = default(double?), double? total = default(double?), double? totalWithTax = default(double?), double? discountAmount = default(double?), double? discountAmountWithTax = default(double?), string taxType = default(string), double? taxTotal = default(double?), double? taxPercentRate = default(double?), IList discounts = default(IList), IList taxDetails = default(IList), string objectType = default(string), IList dynamicProperties = default(IList), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { OuterId = outerId; Currency = currency; @@ -7628,6 +8962,8 @@ public Payment() TaxPercentRate = taxPercentRate; Discounts = discounts; TaxDetails = taxDetails; + ObjectType = objectType; + DynamicProperties = dynamicProperties; CreatedDate = createdDate; ModifiedDate = modifiedDate; CreatedBy = createdBy; @@ -7721,6 +9057,16 @@ public Payment() [JsonProperty(PropertyName = "taxDetails")] public IList TaxDetails { get; set; } + /// + /// + [JsonProperty(PropertyName = "objectType")] + public string ObjectType { get; set; } + + /// + /// + [JsonProperty(PropertyName = "dynamicProperties")] + public IList DynamicProperties { get; set; } + /// /// [JsonProperty(PropertyName = "createdDate")] @@ -7880,10 +9226,12 @@ public Shipment() /// /// Initializes a new instance of the Shipment class. /// - public Shipment(string shipmentMethodCode = default(string), string shipmentMethodOption = default(string), string warehouseLocation = default(string), string currency = default(string), double? volumetricWeight = default(double?), string weightUnit = default(string), double? weight = default(double?), string measureUnit = default(string), double? height = default(double?), double? length = default(double?), double? width = default(double?), double? price = default(double?), double? priceWithTax = default(double?), double? total = default(double?), double? totalWithTax = default(double?), double? discountAmount = default(double?), double? discountAmountWithTax = default(double?), double? fee = default(double?), double? feeWithTax = default(double?), string taxType = default(string), double? taxTotal = default(double?), double? taxPercentRate = default(double?), Address deliveryAddress = default(Address), IList items = default(IList), IList discounts = default(IList), IList taxDetails = default(IList), string id = default(string)) + public Shipment(string shipmentMethodCode = default(string), string shipmentMethodOption = default(string), string fulfillmentCenterId = default(string), string fulfillmentCenterName = default(string), string warehouseLocation = default(string), string currency = default(string), double? volumetricWeight = default(double?), string weightUnit = default(string), double? weight = default(double?), string measureUnit = default(string), double? height = default(double?), double? length = default(double?), double? width = default(double?), double? price = default(double?), double? priceWithTax = default(double?), double? total = default(double?), double? totalWithTax = default(double?), double? discountAmount = default(double?), double? discountAmountWithTax = default(double?), double? fee = default(double?), double? feeWithTax = default(double?), string taxType = default(string), double? taxTotal = default(double?), double? taxPercentRate = default(double?), Address deliveryAddress = default(Address), IList items = default(IList), IList discounts = default(IList), IList taxDetails = default(IList), string objectType = default(string), IList dynamicProperties = default(IList), string id = default(string)) { ShipmentMethodCode = shipmentMethodCode; ShipmentMethodOption = shipmentMethodOption; + FulfillmentCenterId = fulfillmentCenterId; + FulfillmentCenterName = fulfillmentCenterName; WarehouseLocation = warehouseLocation; Currency = currency; VolumetricWeight = volumetricWeight; @@ -7908,6 +9256,8 @@ public Shipment() Items = items; Discounts = discounts; TaxDetails = taxDetails; + ObjectType = objectType; + DynamicProperties = dynamicProperties; Id = id; CustomInit(); } @@ -7927,6 +9277,16 @@ public Shipment() [JsonProperty(PropertyName = "shipmentMethodOption")] public string ShipmentMethodOption { get; set; } + /// + /// + [JsonProperty(PropertyName = "fulfillmentCenterId")] + public string FulfillmentCenterId { get; set; } + + /// + /// + [JsonProperty(PropertyName = "fulfillmentCenterName")] + public string FulfillmentCenterName { get; set; } + /// /// [JsonProperty(PropertyName = "warehouseLocation")] @@ -8047,6 +9407,16 @@ public Shipment() [JsonProperty(PropertyName = "taxDetails")] public IList TaxDetails { get; set; } + /// + /// + [JsonProperty(PropertyName = "objectType")] + public string ObjectType { get; set; } + + /// + /// + [JsonProperty(PropertyName = "dynamicProperties")] + public IList DynamicProperties { get; set; } + /// /// [JsonProperty(PropertyName = "id")] @@ -8825,6 +10195,57 @@ public ShippingRate() // Changes may cause incorrect behavior and will be lost if the code is // regenerated. +namespace VirtoCommerce.Storefront.AutoRestClients.CartModuleApi.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + using VirtoCommerce.Storefront; + using VirtoCommerce.Storefront.AutoRestClients; + using VirtoCommerce.Storefront.AutoRestClients.CartModuleApi; + + public partial class ShippingEvaluationContext + { + /// + /// Initializes a new instance of the ShippingEvaluationContext class. + /// + public ShippingEvaluationContext() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ShippingEvaluationContext class. + /// + public ShippingEvaluationContext(ShoppingCart shoppingCart = default(ShoppingCart)) + { + ShoppingCart = shoppingCart; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "shoppingCart")] + public ShoppingCart ShoppingCart { get; set; } + + } +} +// Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + namespace VirtoCommerce.Storefront.AutoRestClients.CartModuleApi.Models { using Microsoft.Rest; @@ -9099,7 +10520,7 @@ public ShoppingCartSearchCriteria() /// /// Initializes a new instance of the ShoppingCartSearchCriteria class. /// - public ShoppingCartSearchCriteria(string name = default(string), string keyword = default(string), string customerId = default(string), string storeId = default(string), string currency = default(string), string status = default(string), string type = default(string), string responseGroup = default(string), string objectType = default(string), IList objectTypes = default(IList), IList objectIds = default(IList), string searchPhrase = default(string), string languageCode = default(string), string sort = default(string), IList sortInfos = default(IList), int? skip = default(int?), int? take = default(int?)) + public ShoppingCartSearchCriteria(string name = default(string), string keyword = default(string), string customerId = default(string), string storeId = default(string), string currency = default(string), string status = default(string), string type = default(string), IList customerIds = default(IList), string organizationId = default(string), string responseGroup = default(string), string objectType = default(string), IList objectTypes = default(IList), IList objectIds = default(IList), string searchPhrase = default(string), string languageCode = default(string), string sort = default(string), IList sortInfos = default(IList), int? skip = default(int?), int? take = default(int?)) { Name = name; Keyword = keyword; @@ -9108,6 +10529,8 @@ public ShoppingCartSearchCriteria() Currency = currency; Status = status; Type = type; + CustomerIds = customerIds; + OrganizationId = organizationId; ResponseGroup = responseGroup; ObjectType = objectType; ObjectTypes = objectTypes; @@ -9161,6 +10584,16 @@ public ShoppingCartSearchCriteria() [JsonProperty(PropertyName = "type")] public string Type { get; set; } + /// + /// + [JsonProperty(PropertyName = "customerIds")] + public IList CustomerIds { get; set; } + + /// + /// + [JsonProperty(PropertyName = "organizationId")] + public string OrganizationId { get; set; } + /// /// [JsonProperty(PropertyName = "responseGroup")] diff --git a/VirtoCommerce.Storefront/AutoRestClients/CustomerModuleApi.cs b/VirtoCommerce.Storefront/AutoRestClients/CustomerModuleApi.cs index 74cc30e25..ed60d3d1e 100644 --- a/VirtoCommerce.Storefront/AutoRestClients/CustomerModuleApi.cs +++ b/VirtoCommerce.Storefront/AutoRestClients/CustomerModuleApi.cs @@ -5499,7 +5499,7 @@ public Address() /// Initializes a new instance of the Address class. /// /// Possible values include: 'Billing', - /// 'Shipping', 'BillingAndShipping' + /// 'Shipping', 'Pickup', 'BillingAndShipping' public Address(string key = default(string), string addressType = default(string), string name = default(string), string organization = default(string), string countryCode = default(string), string countryName = default(string), string city = default(string), string postalCode = default(string), string zip = default(string), string line1 = default(string), string line2 = default(string), string regionId = default(string), string regionName = default(string), string firstName = default(string), string middleName = default(string), string lastName = default(string), string phone = default(string), string email = default(string)) { Key = key; @@ -5535,7 +5535,7 @@ public Address() /// /// Gets or sets possible values include: 'Billing', 'Shipping', - /// 'BillingAndShipping' + /// 'Pickup', 'BillingAndShipping' /// [JsonProperty(PropertyName = "addressType")] public string AddressType { get; set; } @@ -6827,7 +6827,7 @@ public ApiAccount() /// /// Possible values include: 'Undefined', /// 'Hmac', 'Simple' - public ApiAccount(string id = default(string), string name = default(string), string apiAccountType = default(string), bool? isActive = default(bool?), string appId = default(string), string secretKey = default(string)) + public ApiAccount(string id = default(string), string name = default(string), string apiAccountType = default(string), bool? isActive = default(bool?), string appId = default(string), string secretKey = default(string), bool? forceSecretKeyChange = default(bool?)) { Id = id; Name = name; @@ -6835,6 +6835,7 @@ public ApiAccount() IsActive = isActive; AppId = appId; SecretKey = secretKey; + ForceSecretKeyChange = forceSecretKeyChange; CustomInit(); } @@ -6874,6 +6875,11 @@ public ApiAccount() [JsonProperty(PropertyName = "secretKey")] public string SecretKey { get; set; } + /// + /// + [JsonProperty(PropertyName = "forceSecretKeyChange")] + public bool? ForceSecretKeyChange { get; set; } + } } // Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0 @@ -7014,7 +7020,7 @@ public ApplicationUserExtended() /// /// Possible values include: 'PendingApproval', /// 'Approved', 'Rejected' - public ApplicationUserExtended(string id = default(string), string userName = default(string), string email = default(string), string phoneNumber = default(string), bool? emailConfirmed = default(bool?), bool? phoneNumberConfirmed = default(bool?), bool? twoFactorEnabled = default(bool?), System.DateTime? lockoutEndDateUtc = default(System.DateTime?), bool? lockoutEnabled = default(bool?), int? accessFailedCount = default(int?), string storeId = default(string), string memberId = default(string), string icon = default(string), bool? isAdministrator = default(bool?), string userType = default(string), string userState = default(string), string password = default(string), string passwordHash = default(string), string securityStamp = default(string), IList logins = default(IList), IList roles = default(IList), IList permissions = default(IList), IList apiAccounts = default(IList), IList operationsLog = default(IList)) + public ApplicationUserExtended(string id = default(string), string userName = default(string), string email = default(string), string phoneNumber = default(string), bool? emailConfirmed = default(bool?), bool? phoneNumberConfirmed = default(bool?), bool? twoFactorEnabled = default(bool?), System.DateTime? lockoutEndDateUtc = default(System.DateTime?), bool? lockoutEnabled = default(bool?), int? accessFailedCount = default(int?), string storeId = default(string), string memberId = default(string), string icon = default(string), bool? isAdministrator = default(bool?), string userType = default(string), string userState = default(string), string password = default(string), bool? forcePasswordChange = default(bool?), string passwordHash = default(string), string securityStamp = default(string), IList logins = default(IList), IList roles = default(IList), IList permissions = default(IList), IList apiAccounts = default(IList), IList operationsLog = default(IList)) { Id = id; UserName = userName; @@ -7033,6 +7039,7 @@ public ApplicationUserExtended() UserType = userType; UserState = userState; Password = password; + ForcePasswordChange = forcePasswordChange; PasswordHash = passwordHash; SecurityStamp = securityStamp; Logins = logins; @@ -7135,6 +7142,11 @@ public ApplicationUserExtended() [JsonProperty(PropertyName = "password")] public string Password { get; set; } + /// + /// + [JsonProperty(PropertyName = "forcePasswordChange")] + public bool? ForcePasswordChange { get; set; } + /// /// [JsonProperty(PropertyName = "passwordHash")] diff --git a/VirtoCommerce.Storefront/Domain/Cart/CartBuilder.cs b/VirtoCommerce.Storefront/Domain/Cart/CartBuilder.cs index 7d26069ae..0576e8c2b 100644 --- a/VirtoCommerce.Storefront/Domain/Cart/CartBuilder.cs +++ b/VirtoCommerce.Storefront/Domain/Cart/CartBuilder.cs @@ -54,7 +54,7 @@ public CartBuilder(IWorkContextAccessor workContextAccessor, ICartService cartSe public virtual async Task TakeCartAsync(ShoppingCart cart) { var store = _workContextAccessor.WorkContext.AllStores.FirstOrDefault(x => x.Id.EqualsInvariant(cart.StoreId)); - if(store == null) + if (store == null) { throw new StorefrontException($"{ nameof(cart.StoreId) } not found"); } @@ -196,8 +196,15 @@ public virtual async Task AddOrUpdateShipmentAsync(Shipment shipment) await RemoveExistingShipmentAsync(shipment); shipment.Currency = Cart.Currency; + if (shipment.DeliveryAddress != null) + { + //Reset address key because it can equal a customer address from profile and if not do that it may cause + //address primary key duplication error for multiple carts with the same address + shipment.DeliveryAddress.Key = null; + } Cart.Shipments.Add(shipment); + if (!string.IsNullOrEmpty(shipment.ShipmentMethodCode)) { var availableShippingMethods = await GetAvailableShippingMethodsAsync(); @@ -230,7 +237,12 @@ public virtual async Task AddOrUpdatePaymentAsync(Payment payment) EnsureCartExists(); await RemoveExistingPaymentAsync(payment); - + if (payment.BillingAddress != null) + { + //Reset address key because it can equal a customer address from profile and if not do that it may cause + //address primary key duplication error for multiple carts with the same address + payment.BillingAddress.Key = null; + } Cart.Payments.Add(payment); if (!string.IsNullOrEmpty(payment.PaymentGatewayCode)) @@ -357,7 +369,7 @@ public virtual async Task> GetAvailableShippingMetho //Request available shipping rates var retVal = await _cartService.GetAvailableShippingMethodsAsync(Cart); - + //Evaluate promotions cart and apply rewards for available shipping methods var promoEvalContext = Cart.ToPromotionEvaluationContext(); await _promotionEvaluator.EvaluateDiscountsAsync(promoEvalContext, retVal); @@ -407,7 +419,7 @@ public virtual async Task EvaluatePromotionsAsync() //Get product inventory to fill InStockQuantity parameter of LineItem //required for some promotions evaluation - foreach (var lineItem in Cart.Items.Where(x=>x.Product != null).ToList()) + foreach (var lineItem in Cart.Items.Where(x => x.Product != null).ToList()) { lineItem.InStockQuantity = (int)lineItem.Product.AvailableQuantity; } @@ -596,7 +608,7 @@ protected virtual void EnsureCartExists() protected virtual async Task PrepareCartAsync(ShoppingCart cart, Store store) { - if(cart == null) + if (cart == null) { throw new ArgumentNullException(nameof(cart)); }