public async Task <object> WxpayNotify() { var response = new Senparc.Weixin.MP.TenPayLibV3.ResponseHandler(HttpContext); if (WxPaySdk.IsTenpaySign(response)) { string passbackParams = response.GetParameter("attach"); IDictionary <string, string> ps = SysHelper.GetUrlParam(passbackParams); int id = ps["id"].ToInt32(); //兑换事件Id switch (ps["merchantType"]) { case "身家充值": await _rechargeRecordService.DealWithAsync(id); break; case "兑换租赁": await _exchangeEventService.DealWithAsync(id, "Wx"); break; } } var request = new Senparc.Weixin.MP.TenPayLibV3.RequestHandler(); request.SetParameter("return_code", "SUCCESS"); request.SetParameter("return_msg", "OK"); return(request.ParseXML()); }
public async Task <object> AlipayNotify() { IDictionary <string, string> sPara = GetRequestPost(); if (sPara.Count > 0)//判断是否有带返回参数 { bool verifyResult = AliPaySdk.VerifySignature(sPara); if (verifyResult) //验证成功 { if (Request.Form["trade_status"] == "TRADE_FINISHED" || Request.Form["trade_status"] == "TRADE_SUCCESS") //在指定时间段内未支付时关闭的交易;在交易完成全额退款成功时关闭的交易。//交易成功,且可对该交易做操作,如:多级分润、退款等。 { string passbackParams = Request.Form["passback_params"]; IDictionary <string, string> ps = SysHelper.GetUrlParam(passbackParams); int id = ps["id"].ToInt32(); //兑换事件Id switch (ps["merchantType"]) { case "身家充值": await _rechargeRecordService.DealWithAsync(id); break; case "兑换租赁": await _exchangeEventService.DealWithAsync(id, "Ali"); break; } } else { LogHelper.WriteLog("错误:支付失败"); } //——请根据您的业务逻辑来编写程序(以上代码仅作参考)—— return("success"); //请不要修改或删除 ///////////////////////////////////////////////////////////////////////////////////////////////////////////// } else//验证失败 { LogHelper.WriteLog("错误:验证失败"); return("fail"); } } else { LogHelper.WriteLog("错误:无通知参数"); return("无通知参数"); } }