예제 #1
0
		public ShipmentItem(LineItem lineItem)
		{
			LineItem = lineItem;
			LineItemId = lineItem.Id;

			Quantity = lineItem.Quantity;
		}
예제 #2
0
		public static coreModel.LineItem ToCoreModel(this webModel.LineItem orderItem)
		{
			var retVal = new coreModel.LineItem();
			retVal.InjectFrom(orderItem);
			retVal.Currency = orderItem.Currency;
			if(orderItem.Discount != null)
			{
				retVal.Discount = orderItem.Discount.ToCoreModel();
			}
			retVal.TaxDetails = orderItem.TaxDetails;
			return retVal;
		}
예제 #3
0
        public static coreModel.LineItem ToCoreModel(this webModel.LineItem orderItem)
        {
            var retVal = new coreModel.LineItem();

            retVal.InjectFrom(orderItem);
            retVal.Currency = orderItem.Currency;
            if (orderItem.Discount != null)
            {
                retVal.Discount = orderItem.Discount.ToCoreModel();
            }
            retVal.TaxDetails = orderItem.TaxDetails;
            return(retVal);
        }
예제 #4
0
        public static webModel.LineItem ToWebModel(this coreModel.LineItem orderItem)
        {
            var retVal = new webModel.LineItem();

            retVal.InjectFrom(orderItem);
            retVal.Currency = orderItem.Currency;

            retVal.TaxDetails = orderItem.TaxDetails;

            if (orderItem.DynamicProperties != null)
            {
                retVal.DynamicProperties = orderItem.DynamicProperties;
            }

            return(retVal);
        }
        private static CustomerOrder GetTestOrder(string id)
        {
            var order = new CustomerOrder
            {
                Id          = id,
                Currency    = "USD",
                CustomerId  = "Test Customer",
                EmployeeId  = "employee",
                StoreId     = "test store",
                CreatedDate = DateTime.Now,
                Addresses   = new[]
                {
                    new Address {
                        AddressType  = AddressType.Shipping,
                        Phone        = "+68787687",
                        PostalCode   = "19142",
                        CountryCode  = "US",
                        CountryName  = "United states",
                        Email        = "*****@*****.**",
                        FirstName    = "first name",
                        LastName     = "last name",
                        Line1        = "6025 Greenway Ave",
                        City         = "Philadelphia",
                        RegionId     = "PA",
                        RegionName   = "Pennsylvania",
                        Organization = "org1"
                    }
                }.ToList(),
                Discount = new Discount
                {
                    PromotionId    = "testPromotion",
                    Currency       = "USD",
                    DiscountAmount = 12,
                    Coupon         = new Coupon
                    {
                        Code = "ssss"
                    }
                }
            };
            var item1 = new LineItem
            {
                Id                 = Guid.NewGuid().ToString(),
                BasePrice          = 10,
                Price              = 20,
                ProductId          = "shoes",
                CatalogId          = "catalog",
                Currency           = "USD",
                CategoryId         = "category",
                Name               = "shoes",
                Quantity           = 2,
                ShippingMethodCode = "EMS",
                Discount           = new Discount
                {
                    PromotionId    = "itemPromotion",
                    Currency       = "USD",
                    DiscountAmount = 12,
                    Coupon         = new Coupon
                    {
                        Code = "ssss"
                    }
                }
            };
            var item2 = new LineItem
            {
                Id                 = Guid.NewGuid().ToString(),
                BasePrice          = 100,
                Price              = 100,
                ProductId          = "t-shirt",
                CatalogId          = "catalog",
                CategoryId         = "category",
                Currency           = "USD",
                Name               = "t-shirt",
                Quantity           = 2,
                ShippingMethodCode = "EMS",
                Discount           = new Discount
                {
                    PromotionId    = "testPromotion",
                    Currency       = "USD",
                    DiscountAmount = 12,
                    Coupon         = new Coupon
                    {
                        Code = "ssss"
                    }
                }
            };

            order.Items = new List <LineItem>();
            order.Items.Add(item1);
            order.Items.Add(item2);

            var shipment = new Shipment
            {
                Id              = Guid.NewGuid().ToString(),
                Currency        = "USD",
                DeliveryAddress = new Address
                {
                    City         = "london",
                    CountryName  = "England",
                    Phone        = "+68787687",
                    PostalCode   = "2222",
                    CountryCode  = "ENG",
                    Email        = "*****@*****.**",
                    FirstName    = "first name",
                    LastName     = "last name",
                    Line1        = "line 1",
                    Organization = "org1"
                },
                Discount = new Discount
                {
                    PromotionId    = "testPromotion",
                    Currency       = "USD",
                    DiscountAmount = 12,
                    Coupon         = new Coupon
                    {
                        Code = "ssss"
                    }
                }
            };

            order.Shipments = new List <Shipment>();
            order.Shipments.Add(shipment);

            var payment = new PaymentIn
            {
                Id          = Guid.NewGuid().ToString(),
                GatewayCode = "PayPal",
                Currency    = "USD",
                Sum         = 10,
                CustomerId  = "et",
                IsApproved  = false
            };

            order.InPayments = new List <PaymentIn> {
                payment
            };

            return(order);
        }
