Esempio n. 1
0
        public static string Query_youmifu(string merchant_order)
        {
            string url   = ApplicationSettings.Get("url_ymf");
            string value = ApplicationSettings.Get("parter_ymf");
            string key   = ApplicationSettings.Get("key_ymf");
            Dictionary <string, string> dictionary = new Dictionary <string, string>();

            dictionary["apiName"]    = "SINGLE_SETT_QUERY";
            dictionary["apiVersion"] = "1.0.0.0";
            dictionary["platformID"] = value;
            dictionary["merchNo"]    = value;
            dictionary["orderNo"]    = merchant_order;
            dictionary["tradeDate"]  = DateTime.Now.ToString("yyyyMMdd");
            string sourceData = PayHelper.PrepareSign(dictionary);
            string text2      = dictionary["signMsg"] = Jiami.sign(sourceData, key);
            string param      = HttpHelper.GetParam(dictionary);
            string text3      = HttpHelper.HttpRequest(url, param);

            if (text3.Contains("respCode"))
            {
                XmlDocument xmlDocument = new XmlDocument();
                xmlDocument.LoadXml(text3);
                string innerText  = xmlDocument.SelectSingleNode("/moboAccount/respData/respCode").InnerText;
                string innerText2 = xmlDocument.SelectSingleNode("/moboAccount/respData/Status").InnerText;
                if (innerText == "00" && innerText2 != "2")
                {
                    return("SUCCESS");
                }
                return(xmlDocument.SelectSingleNode("/moboAccount/respData/respDesc").InnerText);
            }
            return("查询订单失败");
        }
Esempio n. 2
0
 public static string sign(string sourceData, string key)
 {
     System.Security.Cryptography.MD5 mD = System.Security.Cryptography.MD5.Create();
     byte[] bytes = System.Text.Encoding.UTF8.GetBytes(sourceData + key);
     byte[] data  = mD.ComputeHash(bytes);
     return(Jiami.GetbyteToString(data));
 }
Esempio n. 3
0
        public static string GateWayPement(string merchant_order, decimal amount, string bank_account, string bank_card_no, string bank_code, string bankAddress, out string flowid)
        {
            string url      = ApplicationSettings.Get("url_san") + "/Pay/GateWayPement.aspx";
            string value    = ApplicationSettings.Get("partner_san");
            string password = ApplicationSettings.Get("key_san");
            Dictionary <string, string> dictionary = new Dictionary <string, string>();

            dictionary["mer_id"]     = value;
            dictionary["pay_type"]   = "1";
            dictionary["order_id"]   = merchant_order;
            dictionary["order_amt"]  = amount.ToString();
            dictionary["acct_name"]  = bank_account;
            dictionary["acct_id"]    = bank_card_no;
            dictionary["time_stamp"] = DateTime.Now.ToString("yyyyMMddHHmmss");
            string text = "";

            foreach (KeyValuePair <string, string> item in dictionary)
            {
                string text2 = text;
                text = text2 + item.Key + "=" + item.Value + "&";
            }
            password = TextEncrypt.EncryptPassword(password).ToLower();
            string value2 = Jiami.MD5(text + "key=" + password, "UTF-8").ToLower();

            dictionary["acct_name"]   = HttpUtility.UrlEncode(bank_account, Encoding.UTF8);
            dictionary["acct_type"]   = "0";
            dictionary["bank_code"]   = bank_code;
            dictionary["bank_branch"] = HttpUtility.UrlEncode(bankAddress, Encoding.UTF8);
            dictionary["sign"]        = value2;
            string param = HttpHelper.GetParam(dictionary);
            string json  = HttpHelper.HttpRequest(url, param);
            Dictionary <string, string> dictionary2 = JsonHelper.DeserializeJsonToObject <Dictionary <string, string> >(json);

            flowid = "";
            if (dictionary2.ContainsKey("status_code"))
            {
                if (dictionary2["status_code"] == "0")
                {
                    flowid = dictionary2["pay_seq"].ToString();
                    return("SUCCESS");
                }
                return(dictionary2["status_msg"].ToString());
            }
            return("下单失败");
        }
Esempio n. 4
0
        public static string Daifu_youmifu(string order_no, decimal amount, string full_name, string bank_card_no, string bank_code, string bankAddress, string province, string city, string host, out string flowid)
        {
            switch (bank_code)
            {
            case "CMBCHINA":
                bank_code = "CMB";
                break;

            case "BOCOM":
                bank_code = "COMM";
                break;

            case "ECITIC":
                bank_code = "CNCB";
                break;

            case "PINGAN":
                bank_code = "PAB";
                break;

            case "CGB":
                bank_code = "GDB";
                break;
            }
            string url   = ApplicationSettings.Get("url_ymf");
            string value = ApplicationSettings.Get("parter_ymf");
            string key   = ApplicationSettings.Get("key_ymf");
            Dictionary <string, string> dictionary = new Dictionary <string, string>();

            dictionary["apiName"]     = "SINGLE_ENTRUST_SETT";
            dictionary["apiVersion"]  = "1.0.0.0";
            dictionary["platformID"]  = value;
            dictionary["merchNo"]     = value;
            dictionary["orderNo"]     = order_no;
            dictionary["tradeDate"]   = DateTime.Now.ToString("yyyyMMdd");
            dictionary["merchUrl"]    = "http://" + host + "/handler.aspx";
            dictionary["merchParam"]  = TextUtility.CreateAuthStr(20, false);
            dictionary["bankAccNo"]   = bank_card_no.Trim();
            dictionary["bankAccName"] = full_name.Trim();
            dictionary["bankCode"]    = bank_code.Trim();
            dictionary["bankName"]    = bankAddress.Trim();
            if (province.Trim() != "")
            {
                dictionary["province"] = province.Trim();
            }
            if (city.Trim() != "")
            {
                dictionary["city"] = city.Trim();
            }
            dictionary["Amt"]          = amount.ToString("#0.00");
            dictionary["tradeSummary"] = "shop";
            string sourceData = PayHelper.PrepareSign(dictionary);
            string text2      = dictionary["signMsg"] = Jiami.sign(sourceData, key);
            string param      = HttpHelper.GetParam(dictionary);
            string text3      = HttpHelper.HttpRequest(url, param);

            flowid = "";
            if (text3.Contains("respCode"))
            {
                XmlDocument xmlDocument = new XmlDocument();
                xmlDocument.LoadXml(text3);
                string innerText = xmlDocument.SelectSingleNode("/moboAccount/respData/respCode").InnerText;
                if (innerText == "00")
                {
                    string text4 = flowid = xmlDocument.SelectSingleNode("/moboAccount/respData/batchNo").InnerText;
                    return("SUCCESS");
                }
                return(xmlDocument.SelectSingleNode("/moboAccount/respData/respDesc").InnerText);
            }
            return(text3);
        }
Esempio n. 5
0
 public static string MD5(string str)
 {
     return(Jiami.MD5(str, "UTF-8"));
 }