/// <summary> /// API付款 /// </summary> /// public string cashpay(M_LLPay p) { SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>(); sParaTemp.Add("oid_partner", PartnerConfig.OID_PARTNER); sParaTemp.Add("api_version", PartnerConfig.CashVERSION); // sParaTemp.Add("acct_name", HttpUtility.UrlEncode(p.Acct_name)); sParaTemp.Add("acct_name", p.Acct_name); sParaTemp.Add("card_no", p.Card_no); sParaTemp.Add("no_order", p.No_order); sParaTemp.Add("dt_order", p.Dt_order); sParaTemp.Add("money_order", p.Money_order); sParaTemp.Add("flag_card", "0"); // sParaTemp.Add("info_order", HttpUtility.UrlEncode("P2P投资回款")); sParaTemp.Add("info_order", "P2P投资回款"); sParaTemp.Add("notify_url", PartnerConfig.PAYNOTIFY_URL); sParaTemp.Add("city_code", p.City_code); sParaTemp.Add("bank_code", p.Bank_code); //sParaTemp.Add("brabank_name", HttpUtility.UrlEncode(p.Brabank_name)); sParaTemp.Add("brabank_name", p.Brabank_name); sParaTemp.Add("sign_type", PartnerConfig.CASHSIGN_TYPE); string sign = YinTongUtil.addSign(sParaTemp, PartnerConfig.CashTRADER_PRI_KEY, PartnerConfig.MD5_KEY); sParaTemp.Add("sign", sign); string reqJson = YinTongUtil.dictToJson(sParaTemp); YinTongUtil.writelog("付款银行卡卡bin信息查询-请求报文[" + reqJson + "]"); string responseJSON = postJson(ServerURLConfig.CASHPAY_URL, reqJson); return(responseJSON); /* * SortedDictionary<string, string> sParaTemp = new SortedDictionary<string, string>(); * sParaTemp.Add("oid_partner", PartnerConfig.OID_PARTNER); * sParaTemp.Add("api_version", PartnerConfig.CashVERSION); * sParaTemp.Add("acct_name", "张长江"); * sParaTemp.Add("card_no", "9559980014443530812"); * sParaTemp.Add("no_order", "20150908120120"); * sParaTemp.Add("dt_order", "20150908120120"); * sParaTemp.Add("money_order", "0.05"); * sParaTemp.Add("flag_card", "0"); * sParaTemp.Add("info_order", "p2p投资回款"); * sParaTemp.Add("notify_url", PartnerConfig.PAYNOTIFY_URL); * sParaTemp.Add("city_code", "110000"); * sParaTemp.Add("bank_code", "01030000"); * sParaTemp.Add("brabank_name", "丽泽桥支行"); * sParaTemp.Add("sign_type", PartnerConfig.SIGN_TYPE); * string sign = YinTongUtil.addSign(sParaTemp, PartnerConfig.TRADER_PRI_KEY, PartnerConfig.MD5_KEY); * sParaTemp.Add("sign", sign); * string reqJson = YinTongUtil.dictToJson(sParaTemp); * YinTongUtil.writelog("银行卡卡bin信息查询-请求报文[" + reqJson + "]"); * string responseJSON = postJson(ServerURLConfig.CASHPAY_URL, reqJson); * return responseJSON; */ }
public string orderquery(string orderid) { string url = "https://yintong.com.cn/traderapi/orderquery.htm"; SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>(); sParaTemp.Add("oid_partner", PartnerConfig.OID_PARTNER); sParaTemp.Add("no_order", "" + orderid + ""); sParaTemp.Add("sign_type", PartnerConfig.CASHSIGN_TYPE); string sign = YinTongUtil.addSign(sParaTemp, PartnerConfig.CashTRADER_PRI_KEY, PartnerConfig.MD5_KEY); sParaTemp.Add("sign", sign); string reqJson = YinTongUtil.dictToJson(sParaTemp); YinTongUtil.writelog("代付查询订单信息-请求报文[" + reqJson + "]"); string responseJSON = postJson(url, reqJson); return(responseJSON); }
/// <summary> /// 卡bin校验查询 /// </summary> /// public string queryCardBin() { SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>(); sParaTemp.Add("oid_partner", PartnerConfig.OID_PARTNER); sParaTemp.Add("card_no", Request["card_no"]); sParaTemp.Add("sign_type", PartnerConfig.SIGN_TYPE); string sign = YinTongUtil.addSign(sParaTemp, PartnerConfig.TRADER_PRI_KEY, PartnerConfig.MD5_KEY); sParaTemp.Add("sign", sign); string reqJson = YinTongUtil.dictToJson(sParaTemp); Console.WriteLine("银行卡卡bin信息查询-请求报文[" + reqJson + "]"); string responseJSON = Utils.HttpPostByte(ServerURLConfig.QUERY_BANKCARD_URL, reqJson); Console.WriteLine("银行卡卡bin信息查询-响应报文[" + responseJSON + "]"); return(responseJSON); }
/// <summary> /// 用户已绑定银行卡信息查询 /// </summary> /// public string queryBankcardList() { SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>(); sParaTemp.Add("oid_partner", PartnerConfig.OID_PARTNER); sParaTemp.Add("user_id", Request["user_id"]); sParaTemp.Add("offset", "0"); sParaTemp.Add("sign_type", PartnerConfig.SIGN_TYPE); string sign = YinTongUtil.addSign(sParaTemp, PartnerConfig.TRADER_PRI_KEY, PartnerConfig.MD5_KEY); sParaTemp.Add("sign", sign); string reqJson = YinTongUtil.dictToJson(sParaTemp); Console.WriteLine("用户已绑定银行列表查询-请求报文[" + reqJson + "]"); string responseJSON = postJson(ServerURLConfig.QUERY_USER_BANKCARD_URL, reqJson); Console.WriteLine("用户已绑定银行列表查询-响应报文[" + responseJSON + "]"); return(responseJSON); }
public ResultInfo <string> UnBind(RequestParam <RequestPayEntity> reqst) { var ri = new ResultInfo <string>("99999"); var sql = string.Format("SELECT no_agree FROM dbo.hx_td_LLPay_bindCard WHERE Usrid={0} AND BankCard='{1}'", reqst.body.userId, reqst.body.bankCard); LoggerHelper.Info(sql); var res = DbHelper.Query(sql); if (res != null && res.Tables[0].Rows.Count > 0) { SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>(); sParaTemp.Add("oid_partner", PartnerConfig.OID_PARTNER); sParaTemp.Add("user_id", reqst.body.userId); sParaTemp.Add("pay_type", "D"); sParaTemp.Add("no_agree", res.Tables[0].Rows[0]["no_agree"].ToString()); sParaTemp.Add("sign_type", PartnerConfig.SIGN_TYPE); string sign = YinTongUtil.addSign(sParaTemp, PartnerConfig.TRADER_PRI_KEY, PartnerConfig.MD5_KEY); sParaTemp.Add("sign", sign); string reqJson = YinTongUtil.dictToJson(sParaTemp); LoggerHelper.Info("解绑-请求报文[" + reqJson + "]"); string responseJSON = HttpHelper.Post(ServerURLConfig.BANK_CARD_UNBIND_URL, reqJson); LoggerHelper.Info(responseJSON); ri.code = "1"; ri.message = ""; ri.body = responseJSON; } return(ri); }
static void Main(string[] args) { //com.lianlianpay.security.utils.LianLianPaySecurity.isNull("1"); SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>(); sParaTemp.Add("acct_name", "测试"); //版本号 sParaTemp.Add("api_version", "1.0"); //版本号 sParaTemp.Add("bank_name", "招商银行"); sParaTemp.Add("card_no", "6245882402098823"); sParaTemp.Add("dt_order", DateTime.Now.ToString("yyyyMMddHHmmss")); sParaTemp.Add("flag_card", "0"); sParaTemp.Add("info_order", "打款");//订单描述 sParaTemp.Add("money_order", "0.01"); sParaTemp.Add("no_order", DateTime.Now.ToString("yyyyMMddHHmmss")); sParaTemp.Add("notify_url", "http://ht.laidaibei.com/notify_url.aspx"); sParaTemp.Add("oid_partner", "201609130000219023");//商户编号 sParaTemp.Add("platform", "jd.com"); sParaTemp.Add("sign_type", "RSA"); //签名 string sign = YinTongUtil.addSign(sParaTemp, PartnerConfig.TRADER_PRI_KEY, string.Empty); sParaTemp["sign"] = sign; string reqJson = YinTongUtil.dictToJson(sParaTemp); var json = ""; try { json = com.lianlianpay.security.utils.LianLianPaySecurity.encrypt(reqJson, PartnerConfig.YT_PUB_KEY); } catch (Exception ex) { Console.WriteLine("异常信息:" + ex.ToString()); } var http = (HttpWebRequest)WebRequest.Create(new Uri("https://instantpay.lianlianpay.com/paymentapi/payment.htm")); http.Accept = "application/json"; http.ContentType = "application/json"; http.Method = "POST"; Console.WriteLine(reqJson); var pay = ($"{{\"pay_load\":\"{json}\",\"oid_partner\":\"{PartnerConfig.OID_PARTNER}\"}}").Replace("\r\n", "\\r\\n"); byte[] bytes = Encoding.GetEncoding("ISO-8859-1").GetBytes(pay); Stream newStream = http.GetRequestStream(); newStream.Write(bytes, 0, bytes.Length); newStream.Close(); var response = http.GetResponse(); var stream = response.GetResponseStream(); var sr = new StreamReader(stream); var content = sr.ReadToEnd(); //调用付款申请接口,同步返回0000,是指创建连连支付单成功,订单处于付款处理中状态,最终的付款状态由异步通知告知 //出现1002,2005,4006,4007,4009,9999这6个返回码时或者没返回码,抛exception(或者对除了0000之后的code都查询一遍查询接口)调用付款结果查询接口, //明确订单状态,不能私自设置订单为失败状态,以免造成这笔订单在连连付款成功了,而商户设置为失败,用户重新发起付款请求,造成重复付款,商户资金损失 Console.WriteLine(content); //对连连响应报文内容需要用连连公钥验签 Console.ReadKey(); }