/// <summary> /// 获取返回链接 /// </summary> /// <param name="requestInfo">支付请求记录</param> /// <param name="notifyInfo">支付结果通知</param> /// <returns></returns> public virtual string GetReturnUrl(PayRequestInfo requestInfo, PayNotifyInfo notifyInfo) { if (requestInfo != null && !string.IsNullOrWhiteSpace(requestInfo.ReturnUrl)) { var setting = JsonHelper.GetDefaultSettings(); setting.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore; string data = JsonHelper.Serialize(notifyInfo, setting); string sign = SignManager.CreateSign(requestInfo.AppId, data).Data; string returnUrl = requestInfo.ReturnUrl + (requestInfo.ReturnUrl.IndexOf("?") > 0 ? "&" : "?"); returnUrl += string.Format("appId={0}&sign={1}&data={2}", requestInfo.AppId, sign, data); return(returnUrl); } return(null); }
public void ReportMatch(int magnitude, Block block) { X = block.X; Y = block.Y; Timestamp = Time.time; if (Time.time != CreationTimestamp) { Multiplier++; MultiplierCount++; signManager.CreateSign(X, Y, Multiplier.ToString() + "x"); } Magnitude += magnitude; if (magnitude > Grid.MinimumPatternLength) { signManager.CreateSign(X, Y, Magnitude.ToString()); } MatchJustOccurred = true; }
public ActionResult AllinpayRefund(string appId, string appSecret, string orderId) { if (appSecret != AppCache.GetAppSecret(appId)) { return(Json(new { msg = "非法appSecret" })); } var resultInfo = PayResultDAL.GetValidPayResult(orderId, AppEnum.PayType.Allinpay); if (resultInfo == null || resultInfo.SysNo <= 0) { return(Json(new { msg = "订单无支付记录" })); } var requestInfo = PayRequestDAL.GetPayRequest(resultInfo.RequestSysNo); var orderTime = JsonHelper.Deserialize <PayOrderInfo>(requestInfo.RequestData).OrderTime; RefundOrderInfo info = new RefundOrderInfo() { OrderId = orderId, OrderTime = orderTime ?? DateTime.Now.ToString("yyyyMMddHHmmss"), TradeNo = resultInfo.TradeNo, PaymentAmt = resultInfo.PaymentAmt.ToString(), RefundOrderId = DateTime.Now.ToString("yyyyMMddHHmmssfff"), RefundAmt = resultInfo.PaymentAmt.ToString(), NotifyUrl = string.Format("http://{0}/Test/RefundNotify?type=0", AppConfig.Global.Domain), }; var setting = JsonHelper.GetDefaultSettings(); setting.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore; string data = JsonHelper.Serialize(info, setting); string sign = SignManager.CreateSign(appId, data).Data; ViewBag.AppId = appId; ViewBag.Sign = sign; ViewBag.Data = data; ViewBag.Title = "通联支付退款(测试)"; ViewBag.Url = "/allinpay/syncrefund"; return(View("Pay")); }
public ActionResult WeChatBarcodePay(string orderId, string paymentAmt, string barcode) { PayOrderInfo info = new PayOrderInfo() { OrderId = orderId, PaymentAmt = paymentAmt, NotifyUrl = string.Format("http://{0}/Test/PayNotify?type=0", AppConfig.Global.Domain), Barcode = barcode, }; var setting = JsonHelper.GetDefaultSettings(); setting.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore; string data = JsonHelper.Serialize(info, setting); string sign = SignManager.CreateSign(_appId, data).Data; ViewBag.AppId = _appId; ViewBag.Sign = sign; ViewBag.Data = data; ViewBag.Title = "微信支付(测试)"; ViewBag.Url = "/wechatpay/barcodepay"; return(View("Pay")); }
public ActionResult SwiftPassWeChatPay(string orderId, string paymentAmt) { PayOrderInfo info = new PayOrderInfo() { OrderId = orderId, PaymentAmt = paymentAmt, OrderTime = DateTime.Now.ToString("yyyyMMddHHmmss"), NotifyUrl = string.Format("http://{0}/Test/PayNotify?type=0", AppConfig.Global.Domain), ReturnUrl = string.Format("http://{0}/Test/PayReturn?type=0", AppConfig.Global.Domain), }; var setting = JsonHelper.GetDefaultSettings(); setting.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore; string data = JsonHelper.Serialize(info, setting); string sign = SignManager.CreateSign(_appId, data).Data; ViewBag.AppId = _appId; ViewBag.Sign = sign; ViewBag.Data = data; ViewBag.Title = "微信支付(测试)"; ViewBag.Url = "/swiftpasswechatpay/onlinepay"; return(View("Pay")); }
/// <summary> /// 通知业务系统支付结果 /// </summary> /// <param name="resultInfo">支付结果记录</param> /// <param name="requestInfo">支付请求记录</param> /// <returns></returns> public virtual ExecuteResult NotifyBack(PayResultInfo resultInfo, PayRequestInfo requestInfo) { var result = new ExecuteResult() { Status = ResultStatus.Failure }; //支付结果记录对象无效,则不执行 if (resultInfo == null || resultInfo.SysNo <= 0) { result.Message = "支付结果记录对象无效"; return(result); } //支付请求记录对象无效,则不执行 if (requestInfo == null || requestInfo.SysNo <= 0) { result.Message = "支付请求记录对象无效"; return(result); } //支付结果记录与支付请求记录不对应,则不执行 if (requestInfo.SysNo != resultInfo.RequestSysNo) { result.Message = "支付结果记录与支付请求记录不对应"; return(result); } //支付结果记录未成功执行,或者已通知,则不执行 if (resultInfo.ExecuteResult != (int)ResultStatus.Success || resultInfo.NotifyStatus == (int)AppEnum.NotifyStatus.Finished) { result.Message = "支付结果记录未成功执行或已通知成功"; return(result); } //支付请求记录中不存在有效的通知地址,则不执行 if (!requestInfo.NotifyUrl.IsUrl()) { result.Message = "支付请求记录中不存在有效的通知地址"; return(result); } var notifyInfo = this.GetPayNotifyInfo(resultInfo); var setting = JsonHelper.GetDefaultSettings(); setting.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore; string data = JsonHelper.Serialize(notifyInfo, setting); string sign = SignManager.CreateSign(requestInfo.AppId, data).Data; string param = string.Format("appId={0}&sign={1}&data={2}", requestInfo.AppId, sign, data); var response = HttpHelper.HttpRequest("POST", requestInfo.NotifyUrl, param, 10000); string status = JsonHelper.GetJsonNode(response, "status"); string msg = JsonHelper.GetJsonNode(response, "msg"); result.Message = msg; var backInfo = new NotifyBackInfo() { ResultSysNo = resultInfo.SysNo, Status = (int)AppEnum.GlobalStatus.Invalid, Msg = msg, CreateTime = DateTime.Now, ResponseData = response, }; if (status == "1") { backInfo.Status = (int)AppEnum.GlobalStatus.Valid; resultInfo.NotifyStatus = (int)AppEnum.NotifyStatus.Finished; PayResultDAL.Update(resultInfo); result.Status = ResultStatus.Success; } PayResultDAL.InsertNotifyBack(backInfo); return(result); }