示例#1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        SortedDictionary <string, string> sPara = GetRequestPost();


        if (sPara.Count > 0)//判断是否有带返回参数
        {
            Console.WriteLine("接收支付异步通知数据:【" + sPara.ToString() + "】");

            if (!YinTongUtil.checkSign(sPara, PartnerConfig.YT_PUB_KEY, //验证失败
                                       PartnerConfig.MD5_KEY))
            {
                Response.Write(@"{""ret_code"":""9999"",""ret_msg"":""验签失败""}");
                Console.WriteLine("支付异步通知验签失败");
                return;
            }
            else
            {
                Response.Write(@"{""ret_code"":""0000"",""ret_msg"":""交易成功""}");
                Response.Write("支付异步通知数据接收处理成功");
            }
        }
        else
        {
            Response.Write(@"{""ret_code"":""9999"",""ret_msg"":""交易失败""}");
        }

        // 解析异步通知对象
        // sPara 字典对象
        // TODO:更新订单,发货等后续处理
    }
示例#2
0
        public bool CheckSign()
        {
            var dic = GetDic();
            var a   = YinTongUtil.checkSign(dic, PartnerConfig.YT_PUB_KEY, //验证失败
                                            PartnerConfig.MD5_KEY);

            return(a);
        }
示例#3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SortedDictionary <string, string> sPara = GetRequestPost();

            if (sPara.Count > 0)//判断是否有带返回参数
            {
                Console.WriteLine("接收支付异步通知数据:【" + sPara.ToString() + "】");

                if (!YinTongUtil.checkSign(sPara, PartnerConfig.YT_PUB_KEY, //验证失败
                                           PartnerConfig.MD5_KEY))
                {
                    Response.Write(@"{""ret_code"":""9999"",""ret_msg"":""验签失败""}");
                    Console.WriteLine("支付异步通知验签失败");
                    return;
                }
                else
                {
                    Response.Write(@"{""ret_code"":""0000"",""ret_msg"":""交易成功""}");
                    Response.Write("支付异步通知数据接收处理成功");
                }

                try
                {
                    var context = new Agp2p.Linq2SQL.Agp2pDataContext();
                    var order   = context.li_bank_transactions.FirstOrDefault(b => b.no_order == sPara["no_order"]);
                    if (order != null)
                    {
                        context.ConfirmBankTransaction(order.id, null);
                    }
                }
                catch (Exception ex)
                {
                    Response.Write(@"{""ret_code"":""9999"",""ret_msg"":" + ex.Message + "}");
                }
            }
            else
            {
                Response.Write(@"{""ret_code"":""9999"",""ret_msg"":""交易失败""}");
            }
        }