예제 #6
0
        private static CustomerOrder GetTestOrder(string id)
        {
            var order = new CustomerOrder
            {
                Id = id,
                Currency = CurrencyCodes.USD,
                CustomerId = "Test Customer",
                EmployeeId = "employee",
                StoreId = "test store",
                CreatedDate = DateTime.Now,
                Addresses = new []
				{
					new Address {	
					AddressType = AddressType.Shipping, 
					Phone = "+68787687",
					PostalCode = "60602",
					CountryCode = "US",
					CountryName = "United states",
					Email = "*****@*****.**",
					FirstName = "first name",
					LastName = "last name",
					Line1 = "45 Fremont Street",
                    City = "Los Angeles",
                    RegionId = "CA",
					Organization = "org1"
					}
				}.ToList(),
                Discount = new Discount
                {
                    PromotionId = "testPromotion",
                    Currency = CurrencyCodes.USD,
                    DiscountAmount = 12,
                    Coupon = new Coupon
                    {
                        Code = "ssss"
                    }
                }
            };
            var item1 = new LineItem
            {
                BasePrice = 10,
                Price = 20,
                ProductId = "shoes",
                CatalogId = "catalog",
                Currency = CurrencyCodes.USD,
                CategoryId = "category",
                Name = "shoes",
                Quantity = 2,
                ShippingMethodCode = "EMS",
                Discount = new Discount
                {
                    PromotionId = "itemPromotion",
                    Currency = CurrencyCodes.USD,
                    DiscountAmount = 12,
                    Coupon = new Coupon
                    {
                        Code = "ssss"
                    }
                }
            };
            var item2 = new LineItem
            {
                BasePrice = 100,
                Price = 100,
                ProductId = "t-shirt",
                CatalogId = "catalog",
                CategoryId = "category",
                Currency = CurrencyCodes.USD,
                Name = "t-shirt",
                Quantity = 2,
                ShippingMethodCode = "EMS",
                Discount = new Discount
                {
                    PromotionId = "testPromotion",
                    Currency = CurrencyCodes.USD,
                    DiscountAmount = 12,
                    Coupon = new Coupon
                    {
                        Code = "ssss"
                    }
                }
            };
            order.Items = new List<LineItem>();
            order.Items.Add(item1);
            order.Items.Add(item2);

            var shipment = new Shipment
            {
                Currency = CurrencyCodes.USD,
                DeliveryAddress = new Address
                {
                    City = "london",
                    CountryName = "England",
                    Phone = "+68787687",
                    PostalCode = "2222",
                    CountryCode = "ENG",
                    Email = "*****@*****.**",
                    FirstName = "first name",
                    LastName = "last name",
                    Line1 = "line 1",
                    Organization = "org1"
                },
                Discount = new Discount
                {
                    PromotionId = "testPromotion",
                    Currency = CurrencyCodes.USD,
                    DiscountAmount = 12,
                    Coupon = new Coupon
                    {
                        Code = "ssss"
                    }
                }
            };
            order.Shipments = new List<Shipment>();
            order.Shipments.Add(shipment);

            var payment = new PaymentIn
            {
                GatewayCode = "PayPal",
                Currency = CurrencyCodes.USD,
                Sum = 10,
                CustomerId = "et"
            };
            order.InPayments = new List<PaymentIn> { payment };

            return order;
        }