Browse Source

pref:修改为从CenterURL2取移动支付密钥和地址,原来是写死密钥和从本地取

zhanfei 4 months ago
parent
commit
be39e218ea
3 changed files with 51 additions and 20 deletions
  1. 3 3
      Business/MobilePay.cs
  2. 1 5
      Helper/EncryptHelper.cs
  3. 47 12
      Helper/InvokeHelper.cs

+ 3 - 3
Business/MobilePay.cs

@@ -53,7 +53,7 @@ namespace PTMedicalInsurance.Business
             try
             {
 
-                EncryptHelper eh = new EncryptHelper();
+                EncryptHelper eh =  new EncryptHelper(Global.inf.MobilePay.appid, Global.inf.MobilePay.secretKey, Global.inf.MobilePay.publicKey, Global.inf.MobilePay.privateKey);
                 if (GetPatientInfo(out errMsg) != 0)
                 {
                     outPar = errMsg;
@@ -196,7 +196,7 @@ namespace PTMedicalInsurance.Business
             outPar = "";
             try
             {
-                EncryptHelper eh = new EncryptHelper();
+                EncryptHelper eh = new EncryptHelper(Global.inf.MobilePay.appid, Global.inf.MobilePay.secretKey, Global.inf.MobilePay.publicKey, Global.inf.MobilePay.privateKey);
                 //6301查询具体明细信息
                 if (GetYH6301Inpar(out errMsg) != 0)
                 {
@@ -245,7 +245,7 @@ namespace PTMedicalInsurance.Business
             outPar = "";
             try
             {
-                EncryptHelper eh = new EncryptHelper();
+                EncryptHelper eh = new EncryptHelper(Global.inf.MobilePay.appid, Global.inf.MobilePay.secretKey, Global.inf.MobilePay.publicKey, Global.inf.MobilePay.privateKey);
                 if (MSettl.onlineYBFalg != "Y")
                 {
                     //读电子凭证

+ 1 - 5
Helper/EncryptHelper.cs

@@ -23,16 +23,12 @@ namespace PTMedicalInsurance.Helper
         //private string appId = "1H1INA1L30OG3F60C80A0000DEE43558";    //渠道ID
         //private string publicKey = "BDMsMM2HPRkaKSl2ynBbCRtJodP8Nh4G5IkEnV+7YHaCplkAZbPMsUlvJpWqQ+Q4sT7611xGSZ1/mPsqgqJ49zs=";            //平台公钥
 
-        //正式
+        //正式  老院
         private string appId = "1H62Q1KGP05J76430B0A00007144E257";    //渠道ID
         private string appSecret = "1H62Q1KH205K76430B0A0000BF149773";   //appSecret 数字密钥sm4
         private string privateKey = "YbNObZNMdUgwgLUEyK4ixNSkaCF9OPtCdDth9APWYKU = ";     //渠道私密
         private string publicKey = "BIrhJIL0UTuC1+Oq50EhzCFNaSJcBwEe9fndgDsAM/1aZCxy77wROYHysAej7wyqAhi+qZcJVXmuj7NfDaHfD40=";            //平台公钥
 
-        public EncryptHelper()
-        { 
-        
-        }
 
         public EncryptHelper(string appId, string appSecret, string publicKey, string privateKey)
         {

+ 47 - 12
Helper/InvokeHelper.cs

@@ -12,21 +12,22 @@
 
 
 ******************************************************************************/
+using Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
+using PTMedicalInsurance.Common;
+using PTMedicalInsurance.Forms;
+using PTMedicalInsurance.Helper;
+using PTMedicalInsurance.Variables;
 using System;
 using System.Collections.Generic;
 using System.IO;
 using System.Linq;
 using System.Net;
+using System.Runtime.InteropServices;
+using System.Security.Policy;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows.Forms;
-using PTMedicalInsurance.Helper;
-using Newtonsoft.Json;
-using PTMedicalInsurance.Common;
-using PTMedicalInsurance.Variables;
-using System.Runtime.InteropServices;
-using PTMedicalInsurance.Forms;
 
 namespace PTMedicalInsurance.Helper
 {
@@ -520,15 +521,49 @@ namespace PTMedicalInsurance.Helper
             String outPar = ""; Boolean bDownLoad = false;
             try
             {
-                Global.curEvt.URL = Global.inf.centerURL;
-                List<string> infList = new List<string> { "6201", "6202", "6203", "6301", "6401" };
+                //Global.curEvt.URL = Global.inf.centerURL;
+                //List<string> infList = new List<string> { "6201", "6202", "6203", "6301", "6401" };
 
-                if (infList.Contains(funNO))
+                //if (infList.Contains(funNO))
+                //{
+                //    IniFile urlIni = new IniFile(Global.curEvt.path + @"\CenterServiceURL.ini");
+                //    Global.curEvt.URL = urlIni.ReadValue("URL", funNO);
+                //    Global.inf.centerURL = Global.curEvt.URL;
+                //}
+
+                string url = "";
+                switch (funNO)
                 {
-                    IniFile urlIni = new IniFile(Global.curEvt.path + @"\CenterServiceURL.ini");
-                    Global.curEvt.URL = urlIni.ReadValue("URL", funNO);
-                    Global.inf.centerURL = Global.curEvt.URL;
+                    case "6201":
+                        url = "/org/local/api/hos/uldFeeInfo";
+                        break;
+                    case "6202":
+                        url = "/org/local/api/hos/pay_order";
+                        break;
+                    case "6203":
+                        url = "/org/local/api/hos/refund_Order";
+                        break;
+                    case "6301":
+                        url = "/org/local/api/hos/query_order_info";
+                        break;
+                    case "6401":
+                        url = "/org/local/api/hos/revoke_order";
+                        break;
+                    default:
+                        break;
                 }
+                /*
+                 * 
+                 * 6201=http://ldjk.yn.hsip.gov.cn/eapdomain/org/local/api/hos/uldFeeInfo
+6202=http://ldjk.yn.hsip.gov.cn/eapdomain/org/local/api/hos/pay_order
+6203=http://ldjk.yn.hsip.gov.cn/eapdomain/org/local/api/hos/refund_Order
+6301=http://ldjk.yn.hsip.gov.cn/eapdomain/org/local/api/hos/query_order_info
+6401=http://ldjk.yn.hsip.gov.cn/eapdomain/org/local/api/hos/revoke_order
+                 */
+
+                // 移动支付地址
+                Global.curEvt.URL = Global.inf.MobilePay.url + url;
+                Global.inf.centerURL = Global.curEvt.URL;
 
                 joRtn = invokeCenterService(data);
                 outPar = JsonHelper.Compress(joRtn);