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; }
public static webModel.LineItem ToWebModel(this coreModel.LineItem orderItem) { var retVal = new webModel.LineItem(); retVal.InjectFrom(orderItem); retVal.Currency = orderItem.Currency; if (orderItem.Discount != null) { retVal.Discount = orderItem.Discount.ToWebModel(); retVal.DiscountAmount = orderItem.Discount.DiscountAmount; } retVal.TaxDetails = orderItem.TaxDetails; return retVal; }
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); }
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); }
public void AddNewOrderItem() { var result = _controller.GetById("order1") as OkNegotiatedContentResult <webModel.CustomerOrder>; var testOrder = result.Content; var item1 = new webModel.LineItem { BasePrice = 77, Price = 77, DisplayName = "boots", ProductId = "boots", Name = "boots", Quantity = 2, FulfilmentLocationCode = "warehouse1", ShippingMethodCode = "EMS" }; testOrder.Items.Add(item1); _controller.Update(testOrder); result = _controller.GetById(testOrder.Id) as OkNegotiatedContentResult <webModel.CustomerOrder>; testOrder = result.Content; }
private static webModel.CustomerOrder GetTestOrder(string id) { var order = new webModel.CustomerOrder { Id = id, Currency = CurrencyCodes.USD, CustomerId = "vasja customer", EmployeeId = "employe", StoreId = "test store", Addresses = new webModel.Address[] { new webModel.Address { AddressType = AddressType.Shipping, City = "london", Phone = "+68787687", PostalCode = "22222", CountryCode = "ENG", CountryName = "England", Email = "*****@*****.**", FirstName = "first name", LastName = "last name", Line1 = "line 1", Organization = "org1" } }.ToList(), Discount = new webModel.Discount { PromotionId = "testPromotion", Currency = CurrencyCodes.USD, DiscountAmount = 12, Coupon = new webModel.Coupon { Code = "ssss" } } }; var item1 = new webModel.LineItem { BasePrice = 10, Price = 9, DisplayName = "shoes", ProductId = "shoes", CatalogId = "catalog", Currency = CurrencyCodes.USD, CategoryId = "category", Name = "shoes", Quantity = 2, FulfilmentLocationCode = "warehouse1", ShippingMethodCode = "EMS", Discount = new webModel.Discount { PromotionId = "itemPromotion", Currency = CurrencyCodes.USD, DiscountAmount = 12, Coupon = new webModel.Coupon { Code = "ssss" } } }; var item2 = new webModel.LineItem { BasePrice = 100, Price = 100, DisplayName = "t-shirt", ProductId = "t-shirt", CatalogId = "catalog", CategoryId = "category", Currency = CurrencyCodes.USD, Name = "t-shirt", Quantity = 2, FulfilmentLocationCode = "warehouse1", ShippingMethodCode = "EMS", Discount = new webModel.Discount { PromotionId = "testPromotion", Currency = CurrencyCodes.USD, DiscountAmount = 12, Coupon = new webModel.Coupon { Code = "ssss" } } }; order.Items = new List <webModel.LineItem>(); order.Items.Add(item1); order.Items.Add(item2); var shipment = new webModel.Shipment { Currency = CurrencyCodes.USD, DeliveryAddress = new webModel.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 webModel.Discount { PromotionId = "testPromotion", Currency = CurrencyCodes.USD, DiscountAmount = 12, Coupon = new webModel.Coupon { Code = "ssss" } }, }; shipment.Items = new List <webModel.ShipmentItem>(); shipment.Items.AddRange(order.Items.Select(x => new webModel.ShipmentItem { Quantity = x.Quantity, LineItem = x })); order.Shipments = new List <webModel.Shipment>(); order.Shipments.Add(shipment); var payment = new webModel.PaymentIn { Currency = CurrencyCodes.USD, Sum = 10, CustomerId = "et" }; order.InPayments = new List <webModel.PaymentIn>(); order.InPayments.Add(payment); return(order); }
private static webModel.CustomerOrder GetTestOrder(string id) { var order = new webModel.CustomerOrder { Id = id, Currency = CurrencyCodes.USD, CustomerId = "vasja customer", EmployeeId = "employe", StoreId = "test store", Addresses = new webModel.Address[] { new webModel.Address { AddressType = coreModel.AddressType.Shipping, City = "london", Phone = "+68787687", PostalCode = "22222", CountryCode = "ENG", CountryName = "England", Email = "*****@*****.**", FirstName = "first name", LastName = "last name", Line1 = "line 1", Organization = "org1" } }.ToList(), Discount = new webModel.Discount { PromotionId = "testPromotion", Currency = CurrencyCodes.USD, DiscountAmount = 12, Coupon = new webModel.Coupon { Code = "ssss" } } }; var item1 = new webModel.LineItem { BasePrice = 10, Price = 9, DisplayName = "shoes", ProductId = "shoes", CatalogId = "catalog", Currency = CurrencyCodes.USD, CategoryId = "category", Name = "shoes", Quantity = 2, FulfilmentLocationCode = "warehouse1", ShippingMethodCode = "EMS", Discount = new webModel.Discount { PromotionId = "itemPromotion", Currency = CurrencyCodes.USD, DiscountAmount = 12, Coupon = new webModel.Coupon { Code = "ssss" } } }; var item2 = new webModel.LineItem { BasePrice = 100, Price = 100, DisplayName = "t-shirt", ProductId = "t-shirt", CatalogId = "catalog", CategoryId = "category", Currency = CurrencyCodes.USD, Name = "t-shirt", Quantity = 2, FulfilmentLocationCode = "warehouse1", ShippingMethodCode = "EMS", Discount = new webModel.Discount { PromotionId = "testPromotion", Currency = CurrencyCodes.USD, DiscountAmount = 12, Coupon = new webModel.Coupon { Code = "ssss" } } }; order.Items = new List<webModel.LineItem>(); order.Items.Add(item1); order.Items.Add(item2); var shipment = new webModel.Shipment { Currency = CurrencyCodes.USD, DeliveryAddress = new webModel.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 webModel.Discount { PromotionId = "testPromotion", Currency = CurrencyCodes.USD, DiscountAmount = 12, Coupon = new webModel.Coupon { Code = "ssss" } }, }; shipment.Items = new List<webModel.ShipmentItem>(); shipment.Items.AddRange(order.Items.Select(x=> new webModel.ShipmentItem { Quantity = x.Quantity, LineItem = x })); order.Shipments = new List<webModel.Shipment>(); order.Shipments.Add(shipment); var payment = new webModel.PaymentIn { GatewayCode = "PayPal", Currency = CurrencyCodes.USD, Sum = 10, CustomerId = "et" }; order.InPayments = new List<webModel.PaymentIn>(); order.InPayments.Add(payment); return order; }
public void AddNewOrderItem() { var result = _controller.GetById("order1") as OkNegotiatedContentResult<webModel.CustomerOrder>; var testOrder = result.Content; var item1 = new webModel.LineItem { BasePrice = 77, Price = 77, DisplayName = "boots", ProductId = "boots", Name = "boots", Quantity = 2, FulfilmentLocationCode = "warehouse1", ShippingMethodCode = "EMS" }; testOrder.Items.Add(item1); _controller.Update(testOrder); result = _controller.GetById(testOrder.Id) as OkNegotiatedContentResult<webModel.CustomerOrder>; testOrder = result.Content; }