public string PlaceOrder(int userId) { var placingOrder = _orderProcessingService.PreparePlaceOrderDetails(userId); var placedOrder = _nopService.CreateOrder(placingOrder); return(placedOrder.Id); }
public ActionResult CreateOrder() { // uncomment for postman customerIdParseResult = 1 int customerIdParseResult; int.TryParse(_userContext.CustomerId(), out customerIdParseResult); var orderItems = new List <OrderItem> { new OrderItem() { Quantity = 2, ProductId = 38 }, new OrderItem() { Quantity = 1, ProductId = 2 } }; var shippingAddress = new Address { Address1 = "21 West 52nd Street", Email = "*****@*****.**", FirstName = "John", LastName = "Smith", City = "New York", PhoneNumber = "12345678", ZipPostalCode = "10021", CountryId = 1, CreatedOnUtc = DateTime.UtcNow, }; var billingAddress = new Address { Address1 = "21 West 52nd Street", Email = "*****@*****.**", FirstName = "John", LastName = "Smith", City = "New York", PhoneNumber = "12345678", ZipPostalCode = "10021", CountryId = 1, CreatedOnUtc = DateTime.UtcNow, }; var stubOrder = new Orders.Order { CustomerId = customerIdParseResult, OrderItems = orderItems, ShippingMethod = "Shipping.FixedRate", ShippingRateComputationMethodSystemName = " Shipping Rate Computation Method System Name", ShippingAddress = shippingAddress, BillingAddress = billingAddress, CreatedOnUtc = DateTime.UtcNow, PaidDateUtc = DateTime.UtcNow.ToString(CultureInfo.InvariantCulture), PaymentMethodSystemName = "Payments.Manual" }; var order = _nopService.CreateOrder(stubOrder); return(new EmptyResult()); }