示例#1
0
文件: MessageBase.cs 项目: yhhno/CRL3
 public bool CheckSign(string ChkValue)
 {
     var signMsgVal = GetSignData();
     CHINAPNRLib.NetpayClient SignObject = new NetpayClientClass();
     var a = SignObject.VeriSignMsg0(publicKey, signMsgVal, signMsgVal.Length, ChkValue);
     return a == "0";
 }
示例#2
0
文件: MessageBase.cs 项目: yhhno/CRL3
 public string MakeSign(string merId)
 {
     CHINAPNRLib.NetpayClient SignObject = new NetpayClientClass();
     string data = GetSignData();
     data = SignObject.SignMsg0(merId, privateKey, data, data.Length); 
     return data;
 }
示例#3
0
        public string MakeSign(string merId)
        {
            CHINAPNRLib.NetpayClient SignObject = new NetpayClientClass();
            string data = GetSignData();

            data = SignObject.SignMsg0(merId, privateKey, data, data.Length);
            return(data);
        }
示例#4
0
        public bool CheckSign(string ChkValue)
        {
            var signMsgVal = GetSignData();

            CHINAPNRLib.NetpayClient SignObject = new NetpayClientClass();
            var a = SignObject.VeriSignMsg0(publicKey, signMsgVal, signMsgVal.Length, ChkValue);

            return(a == "0");
        }
示例#5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string CmdId, MerId, RespCode, TrxId, OrdAmt, CurCode, Pid, OrdId, MerPriv, RetType, DivDetails, GateId, ChkValue;

            CmdId      = RequestString("CmdId");        //消息类型
            MerId      = RequestString("MerId");        //商户号
            RespCode   = RequestString("RespCode");     //应答返回码
            TrxId      = RequestString("TrxId");        //钱管家交易唯一标识
            OrdAmt     = RequestString("OrdAmt");       //金额
            CurCode    = RequestString("CurCode");      //币种
            Pid        = RequestString("Pid");          //商品编号
            OrdId      = RequestString("OrdId");        //订单号
            MerPriv    = RequestString("MerPriv");      //商户私有域
            RetType    = RequestString("RetType");      //返回类型
            DivDetails = RequestString("DivDetails");   //分账明细
            GateId     = RequestString("GateId");       //银行ID
            ChkValue   = RequestString("ChkValue");     //签名信息

            Lebi_Order order;

            if (OrdId.Contains("lebiorderid_"))
            {
                //OrdId = OrdId.Replace("lebiorderid_", "");
                order = B_Lebi_Order.GetModel("id=lbsql{'" + OrdId.Replace("lebiorderid_", "") + "'}");
            }
            else
            {
                order = B_Lebi_Order.GetModel("Code=lbsql{'" + OrdId + "'}");
            }
            if (order == null)
            {
                Response.Write("系统错误");
                Response.End();
                return;
            }
            Lebi_OnlinePay pay = Shop.Bussiness.Money.GetOnlinePay(order, "chinapnr");

            if (pay == null)
            {
                Response.Write("系统错误");
                Response.End();
                return;
            }
            //验证签名
            string MsgData, SignData;

            MsgData = CmdId + MerId + RespCode + TrxId + OrdAmt + CurCode + Pid + OrdId + MerPriv + RetType + DivDetails + GateId;      //参数顺序不能错
            CHINAPNRLib.NetpayClient SignObject = new NetpayClientClass();
            string keypath = System.Web.HttpContext.Current.Server.MapPath("~/" + pay.UserKey.TrimStart('/'));

            SignData = SignObject.VeriSignMsg0(keypath, MsgData, MsgData.Length, ChkValue);           //请将此处改成你的私钥文件所在路径

            if (SignData == "0")
            {
                if (RespCode == "000000")
                {
                    //交易成功
                    //根据订单号 进行相应业务操作
                    //在些插入代码
                    Order.OnlinePaySuccess("chinapnr", order.Code);
                }
                else
                {
                    //交易失败
                    //根据订单号 进行相应业务操作
                    //在些插入代码
                }
                Response.Write("RECV_ORD_ID_" + OrdId);
            }
            else
            {
                //验签失败
            }
        }
示例#6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int        order_id = RequestTool.RequestInt("order_id", 0);
            Lebi_Order order    = B_Lebi_Order.GetModel(order_id);

            if (order == null)
            {
                Response.Write("ERROR");
                Response.End();
                return;
            }
            Lebi_Language language = B_Lebi_Language.GetModel(order.Language_id);

            if (order.IsPaid == 1)
            {
                Response.Write(Language.Tag("已付款", language.Code));
                Response.End();
                return;
            }
            order.Site_id_pay = CurrentSite.id;
            order.Language_id = CurrentLanguage.id;
            Lebi_OnlinePay pay = Shop.Bussiness.Money.GetOnlinePay(order, "chinapnr");

            if (pay == null)
            {
                Response.Write("系统错误");
                Response.End();
                return;
            }
            if (pay.FreeFeeRate == 1)
            {
                pay.FeeRate = 0;
            }
            if (pay.FeeRate > 0)
            {
                order.Money_OnlinepayFee = order.Money_Pay * pay.FeeRate / 100;
            }
            if (order.OnlinePay_id != pay.id)
            {
                order.OnlinePay_id   = pay.id;
                order.OnlinePay_Code = pay.Code;
                order.OnlinePay      = pay.Name;
            }
            B_Lebi_Order.Update(order);
            Lebi_Currency currendy = B_Lebi_Currency.GetModel(pay.Currency_id);
            BaseConfig    SYS      = ShopCache.GetBaseConfig();

            Shop.Bussiness.Site site = new Shop.Bussiness.Site();



            Version = "10";         //版本号
            CmdId   = "Buy";
            MerId   = pay.UserName; //商户号
            OrdId   = order.Code;   //订单编号
            if (OrdId.Length > 20)
            {
                OrdId = "lebiorderid_" + order.id.ToString();
            }
            OrdAmt     = (order.Money_Pay * currendy.ExchangeRate * (1 + (pay.FeeRate / 100))).ToString("f" + currendy.DecimalLength + ""); //订单金额
            CurCode    = pay.Currency_Code;                                                                                                 //币种
            Pid        = "";                                                                                                                //商品编号
            RetUrl     = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/chinapnr/Buy_return_url.aspx";
            BgRetUrl   = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/chinapnr/Buy_notify_url.aspx";
            MerPriv    = ""; //商户私有域,你可以转递一些贵网站系统中特有的参数 选填项
            GateId     = ""; //银行网关号,如果输入网关号将直接跳至银行支付页面   网关号可向汇付销售人员获取  选填项
            UsrMp      = ""; //用户手机号  选填项
            DivDetails = ""; //分帐信息,当存在将支付款项分别入帐时需要 选填项
            PayUsrId   = ""; //付款人的汇付用户号 选填项

            //签名
            String MsgData;

            MsgData = Version + CmdId + MerId + OrdId + OrdAmt + CurCode + Pid + RetUrl + MerPriv + GateId + UsrMp + DivDetails + PayUsrId + BgRetUrl;
            CHINAPNRLib.NetpayClient SignObject = new NetpayClientClass();
            string keypath = System.Web.HttpContext.Current.Server.MapPath("~/" + pay.Email.TrimStart('/'));

            ChkValue = SignObject.SignMsg0(MerId, keypath, MsgData, MsgData.Length);           //请将此处改成你的私钥文件所在路径
        }