Example #1
0
        public virtual async Task <HttpWebResponse> RemoveRecurringCartLineItemAsync(RemoveRecurringCartLineItemParam param)
        {
            if (param == null)
            {
                throw new ArgumentNullException(nameof(param));
            }

            var request = new DeleteRecurringCartLineItemsRequest()
            {
                CustomerId  = param.CustomerId,
                ScopeId     = param.Scope,
                LineItemIds = new List <Guid>()
                {
                    param.LineItemId
                }
            };

            return(await OvertureClient.SendAsync(request).ConfigureAwait(false));
        }
        public virtual async Task <CartViewModel> RemoveLineItemAsync(RemoveRecurringCartLineItemParam param)
        {
            if (!RecurringOrdersSettings.Enabled)
            {
                return(GetEmptyRecurringOrderCartViewModel());
            }

            if (param == null)
            {
                throw new ArgumentNullException(nameof(param), ArgumentNullMessageFormatter.FormatErrorMessage(nameof(param)));
            }
            if (string.IsNullOrWhiteSpace(param.Scope))
            {
                throw new ArgumentNullException(nameof(param.Scope), ArgumentNullMessageFormatter.FormatErrorMessage(nameof(param.Scope)));
            }
            if (param.CultureInfo == null)
            {
                throw new ArgumentNullException(nameof(param.CultureInfo), ArgumentNullMessageFormatter.FormatErrorMessage(nameof(param.CultureInfo)));
            }
            if (param.LineItemId == Guid.Empty)
            {
                throw new ArgumentNullException(nameof(param.LineItemId), ArgumentNullMessageFormatter.FormatErrorMessage(nameof(param.LineItemId)));
            }
            if (param.CustomerId == Guid.Empty)
            {
                throw new ArgumentNullException(nameof(param.CustomerId), ArgumentNullMessageFormatter.FormatErrorMessage(nameof(param.CustomerId)));
            }

            await CartRepository.RemoveRecurringCartLineItemAsync(param).ConfigureAwait(false);

            return(await GetRecurringOrderCartViewModelAsync(new GetRecurringOrderCartViewModelParam
            {
                CartName = param.CartName,
                CultureInfo = param.CultureInfo,
                BaseUrl = param.BaseUrl,
                CustomerId = param.CustomerId,
                Scope = param.Scope
            }));
        }
 public Task <HttpWebResponse> RemoveRecurringCartLineItemAsync(RemoveRecurringCartLineItemParam param)
 {
     throw new NotImplementedException();
 }