lcl 6 місяців тому
батько
коміт
c0fb110e0c

+ 52 - 25
AppStart/Helper/PublicImportDataService.cs

@@ -1173,31 +1173,58 @@ namespace MySystem
             function.WriteLog("返回报文\n" + result + "\n\n\n", "来客吧L吧设置服务费");
             return result;
         }
-        // public string LkbSetFee(string sn, decimal fee = 0.6M)
-        // {
-        //     List<SetDepositList> rateDOs = new List<SetDepositList>();
-        //     rateDOs.Add(new SetDepositList()
-        //     {
-        //         productSubType = "2020032007vz7Ux6",
-        //         updateValue = fee,
-        //         updateType = 0
-        //     });
-        //     Dictionary<string, string> headers = new Dictionary<string, string>();
-        //     headers.Add("X-Client-ID", lkbClientId);
-        //     headers.Add("X-Security", "RSA");
-        //     Dictionary<string, object> obj = new Dictionary<string, object>();
-        //     obj.Add("factorySequenceNo", sn);
-        //     obj.Add("productCode", 2);
-        //     obj.Add("productName", 2);
-        //     obj.Add("rateDOs", rateDOs);
-        //     string content = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
-        //     content = LkbEncrypt2(content);
-        //     string signstr = LkbSign(content);
-        //     headers.Add("X-Sign", signstr);
-        //     string req = "{\"param\":\"" + content + "\"}";
-        //     string result = function.PostWebRequest(lkbReqUrl2, req, headers, "application/json");
-        //     return result;
-        // }
+        public string LkbSetFee(string sn, decimal rate = 0.6M, int fee = 0)
+        {
+            List<Dictionary<string, string>> innerParamList = new List<Dictionary<string, string>>();
+            Dictionary<string, string> item = new Dictionary<string, string>();
+            item.Add("rateNo", "R1012");
+            item.Add("rateName", "刷卡交易手续费");
+            item.Add("rateValue", rate.ToString("f2"));
+            innerParamList.Add(item);
+            item = new Dictionary<string, string>();
+            item.Add("rateNo", "R1013");
+            item.Add("rateName", "刷卡结算手续费");
+            item.Add("rateValue", fee.ToString());
+            innerParamList.Add(item);
+            item = new Dictionary<string, string>();
+            item.Add("rateNo", "R1014");
+            item.Add("rateName", "扫码交易手续费");
+            item.Add("rateValue", "0.38");
+            innerParamList.Add(item);
+            item = new Dictionary<string, string>();
+            item.Add("rateNo", "R1015");
+            item.Add("rateName", "扫码结算手续费");
+            item.Add("rateValue", "0");
+            innerParamList.Add(item);
+            item = new Dictionary<string, string>();
+            item.Add("rateNo", "R1016");
+            item.Add("rateName", "借记卡封顶手续费");
+            item.Add("rateValue", "2500");
+            innerParamList.Add(item);
+            Dictionary<string, string> headers = new Dictionary<string, string>();
+            headers.Add("X-Client", lkbClientId);
+            headers.Add("X-Security", "RSA");
+            DateTimeOffset currentTime = DateTimeOffset.UtcNow;
+            string rfc1123FormattedTime = currentTime.ToString("r");
+            headers.Add("X-Time", rfc1123FormattedTime);
+            headers.Add("X-Trace", function.get_Random(32));
+            function.WriteLog("请求地址\n" + lkbReqUrl2, "来客吧L吧设置费率");
+            Dictionary<string, object> obj = new Dictionary<string, object>();
+            obj.Add("factorySequenceNo", sn);
+            obj.Add("productCode", "100");
+            obj.Add("productName", "来客吧");
+            obj.Add("innerParamList", innerParamList);
+            string content = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
+            function.WriteLog("明文参数\n" + content, "来客吧L吧设置费率");
+            content = LkbEncrypt2(content);
+            string signstr = LkbSign(content);
+            headers.Add("X-Sign", signstr);
+            string req = "{\"param\":\"" + content + "\"}";
+            function.WriteLog("加密参数\n" + req, "来客吧L吧设置费率");
+            string result = function.PostWebRequest(lkbReqUrl2, req, headers, "application/json");
+            function.WriteLog("返回报文\n" + result + "\n\n\n", "来客吧L吧设置费率");
+            return result;
+        }
         public string LkbEncrypt(string data)
         {
             return new RSAHelper(RSAType.RSA, System.Text.Encoding.UTF8, "", lkbMfe88PublicKey).Encrypt(data);

+ 2 - 1
Controllers/HomeController.cs

@@ -70,7 +70,8 @@ namespace MySystem.Controllers
             // {"existsFlag":"1","feeList":[{"feeCalcType":"M1","fixed":"0","rate":"0.24"},{"feeCalcType":"M2","fixed":"0","rate":"0.24"},{"feeCalcType":"M3","fixed":"0","rate":"0.38"},{"feeCalcType":"M4","fixed":"0","rate":"2.63"},{"feeCalcType":"M5","fixed":"0","rate":"0.63"},{"feeCalcType":"M7","fixed":"0"},{"feeCalcType":"M8","fixed":"0"},{"feeCalcType":"M9","fixed":"0"},{"feeCalcType":"T0","fixed":"1","rate":"300"}],"merchNo":"N00000D0022G499","ret_code":"00","ret_msg":"请求成功"}
 
             // return PublicImportDataService.Instance.SetLiSWeFee("WME52S0151221", "N00000C05U77807", "0.63", "300");
-            return PublicImportDataService.Instance.LkbSetDeposit("00003102702301319425328", 0);
+            // return PublicImportDataService.Instance.LkbSetDeposit("00003102702301319425328", 0);
+            return PublicImportDataService.Instance.LkbSetFee("00000302QRNL20019214", 0.63M, 300);
         }