Beispiel #1
0
        public static ShippingService Find(int storeId, ShippingProviderType providerType)
        {
            var q = new ShippingServiceQuery();

            q.Where(q.StoreId == storeId, q.ShippingProviderType == (short)providerType);

            var service = new ShippingService();

            if (service.Load(q))
            {
                return(service);
            }
            return(null);
        }
Beispiel #2
0
        public static IShippingService Get(int storeId, ShippingProviderType providerType, int?orderId, Guid?cartId)
        {
            IShippingService service = null;

            switch (providerType)
            {
            case ShippingProviderType.CustomShipping:
                return(new CustomTablesShippingService(storeId));

            case ShippingProviderType.FedEx:
                return(new FedExShippingService(storeId, orderId, cartId));

            case ShippingProviderType.UPS:
                return(new UpsShippingService(storeId, orderId, cartId));
            }
            return(null);
        }
 protected ShippingService(int storeId, ShippingProviderType providerType, int?orderId, Guid?cartId)
 {
     Init(storeId, providerType);
     this.orderId = orderId;
     this.cartId  = cartId;
 }
 protected ShippingService(int storeId, ShippingProviderType providerType)
 {
     Init(storeId, providerType);
 }
Beispiel #5
0
        public async Task <ActionResult> Index(OrderModel model)
        {
            List <ItemType> items = new List <ItemType>();
            ItemType        type  = new ItemType {
                SKU         = "32861",
                Brand       = "Safe-T",
                Category    = 1829,
                Description = "Safe-T Helmet",
                Model       = "Bicycle helmet",
                Quantity    = 1,
                UnitPrice   = 60.72
            };
            ItemType type1 = new ItemType {
                SKU         = "32779",
                Brand       = "Slaker",
                Category    = 2008,
                Description = "Slaker Water Bottle",
                Model       = "Water bottle",
                Quantity    = 5,
                UnitPrice   = 4.72
            };
            ItemType type2 = new ItemType {
                SKU         = "30421",
                Brand       = "Grand Prix",
                Category    = 2005,
                Description = "Grand Prix Bicycle Tires",
                Model       = "Bicycle Tires",
                Quantity    = 2,
                UnitPrice   = 10.72
            };

            items.Add(type);
            items.Add(type1);
            items.Add(type2);
            ItemType[] itemListClone = items.ToArray();

            List <string> adresgui = new List <string>();

            adresgui.Add(model.AddressLine);
            string[] adressclone = adresgui.ToArray();

            AddressType addressType = new AddressType {
                City        = model.City,
                AddressLine = adressclone,
                FirstName   = model.Firstname,
                LastName    = model.Lastname,
                PhoneNumber = model.Phonenumber,
                State       = model.State,
                ZipCode     = model.ZipCode
            };

            ShippingProviderType shippingProviderType = new ShippingProviderType {
                Name = "USPS"
            };

            ShippingType shippingType = new ShippingType {
                Address                = addressType,
                ShipMethod             = 1,
                ShippingSpeed          = ShippingSpeedType.Oneday,
                ShipMethodSpecified    = true,
                ShippingSpeedSpecified = true,
                ShippingProvider       = shippingProviderType
            };

            PaymentType paymentType = new PaymentType {
                AuthorizationAmount          = 12.12,
                AuthorizationAmountSpecified = true,
                AuthorizationDate            = DateTime.Now,
                AuthorizationDateSpecified   = true,
                BillingAddress  = addressType,
                CardName        = "AMEX",
                CardNum         = "1234123412341234",
                CardPaymentType = 1,
                ExpireDate      = "0316"
            };

            OrderType order = new OrderType {
                Email              = model.Email,
                OrderDate          = new DateTime().ToUniversalTime(),
                Shipping           = shippingType,
                Billing            = paymentType,
                Items              = itemListClone,
                OrderDateSpecified = true
            };

            processOrderPortTypeClient client   = new processOrderPortTypeClient();
            processResponse            response = await client.processAsync(order);

            order.OrderNumber = response.OrderAck.OrderNumber;

            //Random rnd = new Random();
            //order.OrderNumber = rnd.Next(1000, 5000).ToString();


            return(View("OrderSuccess", order));
        }
Beispiel #6
0
 protected EzShippingService(int storeId, ShippingProviderType providerType, int?orderId, Guid?cartId)
     : base(storeId, providerType, orderId, cartId)
 {
     Init();
 }
Beispiel #7
0
 protected EzShippingService(int storeId, ShippingProviderType providerType)
     : base(storeId, providerType)
 {
     Init();
 }
Beispiel #8
0
 public CustomShippingProvider(int storeId, ShippingProviderType providerType) : base(storeId, providerType)
 {
 }