public static webModel.PaymentIn ToWebModel(this coreModel.PaymentIn payment) { var retVal = new webModel.PaymentIn(); retVal.InjectFrom(payment); retVal.Currency = payment.Currency; retVal.ChildrenOperations = payment.GetFlatObjectsListWithInterface <coreModel.IOperation>().Except(new[] { payment }).Select(x => x.ToWebModel()).ToList(); if (payment.DynamicProperties != null) { retVal.DynamicProperties = payment.DynamicProperties; } retVal.PaymentMethod = new webModel.PaymentMethod(); retVal.PaymentMethod.Code = payment.GatewayCode; retVal.PaymentMethod.Description = payment.GatewayCode; retVal.PaymentMethod.Name = payment.GatewayCode; if (payment.PaymentMethod != null) { retVal.PaymentMethod = payment.PaymentMethod.ToWebModel(); } return(retVal); }
public static webModel.PaymentIn ToWebModel(this coreModel.PaymentIn payment) { var retVal = new webModel.PaymentIn(); retVal.InjectFrom(payment); retVal.Currency = payment.Currency; retVal.ChildrenOperations = payment.GetFlatObjectsListWithInterface<coreModel.IOperation>().Select(x => x.ToWebModel()).ToList(); if (payment.DynamicProperties != null) retVal.DynamicProperties = payment.DynamicProperties; return retVal; }
public static coreModel.PaymentIn ToCoreModel(this webModel.PaymentIn payment) { var retVal = new coreModel.PaymentIn(); retVal.InjectFrom(payment); if (payment.Properties != null) { retVal.Properties = payment.Properties.Select(x => x.ToCoreModel()).ToList(); } retVal.Currency = payment.Currency; return(retVal); }
public static webModel.PaymentIn ToWebModel(this coreModel.PaymentIn payment) { var retVal = new webModel.PaymentIn(); retVal.InjectFrom(payment); retVal.Currency = payment.Currency; retVal.Organization = retVal.OrganizationId; retVal.Customer = retVal.CustomerId; if (payment.Properties != null) retVal.Properties = payment.Properties.Select(x => x.ToWebModel()).ToList(); retVal.ChildrenOperations = payment.ChildrenOperations.Select(x => x.ToWebModel()).ToList(); return retVal; }
public static webModel.PaymentIn ToWebModel(this coreModel.PaymentIn payment) { var retVal = new webModel.PaymentIn(); retVal.InjectFrom(payment); retVal.Currency = payment.Currency; retVal.ChildrenOperations = payment.GetFlatObjectsListWithInterface <coreModel.IOperation>().Select(x => x.ToWebModel()).ToList(); if (payment.DynamicProperties != null) { retVal.DynamicProperties = payment.DynamicProperties; } return(retVal); }
public static coreModel.PaymentIn ToCoreModel(this webModel.PaymentIn payment) { var retVal = new coreModel.PaymentIn(); retVal.InjectFrom(payment); retVal.PaymentStatus = EnumUtility.SafeParse <PaymentStatus>(payment.Status, PaymentStatus.Custom); retVal.Currency = payment.Currency; if (payment.DynamicProperties != null) { retVal.DynamicProperties = payment.DynamicProperties; } return(retVal); }
public static webModel.PaymentIn ToWebModel(this coreModel.PaymentIn payment) { var retVal = new webModel.PaymentIn(); retVal.InjectFrom(payment); retVal.Currency = payment.Currency; retVal.Organization = retVal.OrganizationId; retVal.Customer = retVal.CustomerId; if (payment.Properties != null) { retVal.Properties = payment.Properties.Select(x => x.ToWebModel()).ToList(); } retVal.ChildrenOperations = payment.ChildrenOperations.Select(x => x.ToWebModel()).ToList(); return(retVal); }
public static webModel.PaymentIn ToWebModel(this coreModel.PaymentIn payment) { var retVal = new webModel.PaymentIn(); retVal.InjectFrom(payment); retVal.Currency = payment.Currency; retVal.ChildrenOperations = payment.GetFlatObjectsListWithInterface<coreModel.IOperation>().Except(new[] { payment }).Select(x => x.ToWebModel()).ToList(); if (payment.DynamicProperties != null) retVal.DynamicProperties = payment.DynamicProperties; retVal.PaymentMethod = new webModel.PaymentMethod(); retVal.PaymentMethod.Code = payment.GatewayCode; retVal.PaymentMethod.Description = payment.GatewayCode; retVal.PaymentMethod.Name = payment.GatewayCode; if (payment.PaymentMethod != null) { retVal.PaymentMethod = payment.PaymentMethod.ToWebModel(); } return retVal; }
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; }