/// <summary> /// 解密 /// </summary> /// <param name="zhdh"></param> /// <param name="pinBlock"></param> /// <param name="nodeNo"></param> /// <returns></returns> public static string Decrypt(string zhdh, string pinBlock, string nodeNo) { string s = "error"; try { XmlHelper xher = setCommPara("E141", nodeNo); xher.UpdateContent(@"/union/body/pinBlock", pinBlock); xher.UpdateContent(@"/union/body/accNo", zhdh); string send = xher.GetXmlDoc().OuterXml; string recv = SendData(send, nodeNo); if (recv.IndexOf("error") != 0) { XmlHelper xher1 = new XmlHelper(recv); if (xher1.ReadByNode(@"/union/head/responseCode") == "000000") { s = xher1.ReadByNode(@"/union/body/plainPin"); } } } catch (Exception e) { LogWrite.WriteLog("账号:[" + zhdh + "],原因:[" + e.Message + "]", "调用加密机【解密】失败", nodeNo); } return(s); }
////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////// 交易开始 /////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////// private string ET0140() { try { XmlDocument doc1 = new XmlDocument(); BS30600004 b = new BS30600004();//实际为30600003 b.ApplicantAcctNo = xdoc.SelectSingleNode("//ebank//cust_account").InnerText.Trim(); b.BillType = xdoc.SelectSingleNode("//ebank//billType").InnerText.Trim(); b.BillClass = xdoc.SelectSingleNode("//ebank//billClass").InnerText.Trim(); b.AcptDt = xdoc.SelectSingleNode("//ebank//acptDt").InnerText.Trim().Replace("-", ""); b.DueDt = xdoc.SelectSingleNode("//ebank//dueDt").InnerText.Trim().Replace("-", ""); b.BillMoney = xdoc.SelectSingleNode("//ebank//billMoney").InnerText.Trim(); b.Remitter = xdoc.SelectSingleNode("//ebank//remitterCustName").InnerText.Trim(); b.RemitterAcctNo = xdoc.SelectSingleNode("//ebank//remitterCustAcct").InnerText.Trim(); b.RemitterBankName = xdoc.SelectSingleNode("//ebank//remitterCustBank").InnerText.Trim(); b.RemitterBankNo = xdoc.SelectSingleNode("//ebank//remitterCustBankNo").InnerText.Trim(); b.Payee = xdoc.SelectSingleNode("//ebank//payee").InnerText.Trim(); b.PayeeAcctNo = xdoc.SelectSingleNode("//ebank//payeeAcct").InnerText.Trim(); b.PayeeBankName = xdoc.SelectSingleNode("//ebank//payeeBank").InnerText.Trim(); b.PayeeBankNo = xdoc.SelectSingleNode("//ebank//payeeBankNo").InnerText.Trim(); b.Acceptor = xdoc.SelectSingleNode("//ebank//acceptor").InnerText.Trim(); b.AcceptorAcctNo = xdoc.SelectSingleNode("//ebank//acceptorAcct").InnerText.Trim(); b.AcceptorBankName = xdoc.SelectSingleNode("//ebank//acceptorBank").InnerText.Trim(); b.AcceptorBankNo = xdoc.SelectSingleNode("//ebank//acceptorBankNo").InnerText.Trim(); b.ForbidFlag = xdoc.SelectSingleNode("//ebank//protEndors").InnerText.Trim(); b.ConferNo = xdoc.SelectSingleNode("//ebank//conferNo").InnerText.Trim(); b.InvoiceNo = ""; b.Origin = "1"; if (BSET.BS30600004(b, nodeNo, trandType, ref doc1) == "error") { retSysError(errMsg); } else { xher.UpdateContent("/ebank/hostReturnCode", doc1.SelectSingleNode("//root//head//ErrorCode").InnerText.Trim()); xher.UpdateContent("/ebank/hostErrorMessage", doc1.SelectSingleNode("//root//head//ErrorMsg").InnerText.Trim()); if (doc1.SelectSingleNode("//root//head//ErrorCode").InnerText.Trim() == "000000") { xher = new XmlHelper(xdoc); xher.UpdateContent("/ebank/rgct_id", doc1.SelectSingleNode("//root//body//billId").InnerText.Trim()); xher.UpdateContent("/ebank/hostReturnCode", doc1.SelectSingleNode("//root//head//ErrorCode").InnerText.Trim()); xher.UpdateContent("/ebank/hostErrorMessage", doc1.SelectSingleNode("//root//head//ErrorMsg").InnerText.Trim()); } } return(formatRetStr(xher)); } catch (Exception ex) { return(retCatch(ex)); } }
private static XmlHelper setCommPara(string jydm, string nodeNo) { string path = System.Windows.Forms.Application.StartupPath + "\\files\\" + jydm + ".xml"; XmlHelper xher = new XmlHelper(path, true); ini myini = new ini(filename); /* head */ xher.UpdateContent(@"/union/head/transTime", DateTime.Now.ToString("yyyyMMddHHmmss")); xher.UpdateContent(@"/union/head/userInfo", DateTime.Now.ToString("yyyyMMddHHmmss")); xher.UpdateContent(@"/union/head/sysID", myini.ReadValue(nodeNo, "sysID").ToString()); xher.UpdateContent(@"/union/head/appID", myini.ReadValue(nodeNo, "appID").ToString()); xher.UpdateContent(@"/union/head/clientIPAddr", myini.ReadValue(nodeNo, "clientIPAddr").ToString()); xher.UpdateContent(@"/union/head/transFlag", myini.ReadValue(nodeNo, "transFlag").ToString()); /* body */ xher.UpdateContent(@"/union/body/mode", myini.ReadValue(nodeNo, "mode").ToString()); xher.UpdateContent(@"/union/body/keyName", myini.ReadValue(nodeNo, "keyName").ToString()); xher.UpdateContent(@"/union/body/format", myini.ReadValue(nodeNo, "format").ToString()); return(xher); }
/// <summary> /// 设置报文头 /// </summary> /// <param name="lsh"></param> /// <param name="tranCode"></param> /// <returns></returns> static private XmlHelper setHead(head s) { XmlHelper xh = new XmlHelper(filepath, true); xh.UpdateContent("/root/head/ReqsysId", s.ReqsysId); xh.UpdateContent("/root/head/RspsysId", s.RspsysId); xh.UpdateContent("/root/head/ServiceNo", s.ServiceNo); xh.UpdateContent("/root/head/SceneNo", s.SceneNo); xh.UpdateContent("/root/head/TradeCode", s.TradeCode); xh.UpdateContent("/root/head/ServiceVer", s.ServiceVer); xh.UpdateContent("/root/head/SceneVer", s.SceneVer); xh.UpdateContent("/root/head/GloSeqNo", s.GlobalSeq); xh.UpdateContent("/root/head/GlobaTraceNo", s.GlobalSeq + ConfigApp.Lsh); xh.UpdateContent("/root/head/ChannelCode", s.ChannelCode); xh.UpdateContent("/root/head/OrgNum", s.OrgNum); xh.UpdateContent("/root/head/TelrNum", s.TelrNum); xh.UpdateContent("/root/head/ZoneNo", s.ZoneNo); xh.UpdateContent("/root/head/MyBank", s.MyBank); xh.UpdateContent("/root/head/AuthOrgNum", s.AuthOrgNum); xh.UpdateContent("/root/head/AuthTelrNum", s.AuthTelrNum); xh.UpdateContent("/root/head/TermiId", s.TermiId); xh.UpdateContent("/root/head/ReqDate", s.ReqDate); xh.UpdateContent("/root/head/Reqtime", s.Reqtime); xh.UpdateContent("/root/head/ReqSerno", s.GlobalSeq.Substring(10).PadLeft(16, '0')); xh.UpdateContent("/root/head/RspSeq", s.RspSeq); xh.UpdateContent("/root/head/RspDate", s.RspDate); xh.UpdateContent("/root/head/RspTime", s.RspTime); xh.UpdateContent("/root/head/ErrorTyp", s.ErrorTyp); xh.UpdateContent("/root/head/ErrorCode", s.ErrorCode); xh.UpdateContent("/root/head/ErrorMsg", s.ErrorMsg); xh.UpdateContent("/root/head/Mac", s.Mac); return(xh); }