public async Task <IActionResult> Receipt(Guid id) { var order = await _context.Orders.Include(i => i.ApprovedPayment).SingleOrDefaultAsync(o => o.ShareIdentifier == id); if (order == null) { return(NotFound()); } if (order.Status != OrderStatusCodes.Finalized && order.Status != OrderStatusCodes.Complete) { return(NotFound()); } if (!order.Paid) { return(NotFound()); } var model = new OrderReceiptModel(); model.Order = order; model.OrderDetails = order.GetOrderDetails(); model.ApprovedAmount = order.ApprovedPayment.Auth_Amount; dynamic data = JObject.Parse(order.ApprovedPayment.ReturnedResults); model.MaskedCreditCard = data.req_card_number; return(View(model)); }
public async Task <ApiResult> Receipt(OrderReceiptModel model) { var order = await orderService.GetModelAsync(model.OrderId); if (order == null) { return(new ApiResult { status = 0, msg = "订单不存在" }); } int orderStateId = (int)OrderStateEnum.已完成; bool flag = await orderService.Receipt(model.OrderId, orderStateId); if (!flag) { return(new ApiResult { status = 0, msg = "确认收货失败" }); } return(new ApiResult { status = 1, msg = "确认收货成功" }); }
public async Task <ApiResult> Receipt(OrderReceiptModel model) { var order = await orderService.GetModelAsync(model.OrderId); if (order == null) { return(new ApiResult { status = 0, msg = "订单不存在" }); } long orderStateId = await idNameService.GetIdByNameAsync("已完成"); bool flag = await orderService.Receipt(model.OrderId, orderStateId); if (!flag) { return(new ApiResult { status = 0, msg = "确认收货失败" }); } return(new ApiResult { status = 1, msg = "确认收货成功" }); }