private Order PrepareNewOrder() { return(new Order { Creator = _workContext.CurrentUser, CreateDateTime = DateTime.Now, PaymentStatus = PaymentStatus.Pending, OrderStatus = OrderStatus.Pending, UpdateDateTime = DateTime.Now, PaymentMethod = _currentUserService.GetCustomAttribute(UserAttributes.SelectedPaymentMethod)?.Value, ShippingAddressId = _currentUserService.GetCustomAttribute(UserAttributes.SelectedShippingAddressId) ?.Value.ToGuid(), ShippingMethod = _currentUserService.GetCustomAttribute(UserAttributes.SelectedShippingMethodId)?.Value, ShippingStatus = _workContext.CurrentUser.ShoppingCartItems.Any(x => x.Product.Shipment.IsShipEnabled) ? ShippingStatus.NotYetShipped : ShippingStatus.ShippingNotRequired }); }
private Guid?GetCurrentUserPaymentProccessingOrderId() { var orderId = _currentUserService .GetCustomAttribute(UserAttributes.PaymentProccessingOrderId)?.Value.ToGuid(); if (!orderId.HasValue) { throw new ArgumentException("PaymentProccessingOrderId"); } return(orderId); }