|
|
@@ -1484,6 +1484,146 @@ namespace MySystem
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
+ #region 国通星驿付
|
|
|
+
|
|
|
+ // 生产环境
|
|
|
+ string xyfAgentNo = "61000000624958";
|
|
|
+ string xyfReqUrl = "https://yyfsvxm.postar.cn";
|
|
|
+ string xyfPubKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArrC3FguNQY+bYZzK2hzXl5giRw+KLERF+BCmLYfpBroD6qjgKsDek9bYLwzXe9036ClCExiZ2hpTVe00zKceQxogWQuweLCi9614Wn4RPBp2JfJKcWgaWpydnIFiBVk4Rb+Wo3q0KUMwsZSbuRQDWIeSp0ezR5zfCkzgIJLgor2BfokrdieS8Q5k0qYTd8kbPgFm5GFGdufS6Tcar4Cjr6MGPe36Q/CCo4BSODbjczDi5HZAg16EnMD5sGw1rCTEMDaKO+/KFALOxKIFSyInEw17J2bMQXNqMkYnUfnGRx7pLTawyp9PUBeZ/qCGBGxnwG8IBXjkAg620tkbTB8a4QIDAQAB";
|
|
|
+
|
|
|
+ public string xyfServiceList(string snNo)
|
|
|
+ {
|
|
|
+ string logString = "";
|
|
|
+ SortedList<string, string> reqdic = new SortedList<string, string>();
|
|
|
+ string timestamp = function.getTimeStamp();
|
|
|
+ reqdic.Add("agetId", xyfAgentNo);//代理商编号
|
|
|
+ reqdic.Add("termphyno", snNo);//机具编号
|
|
|
+ reqdic.Add("timeStamp", timestamp);//时间戳
|
|
|
+ reqdic.Add("version", "1.0.0");//版本号
|
|
|
+ string signString = function.BuildQueryString(reqdic);
|
|
|
+ signString = xyfSHA256Sign(signString);
|
|
|
+ string sign = xyfSignData(signString);
|
|
|
+ reqdic.Add("sign", sign);//签名
|
|
|
+ string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
|
|
|
+
|
|
|
+ logString += "\n请求参数\n" + req;
|
|
|
+ logString += "\n请求地址:" + xyfReqUrl + "/yyfsevr/traditionCust/termPolicyList";
|
|
|
+ string result = PostWebRequest(xyfReqUrl + "/yyfsevr/traditionCust/termPolicyList", req, new Dictionary<string, string>());
|
|
|
+ logString += "\n返回\n" + result + "\n\n";
|
|
|
+ LogHelper.Instance.WriteLog(logString, "查询星驿付机具服务费政策");
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ public string xyfServiceFee(string snNo, string ServiceFee = "0")
|
|
|
+ {
|
|
|
+ //{"msg":"终端政策列表查询成功","code":"000000","data":[{"recashid":"WZNV1B99","freezeamt":"99","recashname":"微智能V1冻99"},{"recashid":"WZNV1B59","freezeamt":"59","recashname":"微智能V1冻59"},{"recashid":"WZNV1B118","freezeamt":"118","recashname":"微智能V1冻118"},{"recashid":"WZNV1B198","freezeamt":"198","recashname":"微智能V1冻198"},{"recashid":"WZNV1D199","freezeamt":"199","recashname":"微智能V1冻199"},{"recashid":"WZNV1299","freezeamt":"299","recashname":"微智能V1冻299"}],"success":true}
|
|
|
+ string newpolicyid = "";
|
|
|
+ if (ServiceFee == "99") newpolicyid = "WZNV1B99";
|
|
|
+ if (ServiceFee == "59") newpolicyid = "WZNV1B59";
|
|
|
+ if (ServiceFee == "118") newpolicyid = "WZNV1B118";
|
|
|
+ if (ServiceFee == "198") newpolicyid = "WZNV1B198";
|
|
|
+ if (ServiceFee == "199") newpolicyid = "WZNV1D199";
|
|
|
+ if (ServiceFee == "299") newpolicyid = "WZNV1299";
|
|
|
+ string logString = "";
|
|
|
+ SortedList<string, string> reqdic = new SortedList<string, string>();
|
|
|
+ string timestamp = function.getTimeStamp();
|
|
|
+ reqdic.Add("agetId", xyfAgentNo);//代理商编号
|
|
|
+ reqdic.Add("termphyno", snNo);//机具号
|
|
|
+ if(!string.IsNullOrEmpty(newpolicyid))
|
|
|
+ {
|
|
|
+ reqdic.Add("newpolicyid", newpolicyid);//政策编号
|
|
|
+ }
|
|
|
+ reqdic.Add("isDeposit", ServiceFee == "0" ? "1" : "0");//是否免押金
|
|
|
+ reqdic.Add("timeStamp", timestamp);//时间戳
|
|
|
+ reqdic.Add("version", "1.0.0");//版本号
|
|
|
+ string signString = function.BuildQueryString(reqdic);
|
|
|
+ signString = xyfSHA256Sign(signString);
|
|
|
+ string sign = xyfSignData(signString);
|
|
|
+ reqdic.Add("sign", sign);//签名
|
|
|
+ string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
|
|
|
+
|
|
|
+ logString += "\n请求参数\n" + req;
|
|
|
+ logString += "\n请求地址:" + xyfReqUrl + "/yyfsevr/traditionCust/termChgPolicy";
|
|
|
+ string result = PostWebRequest(xyfReqUrl + "/yyfsevr/traditionCust/termChgPolicy", req, new Dictionary<string, string>());
|
|
|
+ logString += "\n返回\n" + result + "\n\n";
|
|
|
+ LogHelper.Instance.WriteLog(logString, "设置星驿付机具服务费");
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ public string xyfFee(string snNo, string rate, string fee = "0")
|
|
|
+ {
|
|
|
+ string logString = "";
|
|
|
+ SortedList<string, object> reqdic = new SortedList<string, object>();
|
|
|
+ string timestamp = function.getTimeStamp();
|
|
|
+ reqdic.Add("agetId", xyfAgentNo);//代理商编号
|
|
|
+ List<Dictionary<string, string>> snNos = new List<Dictionary<string, string>>();
|
|
|
+ Dictionary<string, string> item = new Dictionary<string, string>();
|
|
|
+ item.Add("termphyno", snNo);
|
|
|
+ snNos.Add(item);
|
|
|
+ reqdic.Add("termphynos", snNos);//机具编号
|
|
|
+ reqdic.Add("crerat", rate);//贷记卡费率
|
|
|
+ reqdic.Add("txprice", fee);//提现费
|
|
|
+ reqdic.Add("timeStamp", timestamp);//时间戳
|
|
|
+ reqdic.Add("version", "1.0.0");//版本号
|
|
|
+ SortedList<string, string> reqSign = new SortedList<string, string>();
|
|
|
+ foreach (var kvp in reqdic)
|
|
|
+ {
|
|
|
+ if(kvp.Key == "termphynos")
|
|
|
+ {
|
|
|
+ reqSign.Add(kvp.Key, Newtonsoft.Json.JsonConvert.SerializeObject(snNos));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ reqSign.Add(kvp.Key, kvp.Value.ToString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ string signString = function.BuildQueryString(reqSign);
|
|
|
+ signString = xyfSHA256Sign(signString);
|
|
|
+ string sign = xyfSignData(signString);
|
|
|
+ reqdic.Add("sign", sign);//签名
|
|
|
+ string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
|
|
|
+
|
|
|
+ logString += "\n请求参数\n" + req;
|
|
|
+ logString += "\n请求地址:" + xyfReqUrl + "/yyfsevr/traditionCust/updateTermRate";
|
|
|
+ string result = PostWebRequest(xyfReqUrl + "/yyfsevr/traditionCust/updateTermRate", req, new Dictionary<string, string>());
|
|
|
+ logString += "\n返回\n" + result + "\n\n";
|
|
|
+ LogHelper.Instance.WriteLog(logString, "设置星驿付机具费率");
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ public string xyfSHA256Sign(string toSignStr)
|
|
|
+ {
|
|
|
+ byte[] toSignByte = Encoding.UTF8.GetBytes(toSignStr);
|
|
|
+ SHA256 sha256 = SHA256.Create();
|
|
|
+ byte[] signByte = sha256.ComputeHash(toSignByte);
|
|
|
+ StringBuilder builder = new StringBuilder();
|
|
|
+ for (int i = 0; i < signByte.Length; i++)
|
|
|
+ {
|
|
|
+ builder.Append(signByte[i].ToString("x2"));
|
|
|
+ }
|
|
|
+ var sign = builder.ToString();
|
|
|
+ return sign;
|
|
|
+ }
|
|
|
+
|
|
|
+ public string xyfSignData(string toSignStr)
|
|
|
+ {
|
|
|
+ byte[] toSignByte = Encoding.UTF8.GetBytes(toSignStr);
|
|
|
+ var toKey = Convert.FromBase64String(xyfPubKey);
|
|
|
+ var rsaroot = RSA.Create();
|
|
|
+ rsaroot.ImportSubjectPublicKeyInfo(toKey, out _);
|
|
|
+ var publicKeyParameters = rsaroot.ExportParameters(false);
|
|
|
+ using (var rsa = RSA.Create())
|
|
|
+ {
|
|
|
+ rsa.ImportParameters(publicKeyParameters);
|
|
|
+ // var sha256 = SHA256.Create();
|
|
|
+ // var hash = sha256.ComputeHash(toSignByte);
|
|
|
+ byte[] endByte = rsa.Encrypt(toSignByte, RSAEncryptionPadding.Pkcs1);
|
|
|
+ return Convert.ToBase64String(endByte);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
|
|
|
|
|
|
|