Example #1
0
        private Dictionary <string, string> getAlipayRequstParams(AliServicePostDataMod aliMod)
        {
            Dictionary <string, string> dict = new Dictionary <string, string>();

            dict.Add("service", aliMod.service);
            dict.Add("sign_type", aliMod.sign_type);
            dict.Add("charset", aliMod.charset);
            dict.Add("biz_content", aliMod.biz_content);
            dict.Add("sign", aliMod.sign);
            return(dict);
        }
Example #2
0
 public string  InitGateway(AliServicePostDataMod aliMod, string privateKey, string publicKey, string appId)
 {
     //log(GetUrlParam(getRequstParam(aliMod)));
     // log(getRequestString("service"));
     Config.merchant_private_key = privateKey;
     Config.merchant_public_key  = publicKey;
     //Config.appId = appId;
     Game.Utils.FileManager.WriteFile(System.AppDomain.CurrentDomain.BaseDirectory + ("/PosGateway.txt"), aliMod.service + "\r\n" + aliMod.biz_content + "\r\n" + aliMod.charset + "\r\n" + aliMod.service + "\r\n" + aliMod.sign + "\r\n" + aliMod.sign_type);
     //验证网关
     if ("alipay.service.check".Equals(aliMod.service))
     {
         return(verifygw(aliMod));
     }
     return("");
 }
Example #3
0
        public string verifygw(AliServicePostDataMod aliMod)
        {
            //  Request.Params;
            Dictionary <string, string> dict = getAlipayRequstParams(aliMod);
            //string biz_content = AlipaySignature.CheckSignAndDecrypt(dict, Config.alipay_public_key, Config.merchant_private_key, true, false);
            string biz_content = dict["biz_content"];

            if (!verifySignAlipayRequest(dict))
            {
                txt = verifygwResponse(false, Config.getMerchantPublicKeyStr());
            }
            if ("verifygw".Equals(getXmlNode(biz_content, "EventType")))
            {
                txt = verifygwResponse(true, Config.getMerchantPublicKeyStr());
            }
            return(txt);
        }