Explorar el Código

联动掌中宝设置费率调整

lcl hace 1 semana
padre
commit
83e6cfaef0
Se han modificado 2 ficheros con 36 adiciones y 8 borrados
  1. 33 6
      AppStart/Helper/SetDepositPostService.cs
  2. 3 2
      Controllers/HomeController.cs

+ 33 - 6
AppStart/Helper/SetDepositPostService.cs

@@ -1294,19 +1294,46 @@ namespace MySystem
 
         public string LDZZBFeeRate(string MerNo, decimal AddRate, decimal Fee = 0)
         {
+            string s = LDZZBFeeRateQuery(MerNo);
+            JsonData jsonObj = JsonMapper.ToObject(s);
+            string aesKey = jsonObj["encryptKey"].ToString();
+            aesKey = LDZZBDecrypt(aesKey);
+            string content = AesDecrypt(jsonObj["data"].ToString(), aesKey);
+            JsonData contentObj = JsonMapper.ToObject(content);
+
             Dictionary<string, object> req = new Dictionary<string, object>();
             req.Add("customerNo", MerNo);
             List<Dictionary<string, object>> customerRateList = new List<Dictionary<string, object>>();
-            Dictionary<string, object> customerRateItem = new Dictionary<string, object>();
-            customerRateItem.Add("payTypeViewCode", "POS_CC");
-            customerRateItem.Add("rateValue", AddRate);
-            customerRateItem.Add("fixedValue", Fee);
-            customerRateItem.Add("cappingValue", 0);
-            customerRateList.Add(customerRateItem);
+            for (int i = 0; i < contentObj.Count; i++)
+            {
+                JsonData item = contentObj[i];
+                string payTypeViewCode = item["payTypeViewCode"].ToString();
+                decimal rateValue = decimal.Parse(item["rateValue"].ToString());
+                decimal fixedValue = decimal.Parse(item["fixedValue"].ToString());
+                if(payTypeViewCode == "POS_CC")
+                {
+                    rateValue = AddRate;
+                    fixedValue = Fee;
+                }
+                Dictionary<string, object> customerRateItem = new Dictionary<string, object>();
+                customerRateItem.Add("payTypeViewCode", payTypeViewCode);
+                customerRateItem.Add("rateValue", rateValue);
+                customerRateItem.Add("fixedValue", fixedValue);
+                customerRateItem.Add("cappingValue", decimal.Parse(item["cappingValue"].ToString()));
+                customerRateList.Add(customerRateItem);
+            }
+
             req.Add("customerRateList", customerRateList);
             return LDZZBPost(req, "customerRateModify");
         }
 
+        public string LDZZBFeeRateQuery(string MerNo)
+        {
+            Dictionary<string, object> req = new Dictionary<string, object>();
+            req.Add("customerNo", MerNo);
+            return LDZZBPost(req, "customerRateQuery");
+        }
+
         public string LDZZBPost(Dictionary<string, object> req, string path)
         {
             string logString = "";

+ 3 - 2
Controllers/HomeController.cs

@@ -52,8 +52,9 @@ namespace MySystem.Controllers
         public string test()
         {
             // string s = SetDepositPostService.Instance.LDZZBServiceFeeQuery("00007302225171000028");
-            string s = SetDepositPostService.Instance.LDZZBServiceFee("0000730222517E000019", 1);
-            // string s = SetDepositPostService.Instance.LDZZBFeeRate("00007302225171000028", 0.63M, 3M);
+            // string s = SetDepositPostService.Instance.LDZZBServiceFee("0000730222517E000019", 1);
+            string s = SetDepositPostService.Instance.LDZZBFeeRate("825815174643591", 0.63M, 0);
+            // string s = SetDepositPostService.Instance.LDZZBFeeRateQuery("825815174643591");
             JsonData jsonObj = JsonMapper.ToObject(s);
             string aesKey = jsonObj["encryptKey"].ToString();
             aesKey = SetDepositPostService.Instance.LDZZBDecrypt(aesKey);