Exemplo n.º 1
0
        private static ServiceProvider.OrderSvc.ShippingInfo GetCustomerShippingInfo(ServiceProvider.OrderSvc.Address address, string warehouseCode, InvoiceModel invoice, string shippingMethodId)
        {
            var customerShippingInfo = new ServiceProvider.OrderSvc.CustomerShippingInfo_V01
            {
                Address       = address,
                ShippingSpeed = ServiceProvider.OrderSvc.CustomerShippingMethod.Regular,
                WarehouseCode = warehouseCode,
                Recipient     = new ServiceProvider.OrderSvc.Name_V01 {
                    First = invoice.FirstName, Last = invoice.LastName
                },
                Carrier          = ServiceProvider.OrderSvc.CustomerShippingCarrier.None,
                Phone            = invoice.Phone,
                ShippingMethodId = shippingMethodId
            };

            return(customerShippingInfo);
        }
 public static Address_V01 ConvertAddressViewModelToAddress(ServiceProvider.OrderSvc.Address address)
 {
     if (null == address)
     {
         return(null);
     }
     return(new Address_V01
     {
         City = address.City,
         StateProvinceTerritory = address.StateProvinceTerritory,
         Country = address.Country,
         CountyDistrict = address.CountyDistrict,
         Line1 = address.Line1,
         PostalCode = address.PostalCode,
         Line2 = address.Line2,
         Line3 = address.Line3,
         Line4 = address.Line4
     });
 }
Exemplo n.º 3
0
 public string GetShipToTaxAreaId(ServiceProvider.OrderSvc.Address address)
 {
     return(OrderProvider.GetShipToTaxAreaId(address));
 }
Exemplo n.º 4
0
        public virtual ServiceProvider.OrderSvc.CustomerOrder_V01 ConvertToCustomerOrder(InvoiceModel invoice, string memberId,
                                                                                         string countryCode, ServiceProvider.OrderSvc.Address address, string warehouseCode, string shippingMethodId)
        {
            var customerOrder = new ServiceProvider.OrderSvc.CustomerOrder_V01
            {
                DistributorID     = memberId,
                ProcessingCountry = countryCode,
                OrderItems        = new ServiceProvider.OrderSvc.OrderItems()
            };

            foreach (var customerOrderItem in invoice.InvoiceLines.Select(invoiceLine => new ServiceProvider.OrderSvc.CustomerOrderItem_V01
            {
                Quantity = invoiceLine.Quantity,
                SKU = invoiceLine.Sku,
                RetailPrice = invoiceLine.CalcDiscountedAmount,
                StockingSKU = invoiceLine.StockingSku,
                TaxCategory = invoiceLine.ProductCategory,
                FreightCharge = invoiceLine.FreightCharge
            }))
            {
                customerOrder.OrderItems.Add(customerOrderItem);
            }

            customerOrder.Shipping = GetCustomerShippingInfo(address, warehouseCode, invoice, shippingMethodId);
            return(customerOrder);
        }
Exemplo n.º 5
0
        private static ServiceProvider.OrderSvc.ShippingInfo GetDistributorShippingInfo(ServiceProvider.OrderSvc.Address address, string warehouseCode,
                                                                                        InvoiceModel invoice,
                                                                                        string shippingMethodId)
        {
            var shipping = new ServiceProvider.OrderSvc.ShippingInfo_V01
            {
                FreightVariant   = string.Empty,
                ShippingMethodID = shippingMethodId,
                WarehouseCode    = warehouseCode,
                Address          = address,
                Recipient        = invoice.FirstName,
                Phone            = invoice.Phone
            };

            return(shipping);
        }
Exemplo n.º 6
0
        public virtual ServiceProvider.OrderSvc.Order_V01 ConvertToDistributorrOrder(InvoiceModel invoice, string memberId,
                                                                                     string countryCode, ServiceProvider.OrderSvc.Address address, string warehouseCode, string shippingMethodId, decimal discoount)
        {
            var distributorOrder = new ServiceProvider.OrderSvc.Order_V01
            {
                DistributorID       = memberId,
                CountryOfProcessing = countryCode,
                OrderMonth          = DateUtils.GetCurrentLocalTime(countryCode).ToString("yyMM"),
                InputMethod         = ServiceProvider.OrderSvc.InputMethodType.Internet,
                ReceivedDate        = DateUtils.GetCurrentLocalTime(countryCode),
                OrderCategory       = ServiceProvider.OrderSvc.OrderCategoryType.RSO,
                UseSlidingScale     = true,
                DiscountPercentage  = discoount,
                OrderItems          = new ServiceProvider.OrderSvc.OrderItems()
            };

            foreach (var distributorOrderItem in invoice.InvoiceLines.OrderByDescending(i => i.Quantity).Select(invoiceLine => new ServiceProvider.OrderSvc.OrderItem_V01
            {
                Quantity = invoiceLine.Quantity,
                SKU = invoiceLine.Sku
            }))
            {
                distributorOrder.OrderItems.Add(distributorOrderItem);
            }

            distributorOrder.Shipment = GetDistributorShippingInfo(address, warehouseCode, invoice, shippingMethodId);
            return(distributorOrder);
        }
Exemplo n.º 7
0
        public virtual ServiceProvider.OrderSvc.Order_V01 ConvertToOrderForModifiedPrice(InvoiceModel invoice, string memberId,
                                                                                         string countryCode, ServiceProvider.OrderSvc.Address address, string warehouseCode, string shippingMethodId)
        {
            var distributorOrder = new ServiceProvider.OrderSvc.Order_V01
            {
                DistributorID       = memberId,
                CountryOfProcessing = countryCode,
                OrderMonth          = DateUtils.GetCurrentLocalTime(countryCode).ToString("yyMM"),
                InputMethod         = ServiceProvider.OrderSvc.InputMethodType.Internet,
                ReceivedDate        = DateUtils.GetCurrentLocalTime(countryCode),
                OrderCategory       = ServiceProvider.OrderSvc.OrderCategoryType.RSO,
                UseSlidingScale     = true,
                OrderItems          = new ServiceProvider.OrderSvc.OrderItems()
            };

            foreach (var distributorOrderItem in invoice.InvoiceLines.Select(invoiceLine => new ServiceProvider.OrderSvc.OrderItem_V03
            {
                RetailPrice = invoice.Type == "Distributor" ? invoiceLine.RetailPrice : invoiceLine.EarnBase,
                Quantity = invoiceLine.Quantity,
                SKU = invoiceLine.Sku,
                DiscountAmount = (invoiceLine.RetailPrice * invoiceLine.Quantity) - (invoiceLine.CalcDiscountedAmount * invoiceLine.Quantity),
                FreightCharge = invoiceLine.FreightCharge,
                TaxCategory = invoiceLine.ProductCategory,
                StockingSKU = invoiceLine.StockingSku,
                PackageHandlingCharge = 0,
                Description = string.Empty
            }))
            {
                distributorOrder.OrderItems.Add(distributorOrderItem);
            }

            distributorOrder.Shipment = GetDistributorShippingInfo(address, warehouseCode, invoice, shippingMethodId);
            return(distributorOrder);
        }