예제 #1
0
 public void Index()
 {
     try
     {
         PayDictionary queryArray = YinShengCommon.TransQueryString(Request.Form.ToString());
         queryArray.Sort(PaySortEnum.Asc);//异步验证签名需要配需
         if (queryArray["sign"] == null)
         {
             Response.Write("缺少签名参数");
             Response.End();
         }
         string sign = HttpUtility.UrlDecode(queryArray["sign"]);
         queryArray.Remove("sign");
         string parStr = queryArray.GetParmarStr();
         if (YinShengCommon.SignVerify(parStr, sign))
         {
             Response.Write("success");
             Response.End();
         }
         else
         {
             Response.Write("签证签名不一致");
             Response.End();
         }
     }
     catch (Exception ex) {
         ExceptionsServices.AddExceptionToDbAndTxt("YSAsyncNotify", "支付通知出错", ex, LogFrom.WeiXin);
         Response.Write("error");
         Response.End();
     }
 }
예제 #2
0
        public ActionResult ParkPayment(decimal orderId, string opendId)
        {
            OnlineOrder order = CheckOrder(orderId);

            try
            {
                if (order.OrderType != OnlineOrderType.ParkFee)
                {
                    throw new MyException("支付方法不正确");
                }

                PayDictionary resultArray = new PayDictionary();
                resultArray.Add("method", "ysepay.online.weChat.app.pay");
                resultArray.Add("partner_id", YinShengConfig.PartnerId);
                resultArray.Add("timestamp", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                resultArray.Add("charset", "utf-8");
                resultArray.Add("sign_type", "RSA");
                resultArray.Add("version", "3.0");
                resultArray.Add("notify_url", ""); //异步地址
                resultArray.Add("return_url", ""); //同步地址
                resultArray.Add("seller_id", YinShengConfig.SellerId);
                resultArray.Add("timeout_express", "10m");
                resultArray.Add("currency", "CNY");
                resultArray.Add("seller_name", "商家名称");
                resultArray.Add("business_code", "01000010");
                resultArray.Add("extra_common_param", "备注说明");
                resultArray.Add("open_id", order.PayAccount);
                resultArray.Add("out_trade_no", orderId.ToString());
                resultArray.Add("subject", "临停缴费");
                resultArray.Add("total_amount", "0.1");
                resultArray.Sort(PaySortEnum.Asc);
                string par = resultArray.GetParmarStr();
                resultArray.Add("sign", YinShengCommon.SignEncrypt(par));
                ViewBag.PayDictionary = resultArray;
                return(View(order));
            }
            catch (MyException ex) {
                return(RedirectToAction("Index", "ErrorPrompt", new { message = ex.Message, returnUrl = "/ParkingPayment/Index" }));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptionToDbAndTxt("WxOfficialAccountPay_Error", string.Format("支付失败 orderId:{0};openId:{1}", orderId, order.PayAccount), ex, LogFrom.WeiXin);
                return(RedirectToAction("Index", "ErrorPrompt", new { message = "提交支付失败", returnUrl = "/ParkingPayment/Index" }));
            }
        }