/// <summary> /// 获取支付报文 /// </summary> /// <param name="p"></param> /// <returns></returns> public static string PayMessage(ref PayParam p) { string sendDataStr = ""; PasswordBLL pwdBLL = new PasswordBLL(); if (p.icParams == null) { log.Write("交易类型:万通交易"); pwdBLL.SetCryptMode(1); log.Write("万通卡号:" + p.WtNo); log.Write("交易金额:" + p.rechageAmount); log.Write("终端交易流水号" + p.WtLklorderNo); log.Write("开始支付"); Wanton.pay(p, ref sendDataStr); p.payType = "1"; return(sendDataStr); } else { log.Write("交易类型:拉卡拉交易"); //银行卡支付 pwdBLL.SetCryptMode(0); pwdBLL.SetCryptMode(0);//拉卡拉加密方式 log.Write("银行卡号:" + p.icParams["cardNo"]); log.Write("交易金额:" + p.rechageAmount); log.Write("终端交易流水号" + p.WtLklorderNo); log.Write("开始支付"); wtPayBLL.LKLProcedure.PayOrder(p, ref sendDataStr); p.payType = "0"; return(sendDataStr); } p.shopNo = p.WtLklorderNo + "|" + SysConfigHelper.readerNode("ClientNo") + "|" + SysConfigHelper.readerNode("ShopNo"); }
public static void LklWtSign() { PasswordBLL pwdBLL = new PasswordBLL(); bool ret = pwdBLL.OpenDevice(SysConfigHelper.readerNode("ZT598Port"), "9600"); if (ret) { if (!SysBLL.WantongSign()) { SysBLL.wangtonSignResult = false; log.Write("警告:万通签到失败"); } else { SysBLL.wangtonSignResult = true; log.Write("万通签到成功"); } if (!SysBLL.LakalaSign()) { SysBLL.lakalaSignResult = false; log.Write("警告:拉卡拉签到失败"); } else { SysBLL.lakalaSignResult = true; log.Write("拉卡拉签到成功"); } } else { log.Write("警告:键盘打开失败"); } }
/// <summary> /// 判断支付结果 /// </summary> /// <param name="p"></param> /// <param name="map"></param> /// <returns></returns> public static string PayResult(PayParam p, Dictionary <string, string> map) { if (map == null) { throw new Exception(); } PasswordBLL pwdBLL = new PasswordBLL(); if (!map["recode"].Equals("00")) { if ("55".Equals(map["recode"])) { SysBLL.PasswordErrorInfo = "密码错误,请重新输入!"; log.Write("密码错误"); log.Write("--------------------交易结束--------------------"); if (p.icParams == null) { pwdBLL.OpenKeyboard(SysConfigHelper.readerNode("ZT598Port"), "9600", p.WtNo); return("55"); } else { pwdBLL.OpenKeyboard(SysConfigHelper.readerNode("ZT598Port"), "9600", p.icParams["cardNo"]); return("55"); } } else if ("51".Equals(map["recode"])) { log.Write("余额不足"); return("51"); } else { log.Write("支付失败:返回码:" + map["recode"]); return(map["recode"]); } } return(null); }
public static string MonitorCom() { //终端号 string ClientNo = SysConfigHelper.readerNode("ClientNo"); string strCom = ""; //电动读卡器 string port = SysConfigHelper.readerNode("CRT310Port"); StringBuilder info = new StringBuilder(2048); int handle = CRT310.CommOpen("COM" + port); if (handle > 0) { strCom = strCom + "1"; } else { strCom = strCom + "0"; } CRT310.CommClose(handle); //燃气 port = SysConfigHelper.readerNode("CJ201"); CJ201.handle = CJ201.Open_Com(Int32.Parse(port), 9600, 8, 0, 0); if (CJ201.handle > 0) { strCom = strCom + "1"; } else { strCom = strCom + "0"; } CJ201.Close_Com(CJ201.handle); ////公交读卡器 //port = SysConfigHelper.readerNode("CRT603Port"); //int openRet = CRT603.CRT603Vx_OpenConnection(Int32.Parse(port), 19200); //if (openRet == 0) strCom = strCom + "1"; //else strCom = strCom + "0"; //CRT603.CRT603Vx_CloseConnection(); //打印机 handle = Print.TT_OpenDevice(new StringBuilder("COM" + SysConfigHelper.readerNode("PrintPort")), new StringBuilder("38400"), info); if (handle == 0) { strCom = strCom + "1"; } else { strCom = strCom + "0"; } Print.TT_CloseDevice(info); //密码键盘 PasswordBLL pwdBLL = new PasswordBLL(); bool ret = pwdBLL.OpenDevice(SysConfigHelper.readerNode("ZT598Port"), "9600"); if (ret) { strCom = strCom + "1"; } else { strCom = strCom + "0"; } return(strCom); }
public static Boolean Sign(int type, string mackeyExpress, string pinKeyExpress) { PasswordBLL pwdBLL = new PasswordBLL(); //bool ret = pwdBLL.OpenDevice(SysConfigHelper.readerNode("ZT598Port"), "9600"); //if (!ret) //{ // return false; //} try { bool setMode = true; if (type == 0) { setMode = pwdBLL.SetCryptMode(0); if (!setMode) { return(false); } //激活万通主密钥 /* if (!pwdBLL.ActivWorkKey(0, 0)) * { * return false; * }*/ bool pingSuccess = pwdBLL.DownloadWorkKey(0, 0, pinKeyExpress); if (!pingSuccess) { return(false); } bool macSuccess = pwdBLL.DownloadWorkKey(0, 1, mackeyExpress); if (!macSuccess) { return(false); } SysBLL.RebuildBatchNo(); } else if (type == 1) { setMode = pwdBLL.SetCryptMode(1); if (!setMode) { return(false); } //激活万通主密钥 /*if(!pwdBLL.ActivWorkKey(1, 0)) * { * return false; * }*/ bool pingSuccess = pwdBLL.DownloadWorkKey(1, 2, pinKeyExpress); if (!pingSuccess) { return(false); } bool macSuccess = pwdBLL.DownloadWorkKey(1, 3, mackeyExpress); if (!macSuccess) { return(false); } } pwdBLL.closeKey(); return(true); } catch { return(false); } }