Ejemplo n.º 1
0
        /// <summary>
        /// Delete a cart
        /// </summary>
        /// <param name="param">Parameters to be used for deleting</param>
        /// <returns>Http web response of deleting operation</returns>
        public virtual async Task <HttpWebResponse> DeleteCartAsync(DeleteCartParam param)
        {
            if (param == null)
            {
                throw new ArgumentNullException(nameof(param));
            }
            if (string.IsNullOrWhiteSpace(param.Scope))
            {
                throw new ArgumentException(GetMessageOfNullWhiteSpace(nameof(param.Scope)), nameof(param));
            }
            if (param.CultureInfo == null)
            {
                throw new ArgumentException(GetMessageOfNull(nameof(param.CultureInfo)), nameof(param));
            }
            if (string.IsNullOrWhiteSpace(param.CartName))
            {
                throw new ArgumentException(GetMessageOfNullWhiteSpace(nameof(param.CartName)), nameof(param));
            }
            if (param.CustomerId == Guid.Empty)
            {
                throw new ArgumentException(GetMessageOfEmpty(nameof(param.CustomerId)), nameof(param));
            }

            DeleteCartRequest request = new DeleteCartRequest
            {
                CartName    = param.CartName,
                CultureName = param.CultureInfo.Name,
                CustomerId  = param.CustomerId,
                ScopeId     = param.Scope
            };
            CacheKey cacheKey = BuildCartCacheKey(param.Scope, param.CustomerId, param.CartName);
            await CacheProvider.RemoveAsync(cacheKey);

            return(await OvertureClient.SendAsync(request));
        }
Ejemplo n.º 2
0
 public Task <HttpWebResponse> DeleteCartAsync(DeleteCartParam param) => throw new NotImplementedException();