Esempio n. 1
0
        public ActionResult PayReturn(int type, string appId, string sign, string data)
        {
            var checkResult = SignManager.CheckSign(appId, sign, data);

            if (checkResult.Status != ResultStatus.Success || !checkResult.Data)
            {
                return(Json(new { status = 0, msg = "签名验证未通过", type = type }));
            }

            var notifyInfo = JsonHelper.Deserialize <PayNotifyInfo>(data);

            if (string.IsNullOrWhiteSpace(notifyInfo.OrderId))
            {
                return(Json(new { status = 0, msg = "订单编码为空", data = data, type = type }));
            }

            if (string.IsNullOrWhiteSpace(notifyInfo.PaymentAmt))
            {
                return(Json(new { status = 0, msg = "支付金额为空", data = data, type = type }));
            }

            if (string.IsNullOrWhiteSpace(notifyInfo.Result))
            {
                return(Json(new { status = 0, msg = "支付结果为空", data = data, type = type }));
            }

            return(Json(new { status = 1, data = data, type = type }));
        }
Esempio n. 2
0
        /// <summary>
        /// 校验数据签名
        /// </summary>
        /// <param name="appId">业务系统ID</param>
        /// <param name="sign">数据签名</param>
        /// <param name="data">业务数据报文</param>
        /// <param name="requestInfo">退款请求记录</param>
        /// <returns></returns>
        public virtual ExecuteResult CheckSign(string appId, string sign, string data, RefundRequestInfo requestInfo)
        {
            var result = SignManager.CheckSign(appId, sign, data);

            if (result.Status != ResultStatus.Success || !result.Data)
            {
                requestInfo.ExecuteResult = (int)ResultStatus.Failure;
                requestInfo.ResultDesc    = string.IsNullOrWhiteSpace(result.Message) ? "签名校验未通过" : result.Message;
                RefundRequestDAL.Update(requestInfo);
                result.Status = ResultStatus.Failure;
            }
            return(result);
        }
Esempio n. 3
0
 /// <summary>
 /// 校验签名是否正确
 /// </summary>
 /// <param name="appId"></param>
 /// <param name="sign"></param>
 /// <param name="data"></param>
 /// <returns></returns>
 public JsonResult Check(string appId, string sign, string data)
 {
     try
     {
         var result = SignManager.CheckSign(appId, sign, data);
         if (result.Status == ResultStatus.Success)
         {
             return(Json(new { status = 1, data = result.Data }));
         }
         else
         {
             return(Json(new { status = 0, msg = result.Message }));
         }
     }
     catch (Exception ex)
     {
         return(Json(new { status = -1, msg = ex.Message }));
     }
 }
Esempio n. 4
0
        public JsonResult RefundNotify(int type, string appId, string sign, string data)
        {
            var checkResult = SignManager.CheckSign(appId, sign, data);

            if (checkResult.Status != ResultStatus.Success || !checkResult.Data)
            {
                return(Json(new { status = 0, msg = "签名验证未通过", data = data, type = type }));
            }

            var notifyInfo = JsonHelper.Deserialize <RefundNotifyInfo>(data);

            if (string.IsNullOrWhiteSpace(notifyInfo.OrderId))
            {
                return(Json(new { status = 0, msg = "订单编码为空", data = data, type = type }));
            }

            if (string.IsNullOrWhiteSpace(notifyInfo.TradeNo))
            {
                return(Json(new { status = 0, msg = "支付交易流水号为空", data = data, type = type }));
            }

            if (string.IsNullOrWhiteSpace(notifyInfo.RefundOrderId))
            {
                return(Json(new { status = 0, msg = "退款单编号为空", data = data, type = type }));
            }

            if (string.IsNullOrWhiteSpace(notifyInfo.RefundAmt))
            {
                return(Json(new { status = 0, msg = "退款金额为空", data = data, type = type }));
            }

            if (string.IsNullOrWhiteSpace(notifyInfo.Result))
            {
                return(Json(new { status = 0, msg = "退款结果为空", data = data, type = type }));
            }

            return(Json(new { status = 1, data = data, type = type }));
        }