Example #1
0
        public ContentResult EnterpriseNotify_Post(string id, string outid)
        {
            Log.Info("[ENP]" + Core.Helper.WebHelper.GetRawUrl());
            id = DecodePaymentId(id);
            string errorMsg = string.Empty;
            string response = string.Empty;
            var    _iOperationLogService = ServiceApplication.Create <IOperationLogService>();
            var    withdrawId            = long.Parse(outid);
            var    withdrawData          = MemberCapitalApplication.GetApplyWithDrawInfo(withdrawId);

            if (withdrawData == null)
            {
                Log.Info("[EnterpriseNotify]" + id + " ^ " + outid);
                throw new HimallException("参数错误");
            }
            try
            {
                var payment = Core.PluginsManagement.GetPlugin <IPaymentPlugin>(id);
                var payInfo = payment.Biz.ProcessEnterprisePayNotify(HttpContext.Request);
                if (withdrawData.ApplyStatus == Himall.Entities.ApplyWithDrawInfo.ApplyWithDrawStatus.PayPending)
                {
                    withdrawData.ApplyStatus = Himall.Entities.ApplyWithDrawInfo.ApplyWithDrawStatus.WithDrawSuccess;
                    withdrawData.PayTime     = DateTime.Now;
                    MemberCapitalApplication.ConfirmApplyWithDraw(withdrawData);
                }
                response = payment.Biz.ConfirmPayResult();
            }
            catch (Exception ex)
            {
                //支付失败
                withdrawData.ApplyStatus = Himall.Entities.ApplyWithDrawInfo.ApplyWithDrawStatus.PayFail;
                withdrawData.Remark      = "异步通知失败,请查看日志";
                withdrawData.ConfirmTime = DateTime.Now;
                MemberCapitalApplication.ConfirmApplyWithDraw(withdrawData);
                //操作日志
                _iOperationLogService.AddPlatformOperationLog(new Entities.LogInfo
                {
                    Date        = DateTime.Now,
                    Description = string.Format("会员提现审核失败,提现编号:{0}", outid),
                    IPAddress   = Request.UserHostAddress,
                    PageUrl     = "/Pay/EnterpriseNotify",
                    UserName    = "******",
                    ShopId      = 0
                });
                errorMsg = ex.Message;
                Log.Error("EnterpriseNotify_Post", ex);
            }
            return(Content(response));
        }