spc-kiosk-pb/Agent/OLEDevice/DeviceSignPad.cs
2019-06-16 14:12:09 +09:00

1935 lines
94 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Cosmos.BaseFrame;
using Cosmos.UserFrame;
using Cosmos.Common;
using Cosmos.CommonManager;
using System.Runtime.InteropServices;
/*-----------------------------------------------------------------------------------------------*/
// 설 명 : 사인패드 제어
// 작 성 자 :
// 변경 이력 :
/*-----------------------------------------------------------------------------------------------*/
namespace Cosmos.OLEDevice
{
public class DeviceSignPad : ISignPadUs
{
#region SpcnPos.DLL
/// <summary>
/// [사인패드] 전자서명 요청 함수
/// </summary>
[DllImport("SpcnPos.dll")]
public static extern int SpcnGetSign(int input_amt, byte[] input_sign_path, byte[] input_sign_name, byte[] output_msg);
/// <summary>
/// [사인패드] 전자서명 요청 함수 EX(메세지)
/// </summary>
/// <param name="input_amt"></param>
/// <param name="input_sign_path"></param>
/// <param name="input_sign_name"></param>
/// <param name="output_msg"></param>
/// <returns></returns>
[DllImport("SpcnPos.dll")]
public static extern int SpcnGetSignEx(byte[] input_msg1, byte[] input_msg2, byte[] input_msg3, byte[] input_msg4, byte[] input_sign_path, byte[] input_sign_name, byte[] output_msg);
/// <summary>
/// [사인패드] 비밀번호 요청 함수
/// </summary>
[DllImport("SpcnPos.dll")]
public static extern int SpcnGetPin(byte[] input_pin_block, byte[] output_msg);
/// <summary>
/// [사인패드] 사용자정보 요청 함수
/// </summary>
[DllImport("SpcnPos.dll")]
public static extern int SpcnGetMsg(int maskingType, byte[] show_msg, byte[] output_msg);
/// <summary>
/// [사인패드] 사용자정보 요청 함수(MAX 처리)
/// </summary>
[DllImport("SpcnPos.dll")]
public static extern int SpcnGetMsg2(int maskingType, int maxLen, byte[] show_msg, byte[] output_msg);
// 환경설정 정보 가져오기
[DllImport("SpcnPos.dll")]
public static extern int SpcnGetFlag(byte[] appName, byte[] keyName, byte[] output, int outputMaxLen);
// 환경설정 정보 설정하기
[DllImport("SpcnPos.dll")]
public static extern int SpcnSetFlag(byte[] appName, byte[] keyName, byte[] value);
// 상호인증 요청
[DllImport("SpcnPos.dll")]
public static extern int SpcnIcReaderKeyDownload(byte[] inTrmlId, byte[] inAuthInfo);
// 무결성 요청
[DllImport("SpcnPos.dll")]
public static extern int SpcnIcReaderIntegrity(byte[] outResTime);
// 키오스크 전자서명 요청
[DllImport("SpcnPos.dll")]
public static extern int SpcnGetKioskSign(byte[] input_sign_path, byte[] input_sign_name, byte[] output_msg);
// 승인함수
[DllImport("SpcnPos.dll")]
public static extern int SpcnIcPos(byte[] input_msg, int input_msg_len, byte[] signData, byte[] icData, byte[] oilData, byte[] authInfo, byte[] output_msg);
// (RF) RF카드 정보 조회
[DllImport("SpcnPos.dll")]
public static extern int SpcnRfPrepaidCardInfo(byte[] output_msg);
// (RF) RF카드 잔액 조회
[DllImport("SpcnPos.dll")]
public static extern int SpcnRfCommonCardInfo(byte[] samType, byte[] output_msg);
// (RF) RF카드 잔액 조회 (비프 여부 - 화면표시 여부로 사용)
[DllImport("SpcnPos.dll")]
public static extern int SpcnRfCommonCardInfoEx(byte[] samType, byte[] isBeep, byte[] output_msg);
// (RF) SAM ID조회
[DllImport("SpcnPos.dll")]
public static extern int SpcnRfGetSamId(byte[] samType, byte[] output_msg);
// (RF) T머니/EB카드 개시거래
[DllImport("SpcnPos.dll")]
public static extern int SpcnRfStart(byte[] terminalNo, byte[] bizName, byte[] docSeq, byte[] samType, byte[] output_msg);
// (RF) T머니/EB카드 운영정보 다운로드
[DllImport("SpcnPos.dll")]
public static extern int SpcnRfDownOperatingData(byte[] terminalNo, byte[] bizName, byte[] docSeq, byte[] samType, byte[] output_msg);
// (RF) PAYON SAM 등록
[DllImport("SpcnPos.dll")]
public static extern int SpcnRfPayonOpen(byte[] terminalNo, byte[] bizName, byte[] docSeq, byte[] cardType);
/// <summary>
/// RF 시간 설정
/// </summary>
[DllImport("SpcnPos.dll")]
public static extern int SpcnRfReaderSetTime();
// (RF) 후불 결제 거래 카드 정보 요청
[DllImport("SpcnPos.dll")]
public static extern int SpcnRfCreditCardInfo(byte[] terminalNo, byte[] samType, byte[] amount, byte[] msg1, byte[] msg2, byte[] msg3, byte[] output_msg);
// (RF) 선불카드 지불 거래
[DllImport("SpcnPos.dll")]
public static extern int SpcnRfPrepaidCardApprove(byte[] terminalNo, byte[] samType, byte[] amount, byte[] msg1, byte[] msg2, byte[] msg3, byte[] output_msg);
// (RF) 선불카드 지불 재거래
[DllImport("SpcnPos.dll")]
public static extern int SpcnRfPrepaidCardApproveRe(byte[] terminalNo, byte[] samType, byte[] amount, byte[] msg1, byte[] msg2, byte[] msg3, byte[] output_msg);
// (RF) 선불카드 직전취소
[DllImport("SpcnPos.dll")]
public static extern int SpcnRfPrepaidCardProcCancel(byte[] terminalNo, byte[] samType, byte[] msg1, byte[] msg2, byte[] msg3, byte[] org_money, byte[] org_dateTime, byte[] org_receiptNo, byte[] output_msg);
// (RF) 선불카드 현금반품
[DllImport("SpcnPos.dll")]
public static extern int SpcnRfPrepaidCardVoidCash(byte[] terminalNo, byte[] samType, byte[] msg1, byte[] msg2, byte[] msg3, byte[] org_money, byte[] org_dateTime, byte[] org_receiptNo, byte[] output_msg);
// (RF) 선불카드 반품충전
[DllImport("SpcnPos.dll")]
public static extern int SpcnRfPrepaidCardCancel(byte[] terminalNo, byte[] bizName, byte[] docSeq, byte[] samType, byte[] msg1, byte[] msg2, byte[] msg3, byte[] receiptNo, byte[] org_money, byte[] org_dateTime, byte[] org_receiptNo, byte[] output_msg);
// (RF) 거래내역 개수 조회
[DllImport("SpcnPos.dll")]
public static extern int SpcnRfGetTranCount(byte[] samType, byte[] output_msg);
// (RF) 마지막 거래내역 조회
[DllImport("SpcnPos.dll")]
public static extern int SpcnRfGetLastTran(byte[] samType, byte[] output_msg);
// (RF) 거래내역 조회
[DllImport("SpcnPos.dll")]
public static extern int SpcnRfGetTranIndex(byte[] samType, byte[] tranIndex, byte[] output_msg);
// (RF) 거래내역 순차 조회
[DllImport("SpcnPos.dll")]
public static extern int SpcnRfGetTranOrder(byte[] samType, byte[] tranIndex, byte[] output_msg);
// (RF) 거래내역 삭제
[DllImport("SpcnPos.dll")]
public static extern int SpcnRfDeleteTran(byte[] samType);
// (RF) 거래내역 업로드
[DllImport("SpcnPos.dll")]
public static extern int SpcnRfUploadTran(byte[] terminalNo, byte[] bizName, byte[] docSeq, byte[] receiptNo, byte[] org_money, byte[] org_dateTime, byte[] org_receiptNo, byte[] rfData, byte[] output_msg);
// 싸인 BMP -> 데이터 변환
[DllImport("SpcnPos.dll")]
public static extern int SpcnGetSignFromImage(byte[] filePath, byte[] output_msg);
// 싸인패드 정보 확인((O) 응답메시지 (모델명(10) + 펌웨어버젼(20) + App버젼(30) + RF버젼(30) + 시리얼번호(30) + POS연동타입(1))
[DllImport("SpcnPos.dll")]
public static extern int SpcnGetSignPadInfo(byte[] output_msg);
/// <summary>
/// 키오스크 비밀번호 입력 POS사용자(은련카드용)
/// </summary>
/// <param name="input_pin_block">암호화에 사용될 핀블럭</param>
/// <param name="output">암호화 되어진 비밀번호</param>
/// <returns></returns>
[DllImport("SpcnPos.dll")]
public static extern int SpcnGetKioskPin(byte[] input_pin_block, byte[] output);
/// <summary>
/// 비밀번호 입력 POS사용자(해피포인트)
/// </summary>
/// <param name="output">암호화 되어지지 않는 비밀번호</param>
/// <returns></returns>
[DllImport("SpcnPos.dll")]
public static extern int SpcnGetKioskMsg(byte[] output);
#endregion
#region csp_download.DLL
/// <summary>
/// [사인패드] 업데이트 요청 함수(생성)
/// </summary>
[DllImport("csp_downloader.dll")]
public static extern int CSPDN_Create();
/// <summary>
/// [사인패드] 업데이트 요청 함수(초기화)
/// </summary>
[DllImport("csp_downloader.dll")]
public static extern int CSPDN_ClearFiles(int ret_code);
/// <summary>
/// [사인패드] 업데이트 요청 함수(펌웨어)
/// </summary>
[DllImport("csp_downloader.dll")]
public static extern int CSPDN_SetFileSW(int ret_code, string updateData);
/// <summary>
/// [사인패드] 업데이트 요청 함수(시작)
/// </summary>
[DllImport("csp_downloader.dll")]
public static extern int CSPDN_Start(int ret_code, string sign_port);
/// <summary>
/// [사인패드] 업데이트 요청 함수(영상)
/// </summary>
[DllImport("csp_downloader.dll")]
public static extern int CSPDN_SetFileAVI(int ret_code, byte[] updateData);
/// <summary>
/// [사인패드] 업데이트 요청 함수(이미지)
/// </summary>
[DllImport("csp_downloader.dll")]
public static extern int CSPDN_SetFileBMP(int ret_code, int index, byte[] updateData);
/// <summary>
/// [사인패드] 업데이트 요청 함수(결과코드)
/// </summary>
[DllImport("csp_downloader.dll")]
public static extern int CSPDN_SetMessageResult(int ret_code, IntPtr hwnd, int nMessaage);
/// <summary>
/// [사인패드] 업데이트 요청 함수(프로그래스바 결과값)
/// </summary>
[DllImport("csp_downloader.dll")]
public static extern int CSPDN_SetMessageProgress(int ret_code, IntPtr hwnd, int nMessaage);
/// <summary>
/// [사인패드] 업데이트 자원해제
/// </summary>
[DllImport("csp_downloader.dll")]
public static extern int CSPDN_Destroy(int ret_code);
/// <summary>
/// [사인패드] 업데이트 종료(취소)
/// </summary>
[DllImport("csp_downloader.dll")]
public static extern int CSPDN_Stop(int ret_code);
//[DllImport("user32.dll", SetLastError = true)]
//private static extern int SendMessage(int hWnd, int wMsg, int wParam, int lParam);
#endregion
#region
/// <summary>
/// SPCN_Dongle.ocx 가 포함된 form 객체
/// </summary>
//frmSignPad frmSignPad = null;
/// <summary>
/// StateServer Object (StateServer 객체)
/// </summary>
public StateServer StateObject = (StateServer)StateServer.GetInstance();
/// <summary>
/// Device 상태 정보 객체
/// </summary>
public DeviceStatus m_cDevStatus = null;
/// <summary>
/// Pos 상태 정보 객체
/// </summary>
public PosStatus m_cPosStatus = null;
/// <summary>
/// T-Money Host
/// </summary>
private static string m_sTMoneyHost = null;
public string TMoneyHost { get { return m_sTMoneyHost; } set { m_sTMoneyHost = value; } }
/// <summary>
/// T-Money Port
/// </summary>
private static int m_iTMoneyPort = -1;
public int TMoneyPort { get { return m_iTMoneyPort; } set { m_iTMoneyPort = value; } }
// 임시 pss
private int nRet_Code = 0;
/// <summary>
/// 생성자
/// </summary>
public DeviceSignPad()
{
try
{
//frmSignPad = new frmSignPad();
m_cPosStatus = (PosStatus)StateObject.POS;
m_cDevStatus = (DeviceStatus)StateObject.DEVICE;
//UpdateIniConfig();
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
ex.Message);
}
}
#endregion
#region Byte배열을 string으로 (Byte배열의 null(0x00) )
/// <summary>
/// Byte배열을 string으로 변환 (Byte배열의 null(0x00)값 제거)
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
private string ByteToString(byte[] data)
{
int inx = Array.FindIndex(data, 0, (x) => x == 0x0);
if (inx >= 0)
{
return Encoding.Default.GetString(data, 0, inx);
}
else
{
return Encoding.Default.GetString(data);
}
}
#endregion
#region SpcnPos.dll SpcnPosCfg.ini update
/// <summary>
/// SpcnPos.dll 이 사용하는 SpcnPosCfg.ini 파일 update
/// </summary>
public void UpdateIniConfig()
{
StringBuilder sbGetText = new StringBuilder();
CmMessage m_PosDevice = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + "PosDevice.INI");
string sPortNumber = string.Empty;
string sAutoFlag = string.Empty;
string sMinCnt = string.Empty;
string sTimeOut = string.Empty;
long lBaudrate = 0;
bool bRtn = false;
try
{
sPortNumber = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "SIGNPAD", "SerialPortNumber"));
lBaudrate = CmUtil.LongParse(CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "SIGNPAD", "SerialBaudRate")));
sAutoFlag = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "SIGNPAD", "AutoFlag"));
sMinCnt = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "SIGNPAD", "MinCnt"));
sTimeOut = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "SIGNPAD", "TimeOut"));
if (sPortNumber.Length < 3 || lBaudrate <= 0)
{
new Exception("PosDevice.INI 사인패드 설정 오류");
return;
}
// SIGN_PORT 설정
sbGetText.Clear();
WinAPI.GetPrivateProfileString(PosConst.POS_SIGNPAD_CONFIG.APPNAME,
PosConst.POS_SIGNPAD_CONFIG.KEY_SIGN_PORT,
string.Empty,
sbGetText,
64,
BaseCom.NxBinPath + PosConst.INI_FILE_NAME.ICReaderConfig);
if (sbGetText.ToString() != sPortNumber.Substring(3, sPortNumber.Length - 3))//Yoo modify 20160613
{
bRtn = WinAPI.WritePrivateProfileString(PosConst.POS_SIGNPAD_CONFIG.APPNAME,
PosConst.POS_SIGNPAD_CONFIG.KEY_SIGN_PORT,
sPortNumber.Substring(3, sPortNumber.Length - 3),
BaseCom.NxBinPath + PosConst.INI_FILE_NAME.ICReaderConfig);//Yoo modify 20160613
if (bRtn == false)
{
UserLog.WriteLogFile(UserCom.LOG_IOS,
UserCom.WARNING_LEVEL,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
PosConst.INI_FILE_NAME.ICReaderConfig + "/" + PosConst.POS_SIGNPAD_CONFIG.KEY_SIGN_PORT + " 쓰기 실패");
}
}
// SIGN_BAUDRATE 설정
sbGetText.Clear();
WinAPI.GetPrivateProfileString(PosConst.POS_SIGNPAD_CONFIG.APPNAME,
PosConst.POS_SIGNPAD_CONFIG.KEY_SIGN_BAUDRATE,
string.Empty,
sbGetText,
64,
BaseCom.NxBinPath + PosConst.INI_FILE_NAME.ICReaderConfig);
if (sbGetText.ToString() != Convert.ToString(lBaudrate))
{
bRtn = WinAPI.WritePrivateProfileString(PosConst.POS_SIGNPAD_CONFIG.APPNAME,
PosConst.POS_SIGNPAD_CONFIG.KEY_SIGN_BAUDRATE,
Convert.ToString(lBaudrate),
BaseCom.NxBinPath + PosConst.INI_FILE_NAME.ICReaderConfig);
if (bRtn == false)
{
UserLog.WriteLogFile(UserCom.LOG_IOS,
UserCom.WARNING_LEVEL,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
PosConst.INI_FILE_NAME.ICReaderConfig + "/" + PosConst.POS_SIGNPAD_CONFIG.KEY_SIGN_BAUDRATE + " 쓰기 실패");
}
}
// SIGN_AUTO_FLAG 설정
sbGetText.Clear();
WinAPI.GetPrivateProfileString(PosConst.POS_SIGNPAD_CONFIG.APPNAME,
PosConst.POS_SIGNPAD_CONFIG.KEY_SIGN_AUTOFLAG,
string.Empty,
sbGetText,
64,
BaseCom.NxBinPath + PosConst.INI_FILE_NAME.ICReaderConfig);
if (sbGetText.ToString() != sAutoFlag)
{
bRtn = WinAPI.WritePrivateProfileString(PosConst.POS_SIGNPAD_CONFIG.APPNAME,
PosConst.POS_SIGNPAD_CONFIG.KEY_SIGN_AUTOFLAG,
sAutoFlag,
BaseCom.NxBinPath + PosConst.INI_FILE_NAME.ICReaderConfig);
if (bRtn == false)
{
UserLog.WriteLogFile(UserCom.LOG_IOS,
UserCom.WARNING_LEVEL,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
PosConst.INI_FILE_NAME.ICReaderConfig + "/" + PosConst.POS_SIGNPAD_CONFIG.KEY_SIGN_AUTOFLAG + " 쓰기 실패");
}
}
// SIGN_MIN_CNT 설정
sbGetText.Clear();
WinAPI.GetPrivateProfileString(PosConst.POS_SIGNPAD_CONFIG.APPNAME,
PosConst.POS_SIGNPAD_CONFIG.KEY_SIGN_MIN_CNT,
string.Empty,
sbGetText,
64,
BaseCom.NxBinPath + PosConst.INI_FILE_NAME.ICReaderConfig);
if (sbGetText.ToString() != sMinCnt)
{
bRtn = WinAPI.WritePrivateProfileString(PosConst.POS_SIGNPAD_CONFIG.APPNAME,
PosConst.POS_SIGNPAD_CONFIG.KEY_SIGN_MIN_CNT,
sMinCnt,
BaseCom.NxBinPath + PosConst.INI_FILE_NAME.ICReaderConfig);
if (bRtn == false)
{
UserLog.WriteLogFile(UserCom.LOG_IOS,
UserCom.WARNING_LEVEL,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
PosConst.INI_FILE_NAME.ICReaderConfig + "/" + PosConst.POS_SIGNPAD_CONFIG.KEY_SIGN_MIN_CNT + " 쓰기 실패");
}
}
// SIGN_TIMEOUT 설정
sbGetText.Clear();
WinAPI.GetPrivateProfileString(PosConst.POS_SIGNPAD_CONFIG.APPNAME,
PosConst.POS_SIGNPAD_CONFIG.KEY_SIGN_TIMEOUT,
string.Empty,
sbGetText,
64,
BaseCom.NxBinPath + PosConst.INI_FILE_NAME.ICReaderConfig);
if (sbGetText.ToString() != sTimeOut)
{
bRtn = WinAPI.WritePrivateProfileString(PosConst.POS_SIGNPAD_CONFIG.APPNAME,
PosConst.POS_SIGNPAD_CONFIG.KEY_SIGN_TIMEOUT,
sTimeOut,
BaseCom.NxBinPath + PosConst.INI_FILE_NAME.ICReaderConfig);
if (bRtn == false)
{
UserLog.WriteLogFile(UserCom.LOG_IOS,
UserCom.WARNING_LEVEL,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
PosConst.INI_FILE_NAME.ICReaderConfig + "/" + PosConst.POS_SIGNPAD_CONFIG.KEY_SIGN_TIMEOUT + " 쓰기 실패");
}
}
//#20170904 IC_MSG_CARD, RF_MSG_CARD 문구 추가 start
// IC_MSG_CARD 설정
sbGetText.Clear();
WinAPI.GetPrivateProfileString(PosConst.POS_SIGNPAD_CONFIG.APPNAME,
PosConst.POS_SIGNPAD_CONFIG.KEY_IC_MSG_CARD,
string.Empty,
sbGetText,
64,
BaseCom.NxBinPath + PosConst.INI_FILE_NAME.ICReaderConfig);
if (sbGetText.ToString() != MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0726))
{
bRtn = WinAPI.WritePrivateProfileString(PosConst.POS_SIGNPAD_CONFIG.APPNAME,
PosConst.POS_SIGNPAD_CONFIG.KEY_IC_MSG_CARD,
MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0726),
BaseCom.NxBinPath + PosConst.INI_FILE_NAME.ICReaderConfig);
if (bRtn == false)
{
UserLog.WriteLogFile(UserCom.LOG_IOS,
UserCom.WARNING_LEVEL,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
PosConst.INI_FILE_NAME.ICReaderConfig + "/" + PosConst.POS_SIGNPAD_CONFIG.KEY_IC_MSG_CARD + " 쓰기 실패");
}
}
// RF_MSG_CARD 설정
sbGetText.Clear();
WinAPI.GetPrivateProfileString(PosConst.POS_SIGNPAD_CONFIG.APPNAME,
PosConst.POS_SIGNPAD_CONFIG.KEY_RF_MSG_CARD,
string.Empty,
sbGetText,
64,
BaseCom.NxBinPath + PosConst.INI_FILE_NAME.ICReaderConfig);
if (sbGetText.ToString() != MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0727))
{
bRtn = WinAPI.WritePrivateProfileString(PosConst.POS_SIGNPAD_CONFIG.APPNAME,
PosConst.POS_SIGNPAD_CONFIG.KEY_RF_MSG_CARD,
MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0727),
BaseCom.NxBinPath + PosConst.INI_FILE_NAME.ICReaderConfig);
if (bRtn == false)
{
UserLog.WriteLogFile(UserCom.LOG_IOS,
UserCom.WARNING_LEVEL,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
PosConst.INI_FILE_NAME.ICReaderConfig + "/" + PosConst.POS_SIGNPAD_CONFIG.KEY_RF_MSG_CARD + " 쓰기 실패");
}
}
//#20170904 IC_MSG_CARD, RF_MSG_CARD 문구 추가 end
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
ex.Message);
}
}
#endregion
#region
/// <summary>
/// 설정 파일 읽기
/// </summary>
/// <param name="cCfgInfo"></param>
/// <param name="sGroup"></param>
/// <param name="sValueName"></param>
/// <returns></returns>
private string GetConfigInfo(CmMessage cCfgInfo, string sGroup, string sValueName)
{
return GetConfigInfo(cCfgInfo, sGroup, sValueName, "");
}
private string GetConfigInfo(CmMessage cCfgInfo, string sGroup, string sValueName, string sDefault)
{
try
{
string sValue = cCfgInfo.GetMessage(sGroup).GetMessageValue(sValueName);
if (sValue == null)
return sDefault;
else
return sValue;
}
catch { }
return sDefault;
}
#endregion
#region
/// <summary>
/// [사인패드] 전자서명 요청
/// </summary>
/// <param name="iAmount">거래금액</param>
/// <param name="sSignDataPath">전자서명 생성 디렉토리</param>
/// <param name="sSignDataName">전자서명 생성 파일명</param>
/// <param name="sSignData">전자서명 데이터</param>
/// <returns></returns>
public bool GetSign_SignPad(int iAmount, string sSignDataPath, string sSignDataName, ref string sSignData)
{
int iRtn = 0;
bool bRtn = false;
byte[] arSignData = new byte[2048];
try
{
sSignData = string.Empty;
Array.Clear(arSignData, 0x0, arSignData.Length);
if (m_cDevStatus.SignPad.UseYn != true)
{
Cosmos.CommonManager.WinManager.ErrorMessage(Cosmos.CommonManager.POS_MESSAGE.ERROR.MSG_0390);
return bRtn;
}
#if !DEVICE_MSR_VER
//if (m_cDevStatus.ICReader.Integrity_SignPad_Status != true)
//{
// Cosmos.CommonManager.WinManager.ErrorMessage(Cosmos.CommonManager.POS_MESSAGE.ERROR.MSG_0387);
// return bRtn;
//}
iRtn = SpcnGetSign(iAmount, Encoding.Default.GetBytes(sSignDataPath), Encoding.Default.GetBytes(sSignDataName), arSignData);
#else
if (m_cDevStatus.ICReader.UseYn == true) // 여전법 인증여부(0:MSR, 1:IC)
{
//if (m_cDevStatus.ICReader.Integrity_SignPad_Status != true)
//{
// Cosmos.CommonManager.WinManager.ErrorMessage(Cosmos.CommonManager.POS_MESSAGE.ERROR.MSG_0387);
// return bRtn;
//}
iRtn = SpcnGetSign(iAmount, Encoding.Default.GetBytes(sSignDataPath), Encoding.Default.GetBytes(sSignDataName), arSignData);
}
else
{
iRtn = SpcnGetSign(iAmount, Encoding.Default.GetBytes(sSignDataPath), Encoding.Default.GetBytes(sSignDataName), arSignData);
}
#endif
if (iRtn > 0)
{
sSignData = ByteToString(arSignData);
bRtn = true;
}
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
ex.Message);
}
return bRtn;
}
/// <summary>
/// [사인패드] 전자서명 요청EX
/// </summary>
/// <param name="iAmount">거래금액</param>
/// <param name="sSignDataPath">전자서명 생성 디렉토리</param>
/// <param name="sSignDataName">전자서명 생성 파일명</param>
/// <param name="sSignData">전자서명 데이터</param>
/// <returns></returns>
public bool GetSign_SignPadEx(string sMsg1, string sMsg2, string sMsg3, string sMsg4, string sSignDataPath, string sSignDataName, ref string sSignData)
{
int iRtn = 0;
bool bRtn = false;
byte[] arSignData = new byte[2048];
try
{
sSignData = string.Empty;
Array.Clear(arSignData, 0x0, arSignData.Length);
if (m_cDevStatus.SignPad.UseYn != true)
{
Cosmos.CommonManager.WinManager.ErrorMessage(Cosmos.CommonManager.POS_MESSAGE.ERROR.MSG_0390);
return bRtn;
}
#if !DEVICE_MSR_VER
//if (m_cDevStatus.ICReader.Integrity_SignPad_Status != true && m_cDevStatus.SignPad.UseYn == true)
//{
// Cosmos.CommonManager.WinManager.ErrorMessage(Cosmos.CommonManager.POS_MESSAGE.ERROR.MSG_0387);
// return bRtn;
//}
iRtn = SpcnGetSignEx(Encoding.Default.GetBytes(sMsg1), Encoding.Default.GetBytes(sMsg2), Encoding.Default.GetBytes(sMsg3), Encoding.Default.GetBytes(sMsg4), Encoding.Default.GetBytes(sSignDataPath), Encoding.Default.GetBytes(sSignDataName), arSignData);
#else
if (m_cDevStatus.ICReader.UseYn == true) // 여전법 인증여부(0:MSR, 1:IC)
{
//if (m_cDevStatus.ICReader.Integrity_SignPad_Status != true && m_cDevStatus.SignPad.UseYn == true)
//{
// Cosmos.CommonManager.WinManager.ErrorMessage(Cosmos.CommonManager.POS_MESSAGE.ERROR.MSG_0387);
// return bRtn;
//}
iRtn = SpcnGetSignEx(Encoding.Default.GetBytes(sMsg1), Encoding.Default.GetBytes(sMsg2), Encoding.Default.GetBytes(sMsg3), Encoding.Default.GetBytes(sMsg4), Encoding.Default.GetBytes(sSignDataPath), Encoding.Default.GetBytes(sSignDataName), arSignData);
}
else
{
iRtn = SpcnGetSignEx(Encoding.Default.GetBytes(sMsg1), Encoding.Default.GetBytes(sMsg2), Encoding.Default.GetBytes(sMsg3), Encoding.Default.GetBytes(sMsg4), Encoding.Default.GetBytes(sSignDataPath), Encoding.Default.GetBytes(sSignDataName), arSignData);
}
#endif
if (iRtn > 0)
{
sSignData = ByteToString(arSignData);
bRtn = true;
}
else
{
Cosmos.CommonManager.WinManager.ErrorMessage( ErrCodeToMsg(iRtn));
bRtn = false;
}
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
ex.Message);
}
return bRtn;
}
/// <summary>
/// [사인패드] 전자서명 요청 터치패드(키오스크,테블릿용)
/// </summary>
/// <param name="sSignDataPath"></param>
/// <param name="sSignDataName"></param>
/// <param name="sSignData"></param>
/// <returns></returns>
public bool GetSign_SignPadForTouchpad(string sSignDataPath, string sSignDataName, ref string sSignData)
{
int iRtn = 0;
bool bRtn = false;
byte[] arSignData = new byte[2048];
try
{
//이 함수 사용시 설정 추가 부분!
//============================================
//SpcnPoscfg.ini 해당 항목 추가
//============================================
//KIOSK_CUSTOM_SET=Y
//[DESIGN]
//KIOSK_SIGN_DIALOG_POS=50,100,800,800
//KIOSK_SIGN_BG_COLOR=0,0,0
//KIOSK_SIGN_FONT_COLOR=150,100,100
//KIOSK_SIGN_BTN_COLOR=40,40,40
//KIOSK_SIGN_FONT=굴림,27
//============================================
//KIOSK_CUSTOM_SET : Y 고정
//KIOSK_SIGN_DIALOG_POS : 위치 및 크기
//KIOSK_SIGN_DIALOG_POS : 폼 배경색
//KIOSK_SIGN_BG_COLOR : 싸인화면 배경색
//KIOSK_SIGN_FONT_COLOR : 글자폰트
//KIOSK_SIGN_BTN_COLOR : 버튼색상
//KIOSK_SIGN_FONT : 폰트 및 사이즈
sSignData = string.Empty;
Array.Clear(arSignData, 0x0, arSignData.Length);
//if (m_cPosStatus.Base.OlePosSignPadUseFlag != "1")
//{
// Cosmos.CommonManager.WinManager.ErrorMessage(Cosmos.CommonManager.POS_MESSAGE.ERROR.MSG_0390);
// return bRtn;
//}
//else if (m_cDevStatus.ICReader.Integrity_SignPad_Status != true && m_cPosStatus.Base.OlePosSignPadUseFlag == "1")
//{
// Cosmos.CommonManager.WinManager.ErrorMessage(Cosmos.CommonManager.POS_MESSAGE.ERROR.MSG_0387);
// return bRtn;
//}
iRtn = SpcnGetKioskSign(Encoding.Default.GetBytes(sSignDataPath), Encoding.Default.GetBytes(sSignDataName), arSignData);
if (iRtn > 0)
{
sSignData = ByteToString(arSignData);
bRtn = true;
}
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
ex.Message);
}
return bRtn;
}
/// <summary>
/// BitMap -> SignData 변환
/// </summary>
/// <param name="sSignDataPath"></param>
/// <param name="sSignData"></param>
/// <returns></returns>
public bool GetSign_BmpToData(string sSignDataPath, ref string sSignData)
{
int iRtn = 0;
bool bRtn = false;
byte[] arSignData = new byte[2048];
try
{
sSignData = string.Empty;
Array.Clear(arSignData, 0x0, arSignData.Length);
iRtn = SpcnGetSignFromImage(Encoding.Default.GetBytes(sSignDataPath), arSignData);
if (iRtn > 0)
{
sSignData = ByteToString(arSignData);
bRtn = true;
}
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
ex.Message);
}
return bRtn;
}
/// <summary>
/// 싸인패드 정보 확인[(O) 응답메시지 (모델명(10) + 펌웨어버젼(20) + App버젼(30) + RF버젼(30) + 시리얼번호(30) + POS연동타입(1)]
/// </summary>
/// <param name="sRsltMsg"></param>
/// <returns></returns>
public bool GetSignPadInfo(ref string sRsltMsg)
{
int iRtn = 0;
bool bRtn = false;
byte[] outMsg = new byte[2049];
try
{
sRsltMsg = string.Empty;
Array.Clear(outMsg, 0x0, outMsg.Length);
iRtn = SpcnGetSignPadInfo(outMsg);
if (iRtn > 0)
{
sRsltMsg = ByteToString(outMsg);
bRtn = true;
}
else
{
sRsltMsg = string.Empty;
}
}
catch (Exception ex)
{
sRsltMsg = string.Empty;
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
ex.Message);
}
return bRtn;
}
/// <summary>
/// [사인패드] 비밀번호 요청
/// </summary>
/// <param name="sMaskedCardNo">마스킹 처리된 카드번호</param>
/// <param name="sEncryptedPwd">암호화 되어진 비밀번호</param>
/// <returns></returns>
public bool GetPin_SignPad(string sMaskedCardNo, ref string sEncryptedPwd)
{
int iRtn = 0;
bool bRtn = false;
byte[] arCardNo = null;
byte[] arPwd = new byte[2048];
try
{
sEncryptedPwd = string.Empty;
arCardNo = Encoding.Default.GetBytes(sMaskedCardNo);
Array.Clear(arPwd, 0x0, arPwd.Length);
for (int i = 0; i < arCardNo.Length; i++)
{
if (arCardNo[i] == '*')
{
arCardNo[i] = (byte)'0';
}
}
if (m_cDevStatus.SignPad.UseYn != true)
{
Cosmos.CommonManager.WinManager.ErrorMessage(Cosmos.CommonManager.POS_MESSAGE.ERROR.MSG_0390);
return bRtn;
}
#if !DEVICE_MSR_VER
//if (m_cDevStatus.ICReader.Integrity_SignPad_Status != true && m_cDevStatus.SignPad.UseYn == true)
//{
// Cosmos.CommonManager.WinManager.ErrorMessage(Cosmos.CommonManager.POS_MESSAGE.ERROR.MSG_0387);
// return bRtn;
//}
iRtn = SpcnGetPin(arCardNo, arPwd);
#else
if (m_cDevStatus.ICReader.UseYn == true) // 여전법 인증여부(0:MSR, 1:IC)
{
//if (m_cDevStatus.ICReader.Integrity_SignPad_Status != true && m_cDevStatus.SignPad.UseYn == true)
//{
// Cosmos.CommonManager.WinManager.ErrorMessage(Cosmos.CommonManager.POS_MESSAGE.ERROR.MSG_0387);
// return bRtn;
//}
iRtn = SpcnGetPin(arCardNo, arPwd);
}
else
{
iRtn = SpcnGetPin(arCardNo, arPwd);
}
#endif
if (iRtn <= 0)
{
if (iRtn != -84)
{
string sErrMsg = ErrCodeToMsg(iRtn);
Cosmos.CommonManager.WinManager.ErrorMessage(sErrMsg);
UserLog.WriteLogFile(UserCom.LOG_IOS, UserCom.INFO_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name
, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()"
, "ERROR => CODE : " + iRtn + "=" + sErrMsg);
}
return false;
}
sEncryptedPwd = ByteToString(arPwd);
bRtn = true;
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
ex.Message);
}
return bRtn;
}
/// <summary>
/// 은련카드 비밀번호 사용자 입력 처리
/// </summary>
/// <param name="sMaskedCardNo"></param>
/// <param name="sEncryptedPwd"></param>
/// <returns></returns>
public bool GetKioskPin(string sMaskedCardNo, ref string sEncryptedPwd)
{
int iRtn = 0;
bool bRtn = false;
byte[] arCardNo = null;
byte[] arPwd = new byte[2048];
try
{
sEncryptedPwd = string.Empty;
arCardNo = Encoding.Default.GetBytes(sMaskedCardNo.Replace("*", "0")); // 카드번호 마스킹 '*' => '0' 으로 치환!
Array.Clear(arPwd, 0x0, arPwd.Length);
iRtn = SpcnGetKioskPin(arCardNo, arPwd);
if (iRtn <= 0)
{
if (iRtn != -84)
{
string sErrMsg = ErrCodeToMsg(iRtn);
Cosmos.CommonManager.WinManager.ErrorMessage(sErrMsg);
UserLog.WriteLogFile(UserCom.LOG_IOS, UserCom.INFO_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name
, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()"
, "ERROR => CODE : " + iRtn + "=" + sErrMsg);
}
return false;
}
sEncryptedPwd = ByteToString(arPwd);
bRtn = true;
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
ex.Message);
}
return bRtn;
}
/// <summary>
/// 비밀번호 입력 처리(해피포인트)
/// </summary>
/// <param name="sEncryptedPwd"></param>
/// <returns></returns>
public bool GetKioskMsg(ref string sEncryptedPwd)
{
int iRtn = 0;
bool bRtn = false;
byte[] arPwd = new byte[2048];
try
{
sEncryptedPwd = string.Empty;
Array.Clear(arPwd, 0x0, arPwd.Length);
iRtn = SpcnGetKioskMsg(arPwd);
if (iRtn <= 0)
{
if (iRtn != -84)
{
string sErrMsg = ErrCodeToMsg(iRtn);
Cosmos.CommonManager.WinManager.ErrorMessage(sErrMsg);
UserLog.WriteLogFile(UserCom.LOG_IOS, UserCom.INFO_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name
, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()"
, "ERROR => CODE : " + iRtn + "=" + sErrMsg);
}
return false;
}
sEncryptedPwd = ByteToString(arPwd);
bRtn = true;
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
ex.Message);
}
return bRtn;
}
/// <summary>
/// 사용자정보 요청 함수
/// </summary>
/// <param name="bMaskingEnable"></param>
/// <param name="sDisplayMsg"></param>
/// <param name="sReceivedData"></param>
/// <returns></returns>
public bool GetMsg_SignPad(bool bMaskingEnable, string sDisplayMsg, ref string sReceivedData)
{
return GetMsg_SignPad(bMaskingEnable, sDisplayMsg, ref sReceivedData, 0);
}
/// <summary>
/// 사용자정보 요청 함수
/// </summary>
/// <param name="bMaskingEnable"></param>
/// <param name="sDisplayMsg"></param>
/// <param name="sReceivedData"></param>
/// <returns></returns>
public bool GetMsg_SignPad(bool bMaskingEnable, string sDisplayMsg, ref string sReceivedData, int iMaxLengh)
{
int iRtn = 0;
bool bRtn = false;
byte[] arReceivedData = new byte[2048];
try
{
sReceivedData = string.Empty;
Array.Clear(arReceivedData, 0x0, arReceivedData.Length);
if (m_cDevStatus.SignPad.UseYn != true)
{
Cosmos.CommonManager.WinManager.ErrorMessage(Cosmos.CommonManager.POS_MESSAGE.ERROR.MSG_0390);
return bRtn;
}
#if !DEVICE_MSR_VER
//if (m_cDevStatus.ICReader.Integrity_SignPad_Status != true && m_cDevStatus.SignPad.UseYn)
//{
// Cosmos.CommonManager.WinManager.ErrorMessage(Cosmos.CommonManager.POS_MESSAGE.ERROR.MSG_0387);
// return bRtn;
//}
if (iMaxLengh > 0 )
{
iRtn = SpcnGetMsg2(bMaskingEnable ? 0 : 1, iMaxLengh, Encoding.Default.GetBytes(sDisplayMsg), arReceivedData);
}
else
{
iRtn = SpcnGetMsg(bMaskingEnable ? 0 : 1, Encoding.Default.GetBytes(sDisplayMsg), arReceivedData);
}
#else
if (m_cDevStatus.ICReader.UseYn == true) // 여전법 인증여부(0:MSR, 1:IC)
{
//if (m_cDevStatus.ICReader.Integrity_SignPad_Status != true && m_cDevStatus.SignPad.UseYn)
//{
// Cosmos.CommonManager.WinManager.ErrorMessage(Cosmos.CommonManager.POS_MESSAGE.ERROR.MSG_0387);
// return bRtn;
//}
if (iMaxLengh > 0)
{
iRtn = SpcnGetMsg2(bMaskingEnable ? 0 : 1, iMaxLengh, Encoding.Default.GetBytes(sDisplayMsg), arReceivedData);
}
else
{
iRtn = SpcnGetMsg(bMaskingEnable ? 0 : 1, Encoding.Default.GetBytes(sDisplayMsg), arReceivedData);
}
}
else
{
if (iMaxLengh > 0)
{
iRtn = SpcnGetMsg2(bMaskingEnable ? 0 : 1, iMaxLengh, Encoding.Default.GetBytes(sDisplayMsg), arReceivedData);
}
else
{
iRtn = SpcnGetMsg(bMaskingEnable ? 0 : 1, Encoding.Default.GetBytes(sDisplayMsg), arReceivedData);
}
}
#endif
if (iRtn <= 0)
{
if (iRtn != -84)
{
string sErrMsg = ErrCodeToMsg(iRtn);
Cosmos.CommonManager.WinManager.ErrorMessage(sErrMsg);
UserLog.WriteLogFile(UserCom.LOG_IOS, UserCom.INFO_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name
, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()"
, "ERROR => CODE : " + iRtn + "=" + sErrMsg);
}
return false;
}
sReceivedData = ByteToString(arReceivedData);
bRtn = true;
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
ex.Message);
}
return bRtn;
}
/// <summary>
/// 서명패드 업데이트(펌웨어)
/// </summary>
/// <returns></returns>
public bool SetFirmware_SignPad_Update(int nCreateCode, string sDatePath)
{
bool bRtn = true;
int nRet = -1;
nRet = CSPDN_ClearFiles(nCreateCode);
if (nRet < 0)
{
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name
, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()"
, "ERROR => CODE : " + nRet);
bRtn = false;
}
nRet = -1;
nRet = CSPDN_SetFileSW(nCreateCode, sDatePath);
if (nRet < 0)
{
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name
, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()"
, "ERROR => CODE : " + nRet);
bRtn = false;
}
return bRtn;
}
/// <summary>
/// 서명패드 업데이트(동영상)
/// </summary>
/// <returns></returns>
public bool SetAvi_SignPad_Update(int nCreateCode, string sDatePath)
{
bool bRtn = true;
int nRet = -1;
nRet = CSPDN_ClearFiles(nCreateCode);
if (nRet < 0)
{
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name
, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()"
, "ERROR => CODE : " + nRet);
return false;
}
nRet = -1;
nRet = CSPDN_SetFileAVI(nCreateCode, Encoding.Default.GetBytes(sDatePath));
if (nRet < 0)
{
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name
, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()"
, "ERROR => CODE : " + nRet);
return false;
}
return bRtn;
}
/// <summary>
/// 서명패드 업데이트(이미지)
/// </summary>
/// <returns></returns>
public bool SetImage_SignPad_Update(int nCreateCode, int nIndex, string sDatePath)
{
bool bRtn = true;
int nRet = -1;
//
//nRet = CSPDN_ClearFiles(nRet_Code);
//if (nRet <= 0)
//{
// UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name
// , System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()"
// , "ERROR => CODE : " + nRet);
// return false;
//}
//nRet = -1;
nRet = CSPDN_SetFileBMP(nCreateCode, nIndex, Encoding.Default.GetBytes(sDatePath));
if (nRet < 0)
{
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name
, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()"
, "ERROR => CODE : " + nRet);
return false;
}
return bRtn;
}
/// <summary>
/// 서명패드 업데이트 완료 후 시작
/// </summary>
/// <returns></returns>
public bool SignPad_Start(int nCreateCode, string sSignPort)
{
bool bRtn = false;
int nRet = -1;
nRet = CSPDN_Start(nCreateCode, sSignPort);
if (nRet < 0)
{
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name
, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()"
, "ERROR => CODE : " + nRet);
return bRtn;
}
bRtn = true;
return bRtn;
}
/// <summary>
/// 서명패드 업데이트(결과메세지 리턴)
/// </summary>
/// <returns></returns>
public bool SignPad_Update_Return(int nCreateCode, IntPtr nhwnd, int nMessage)
{
bool bRtn = false;
int nRet = -1;
nRet = CSPDN_SetMessageResult(nCreateCode, nhwnd, nMessage);
return bRtn;
}
/// <summary>
/// 서명패드 업데이트(결과메세지 리턴)
/// </summary>
/// <returns></returns>
public bool SignPad_Update_Progress_Return(int nCreateCode, IntPtr nhwnd, int nMessage)
{
bool bRtn = false;
int nRet = -1;
nRet = CSPDN_SetMessageProgress(nCreateCode, nhwnd, nMessage);
return bRtn;
}
/// <summary>
/// 서명패드 업데이트 파일 코드(각 함수에 다 넣어 줌)
/// </summary>
/// <returns></returns>
public int SignPad_Create_UpdateCode()
{
int nRet_Code = -1;
nRet_Code = CSPDN_Create();
return nRet_Code;
}
/// <summary>
/// 서명패드 업데이트 자원해제
/// </summary>
/// <returns></returns>
public int SignPad_Update_Destroy(int nCreateCode)
{
int nRet = -1;
CSPDN_Destroy(nCreateCode);
return nRet;
}
/// <summary>
/// 서명패드 업데이트 파일초기화
/// </summary>
/// <returns></returns>
public int SignPad_Update_FileClear(int nCreateCode)
{
int nRet = -1;
CSPDN_ClearFiles(nCreateCode);
return nRet;
}
/// <summary>
/// 서명패드 업데이트 취소
/// </summary>
/// <returns></returns>
public int SignPad_Update_Stop(int nCreateCode)
{
int nRet = -1;
nRet = CSPDN_Stop(nCreateCode);
return nRet;
}
#endregion
#region T-Money
/// <summary>
/// 운영정보 다운로드
/// </summary>
/// <param name="sTerminalNo"></param>
/// <param name="sBizNm"></param>
/// <param name="sSeqNo"></param>
/// <param name="sCardType"></param>
/// <param name="sDownType"></param>
/// <returns></returns>
public string TMoneyDownload(string sTerminalNo, string sBizNm, string sSeqNo, string sCardType, string sDownType, ref byte[] rep_array)
{
//byte[] rep_array = new byte[2049];
int iReturn = -1;
string sRet = UserCom.RST_ERR;
int iRtn = -1;
try
{
// 서명패드 시간설정 요청
if (m_cDevStatus.ICReader.UseYn == true)
iRtn = SpcnRfReaderSetTime();
if (sCardType == "T")
{
//WinManager.ShowSearchMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0349));
iReturn = SpcnRfDownOperatingData(GetByteArrayFromString(sTerminalNo), GetByteArrayFromString(sBizNm), GetByteArrayFromString(sSeqNo), GetByteArrayFromString(sCardType), rep_array);
}
else if (sCardType == "E")
{
//WinManager.ShowSearchMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0360));
iReturn = SpcnRfDownOperatingData(GetByteArrayFromString(sTerminalNo), GetByteArrayFromString(sBizNm), GetByteArrayFromString(sSeqNo), GetByteArrayFromString(sCardType), rep_array);
}
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
ex.Message);
}
finally
{
if (iReturn > 0) sRet = UserCom.RST_OK;
//WinManager.HideSearchMessage(this);
}
return sRet;
}
/// <summary>
/// T-Money 개시
/// </summary>
/// <param name="sTerminalNo"></param>
/// <param name="sBizNm"></param>
/// <param name="sSeqNo"></param>
/// <param name="sCardType"></param>
/// <returns></returns>
public string TMoneyOpen(string sTerminalNo, string sBizNm, string sSeqNo, string sCardType)
{
int iReturn = -1;
byte[] rep_array = new byte[2049];
string sRet = UserCom.RST_ERR;
int iRtn = -1;
try
{
// 서명패드 시간설정 요청
if (m_cDevStatus.ICReader.UseYn == true)
iRtn = SpcnRfReaderSetTime();
if (sCardType == "Y")
{
//WinManager.ShowSearchMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0350));
iReturn = SpcnRfPayonOpen(GetByteArrayFromString(sTerminalNo), GetByteArrayFromString(sBizNm), GetByteArrayFromString(sSeqNo), GetByteArrayFromString(sCardType));
}
else if (sCardType == "T")
{
//WinManager.ShowSearchMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0348));
iReturn = SpcnRfStart(GetByteArrayFromString(sTerminalNo), GetByteArrayFromString(sBizNm), GetByteArrayFromString(sSeqNo), GetByteArrayFromString(sCardType), rep_array);
}
else if (sCardType == "E")
{
//WinManager.ShowSearchMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0359));
iReturn = SpcnRfStart(GetByteArrayFromString(sTerminalNo), GetByteArrayFromString(sBizNm), GetByteArrayFromString(sSeqNo), GetByteArrayFromString(sCardType), rep_array);
}
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
ex.Message);
}
finally
{
if (iReturn > 0) sRet = UserCom.RST_OK;
//WinManager.HideSearchMessage(this);
}
return sRet;
}
/// <summary>
/// T-Money 잔액조회
/// </summary>
/// <param name="sCardType"></param>
/// <param name="sBeep"></param>
/// <param name="sRet"></param>
/// <returns></returns>
public int TMoneyInfo(string sCardType, ref string sRet)
{
return TMoneyInfo(sCardType, ref sRet, "N" );
}
public int TMoneyInfo(string sCardType, ref string sRet, string sBeep = "N" )
{
int nReturn = -1;
byte[] rep_array = new byte[2049];
try
{
// 무결성 실패후 진행시 오류 메시지 표시
if (m_cDevStatus.SignPad.UseYn != true)
{
Cosmos.CommonManager.WinManager.ErrorMessage(Cosmos.CommonManager.POS_MESSAGE.ERROR.MSG_0390);
return nReturn;
}
//nReturn = SpcnRfCommonCardInfo(GetByteArrayFromString(sCardType), rep_array);
nReturn = SpcnRfCommonCardInfoEx(GetByteArrayFromString(sCardType), GetByteArrayFromString(sBeep), rep_array);
if (nReturn <= 0)
{
if (nReturn != -84)
{
string sErrMsg = ErrCodeToMsg(nReturn);
Cosmos.CommonManager.WinManager.ErrorMessage(sErrMsg);
UserLog.WriteLogFile(UserCom.LOG_IOS, UserCom.INFO_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name
, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()"
, "ERROR => CODE : " + nReturn + "=" + sErrMsg);
}
return nReturn;
}
sRet = System.Text.Encoding.Default.GetString(rep_array);
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
ex.Message);
}
return nReturn;
}
/// <summary>
/// T-Money 지불거래
/// </summary>
/// <param name="sTID"></param>
/// <param name="sCardType"></param>
/// <param name="sAmount"></param>
/// <param name="sMsg1"></param>
/// <param name="sMsg2"></param>
/// <param name="sMsg3"></param>
/// <param name="sResultMsg"></param>
/// <returns></returns>
public int TMoneyApprove(string sTID, string sCardType, string sAmount, string sMsg1, string sMsg2, string sMsg3, ref string sResultMsg)
{
int nReturn = -1;
byte[] rep_signpad_array = new byte[2049];
try
{
// 무결성 실패후 진행시 오류 메시지 표시
if (m_cDevStatus.SignPad.UseYn != true)
{
Cosmos.CommonManager.WinManager.ErrorMessage(Cosmos.CommonManager.POS_MESSAGE.ERROR.MSG_0390);
return nReturn;
}
nReturn = SpcnRfPrepaidCardApprove(GetByteArrayFromString(sTID), GetByteArrayFromString(sCardType), GetByteArrayFromString(sAmount), GetByteArrayFromString(sMsg1), GetByteArrayFromString(sMsg2), GetByteArrayFromString(sMsg3), rep_signpad_array);
sResultMsg = System.Text.Encoding.Default.GetString(rep_signpad_array);
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
ex.Message);
}
return nReturn;
}
/// <summary>
/// T-Money 지불 재거래
/// </summary>
/// <param name="sTID"></param>
/// <param name="sCardType"></param>
/// <param name="sAmount"></param>
/// <param name="sMsg1"></param>
/// <param name="sMsg2"></param>
/// <param name="sMsg3"></param>
/// <param name="sResultMsg"></param>
/// <returns></returns>
public int TMoneyApproveRe(string sTID, string sCardType, string sAmount, string sMsg1, string sMsg2, string sMsg3, ref string sResultMsg)
{
int nReturn = -1;
byte[] rep_signpad_array = new byte[2049];
try
{
// 무결성 실패후 진행시 오류 메시지 표시
if (m_cDevStatus.SignPad.UseYn != true)
{
Cosmos.CommonManager.WinManager.ErrorMessage(Cosmos.CommonManager.POS_MESSAGE.ERROR.MSG_0390);
return nReturn;
}
nReturn = SpcnRfPrepaidCardApproveRe(GetByteArrayFromString(sTID), GetByteArrayFromString(sCardType), GetByteArrayFromString(sAmount), GetByteArrayFromString(sMsg1), GetByteArrayFromString(sMsg2), GetByteArrayFromString(sMsg3), rep_signpad_array);
sResultMsg = System.Text.Encoding.Default.GetString(rep_signpad_array);
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
ex.Message);
}
return nReturn;
}
/// <summary>
/// T-Money 승인내역 Upload
/// </summary>
/// <param name="sTID"></param>
/// <param name="sbizName"></param>
/// <param name="sDocSeq"></param>
/// <param name="sTradeNo"></param>
/// <param name="sOrgAmount"></param>
/// <param name="sOrgDateTime"></param>
/// <param name="sOrgTradeNo"></param>
/// <param name="sRfData"></param>
/// <param name="sResultMsg"></param>
/// <returns></returns>
public int TMoneyUploadTran(string sTID, string sbizName, string sDocSeq, string sTradeNo, string sOrgAmount, string sOrgDateTime, string sOrgTradeNo, string sRfData, ref string sResultMsg)
{
int nReturn = -1;
byte[] rep_signpad_array = new byte[2049];
byte[] rep_van_array = new byte[2049];
try
{
// 무결성 실패후 진행시 오류 메시지 표시
if (m_cDevStatus.SignPad.UseYn != true)
{
Cosmos.CommonManager.WinManager.ErrorMessage(Cosmos.CommonManager.POS_MESSAGE.ERROR.MSG_0390);
return nReturn;
}
rep_signpad_array = System.Text.Encoding.Default.GetBytes(sRfData);
nReturn = SpcnRfUploadTran(GetByteArrayFromString(sTID), GetByteArrayFromString(sbizName), GetByteArrayFromString(sDocSeq), GetByteArrayFromString(sTradeNo), GetByteArrayFromString(sOrgAmount), GetByteArrayFromString(sOrgDateTime), GetByteArrayFromString(sOrgTradeNo), rep_signpad_array, rep_van_array);
sResultMsg = System.Text.Encoding.Default.GetString(rep_van_array);
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
ex.Message);
}
return nReturn;
}
/// <summary>
/// T-Money 직전취소
/// </summary>
/// <param name="sTID"></param>
/// <param name="sCardType"></param>
/// <param name="sMsg1"></param>
/// <param name="sMsg2"></param>
/// <param name="sMsg3"></param>
/// <param name="sOrgAmount"></param>
/// <param name="sOrgDateTime"></param>
/// <param name="sOrgTradeNo"></param>
/// <param name="sResultMsg"></param>
/// <returns></returns>
public int TMoneyApproveCancel(string sTID, string sCardType, string sMsg1, string sMsg2, string sMsg3, string sOrgAmount, string sOrgDateTime, string sOrgTradeNo, ref string sResultMsg)
{
byte[] rep_signpad_array = new byte[2049];
int nReturn = -1;
try
{
// 무결성 실패후 진행시 오류 메시지 표시
if (m_cDevStatus.SignPad.UseYn != true)
{
Cosmos.CommonManager.WinManager.ErrorMessage(Cosmos.CommonManager.POS_MESSAGE.ERROR.MSG_0390);
return nReturn;
}
nReturn = SpcnRfPrepaidCardProcCancel(GetByteArrayFromString(sTID), GetByteArrayFromString(sCardType), GetByteArrayFromString(sMsg1), GetByteArrayFromString(sMsg2), GetByteArrayFromString(sMsg3), GetByteArrayFromString(sOrgAmount), GetByteArrayFromString(sOrgDateTime), GetByteArrayFromString(sOrgTradeNo), rep_signpad_array);
sResultMsg = System.Text.Encoding.Default.GetString(rep_signpad_array);
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
ex.Message);
}
return nReturn;
}
/// <summary>
/// T-Money 현금반품
/// </summary>
/// <param name="sTID"></param>
/// <param name="sCardType"></param>
/// <param name="sMsg1"></param>
/// <param name="sMsg2"></param>
/// <param name="sMsg3"></param>
/// <param name="sTradeNo"></param>
/// <param name="sOrgAmount"></param>
/// <param name="sOrgDateTime"></param>
/// <param name="sOrgTradeNo"></param>
/// <param name="sResultMsg"></param>
/// <returns></returns>
public int TMoneyCashVoid(string sTID, string sCardType, string sMsg1, string sMsg2, string sMsg3, string sTradeNo, string sOrgAmount, string sOrgDateTime, string sOrgTradeNo, ref string sResultMsg)
{
byte[] rep_signpad_array = new byte[2049];
int nReturn = -1;
try
{
// 무결성 실패후 진행시 오류 메시지 표시
if (m_cDevStatus.SignPad.UseYn != true)
{
Cosmos.CommonManager.WinManager.ErrorMessage(Cosmos.CommonManager.POS_MESSAGE.ERROR.MSG_0390);
return nReturn;
}
Array.Clear(rep_signpad_array, 0, rep_signpad_array.Length);
nReturn = SpcnRfPrepaidCardVoidCash(GetByteArrayFromString(sTID), GetByteArrayFromString(sCardType), GetByteArrayFromString(sMsg1), GetByteArrayFromString(sMsg2), GetByteArrayFromString(sMsg3), GetByteArrayFromString(sOrgAmount), GetByteArrayFromString(sOrgDateTime), GetByteArrayFromString(sOrgTradeNo), rep_signpad_array);
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
ex.Message);
}
return nReturn;
}
/// <summary>
/// T-Money 반품충전
/// </summary>
/// <param name="sTID"></param>
/// <param name="sbizName"></param>
/// <param name="sDocSeq"></param>
/// <param name="sCardType"></param>
/// <param name="sMsg1"></param>
/// <param name="sMsg2"></param>
/// <param name="sMsg3"></param>
/// <param name="sTradeNo"></param>
/// <param name="sOrgAmount"></param>
/// <param name="sOrgDateTime"></param>
/// <param name="sOrgTradeNo"></param>
/// <param name="sResultMsg"></param>
/// <returns></returns>
public int TMoneyVoidCharge(string sTID, string sbizName, string sDocSeq, string sCardType, string sMsg1, string sMsg2, string sMsg3, string sTradeNo, string sOrgAmount, string sOrgDateTime, string sOrgTradeNo, ref string sResultMsg)
{
byte[] rep_signpad_array = new byte[2049];
int nReturn = -1;
try
{
// 무결성 실패후 진행시 오류 메시지 표시
if (m_cDevStatus.SignPad.UseYn != true)
{
Cosmos.CommonManager.WinManager.ErrorMessage(Cosmos.CommonManager.POS_MESSAGE.ERROR.MSG_0390);
return nReturn;
}
Array.Clear(rep_signpad_array, 0, rep_signpad_array.Length);
nReturn = SpcnRfPrepaidCardCancel(GetByteArrayFromString(sTID), GetByteArrayFromString(sbizName), GetByteArrayFromString(sDocSeq), GetByteArrayFromString(sCardType), GetByteArrayFromString(sMsg1), GetByteArrayFromString(sMsg2), GetByteArrayFromString(sMsg3), GetByteArrayFromString(sTradeNo), GetByteArrayFromString(sOrgAmount), GetByteArrayFromString(sOrgDateTime), GetByteArrayFromString(sOrgTradeNo), rep_signpad_array);
sResultMsg = System.Text.Encoding.Default.GetString(rep_signpad_array);
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
ex.Message);
}
return nReturn;
}
private byte[] GetByteArrayFromString(string src)
{
return System.Text.Encoding.Default.GetBytes(src);
}
#endregion
#region
/// <summary>
/// 응답코드
/// </summary>
/// <param name="nErrCode"></param>
/// <returns></returns>
private string ErrCodeToMsg(int nErrCode)
{
string sMsg = string.Empty;
try
{
switch (nErrCode)
{
case -3: sMsg = "암호화오류(전문생성오류)"; break;
case -4: sMsg = "암호화오류(전문생성오류)"; break;
case -5: sMsg = "암호화오류 (전문오류)"; break;
case -6: sMsg = "암호화오류 (전문오류)"; break;
case -7: sMsg = "암호화오류 (키생성)"; break;
case -8: sMsg = "암호화오류 (키생성)"; break;
case -9: sMsg = "암호화오류 (키생성)"; break;
case -10: sMsg = "요청 IP 오류"; break;
case -11: sMsg = "암호화 구분 2 붙인 전문 오류"; break;
case -12: sMsg = "전자서명 전문일 경우 전문길이 필드 없는 오류"; break;
case -13: sMsg = "전자서명 전문일 경우 전문길이 필드 없는 오류"; break;
case -14: sMsg = "전문 전체길이 체크 오류"; break;
case -15: sMsg = "파라미터 오류 (접속 IP 오류)"; break;
case -16: sMsg = "파라미터 오류 (요청전문 오류)"; break;
case -17: sMsg = "전자서명 암호화 오류"; break;
case -18: sMsg = "개시거래 요망"; break;
case -20: sMsg = "SOCKET CONNECT 오류"; break;
case -21: sMsg = "SOCKET SELECT 오류"; break;
case -22: sMsg = "SOCKET RECV SELECT 오류"; break;
case -23: sMsg = "SOCKET RECV SELECT 오류"; break;
case -24: sMsg = "SOCKET RECV 오류"; break;
case -25: sMsg = "SOCKET RECV 오류"; break;
case -26: sMsg = "SOCKET SEND 오류"; break;
case -30: sMsg = "전문오류 (전자서명 필요없는 거래)"; break;
case -31: sMsg = "전문오류 (전자서명 데이터 구조 오류)"; break;
case -32: sMsg = "전문오류 (CR 없음)"; break;
case -33: sMsg = "전문오류 (ETX 없음)"; break;
case -34: sMsg = "전문오류(FS2 없음)"; break;
case -35: sMsg = "전자서명오류 (암호화 오류)"; break;
case -36: sMsg = "전자서명 길이 오류 (모바일)"; break;
case -37: sMsg = "IC데이터 오류 (FS오류)"; break;
case -38: sMsg = "IC데이터 오류(IC데이터/등록정보 오류)"; break;
case -40: sMsg = "EOT 미수신 (수신X)"; break;
case -41: sMsg = "EOT 미수신 (수신오류)"; break;
case -42: sMsg = "SOCKET 초기화 오류"; break;
case -43: sMsg = "SOCKET CONNECT 오류"; break;
case -44: sMsg = "SOCKET SEND 오류 (암호화)"; break;
case -45: sMsg = "SOCKET SEND 오류 (전문)"; break;
case -46: sMsg = "SOCKET RECV 오류 (헤더)"; break;
case -47: sMsg = "SOCKET RECV 오류 (전문)"; break;
case -48: sMsg = "SOCKET RECV 오류 (암호화)"; break;
case -49: sMsg = "SOCKET RECV 오류 (CHECK)"; break;
case -50: sMsg = "SOCKET SEND 오류 (ACK)"; break;
case -60: sMsg = "(모바일)SOCKET 생성 오류"; break;
case -61: sMsg = "(모바일)SOCKET CONNECT 오류"; break;
case -62: sMsg = "(모바일)SOCKET SELECT 오류"; break;
case -63: sMsg = "(모바일)SOCKET 옵션 설정 오류"; break;
case -64: sMsg = "(모바일)SOCKET 옵션 설정 오류"; break;
case -65: sMsg = "(모바일)SOCKET 오류"; break;
case -66: sMsg = "(모바일)SOCKET RECV 오류"; break;
case -67: sMsg = "(모바일)SOCKET RECV SELECT 오류"; break;
case -68: sMsg = "(모바일)SOCKET RECV SELECT 오류"; break;
case -69: sMsg = "(모바일)SOCKET SEND 오류"; break;
case -70: sMsg = "(모바일)SOCKET SEND SELECT 오류"; break;
case -79: sMsg = "시리얼 클래스 생성 오류"; break;
case -80: sMsg = "INI 파일 오류 (TYPE 구분 설정요망)"; break;
case -81: sMsg = "싸인패드 포트 오류"; break;
case -82: sMsg = "싸인패드 포트 오류"; break;
case -83: sMsg = "싸인패드 통신 오류"; break;
case -84: sMsg = "싸인패드 사용자 취소"; break;
case -85: sMsg = "싸인패드 타임아웃 오류"; break;
case -86: sMsg = "싸인패드 오픈 오류"; break;
case -87: sMsg = "싸인패드 초기화 오류"; break;
case -88: sMsg = "싸인패드 요청 오류"; break;
case -89: sMsg = "싸인패드 통신 오류"; break;
case -90: sMsg = "요청전문오류 (헤더 메시지 길이 오류)"; break;
case -91: sMsg = "요청전문오류 (거래구분 코드 오류)"; break;
case -92: sMsg = "미지원 전문"; break;
case -93: sMsg = "요청전문 필수 항목 누락"; break;
case -94: sMsg = "버퍼 초과"; break;
case -95: sMsg = "핀블럭 길이 오류"; break;
case -96: sMsg = "(전자서명생성) 이미지 파일 미존재"; break;
case -97: sMsg = "(전자서명생성) 이미지 파일 읽기 오류"; break;
case -98: sMsg = "(전자서명생성) 이미지 파일 크기 오류"; break;
case -99: sMsg = "(전자서명생성) 이미지 파일 데이터 오류"; break;
case -101: sMsg = "IC리더기 포트 설정 오류"; break;
case -102: sMsg = "IC리더기 오픈 오류"; break;
case -103: sMsg = "IC리더기 시리얼 생성 오류"; break;
case -104: sMsg = "IC리더기 파라미터 오류"; break;
case -105: sMsg = "IC리더기 쓰기 오류"; break;
case -106: sMsg = "보안표준키 다운로드 항목 오류(K2)"; break;
case -107: sMsg = "보안표준키 다운로드 승인 거절(K2)"; break;
case -108: sMsg = "보안표준키 다운로드 항목 오류(K4)"; break;
case -109: sMsg = "보안표준키 다운로드 승인 거절(K4)"; break;
case -110: sMsg = "IC리더기 응답 오류(Class 생성 오류)"; break;
case -111: sMsg = "IC리더기 응답 오류(길이 정보 수신 오류)"; break;
case -112: sMsg = "IC리더기 응답 오류(STX 오류)"; break;
case -113: sMsg = "IC리더기 응답 오류(수신 오류)"; break;
case -114: sMsg = "IC리더기 응답전문 오류(STX 오류)"; break;
case -115: sMsg = "IC리더기 응답전문 오류(ETX 오류)"; break;
case -116: sMsg = "IC리더기 응답전문 오류(LRC 오류)"; break;
case -117: sMsg = "IC리더기 초기화 오류"; break;
case -118: sMsg = "IC리더기 사용자 취소"; break;
case -119: sMsg = "IC리더기 타임아웃 오류"; break;
case -120: sMsg = "IC리더기 통신 오류"; break;
case -121: sMsg = "카드발급사 인증요청 IC CHIP DATA 오류"; break;
case -122: sMsg = "카드발급사 인증요청 데이터 오류"; break;
case -123: sMsg = "카드발급사 등록제 정보 데이터 오류"; break;
case -124: sMsg = "카드발급사 응답전문 데이터 오류"; break;
case -125: sMsg = "카드발급사 전문 구분 데이터 오류"; break;
case -126: sMsg = "카드발급사 전문버젼 데이터 오류"; break;
case -127: sMsg = "카드발급사 응답전문 미승인 오류"; break;
case -128: sMsg = "카드발급사 응답전문 GS 데이터 오류"; break;
case -129: sMsg = "카드발급사 인증 거절 (망취소 거절) - POS 망취소 요망"; break;
case -130: sMsg = "카드발급사 인증 거절 (망취소 완료)"; break;
case -131: sMsg = "망취소 실패(GS 없음) - POS에서 망취소 요망"; break;
case -132: sMsg = "망취소 실패(서버 거절) - POS에서 망취소 요망"; break;
case -133: sMsg = "망취소 실패(통신오류) - POS에서 망취소 요망"; break;
case -134: sMsg = "망취소 대상 아님"; break;
case -140: sMsg = "IC리더기 카드 읽기 오류 (거래매체 유형 미지정 오류)"; break;
case -141: sMsg = "IC리더기 카드 읽기 오류 (거래매체 유형 예외 오류)"; break;
case -142: sMsg = "IC리더기 카드 읽기 오류 (IC거래 구분 오류)"; break;
case -143: sMsg = "IC리더기 거래중 카드 제거 오류"; break;
case -144: sMsg = "IC리더기 거래가 거절된 카드 오류"; break;
case -145: sMsg = "IC리더기 기타 오류"; break;
case -146: sMsg = "IC리더기 거래 요청 전 카드 삽입 오류"; break;
case -147: sMsg = "IC리더기 상호인증 미완료 후 거래 시도 오류"; break;
case -148: sMsg = "IC리더기 무결성 미성공 후 거래 시도 오류"; break;
case -149: sMsg = "IC리더기 에러 코드 발생 오류"; break;
case -150: sMsg = "IC리더기 Fallback 진행 오류"; break;
case -151: sMsg = "IC리더기 거래 중 오류 (비정상 응답)"; break;
case -161: sMsg = "IC 거래 진행 중"; break;
case -162: sMsg = "SIGNPAD 거래 진행 중"; break;
case -2150: sMsg = "지원 불가 카드입니다."; break;
default: sMsg = "알수없는 메세지"; break;
}
//sMsg = string.Format("ErrCd:{0} Desc:{1}", nErrCode, sMsg);
}
catch { }
return sMsg;
}
#endregion
}
}