Ejemplo n.º 1
0
        /// <summary>
        /// Get the Shipping methods available for a shipment.
        /// The Cost and Expected Delivery Date are calculated in overture.
        /// </summary>
        /// <param name="param"></param>
        /// <returns>The ShippingMethodsViewModel</returns>
        /// <remarks>This cannot be cached because Overture may include custom logic depending on the current cart state.</remarks>
        public virtual Task <List <FulfillmentMethod> > GetCalculatedFulfillmentMethods(GetShippingMethodsParam param)
        {
            if (param == null)
            {
                throw new ArgumentNullException(nameof(param));
            }
            if (string.IsNullOrWhiteSpace(param.CartName))
            {
                throw new ArgumentException(GetMessageOfNullWhiteSpace(nameof(param.CartName)), nameof(param));
            }
            if (string.IsNullOrWhiteSpace(param.Scope))
            {
                throw new ArgumentException(GetMessageOfNullWhiteSpace(nameof(param.Scope)), nameof(param));
            }
            if (param.CustomerId == Guid.Empty)
            {
                throw new ArgumentException(GetMessageOfEmpty(nameof(param.CustomerId)), nameof(param));
            }
            if (param.CultureInfo == null)
            {
                throw new ArgumentException(GetMessageOfNull(nameof(param.CultureInfo)), nameof(param));
            }

            var request = new FindCalculatedFulfillmentMethodsRequest
            {
                CartName   = param.CartName,
                CustomerId = param.CustomerId,
                ScopeId    = param.Scope,
                ShipmentId = param.ShipmentId
            };

            return(OvertureClient.SendAsync(request));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Get the Shipping methods available for a shipment.
        /// The Cost and Expected Delivery Date are calculated in overture.
        /// </summary>
        /// <param name="param"></param>
        /// <returns>The ShippingMethodsViewModel</returns>
        /// <remarks>This cannot be cached because Overture may include custom logic depending on the current cart state.</remarks>
        public virtual Task <List <FulfillmentMethod> > GetCalculatedFulfillmentMethods(GetShippingMethodsParam param)
        {
            if (param == null)
            {
                throw new ArgumentNullException("param");
            }
            if (string.IsNullOrWhiteSpace(param.CartName))
            {
                throw new ArgumentException(ArgumentNullMessageFormatter.FormatErrorMessage("CartName"), "param");
            }
            if (string.IsNullOrWhiteSpace(param.Scope))
            {
                throw new ArgumentException(ArgumentNullMessageFormatter.FormatErrorMessage("Scope"), "param");
            }
            if (param.CustomerId == Guid.Empty)
            {
                throw new ArgumentException(ArgumentNullMessageFormatter.FormatErrorMessage("CustomerId"), "param");
            }
            if (param.CultureInfo == null)
            {
                throw new ArgumentException(ArgumentNullMessageFormatter.FormatErrorMessage("CultureInfo"), "param");
            }

            var request = new FindCalculatedFulfillmentMethodsRequest
            {
                CartName   = param.CartName,
                CustomerId = param.CustomerId,
                ScopeId    = param.Scope,
                ShipmentId = param.ShipmentId
            };

            return(OvertureClient.SendAsync(request));
        }