Пример #1
0
        public CheckResult Check(IUnitOfWork db,
                                 DTOMarketOrder order,
                                 IList <ListingOrderDTO> items,
                                 AddressValidationStatus addressValidationStatus)
        {
            if (order.Id == 0)
            {
                throw new ArgumentOutOfRangeException("order.Id", "Should be non zero");
            }

            if (order.OrderStatus == OrderStatusEnumEx.Pending)
            {
                throw new ArgumentException("order.OrderStatus", "Not supported status Pending");
            }

            if (ShippingUtils.IsLatvia(order.FinalShippingCountry))
            {
                if ((order.ShippingZip ?? "").Contains("LV-"))
                {
                    return(new CheckResult()
                    {
                        IsSuccess = true,
                        AdditionalData = new[] { (order.ShippingZip ?? "").Replace("LV-", "LV") }
                    });
                }
            }

            return(new CheckResult()
            {
                IsSuccess = false
            });
        }