public OrderResponse SubmitOrder(Order order) { OrderResponse response; try { var paymentResult = _paymentService.Pay(order); ShippingResult shippingResult = null; if (paymentResult.Success) { shippingResult = _shippingService.Ship(order); } response = new OrderResponse { Success = paymentResult.Success && shippingResult.Success, PaymentResult = paymentResult, ShippingResult = shippingResult }; _auditLogger.LogOrder(order, response); } catch (Exception) { response = new OrderResponse { Success = false }; } return(response); }
/// <summary> /// Gets the shipping result. /// </summary> /// <param name="ShipMethodName">Name of the ship method.</param> /// <param name="ThisOrder">The this order.</param> /// <param name="Address">The address.</param> /// <returns>ShippingResult object</returns> public override ShippingResult GetShippingResult(string ShipMethodName, Order ThisOrder, AnonymousAddress Address) { string conn = Orders.GetConnectionString(); StoreDataClassesDataContext db = new StoreDataClassesDataContext(conn); ShippingResult result = new ShippingResult(); int orderNumber = int.Parse(orderId); string shipping = (from o in db.orders where o.order_id == orderNumber select o.shipping).Single().ToString(); result.ShippingRate = decimal.Parse(shipping); result.Shippable = true; return(result); }