Пример #1
0
        public IActionResult Pay(string orderId)
        {
            var order = _orderService.Get(orderId);
            var items = _orderItemService.Get(m => m.OrderId == orderId);

            if (!items.Any())
            {
                return(Redirect("~/"));
            }
            AlipayTradePagePayModel model = new AlipayTradePagePayModel
            {
                Body        = string.Join(",", items.Select(m => m.Title)),
                Subject     = items.First().Title,
                TotalAmount = order.Total.ToString("F2"),
                OutTradeNo  = orderId,
                ProductCode = "FAST_INSTANT_TRADE_PAY"
            };
            AlipayTradePagePayRequest request = new AlipayTradePagePayRequest();

            // 设置同步回调地址
            request.SetReturnUrl($"{_hostOptionProvider.GetOrigin()}/AliPay/Callback");

            // 设置异步通知接收地址
            request.SetNotifyUrl($"{_hostOptionProvider.GetOrigin()}/AliPay/Notify");
            request.SetBizModel(model);
            var response = _alipayService.SdkExecute(request);

            _orderService.BeginPay(order);

            return(Redirect(_alipayService.Options.Gatewayurl + "?" + response.Body));
        }
Пример #2
0
        public override Order Get(params object[] primaryKey)
        {
            Order order = base.Get(primaryKey);

            order.OrderItems = _orderItemService.Get(m => m.OrderId == order.ID);
            return(order);
        }
Пример #3
0
        public void OnInserted(ShipmentItem entity)
        {
            //update shipment status
            entity.Shipment.ShipmentStatus = ShipmentStatus.Packaged;
            _shipmentService.Update(entity.Shipment);

            //update order status
            var orderItem = _orderItemService.Get(entity.OrderItemId);

            _purchaseAccountant.EvaluateOrderStatus(orderItem?.Order);
        }
Пример #4
0
        public IActionResult Detail(string Id)
        {
            var order = _orderService.Get(Id);

            if (order.UserId != _applicationContextAccessor.Current.CurrentCustomer.UserID)
            {
                return(RedirectToAction("Index"));
            }
            return(View(new OrderDetailViewModel
            {
                Order = order,
                OrderItems = _orderItemService.Get(m => m.OrderId == Id)
            }));
        }
Пример #5
0
 public Domain.Orders.Order_Item Get(int id)
 {
     return(_Service.Get(id));
 }