1881 lines
87 KiB
C#
1881 lines
87 KiB
C#
using System;
|
|
using System.Text;
|
|
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
using System.Collections;
|
|
using System.Data;
|
|
|
|
using Cosmos.BaseFrame;
|
|
using Cosmos.UserFrame;
|
|
using Cosmos.ServiceProvider;
|
|
using Cosmos.Common;
|
|
using Cosmos.CommonManager;
|
|
|
|
using System.Threading;
|
|
|
|
namespace Cosmos.Service
|
|
{
|
|
public partial class frmInputCardCom : Form
|
|
{
|
|
#region 변수 선언
|
|
|
|
private SManager sManager = new SManager(); // 이 객체를 통해 업무 Service 호출
|
|
private StateServer StateObject = (StateServer)StateServer.GetInstance(); // StateObject : StateServer Object (객체)
|
|
private PosStatus m_cPosStatus = new PosStatus(); // 기본정보 참조
|
|
private TranStatus m_cTrnStatus = new TranStatus(); // 거래정보 참조
|
|
private DeviceStatus m_cDevStatus = new DeviceStatus(); // 디바이스 관리
|
|
private PosOLEDevice.DelegateOlePos delegatePos;
|
|
private PosOLEDevice.DelegateIcReader delegateReader; // IC리더 콜백
|
|
//#20170918 IC 콜백 함수 변경 start
|
|
//포인트창에서 해피제휴 신용카드 리딩시 IC 우선 거래로 인해 '카드를 읽혀 주세요' 팝업 나오는 현상 수정.
|
|
/*
|
|
private PosOLEDevice.CallbackIc delegateReaderCardInfo; // IC리더 콜백(CardInfo)
|
|
private bool m_bCardInPut; //카드 입력 중복 방지
|
|
private string m_sIcChip; //IC CHIP DATA(EMV)
|
|
private string m_sFallDiv; //FallBack구분
|
|
private string m_sServiceCode; //서비스코드
|
|
private string m_InputType = ""; //PosConst.POS_VAN_MASTER.VAN_KEYIN; //입력구분
|
|
private string m_sCardNo; //입력 카드 번호
|
|
*/
|
|
//#20170918 IC 콜백 함수 변경 end
|
|
private IDataCommonUs m_cDataCommon = null; // POS 공통함수 인터페이스
|
|
|
|
private IICReaderUs m_cDeviceICReader = null;
|
|
private ISignPadUs m_cDeviceSignPad = null;
|
|
private IDataProcessUs m_cDataService = null; // 거래데이터 합계금액 계산 및 관리
|
|
|
|
private bool bNotDoubleClik = false; // 더블 클릭 방지용
|
|
private int m_PasswordLength = 4;
|
|
|
|
private string m_sPAY_WAY_CD;
|
|
/// <summary>
|
|
/// 결제수단코드
|
|
/// </summary>
|
|
public string PAY_WAY_CD { set { this.m_sPAY_WAY_CD = value; } }
|
|
|
|
private string m_sPAY_DTL_CD;
|
|
/// <summary>
|
|
/// 결제수단상세코드
|
|
/// </summary>
|
|
public string PAY_DTL_CD { set { this.m_sPAY_DTL_CD = value; } }
|
|
|
|
private string m_sDspCardNo;
|
|
/// <summary>
|
|
/// 카드번호
|
|
/// </summary>
|
|
public string SetCardNo { set { this.m_sDspCardNo = value; } }
|
|
|
|
private string m_sDspAppAmt;
|
|
/// <summary>
|
|
/// 승인금액
|
|
/// </summary>
|
|
public string SetAppAmt { set { this.m_sDspAppAmt = value; } }
|
|
|
|
private string m_sDspCardNm;
|
|
/// <summary>
|
|
/// 카드명(결제명)
|
|
/// </summary>
|
|
public string SetCardNm { set { this.m_sDspCardNm = value; } }
|
|
|
|
private string m_sInputType;
|
|
/// <summary>
|
|
/// 입력구분
|
|
/// </summary>
|
|
public string SetInPutType { set { this.m_sInputType = value; } }
|
|
|
|
private string m_sCardInfoOut;
|
|
/// <summary>
|
|
/// 카드 데이터(신용:IC데이터, 그외:입력구분(1)+암호화데이터)
|
|
/// </summary>
|
|
public string CardInfoOut { set { m_sCardInfoOut = value; } get { return m_sCardInfoOut; } }
|
|
|
|
private string m_sCardInPutType;
|
|
/// <summary>
|
|
/// 카드 입력구분
|
|
/// </summary>
|
|
public string CardInputType { set { m_sCardInPutType = value; } get { return m_sCardInPutType; } }
|
|
|
|
private string m_sPassWordYn;
|
|
/// <summary>
|
|
/// 비밀번호 입력 여부
|
|
/// </summary>
|
|
public string PassWordYn { set { this.m_sPassWordYn = value; } }
|
|
|
|
private string m_sPassWordOut;
|
|
/// <summary>
|
|
/// 비밀번호 입력 데이터
|
|
/// </summary>
|
|
public string PassWordOut { set { m_sPassWordOut = value; } get { return m_sPassWordOut; } }
|
|
|
|
/// <summary>
|
|
/// 콜백 카드 데이터
|
|
/// </summary>
|
|
private string m_sCallBackCardData = "";
|
|
|
|
#endregion 변수 선언
|
|
|
|
#region 생성자 & 소멸자
|
|
public frmInputCardCom()
|
|
{
|
|
InitializeComponent();
|
|
|
|
base.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw, true);
|
|
//this.UpdateStyles();
|
|
|
|
m_cPosStatus = (PosStatus)StateObject.POS; // POS 기본정보
|
|
m_cTrnStatus = (TranStatus)StateObject.TRAN; // POS 거래정보
|
|
m_cDevStatus = (DeviceStatus)StateObject.DEVICE;
|
|
|
|
m_cDeviceICReader = (IICReaderUs)sManager.InitServiceInstance(ServiceLists.AGENT_OLEDEVICE.DLL, ServiceLists.AGENT_OLEDEVICE.DEVICE_ICREADER);
|
|
m_cDeviceSignPad = (ISignPadUs)sManager.InitServiceInstance(ServiceLists.AGENT_OLEDEVICE.DLL, ServiceLists.AGENT_OLEDEVICE.DEVICE_SIGNPAD);
|
|
m_cDataService = (IDataProcessUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.DATA_SERVICE);
|
|
m_cDataCommon = (IDataCommonUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.DATA_COMMON);
|
|
|
|
delegatePos = new PosOLEDevice.DelegateOlePos(OnDeviceEvent);
|
|
delegateReader = new PosOLEDevice.DelegateIcReader(OnIcReaderCallBack); // IC리더 콜백
|
|
//#20170918 IC 콜백 함수 변경 start
|
|
//포인트창에서 해피제휴 신용카드 리딩시 IC 우선 거래로 인해 '카드를 읽혀 주세요' 팝업 나오는 현상 수정.
|
|
//delegateReaderCardInfo = new PosOLEDevice.CallbackIc(OnIcReaderCallBackCardInfo); // IC리더 콜백(CardInfo)
|
|
//#20170918 IC 콜백 함수 변경 end
|
|
}
|
|
|
|
private void frmInputCardCom_Load(object sender, EventArgs e)
|
|
{
|
|
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "");
|
|
|
|
InitControl();
|
|
if (((m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.CREDITCARD_ITEM && m_sInputType == PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_RF)
|
|
|| (m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.PAY_ITEM && m_sPAY_DTL_CD == ItemConst.TR_ITEM_ID.PAY.T_PAY)) == false)
|
|
{
|
|
tmrIcCard.Tag = "";
|
|
tmrIcCard.Enabled = true; // IC리더 콜백 설정
|
|
}
|
|
}
|
|
|
|
private void frmInputCardCom_FormClosing(object sender, FormClosingEventArgs e)
|
|
{
|
|
tmrIcCard.Tag = "CLOSE";
|
|
UnRegIcCallback(); // IC리더 콜백 해지
|
|
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", lblTitle.Text);
|
|
}
|
|
|
|
private void frmInputCardCom_Activated(object sender, EventArgs e)
|
|
{
|
|
PosOLEDevice.SetEventHandle(delegatePos);
|
|
}
|
|
private void frmInputCardCom_Deactivate(object sender, EventArgs e)
|
|
{
|
|
PosOLEDevice.SetEventHandle(null);
|
|
}
|
|
|
|
#endregion 생성자 & 소멸자
|
|
|
|
#region 폼 컨트롤 초기화
|
|
/// <summary>
|
|
/// 폼 컨트롤 초기화
|
|
/// </summary>
|
|
private void InitControl()
|
|
{
|
|
try
|
|
{
|
|
// 이미지 로딩 처리
|
|
picBack.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.POP_SIZE_S);
|
|
picBack.SetBounds(0, 0, picBack.Image.Size.Width, picBack.Image.Size.Height);
|
|
picBack.SendToBack();
|
|
|
|
if (m_cPosStatus.Sale.SaleFlow == PosConst.SALE_FLOW.SALE_WAIT)
|
|
FormManager.MovePopUpForm(this, false, m_cPosStatus.Sale.ScreenSizeUser);
|
|
else
|
|
FormManager.MovePopUpForm(this, true, m_cPosStatus.Sale.ScreenSizeUser);
|
|
FormManager.SetFormAllControlFont(this, m_cPosStatus.Base.FONT);
|
|
|
|
btnExit.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.BTN_CLOSE);
|
|
if (btnExit.Image != null) btnExit.Text = "";
|
|
|
|
//테마색상 적용!
|
|
btnEnter.BackColor = CmUtil.GetColorToString(m_cPosStatus.ScnMst.ThemeColor);
|
|
btnEnter.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0057);
|
|
|
|
padInPut.ThemeColor = m_cPosStatus.ScnMst.ThemeColor;
|
|
padInPut.ClearBtnText = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0817);
|
|
padInPut.SearchBtnText = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1018);
|
|
|
|
lblTitle.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0197);
|
|
|
|
lblDspCardNo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0195);
|
|
lblDspAppAmt.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0066);
|
|
lblDspCardNm.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0196);
|
|
lblPassword.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0013);
|
|
|
|
//lblCardNo.Text = m_sInputType == PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_RF ? "RF_" : "" + MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0051);
|
|
lblCardNo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0051);
|
|
btnMenu1.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0132);
|
|
btnMenu2.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0580);
|
|
btnMenu4.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0097);
|
|
btnMenu3.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0878);
|
|
|
|
lblValidDate.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0052);
|
|
|
|
txtDspCardNo.Text = m_sDspCardNo;
|
|
txtDspAppAmt.Text = m_cPosStatus.Global.NumericTOCurrency(CmUtil.DoubleParse(m_sDspAppAmt));
|
|
txtDspCardNm.Text = m_sDspCardNm;
|
|
|
|
//#20170913 현금영수증, 포인트카드 마스킹 미적용 start
|
|
if (m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.ETC_INFO_ITEM && m_sPAY_DTL_CD == ItemConst.TR_ITEM_ID.ETC_INFO.CASHBILL)
|
|
{
|
|
txtCardNo.InputType = Cosmos.UI.InputType.None;
|
|
}
|
|
else
|
|
{
|
|
txtCardNo.InputType = Cosmos.UI.InputType.CardNo;
|
|
}
|
|
//#20170913 현금영수증, 포인트카드 마스킹 미적용 end
|
|
|
|
if (m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.EMP_PAY_ITEM && m_sPAY_DTL_CD == ItemConst.TR_ITEM_ID.EMP_PAY.SPC)
|
|
{
|
|
btnMenu2.Visible = true;
|
|
btnMenu1.Visible = false;
|
|
m_sInputType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_RF;
|
|
|
|
}
|
|
else if (m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.CREDITCARD_ITEM)
|
|
{
|
|
if (m_sInputType == PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_RF)
|
|
{
|
|
btnMenu2.Visible = true;
|
|
btnMenu1.Visible = false;
|
|
}
|
|
else
|
|
{
|
|
btnMenu2.Visible = false;
|
|
btnMenu1.Visible = true;
|
|
}
|
|
btnMenu4.Visible = false;
|
|
btnMenu3.Visible = false;
|
|
txtCardNo.ReadOnly = true;
|
|
}
|
|
else if (m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.PAY_ITEM && m_sPAY_DTL_CD == ItemConst.TR_ITEM_ID.PAY.T_PAY)
|
|
{
|
|
// T페이
|
|
txtCardNo.ReadOnly = false;
|
|
|
|
btnMenu2.Visible = false;
|
|
btnMenu1.Visible = false;
|
|
btnMenu4.Visible = true;
|
|
btnMenu3.Visible = false;
|
|
|
|
//lblPassword.Visible = true;
|
|
//txtPassword.Visible = true;
|
|
//label7.Visible = true;
|
|
//label3.BackColor = Color.FromArgb(229, 229, 229);
|
|
|
|
//m_PasswordLength = 4;
|
|
}
|
|
else
|
|
{
|
|
txtCardNo.ReadOnly = false;
|
|
|
|
if ((m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.POINT_ITEM && m_sPAY_DTL_CD == ItemConst.TR_ITEM_ID.POINT_USE.HAPPY_POINT)
|
|
|| m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.ETC_INFO_ITEM)
|
|
{
|
|
btnMenu2.Visible = true;
|
|
btnMenu1.Visible = true;
|
|
btnMenu4.Visible = true;
|
|
btnMenu3.Visible = true;
|
|
}
|
|
else
|
|
{
|
|
btnMenu2.Visible = false;
|
|
btnMenu1.Visible = true;
|
|
btnMenu4.Visible = false;
|
|
btnMenu3.Visible = false;
|
|
}
|
|
}
|
|
|
|
if (m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.ETC_INFO_ITEM && m_sPAY_DTL_CD == ItemConst.TR_ITEM_ID.ETC_INFO.CASHBILL)
|
|
{
|
|
txtCardNo.MaxLength = 30;
|
|
}
|
|
else if ((m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.POINT_ITEM && m_sPAY_DTL_CD == ItemConst.TR_ITEM_ID.POINT_USE.HAPPY_POINT)
|
|
|| (m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.ETC_INFO_ITEM && m_sPAY_DTL_CD == ItemConst.TR_ITEM_ID.ETC_INFO.SAVEPOINT))
|
|
{
|
|
txtCardNo.MaxLength = 30;
|
|
}
|
|
else if (m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.PAY_ITEM && m_sPAY_DTL_CD == ItemConst.TR_ITEM_ID.PAY.SMILE_PAY)
|
|
{
|
|
// 스마일페이
|
|
btnMenu2.Visible = false;
|
|
btnMenu1.Visible = false;
|
|
btnMenu4.Visible = false;
|
|
btnMenu3.Visible = false;
|
|
|
|
txtCardNo.MaxLength = 30;
|
|
}
|
|
//#20171018, 해피기프트(코나머니) 결제코드(신용->선불) 변경 Start, srlee
|
|
//#20170731, 해피기프트카드(코나머니) 개발 Start, srlee
|
|
else if (m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.PPCARD_ITEM && m_sPAY_DTL_CD == ItemConst.TR_ITEM_ID.PPCARD.HPGIFT_CARD)
|
|
{
|
|
// 해피기프트카드
|
|
if (m_sInputType == PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_KEYIN)
|
|
{
|
|
btnMenu2.Visible = false;
|
|
btnMenu1.Visible = false;
|
|
|
|
txtCardNo.ReadOnly = false;
|
|
txtCardNo.MaxLength = 19;
|
|
}
|
|
else if (m_sInputType == PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_RF)
|
|
{
|
|
btnMenu2.Visible = true;
|
|
btnMenu1.Visible = false;
|
|
|
|
txtCardNo.ReadOnly = true;
|
|
}
|
|
else
|
|
{
|
|
btnMenu2.Visible = false;
|
|
btnMenu1.Visible = true;
|
|
|
|
txtCardNo.ReadOnly = true;
|
|
}
|
|
|
|
btnMenu4.Visible = false;
|
|
btnMenu3.Visible = false;
|
|
}
|
|
//#20170731, 해피기프트카드(코나머니) 개발 End, srlee
|
|
//#20171018, 해피기프트(코나머니) 결제코드(신용->선불) 변경 End, srlee
|
|
else
|
|
{
|
|
txtCardNo.MaxLength = 20;
|
|
}
|
|
|
|
// 비밀번호
|
|
m_sPassWordOut = "";
|
|
if (m_sPassWordYn == "Y")
|
|
{
|
|
lblPassword.Visible = true;
|
|
txtPassword.Visible = true;
|
|
label7.Visible = true;
|
|
label3.BackColor = Color.FromArgb(229, 229, 229);
|
|
|
|
m_PasswordLength = 4;
|
|
}
|
|
else
|
|
{
|
|
txtPassword.Visible = false;
|
|
lblPassword.Visible = false;
|
|
label7.Visible = false;
|
|
label3.BackColor = Color.FromArgb(127, 127, 127);
|
|
}
|
|
txtPassword.Value = string.Empty;
|
|
|
|
lblValidDate.Visible = false;
|
|
txtValidDate.Visible = false;
|
|
label8.Visible = false;
|
|
txtValidDate.Value = "";
|
|
|
|
if (m_cDevStatus.ICReader.UseYn != true) // 여전법 인증여부(0:MSR, 1:IC)
|
|
{
|
|
txtCardNo.MaxLength = 40;
|
|
txtCardNo.ReadOnly = false;
|
|
|
|
lblValidDate.Visible = true;
|
|
txtValidDate.Visible = true;
|
|
label8.Visible = true;
|
|
label7.Visible = true;
|
|
}
|
|
|
|
// 기능 버튼 설정 체크
|
|
FormManager.SetbtnMenu(txtCardNo, m_cDevStatus.ICReader.UseYn, btnMenu1, btnMenu2, btnMenu3, btnMenu4);
|
|
|
|
m_sCallBackCardData = "";
|
|
|
|
bNotDoubleClik = false;
|
|
|
|
// T페이 실바코드번호 저장(취소/반품시 바코드 재입력 안함)(2017.06.20)
|
|
if (m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.PAY_ITEM && m_sPAY_DTL_CD == ItemConst.TR_ITEM_ID.PAY.T_PAY)
|
|
{
|
|
if (m_sDspCardNo.IndexOf("*") < 0)
|
|
{
|
|
txtCardNo.Value = m_sDspCardNo;
|
|
EncryptedCardNo(txtCardNo.Value);
|
|
txtPassword.Select();
|
|
return;
|
|
}
|
|
}
|
|
txtCardNo.Value = "";
|
|
txtCardNo.Select();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 버튼 입력 처리
|
|
/// <summary>
|
|
/// 버튼 입력 처리
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void btnProc_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (bNotDoubleClik) return;
|
|
bNotDoubleClik = true;
|
|
|
|
bool isCompleted = false;
|
|
|
|
if (((Cosmos.UI.CsmButton)sender) == btnMenu1) // IC카드입력
|
|
{
|
|
isCompleted = GetIcCardData(e != null ? true : false);
|
|
}
|
|
else if (((Cosmos.UI.CsmButton)sender) == btnMenu2) // RF카드입력
|
|
{
|
|
UnRegIcCallback(); // IC리더 콜백 해지
|
|
isCompleted = GetRfCardData();
|
|
if (txtCardNo.Value == "") tmrIcCard.Enabled = true;
|
|
}
|
|
else if (((Cosmos.UI.CsmButton)sender) == btnMenu3) // POP카드입력
|
|
{
|
|
UnRegIcCallback(); // IC리더 콜백 해지
|
|
isCompleted = GetPopCardData();
|
|
if (txtCardNo.Value == "") tmrIcCard.Enabled = true;
|
|
}
|
|
else if (((Cosmos.UI.CsmButton)sender) == btnMenu4) // 핀패드
|
|
{
|
|
UnRegIcCallback(); // IC리더 콜백 해지
|
|
isCompleted = GetPinPadData();
|
|
if (txtCardNo.Value == "") tmrIcCard.Enabled = true;
|
|
}
|
|
else if (((Cosmos.UI.CsmButton)sender) == btnEnter) // 승인
|
|
{
|
|
if (txtPassword.Visible)
|
|
{
|
|
//txtEditBox_EditBoxKeyDownEvent(txtPassword, PosKey.MENU_KEY.ENTER);
|
|
|
|
if (CheckTxtInPut(null) == false) return;
|
|
if (string.IsNullOrWhiteSpace(this.m_sCardInfoOut)) return;
|
|
|
|
m_sPassWordOut = txtPassword.Value;
|
|
|
|
this.DialogResult = System.Windows.Forms.DialogResult.OK;
|
|
this.Close();
|
|
}
|
|
else
|
|
{
|
|
if (txtCardNo.Text != "")
|
|
{
|
|
isCompleted = EncryptedCardNo(txtCardNo.Text);
|
|
}
|
|
else if (m_sInputType == PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_RF)
|
|
{
|
|
UnRegIcCallback(); // IC리더 콜백 해지
|
|
isCompleted = GetRfCardData();
|
|
if (txtCardNo.Value == "") tmrIcCard.Enabled = true;
|
|
}
|
|
else
|
|
{
|
|
isCompleted = GetIcCardData(true);
|
|
|
|
}
|
|
}
|
|
}
|
|
Thread.Sleep(3000);
|
|
if (txtPassword.Visible == false && isCompleted)
|
|
{
|
|
this.DialogResult = System.Windows.Forms.DialogResult.OK;
|
|
this.Close();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
}
|
|
finally
|
|
{
|
|
bNotDoubleClik = false;
|
|
}
|
|
#region (주석)
|
|
//try
|
|
//{
|
|
// if (bNotDoubleClik) return;
|
|
// bNotDoubleClik = true;
|
|
|
|
// if (((Cosmos.UI.CsmButton)sender) == btnIcCard) // IC카드입력
|
|
// {
|
|
// GetIcCardData();
|
|
// }
|
|
// else if (((Cosmos.UI.CsmButton)sender) == btnRfCard) // RF카드입력
|
|
// {
|
|
// GetRfCardData();
|
|
// }
|
|
// else if (((Cosmos.UI.CsmButton)sender) == btnPinPad) // 핀패드
|
|
// {
|
|
// GetPinPadData();
|
|
// }
|
|
// else if (((Cosmos.UI.CsmButton)sender) == btnEnter) // 승인
|
|
// {
|
|
// if (m_sInputType == PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_RF)
|
|
// {
|
|
// GetRfCardData();
|
|
// }
|
|
// else
|
|
// {
|
|
// GetIcCardData();
|
|
// }
|
|
// }
|
|
//}
|
|
//catch (Exception ex)
|
|
//{
|
|
// WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
// System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
//}
|
|
//bNotDoubleClik = false;
|
|
#endregion
|
|
}
|
|
private void btnExit_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
this.DialogResult = DialogResult.Cancel;
|
|
this.Close();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 텍스트박스 입력 이벤트 처리
|
|
/// <summary>
|
|
/// 텍스트박스 활성화 처리
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void txtEditBox_EnterEvent(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
padInPut.SetActiveControl = (Control)sender;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 텍스트박스 키 입력 이벤트 처리
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="sFuncValue"></param>
|
|
private void txtEditBox_EditBoxKeyDownEvent(object sender, string sFuncValue)
|
|
{
|
|
#region (주석)
|
|
//try
|
|
//{
|
|
// if (bNotDoubleClik) return;
|
|
// bNotDoubleClik = true;
|
|
|
|
// if (sFuncValue == PosKey.MENU_KEY.ENTER)
|
|
// {
|
|
// if (((Cosmos.UI.CsmPosEditBox)sender) == txtCardNo)
|
|
// {
|
|
// if (txtCardNo.Text != "")
|
|
// {
|
|
// if (CheckTxtInPut(txtCardNo) == false)
|
|
// {
|
|
// bNotDoubleClik = false;
|
|
// return;
|
|
// }
|
|
// EncryptedCardNo(txtCardNo.Text);
|
|
// }
|
|
// else
|
|
// {
|
|
// if (m_sInputType == PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_RF) //RF 입력 분개 처리
|
|
// {
|
|
// GetRfCardData();
|
|
// }
|
|
// else
|
|
// {
|
|
// GetIcCardData();
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
// else if (sFuncValue == PosKey.MENU_KEY.CLEAR)
|
|
// {
|
|
// if (((Cosmos.UI.CsmPosEditBox)sender).ReadOnly == false) ((Cosmos.UI.CsmPosEditBox)sender).Text = "";
|
|
// }
|
|
// else if (sFuncValue == PosKey.MENU_KEY.ESC_PREVIOUS)
|
|
// {
|
|
// bNotDoubleClik = false;
|
|
|
|
// this.DialogResult = DialogResult.Cancel;
|
|
// this.Close();
|
|
// }
|
|
//}
|
|
//catch (Exception ex)
|
|
//{
|
|
// WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
// System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
// bNotDoubleClik = false;
|
|
//}
|
|
|
|
//bNotDoubleClik = false;
|
|
#endregion
|
|
|
|
try
|
|
{
|
|
if (bNotDoubleClik) return;
|
|
bNotDoubleClik = true;
|
|
|
|
bool isCompleted = false;
|
|
|
|
if (sFuncValue == PosKey.MENU_KEY.ENTER)
|
|
{
|
|
if (((Cosmos.UI.CsmPosEditBox)sender) == txtCardNo)
|
|
{
|
|
if (txtCardNo.Text != "")
|
|
{
|
|
if (CheckTxtInPut(txtCardNo) == false) return;
|
|
isCompleted = EncryptedCardNo(txtCardNo.Text);
|
|
}
|
|
else
|
|
{
|
|
if (txtPassword.Visible)
|
|
{
|
|
if (CheckTxtInPut(txtCardNo) == false) return;
|
|
//isCompleted = EncryptedCardNo(txtCardNo.Text);
|
|
}
|
|
else if (m_sInputType == PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_RF) //RF 입력 분개 처리
|
|
{
|
|
UnRegIcCallback(); // IC리더 콜백 해지
|
|
isCompleted = GetRfCardData();
|
|
if (txtCardNo.Value == "") tmrIcCard.Enabled = true;
|
|
}
|
|
else
|
|
{
|
|
isCompleted = GetIcCardData(true);
|
|
}
|
|
|
|
//if (m_cDevStatus.Msr.STX != "" && txtCardNo.Value.StartsWith(m_cDevStatus.Msr.STX)) txtCardNo.Value = txtCardNo.Value.Substring(1);
|
|
}
|
|
|
|
if (txtPassword.Visible == false && isCompleted)
|
|
{
|
|
this.DialogResult = DialogResult.OK;
|
|
this.Close();
|
|
}
|
|
else if (txtPassword.Visible)
|
|
{
|
|
if (isCompleted)
|
|
{
|
|
txtPassword.Focus();
|
|
}
|
|
else
|
|
{
|
|
txtCardNo.Focus();
|
|
txtCardNo.SelectText();
|
|
}
|
|
}
|
|
}
|
|
|
|
if (sender == txtPassword)
|
|
{
|
|
if (CheckTxtInPut(null) == false) return;
|
|
if (string.IsNullOrWhiteSpace(this.m_sCardInfoOut)) return;
|
|
m_sPassWordOut = txtPassword.Value;
|
|
|
|
this.DialogResult = DialogResult.OK;
|
|
this.Close();
|
|
}
|
|
}
|
|
else if (sFuncValue == PosKey.MENU_KEY.CLEAR)
|
|
{
|
|
if (((Cosmos.UI.CsmPosEditBox)sender).ReadOnly == false)
|
|
{
|
|
((Cosmos.UI.CsmPosEditBox)sender).Text = "";
|
|
if (((Cosmos.UI.CsmPosEditBox)sender) == txtCardNo) tmrIcCard.Enabled = true;
|
|
}
|
|
}
|
|
else if (sFuncValue == PosKey.MENU_KEY.ESC_PREVIOUS)
|
|
{
|
|
this.DialogResult = DialogResult.Cancel;
|
|
this.Close();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
}
|
|
finally
|
|
{
|
|
bNotDoubleClik = false;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 텍스트박스 입력 유효성 체크
|
|
/// <summary>
|
|
/// 텍스트박스 입력 유효성 체크
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <returns></returns>
|
|
private bool CheckTxtInPut(object sender)
|
|
{
|
|
try
|
|
{
|
|
// 특정 문자값 제거
|
|
try
|
|
{
|
|
if (m_cDevStatus.Msr.STX != "" && txtCardNo.Value.StartsWith(m_cDevStatus.Msr.STX)) txtCardNo.Value = txtCardNo.Value.Substring(1);
|
|
|
|
int iLastEtx = txtCardNo.Value.LastIndexOf(m_cDevStatus.Msr.ETX);
|
|
if (m_cDevStatus.Msr.ETX != "" && iLastEtx > 0) txtCardNo.Value = CmUtil.MidH(txtCardNo.Value, 0, iLastEtx);
|
|
}
|
|
catch { }
|
|
|
|
if (sender == null || ((Cosmos.UI.CsmPosEditBox)sender) == txtCardNo)
|
|
{
|
|
// 카드번호 길이 체크
|
|
if (txtCardNo.Text.Length < 10)
|
|
{
|
|
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0037);
|
|
txtCardNo.Text = "";
|
|
txtCardNo.Focus();
|
|
return false;
|
|
}
|
|
}
|
|
|
|
if (sender == null || ((Cosmos.UI.CsmPosEditBox)sender) == txtPassword)
|
|
{
|
|
if (m_sPassWordYn == "Y")
|
|
{
|
|
if (string.IsNullOrWhiteSpace(txtPassword.Value))
|
|
{
|
|
if (GetPinPadData() == false) return false;
|
|
}
|
|
if (txtPassword.Value.Trim().Length != m_PasswordLength)
|
|
{
|
|
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0074);
|
|
txtPassword.Text = "";
|
|
txtPassword.Focus();
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
return false;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region User Method
|
|
|
|
/// <summary>
|
|
/// 카드 번호 암호화 처리
|
|
/// </summary>
|
|
/// <param name="sInPutData"></param>
|
|
/// <returns></returns>
|
|
private bool EncryptedCardNo(string sInPutData)
|
|
{
|
|
string sRsvStr = "", sInEncData = "", sInMaskData = "";
|
|
bool bRet = false;
|
|
string sInPutType = "";
|
|
|
|
try
|
|
{
|
|
if (m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.CREDITCARD_ITEM && m_cDevStatus.ICReader.UseYn == true) // 여전법 인증여부(0:MSR, 1:IC)
|
|
{
|
|
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0263);
|
|
txtCardNo.SelectText();
|
|
return false;
|
|
}
|
|
|
|
if (((m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.POINT_ITEM && m_sPAY_DTL_CD == ItemConst.TR_ITEM_ID.POINT_USE.OKCASHBACK_POINT)
|
|
|| (m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.ETC_INFO_ITEM && m_sPAY_DTL_CD == ItemConst.TR_ITEM_ID.ETC_INFO.OCB_SAVE))
|
|
&& PosMstManager.GetPosOption(POS_OPTION.OPT326) != "0" && PosMstManager.GetPosOption(POS_OPTION.OPT326) != "" && m_cDevStatus.ICReader.UseYn != true) // OCB 직통신
|
|
{
|
|
if (m_cDevStatus.ICReader.UseYn == true) // 여전법 인증여부(0:MSR, 1:IC)
|
|
{
|
|
sInPutType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_KEYIN;
|
|
}
|
|
else
|
|
{
|
|
sInPutData = m_cDataCommon.MSR_CardNoCheck(txtCardNo.Value, txtValidDate.Value, ref sInPutType);
|
|
int index = sInPutData.IndexOf("=");
|
|
|
|
if (index > 0)
|
|
{
|
|
txtValidDate.Value = CmUtil.MidH(sInPutData, index + 1, 4);
|
|
txtValidDate.Update();
|
|
}
|
|
}
|
|
|
|
txtCardNo.Value = sInPutData.Trim();
|
|
m_sCardInfoOut = sInPutType + sInPutData;
|
|
|
|
if (m_sPassWordYn == "Y") txtPassword.Focus();
|
|
return true;
|
|
}
|
|
|
|
if (m_cDevStatus.ICReader.UseYn == true) // 여전법 인증여부(0:MSR, 1:IC)
|
|
{
|
|
UnRegIcCallback(); // IC리더 콜백 해지
|
|
}
|
|
|
|
//현금 영수증 카드번호 스캔처리
|
|
if (m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.ETC_INFO_ITEM && m_sPAY_DTL_CD == ItemConst.TR_ITEM_ID.ETC_INFO.CASHBILL && sInPutData.Length == 18 && sInPutData.StartsWith("15442020")==true)
|
|
{
|
|
sInPutData = sInPutData + "=";
|
|
}
|
|
|
|
//#20170913 현금영수증, 포인트카드 마스킹 미적용 start
|
|
//기존
|
|
//sRsvStr = m_cDeviceICReader.GetEncryptedCardNo(sInPutData).Trim();
|
|
|
|
|
|
//변경
|
|
if (m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.ETC_INFO_ITEM && m_sPAY_DTL_CD == ItemConst.TR_ITEM_ID.ETC_INFO.CASHBILL)
|
|
{
|
|
//#20171024 START, PHJ
|
|
m_cDeviceICReader.PAY_WAY_CD = m_sPAY_WAY_CD;
|
|
m_cDeviceICReader.PAY_DTL_CD = m_sPAY_DTL_CD;
|
|
//#20171024 END, PHJ
|
|
|
|
sRsvStr = m_cDeviceICReader.GetEncryptedCardNo(sInPutData, "0").Trim();
|
|
}
|
|
else
|
|
{
|
|
//MoonSeokWoo 20171023
|
|
//#20171027 start
|
|
//MSR에서 신용카드 리딩시 track2가 지워진 상태로 승인 요청해서 승인취소가 안됨.
|
|
//sInPutData = sInPutData.Substring(0, 16) + "=";
|
|
//#20171027 end
|
|
|
|
int index = sInPutData.IndexOf("=");
|
|
|
|
if (index > 0 && sInPutData.Trim().Length >= 37)
|
|
{
|
|
sRsvStr = m_cDeviceICReader.GetEncryptedCardNo(sInPutData).Trim();
|
|
}
|
|
//#20180123 MSR에서 신용카드반품시 카드번호 37자리가 아닌 경우 유효기간 오류 증상 수정 start, 20180319
|
|
else if (index > 0 && m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.CREDITCARD_ITEM && m_sPAY_DTL_CD == ItemConst.TR_ITEM_ID.CREDITCARD.CREDIT_CARD)
|
|
{
|
|
sRsvStr = m_cDeviceICReader.GetEncryptedCardNo(sInPutData).Trim();
|
|
}
|
|
//#20180123 MSR에서 신용카드반품시 카드번호 37자리가 아닌 경우 유효기간 오류 증상 수정 end, 20180319
|
|
//#20171101 스마일페이 반품승인 안되는 현상 수정 start
|
|
//스마일페이 카드번호 16자리 초과에 17번째 자리가 숫자가 아니라서 16자리 + '=' 처리가 되었음.
|
|
else if (sInPutData.Length > 17 && sInPutData.Substring(17, 1) == "=")
|
|
{
|
|
sRsvStr = m_cDeviceICReader.GetEncryptedCardNo(sInPutData).Trim();
|
|
}
|
|
//#20171101 스마일페이 반품승인 안되는 현상 수정 end
|
|
else if (sInPutData.Length > 16 && CmUtil.IsNumber(sInPutData.Substring(16, 1)) == false)
|
|
{
|
|
sInPutData = sInPutData.Substring(0, 16) + "=";
|
|
sRsvStr = m_cDeviceICReader.GetEncryptedCardNo(sInPutData).Trim();
|
|
}
|
|
//#20171030 start, phj
|
|
//통신사 반품 시 암호화 에러남.
|
|
else
|
|
{
|
|
sRsvStr = m_cDeviceICReader.GetEncryptedCardNo(sInPutData).Trim();
|
|
}
|
|
//#20171030 end, phj
|
|
}
|
|
|
|
//#20170913 현금영수증, 포인트카드 마스킹 미적용 end
|
|
|
|
if (CmUtil.MidH(sRsvStr, 0, 2) != "00")
|
|
{
|
|
// 암호화 처리 실패!
|
|
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Fail =>" + sInPutData);
|
|
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0280);
|
|
|
|
txtCardNo.SelectText();
|
|
}
|
|
else
|
|
{
|
|
sInEncData = CmUtil.MidH(sRsvStr, 2, 512).Trim(); // 암호화 데이터
|
|
sInMaskData = CmUtil.MidH(sRsvStr, 514, sRsvStr.Length - 514).Trim(); // 마스킹 데이터
|
|
|
|
//#20171018, 해피기프트(코나머니) 결제코드(신용->선불) 변경 Start, srlee
|
|
//#20170731, 해피기프트카드(코나머니) 개발 Start, srlee
|
|
// if (m_cDevStatus.ICReader.UseYn != true) // 여전법 인증여부(0:MSR, 1:IC)
|
|
if ((m_cDevStatus.ICReader.UseYn != true) && // 여전법 인증여부(0:MSR, 1:IC)
|
|
!(m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.PPCARD_ITEM && m_sPAY_DTL_CD == ItemConst.TR_ITEM_ID.PPCARD.HPGIFT_CARD))
|
|
//#20170731, 해피기프트카드(코나머니) 개발 End, srlee
|
|
//#20171018, 해피기프트(코나머니) 결제코드(신용->선불) 변경 End, srlee
|
|
{
|
|
|
|
//#20171024 START, PHJ
|
|
//기존
|
|
//string sCardNo = m_cDataCommon.MSR_CardNoCheck(txtCardNo.Value, txtValidDate.Value, ref sInPutType);
|
|
|
|
//변경
|
|
//MSR 버전에서 해피포인트 번호로 현금 영수증 반품 할 때.
|
|
//그 구분을 해주기 위해 m_sPAY_WAY_CD, m_sPAY_DTL_CD 값을 넘김.
|
|
string sCardNo = m_cDataCommon.MSR_CardNoCheck(txtCardNo.Value, txtValidDate.Value, ref sInPutType, m_sPAY_WAY_CD, m_sPAY_DTL_CD);
|
|
|
|
//#20171024 END, PHJ
|
|
|
|
int index = sCardNo.IndexOf("=");
|
|
|
|
//#20180123 MSR에서 신용카드반품시 카드번호 37자리가 아닌 경우 유효기간 오류 증상 수정 start
|
|
//기존
|
|
/*
|
|
if (index > 0 && sCardNo.Trim().Length >= 37)
|
|
{
|
|
txtValidDate.Value = CmUtil.MidH(sCardNo, index + 1, 4);
|
|
txtValidDate.Update();
|
|
}
|
|
*/
|
|
//변경
|
|
|
|
if ((index > 0) && (m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.CREDITCARD_ITEM && m_sPAY_DTL_CD == ItemConst.TR_ITEM_ID.CREDITCARD.CREDIT_CARD))
|
|
{
|
|
txtValidDate.Value = CmUtil.MidH(sCardNo, index + 1, 4);
|
|
txtValidDate.Update();
|
|
}
|
|
|
|
//#20180123 MSR에서 신용카드반품시 카드번호 37자리가 아닌 경우 유효기간 오류 증상 수정 end
|
|
}
|
|
else if ((m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.PAY_ITEM && m_sPAY_DTL_CD == ItemConst.TR_ITEM_ID.PAY.SMILE_PAY))
|
|
{
|
|
// 스마일페이
|
|
sInPutType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_MOBILE_SWIP;
|
|
}
|
|
else if (sInPutData.Length > 16 && CmUtil.IsNumber(sInPutData.Substring(16, 1)) == false)
|
|
{
|
|
//#20171024 START, PHJ
|
|
//기존
|
|
//sInPutType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_MOBILE_SWIP;
|
|
|
|
//변경
|
|
//해피포인트로 현금영수증 반품 할 때
|
|
if ((m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.ETC_INFO_ITEM) &&
|
|
(m_sPAY_DTL_CD == ItemConst.TR_ITEM_ID.ETC_INFO.CASHBILL) &&
|
|
(txtCardNo.Value.StartsWith(PosConst.HP_CARD_PRIFIX)) &&
|
|
(txtCardNo.Value.Length >= 16))
|
|
{
|
|
sInPutType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_SWIP;
|
|
}
|
|
else
|
|
{
|
|
sInPutType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_MOBILE_SWIP;
|
|
}
|
|
//#20171024 END, PHJ
|
|
}
|
|
else if (m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.ETC_INFO_ITEM && m_sPAY_DTL_CD == ItemConst.TR_ITEM_ID.ETC_INFO.CASHBILL && sInPutData.Length == 19 && sInPutData.StartsWith("15442020"))
|
|
{
|
|
sInPutType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_SWIP;
|
|
}
|
|
//#20170731, 해피기프트카드(코나머니) 개발 Start, srlee
|
|
//#20171018, 해피기프트(코나머니) 결제코드(신용->선불) 변경 Start, srlee
|
|
else if (m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.PPCARD_ITEM && m_sPAY_DTL_CD == ItemConst.TR_ITEM_ID.PPCARD.HPGIFT_CARD)
|
|
//#20171018, 해피기프트(코나머니) 결제코드(신용->선불) 변경 End, srlee
|
|
{
|
|
// 해피기프트카드(코나머니)
|
|
sInMaskData = m_cDataCommon.MSR_CardNoCheck(txtCardNo.Value, "0000", ref sInPutType);
|
|
}
|
|
//#20170731, 해피기프트카드(코나머니) 개발 End, srlee
|
|
else
|
|
{
|
|
if (m_cDevStatus.ICReader.UseYn == true) // 여전법 인증여부(0:MSR, 1:IC)
|
|
{
|
|
sInPutType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_KEYIN;
|
|
}
|
|
else
|
|
{
|
|
string sCardNo = m_cDataCommon.MSR_CardNoCheck(txtCardNo.Value, txtValidDate.Value, ref sInPutType);
|
|
int index = sCardNo.IndexOf("=");
|
|
|
|
if (index > 0 && sCardNo.Trim().Length >= 37)
|
|
{
|
|
txtValidDate.Value = CmUtil.MidH(sCardNo, index + 1, 4);
|
|
txtValidDate.Update();
|
|
}
|
|
}
|
|
}
|
|
if(m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.CREDITCARD_ITEM && m_sPAY_DTL_CD == ItemConst.TR_ITEM_ID.CREDIT.CREDIT_PAY)
|
|
//bRet = CompleteCardInPut(string.Format("00{0}^!@{1}", sInPutType, sInEncData));
|
|
bRet = CompleteCardInPut(sInMaskData, string.Format("00{0}^!@{1}", sInPutType, sInEncData));
|
|
|
|
//#20170731, 해피기프트카드(코나머니) 개발 Start, srlee
|
|
//#20171018, 해피기프트(코나머니) 결제코드(신용->선불) 변경 Start, srlee
|
|
else if (m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.PPCARD_ITEM && m_sPAY_DTL_CD == ItemConst.TR_ITEM_ID.PPCARD.HPGIFT_CARD)
|
|
//#20171018, 해피기프트(코나머니) 결제코드(신용->선불) 변경 End, srlee
|
|
bRet = CompleteCardInPut(sInMaskData, string.Format("00{0}^!@{1}", sInPutType, sInMaskData));
|
|
//#20170731, 해피기프트카드(코나머니) 개발 End, srlee
|
|
|
|
else
|
|
// 카드 데이터(입력구분(1) + 암호화데이터)
|
|
bRet = CompleteCardInPut(sInMaskData, sInPutType + sInEncData);
|
|
}
|
|
|
|
if (btnMenu1.Visible == true)
|
|
{
|
|
if (txtCardNo.Value == "") tmrIcCard.Enabled = true; // IC리더 콜백 설정
|
|
}
|
|
return bRet;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
}
|
|
finally
|
|
{
|
|
//여전법 대응!
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|
CmUtil.ZeroFillClear(ref sRsvStr);
|
|
CmUtil.ZeroFillClear(ref sInEncData);
|
|
CmUtil.ZeroFillClear(ref sInMaskData);
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// IC 카드 정보 입력 처리
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private bool GetIcCardData(bool bCancelCallBack)
|
|
{
|
|
string sRsvStr = "";
|
|
string m_InputType = "";
|
|
|
|
try
|
|
{
|
|
if (m_cDevStatus.ICReader.UseYn == true) // 여전법 인증여부(0:MSR, 1:IC)
|
|
{
|
|
if (bCancelCallBack == true) UnRegIcCallback(); // IC리더 콜백 해지
|
|
}
|
|
|
|
txtCardNo.Value = "";
|
|
m_sCardInfoOut = "";
|
|
|
|
if (m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.CREDITCARD_ITEM)
|
|
{
|
|
// 신용카드
|
|
if (m_cDevStatus.ICReader.UseYn == true) // 여전법 인증여부(0:MSR, 1:IC)
|
|
{
|
|
if (m_cDeviceICReader.GetCardInfo_ICReader(PosConst.IC_READER_TRAN_TYPE.CREDIT, CmUtil.IntParse(txtDspAppAmt.Text), ref sRsvStr) == false) return false;
|
|
|
|
if (CmUtil.MidH(sRsvStr, 0, 2) != "00") return false;
|
|
|
|
if (CmUtil.MidH(sRsvStr, 4, 2).Trim() == "02")
|
|
{
|
|
m_InputType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_SWIP;
|
|
}
|
|
else
|
|
{
|
|
m_InputType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_IC;
|
|
}
|
|
|
|
// 카드 데이터(신용:IC데이터, 그외:입력구분(1)+암호화데이터), 취소 일경우 앞 두자리를 입력 정상 유무를 체크 하기 때문에 붙여줌!
|
|
return CompleteCardInPut(CmUtil.MidH(sRsvStr, 1030, 37), string.Format("00{0}^!@{1}", m_InputType, sRsvStr));
|
|
|
|
}
|
|
else
|
|
{
|
|
string sCardNo = m_cDataCommon.MSR_CardNoCheck(txtCardNo.Value, txtValidDate.Value, ref m_InputType);
|
|
|
|
if (sCardNo.Trim() == "")
|
|
{
|
|
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0037);
|
|
txtCardNo.Select();
|
|
return false;
|
|
}
|
|
|
|
// 카드 데이터(신용:IC데이터, 그외:입력구분(1)+암호화데이터), 취소 일경우 앞 두자리를 입력 정상 유무를 체크 하기 때문에 붙여줌!
|
|
return CompleteCardInPut(sCardNo, string.Format("00{0}^!@{1}", m_InputType, sCardNo));
|
|
}
|
|
}
|
|
//#20171018, 해피기프트(코나머니) 결제코드(신용->선불) 변경 Start, srlee
|
|
else if (m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.PPCARD_ITEM && m_sPAY_DTL_CD == ItemConst.TR_ITEM_ID.PPCARD.HPGIFT_CARD)
|
|
{
|
|
if (m_cDevStatus.ICReader.UseYn == true) // 여전법 인증여부(0:MSR, 1:IC)
|
|
{
|
|
if (m_cDeviceICReader.GetCardInfo_ICReader(PosConst.IC_READER_TRAN_TYPE.CREDIT, CmUtil.IntParse(txtDspAppAmt.Text), ref sRsvStr) == false) return false;
|
|
|
|
if (CmUtil.MidH(sRsvStr, 0, 2) != "00") return false;
|
|
|
|
if (CmUtil.MidH(sRsvStr, 4, 2).Trim() == "02")
|
|
{
|
|
m_InputType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_SWIP;
|
|
}
|
|
else
|
|
{
|
|
m_InputType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_IC;
|
|
}
|
|
|
|
// 카드 데이터(신용:IC데이터, 그외:입력구분(1)+암호화데이터), 취소 일경우 앞 두자리를 입력 정상 유무를 체크 하기 때문에 붙여줌!
|
|
return CompleteCardInPut(CmUtil.MidH(sRsvStr, 1030, 37), string.Format("00{0}^!@{1}", m_InputType, sRsvStr));
|
|
}
|
|
}
|
|
//#20171018, 해피기프트(코나머니) 결제코드(신용->선불) 변경 End, srlee
|
|
else if (m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.ETC_INFO_ITEM && m_sPAY_DTL_CD == ItemConst.TR_ITEM_ID.ETC_INFO.CASHBILL)
|
|
{
|
|
// 신용카드
|
|
if (m_cDeviceICReader.GetCardInfo_ICReader(PosConst.IC_READER_TRAN_TYPE.CASHBILL, CmUtil.IntParse(txtDspAppAmt.Text), ref sRsvStr) == false) return false;
|
|
|
|
if (CmUtil.MidH(sRsvStr, 0, 2) != "00") return false;
|
|
|
|
if (CmUtil.MidH(sRsvStr, 4, 2).Trim() == "02")
|
|
{
|
|
m_InputType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_SWIP;
|
|
}
|
|
else
|
|
{
|
|
m_InputType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_IC;
|
|
}
|
|
|
|
// 카드 데이터(신용:IC데이터, 그외:입력구분(1)+암호화데이터), 취소 일경우 앞 두자리를 입력 정상 유무를 체크 하기 때문에 붙여줌!
|
|
return CompleteCardInPut(CmUtil.MidH(sRsvStr, 1030, 37), m_InputType + CmUtil.MidH(sRsvStr, 6, 512).Trim());
|
|
}
|
|
else
|
|
{
|
|
// 포인트 카드
|
|
if (m_cDeviceICReader.GetCardInfo_ICReader(PosConst.IC_READER_TRAN_TYPE.POINT, CmUtil.IntParse(txtDspAppAmt.Text), ref sRsvStr) == false) return false;
|
|
|
|
if (CmUtil.MidH(sRsvStr, 0, 2) != "00") return false;
|
|
|
|
// 카드 데이터(신용:IC데이터, 그외:입력구분(1)+암호화데이터)
|
|
return CompleteCardInPut(CmUtil.MidH(sRsvStr, 1030, 37), PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_SWIP + CmUtil.MidH(sRsvStr, 6, 512).Trim());
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
}
|
|
finally
|
|
{
|
|
if (btnMenu1.Visible == true)
|
|
{
|
|
if (txtCardNo.Value == "") tmrIcCard.Enabled = true; // IC리더 콜백 설정
|
|
}
|
|
//여전법 대응!
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|
CmUtil.ZeroFillClear(ref sRsvStr);
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|
}
|
|
return false;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Rf 카드 정보 입력 처리
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private bool GetRfCardData()
|
|
{
|
|
string sRsvStr = "";
|
|
bool bRet = false;
|
|
try
|
|
{
|
|
txtCardNo.Value = "";
|
|
m_sCardInfoOut = "";
|
|
|
|
// 카드 정보 입력
|
|
if (m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.EMP_PAY_ITEM && m_sPAY_DTL_CD == ItemConst.TR_ITEM_ID.EMP_PAY.SPC)
|
|
// SPC 임직원 결제
|
|
{
|
|
bRet = m_cDeviceICReader.GetSpcEmpCardInfo(ref sRsvStr);
|
|
if (bRet == false)
|
|
{
|
|
WinManager.ErrorMessage(sRsvStr);
|
|
return false;
|
|
}
|
|
|
|
return CompleteCardInPut(CmUtil.MidH(sRsvStr, 1, 16), string.Format("00{0}^!@{1}", PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_RF, sRsvStr));
|
|
}
|
|
//20171013 dkshin 해피기프트(신) IC/RF 충전 및 승인 - RF 반품시
|
|
//#20171018, 해피기프트(코나머니) 결제코드(신용->선불) 변경 Start, srlee
|
|
else if (m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.PPCARD_ITEM && m_sPAY_DTL_CD == ItemConst.TR_ITEM_ID.PPCARD.HPGIFT_CARD)
|
|
//#20171018, 해피기프트(코나머니) 결제코드(신용->선불) 변경 End, srlee
|
|
{
|
|
bRet = m_cDeviceICReader.GetRfEtcCardInfo("G", txtDspAppAmt.Text, "", "", "", ref sRsvStr);
|
|
|
|
if (bRet == false)
|
|
{
|
|
if (sRsvStr != "") WinManager.ErrorMessage(sRsvStr);
|
|
return false;
|
|
}
|
|
|
|
//#20171018, 해피기프트(코나머니) 결제코드(신용->선불) 변경 Start, srlee
|
|
/*if (m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.CREDITCARD_ITEM)
|
|
{
|
|
//취소 일경우 앞 두자리를 입력 정상 유무를 체크 하기 때문에 붙여줌!
|
|
return CompleteCardInPut(CmUtil.MidH(sRsvStr, 1, 16), string.Format("00{0}^!@{1}", PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_RF, sRsvStr));
|
|
}
|
|
else
|
|
{
|
|
// 카드 데이터(신용:IC데이터, 그외:입력구분(1)+암호화데이터)
|
|
//return CompleteCardInPut(CmUtil.MidH(sRsvStr, 1, 16), PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_RF + CmUtil.MidH(sRsvStr, 2, 512).Trim());
|
|
}*/
|
|
|
|
//취소 일경우 앞 두자리를 입력 정상 유무를 체크 하기 때문에 붙여줌!
|
|
return CompleteCardInPut(CmUtil.MidH(sRsvStr, 1, 16), string.Format("00{0}^!@{1}", PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_RF, sRsvStr));
|
|
//#20171018, 해피기프트(코나머니) 결제코드(신용->선불) 변경 End, srlee
|
|
}
|
|
else
|
|
{
|
|
bRet = m_cDeviceICReader.GetRfCreditCardInfo("1", txtDspAppAmt.Text, "", "", "", ref sRsvStr);
|
|
if (bRet == false)
|
|
{
|
|
if (sRsvStr != "") WinManager.ErrorMessage(sRsvStr);
|
|
return false;
|
|
}
|
|
|
|
if (m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.CREDITCARD_ITEM)
|
|
{
|
|
//취소 일경우 앞 두자리를 입력 정상 유무를 체크 하기 때문에 붙여줌!
|
|
return CompleteCardInPut(CmUtil.MidH(sRsvStr, 514, 40), string.Format("00{0}^!@{1}", PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_RF, sRsvStr));
|
|
}
|
|
else
|
|
{
|
|
// 카드 데이터(신용:IC데이터, 그외:입력구분(1)+암호화데이터)
|
|
return CompleteCardInPut(CmUtil.MidH(sRsvStr, 514, 40), PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_RF + CmUtil.MidH(sRsvStr, 2, 512).Trim());
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
}
|
|
finally
|
|
{
|
|
//여전법 대응!
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|
CmUtil.ZeroFillClear(ref sRsvStr);
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|
}
|
|
return false;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// POP 카드 정보 입력 처리
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private bool GetPopCardData()
|
|
{
|
|
string sRsvStr = "";
|
|
bool bRet = false;
|
|
try
|
|
{
|
|
txtCardNo.Value = "";
|
|
m_sCardInfoOut = "";
|
|
|
|
string sInPutData = "";
|
|
if (m_cDeviceICReader.RfPrepaidCardInfo(ref sRsvStr) == false)
|
|
{
|
|
if (sRsvStr != "") WinManager.ErrorMessage(sRsvStr);
|
|
return false;
|
|
}
|
|
if (sRsvStr.StartsWith("T") == true)
|
|
{
|
|
sInPutData = sRsvStr.Substring(7, 16).Trim();
|
|
}
|
|
else if (sRsvStr.StartsWith("E") == true)
|
|
{
|
|
sInPutData = sRsvStr.Substring(1, 20).Trim();
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
|
|
UnRegIcCallback(); // IC리더 콜백 해지
|
|
|
|
string sEncData = m_cDeviceICReader.GetEncryptedCardNo(sInPutData).Trim();
|
|
if (CmUtil.MidH(sEncData, 0, 2) != "00")
|
|
{
|
|
//암호화 처리 실패!
|
|
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Fail =>" + sInPutData);
|
|
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0280);
|
|
bRet = false;
|
|
}
|
|
else
|
|
{
|
|
// 카드 데이터(신용:IC데이터, 그외:입력구분(1)+암호화데이터)
|
|
bRet = CompleteCardInPut(CmUtil.MidH(sEncData, 514, sEncData.Length - 514).Trim(), PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_RF + CmUtil.MidH(sEncData, 2, 512).Trim());
|
|
}
|
|
if (btnMenu1.Visible == true)
|
|
{
|
|
if (txtCardNo.Value == "") tmrIcCard.Enabled = true; // IC리더 콜백 설정
|
|
}
|
|
|
|
return bRet;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
}
|
|
finally
|
|
{
|
|
//여전법 대응!
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|
CmUtil.ZeroFillClear(ref sRsvStr);
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 카드번호 입력 완료 처리
|
|
/// </summary>
|
|
/// <param name="sInPutData"></param>
|
|
/// <param name="sInEncData"></param>
|
|
/// <returns></returns>
|
|
private bool CompleteCardInPut(string sInPutData, string sInEncData)
|
|
{
|
|
string sCardInfoOut = "";
|
|
try
|
|
{
|
|
sCardInfoOut = sInEncData;
|
|
|
|
if (((m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.ETC_INFO_ITEM && m_sPAY_DTL_CD == ItemConst.TR_ITEM_ID.ETC_INFO.SAVEPOINT) //해피포인트 적립
|
|
|| (m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.POINT_ITEM && m_sPAY_DTL_CD == ItemConst.TR_ITEM_ID.POINT_USE.HAPPY_POINT))) //해피포인트 사용
|
|
{
|
|
// 제휴카드 이면 해피포인트 조회 후 해피포인트 카드번호로 변경 필요
|
|
if (sInPutData.StartsWith(PosConst.HP_CARD_PRIFIX) == false)
|
|
{
|
|
// 해피 포인트 조회
|
|
IPaymentExpUs cHappyPoint = (IPaymentExpUs)sManager.InitServiceInstance(ServiceLists.BSV_PAYMENT.DLL, ServiceLists.BSV_PAYMENT.POINTHAPPYPOINT);
|
|
string[] saRecvdData = null;
|
|
string sRet = cHappyPoint.SearchPayment(new string[] { sInEncData.Substring(0,1), sInPutData, sInEncData.Substring(1), "1" }, ref saRecvdData);
|
|
if (sRet != UserCom.RST_OK) return false;
|
|
|
|
// 조회 데이터 획득
|
|
Column.TR_ETC.DATA cEtcItem = (Column.TR_ETC.DATA)cHappyPoint.GetPayment(new string[] { });
|
|
if (cEtcItem.HP_ADD_INFO_SCH.Trim() != "")
|
|
{
|
|
int nNowPos = 0;
|
|
string[] aIrtRsp = new string[Column.POINT_ADD_INFO_SEARCH.LEN.Length];
|
|
ItemColumn.ParseMessage(Column.POINT_ADD_INFO_SEARCH.LEN, Column.POINT_ADD_INFO_SEARCH.TYPE, Encoding.Default.GetBytes(cEtcItem.HP_ADD_INFO_SCH), ref nNowPos, ref aIrtRsp);
|
|
|
|
// 고객정보 중에서 첫번째 카드 선택
|
|
string sMemInfo = aIrtRsp[Column.POINT_ADD_INFO_SEARCH.SEQ.pointMEMINFO].Trim();
|
|
if (sMemInfo.Length >= 17 && CmUtil.LongParse(sMemInfo.Substring(0, 1)) > 0)
|
|
{
|
|
UnRegIcCallback(); // IC리더 콜백 해지
|
|
|
|
string sCardNo = sMemInfo.Substring(1, 16).Trim(); // 카드번호
|
|
|
|
bool bRet = false;
|
|
string sCardNoEncData = "";
|
|
if (m_cDevStatus.ICReader.UseYn == true) // 여전법 인증여부(0:MSR, 1:IC)
|
|
{
|
|
// IC
|
|
sCardNoEncData = m_cDeviceICReader.GetEncryptedCardNo(sCardNo).Trim();
|
|
}
|
|
else
|
|
{
|
|
// MSR
|
|
sCardNoEncData = "00" + sCardNo;
|
|
}
|
|
|
|
if (CmUtil.MidH(sCardNoEncData, 0, 2) != "00")
|
|
{
|
|
// 암호화 처리 실패!
|
|
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Fail =>" + sCardNo);
|
|
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0280);
|
|
txtCardNo.SelectText();
|
|
bRet = false;
|
|
}
|
|
else
|
|
{
|
|
sCardInfoOut = sInEncData.Substring(0, 1) + CmUtil.MidH(sCardNoEncData, 2, 512).Trim(); // 암호화 데이터
|
|
//sInPutData = sCardNo;
|
|
bRet = true;
|
|
}
|
|
|
|
if (btnMenu1.Visible == true)
|
|
{
|
|
if (txtCardNo.Value == "") tmrIcCard.Enabled = true; // IC리더 콜백 설정
|
|
}
|
|
if (bRet == false) return bRet;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if ((m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.PAY_ITEM && m_sPAY_DTL_CD == ItemConst.TR_ITEM_ID.PAY.SMILE_PAY))
|
|
{
|
|
// 스마일페이
|
|
}
|
|
//#20180426 현금영수증 마스킹 변경 및 영수증 문구 변경 start
|
|
else if ((m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.ETC_INFO_ITEM && m_sPAY_DTL_CD == ItemConst.TR_ITEM_ID.ETC_INFO.CASHBILL))
|
|
{
|
|
|
|
}
|
|
//#20180426 현금영수증 마스킹 변경 및 영수증 문구 변경 end
|
|
else if (txtDspCardNo.Text.Substring(0, 6) != sInPutData.Substring(0, 6))
|
|
{
|
|
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0062);
|
|
txtCardNo.Focus();
|
|
txtCardNo.SelectText();
|
|
return false;
|
|
}
|
|
//if (m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.CREDITCARD_ITEM && m_sPAY_DTL_CD == ItemConst.TR_ITEM_ID.CREDIT.CREDIT_PAY &&
|
|
// m_cDevStatus.ICReader.UseYn == false && sCardInfoOut.StartsWith("00") == false)
|
|
//{
|
|
// // 신용카드 MSR 입력
|
|
// sCardInfoOut = string.Format("00{0}^!@{1}", sCardInfoOut.Substring(0, 1), sCardInfoOut.Substring(1));
|
|
//}
|
|
}
|
|
txtCardNo.Value = sInPutData.Trim();
|
|
m_sCardInfoOut = sCardInfoOut;
|
|
|
|
if (m_sPassWordYn == "Y") txtPassword.Focus();
|
|
//this.DialogResult = DialogResult.OK;
|
|
//this.Close();
|
|
return true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
}
|
|
finally
|
|
{
|
|
//여전법 대응!
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|
CmUtil.ZeroFillClear(ref sInEncData);
|
|
CmUtil.ZeroFillClear(ref sCardInfoOut);
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|
}
|
|
return false;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 전화번호 입력 처리
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private bool GetPinPadData()
|
|
{
|
|
string sRsvStr = "";
|
|
|
|
try
|
|
{
|
|
//txtCardNo.Value = "";
|
|
//if (m_cDeviceSignPad.GetMsg_SignPad(true, MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0324), ref sRsvStr) == false) return false;
|
|
//txtCardNo.Value = sRsvStr;
|
|
|
|
if (m_sPassWordYn == "Y")
|
|
{
|
|
txtPassword.Value = "";
|
|
if (m_cDeviceSignPad.GetMsg_SignPad(false, MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0074), ref sRsvStr, m_PasswordLength) == false) return false;
|
|
txtPassword.Value = sRsvStr;
|
|
m_sPassWordOut = sRsvStr;
|
|
}
|
|
else
|
|
{
|
|
txtCardNo.Value = "";
|
|
if (m_cDeviceSignPad.GetMsg_SignPad(false, MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0324), ref sRsvStr) == false) return false;
|
|
txtCardNo.Value = sRsvStr;
|
|
if (EncryptedCardNo(sRsvStr) == false) return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
}
|
|
return false;
|
|
}
|
|
#endregion User Method
|
|
|
|
#region DeviceEvent 관련
|
|
/// <summary>
|
|
/// DeviceEvent 관련
|
|
/// </summary>
|
|
/// <param name="sDevice"></param>
|
|
/// <param name="sData1"></param>
|
|
/// <param name="sData2"></param>
|
|
/// <param name="sData3"></param>
|
|
public void OnDeviceEvent(string sDevice, string sData1, string sData2, string sData3)
|
|
{
|
|
try
|
|
{
|
|
switch (sDevice)
|
|
{
|
|
case PosConst.OPOS_DEVICE.MSR:
|
|
this.Invoke(new EventHandler(OnMSREvent));
|
|
break;
|
|
case PosConst.OPOS_DEVICE.SCANNER:
|
|
this.Invoke(new EventHandler(OnScannerEvent));
|
|
break;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// MSR Event
|
|
/// </summary>
|
|
/// <param name="source"></param>
|
|
/// <param name="e"></param>
|
|
private void OnMSREvent(object source, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 스캐너 이벤트 처리
|
|
/// </summary>
|
|
/// <param name="source"></param>
|
|
/// <param name="e"></param>
|
|
private void OnScannerEvent(object source, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region IC리더 콜백 관련
|
|
/// <summary>
|
|
/// IC리더 콜백 설정
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void tmrIcCard_Tick(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (m_cDevStatus.ICReader.UseYn != true) // 여전법 인증여부(0:MSR, 1:IC)
|
|
{
|
|
tmrIcCard.Enabled = false;
|
|
return;
|
|
}
|
|
|
|
if (tmrIcCard.Tag == null || tmrIcCard.Tag.ToString() == "")
|
|
{
|
|
// IC리더 콜백 설정
|
|
if (bNotDoubleClik) return;
|
|
|
|
tmrIcCard.Enabled = false;
|
|
|
|
//#20170918 IC 콜백 함수 변경 start
|
|
//포인트창에서 해피제휴 신용카드 리딩시 IC 우선 거래로 인해 '카드를 읽혀 주세요' 팝업 나오는 현상 수정.
|
|
//기존
|
|
m_cDeviceICReader.RegIcCallback(delegateReader);
|
|
//변경
|
|
//string sApprID = PosMstManager.GetMstVan(ItemConst.TR_ITEM_ID.CREDITCARD_ITEM, ItemConst.TR_ITEM_ID.CREDITCARD.CREDIT_CARD, PosMst.MST_VAN.DATA.APPR_ID);
|
|
//m_cDeviceICReader.RegIcCallbackCardInfo(sApprID, m_cDataService.IntParse(txtDspAppAmt.Text), delegateReaderCardInfo);
|
|
//#20170918 IC 콜백 함수 변경 end
|
|
}
|
|
else if (tmrIcCard.Tag.ToString() == "MSR")
|
|
{
|
|
// MSR 카드 읽기
|
|
tmrIcCard.Enabled = false;
|
|
tmrIcCard.Tag = "";
|
|
tmrIcCard.Interval = 500;
|
|
|
|
bool isCompleted = false;
|
|
if (m_sPAY_WAY_CD == ItemConst.TR_ITEM_ID.CREDITCARD_ITEM)
|
|
{
|
|
// 신용카드
|
|
string sInputType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_SWIP;
|
|
string sIcCardData = "000102" + CmUtil.MidH(m_sCallBackCardData, 0, 512) + CmUtil.RPadH("", 512) + CmUtil.RPadH(CmUtil.MidH(m_sCallBackCardData, 512, 40).Trim(), 37); // +CmUtil.MidH(m_sCallBackCardData, 552, 5);
|
|
|
|
// 카드 데이터(신용:IC데이터, 그외:입력구분(1)+암호화데이터), 취소 일경우 앞 두자리를 입력 정상 유무를 체크 하기 때문에 붙여줌!
|
|
isCompleted = CompleteCardInPut(CmUtil.MidH(m_sCallBackCardData, 512, 37).Trim(), string.Format("00{0}^!@{1}", sInputType, sIcCardData));
|
|
}
|
|
else
|
|
{
|
|
// 카드 데이터(신용:IC데이터, 그외:입력구분(1)+암호화데이터)
|
|
isCompleted = CompleteCardInPut(CmUtil.MidH(m_sCallBackCardData, 512, 40).Trim(), PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_SWIP + CmUtil.MidH(m_sCallBackCardData, 0, 512).Trim());
|
|
}
|
|
|
|
if (txtPassword.Visible == false && isCompleted == true)
|
|
{
|
|
this.DialogResult = System.Windows.Forms.DialogResult.OK;
|
|
this.Close();
|
|
return;
|
|
}
|
|
tmrIcCard.Enabled = true;
|
|
}
|
|
else if (tmrIcCard.Tag.ToString() == "IC")
|
|
{
|
|
// IC리더 카드 읽기
|
|
tmrIcCard.Enabled = false;
|
|
tmrIcCard.Tag = "";
|
|
tmrIcCard.Interval = 500;
|
|
|
|
bNotDoubleClik = false;
|
|
btnProc_Click(btnMenu1, null);
|
|
}
|
|
else
|
|
tmrIcCard.Enabled = false;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
}
|
|
}
|
|
|
|
delegate void DelegateIcReaderCallBack(int rc, StringBuilder str);
|
|
/// <summary>
|
|
/// IC리더 콜백 함수
|
|
/// </summary>
|
|
/// <param name="num"></param>
|
|
/// <param name="str"></param>
|
|
public void OnIcReaderCallBack(int num, StringBuilder str)
|
|
{
|
|
try
|
|
{
|
|
if (m_cDevStatus.ICReader.UseYn != true) // 여전법 인증여부(0:MSR, 1:IC)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (txtCardNo.InvokeRequired)
|
|
{
|
|
DelegateIcReaderCallBack d = new DelegateIcReaderCallBack(OnIcReaderCallBack);
|
|
this.Invoke(d, new object[] { num, str });
|
|
}
|
|
else
|
|
{
|
|
if (bNotDoubleClik) return;
|
|
bNotDoubleClik = true;
|
|
|
|
if (num == 1)
|
|
{
|
|
// IC 카드
|
|
tmrIcCard.Tag = "IC";
|
|
tmrIcCard.Interval = 100;
|
|
}
|
|
else
|
|
{
|
|
// MSR 카드
|
|
if (str.ToString().StartsWith("EN") == true)
|
|
{
|
|
m_sCallBackCardData = str.ToString();
|
|
|
|
tmrIcCard.Tag = "MSR";
|
|
tmrIcCard.Interval = 100;
|
|
}
|
|
else
|
|
{
|
|
tmrIcCard.Interval = 500;
|
|
}
|
|
}
|
|
tmrIcCard.Enabled = true;
|
|
|
|
bNotDoubleClik = false;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
bNotDoubleClik = false;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// IC리더 콜백 해지
|
|
/// </summary>
|
|
private void UnRegIcCallback()
|
|
{
|
|
try
|
|
{
|
|
if (m_cDevStatus.ICReader.UseYn == true) // 여전법 인증여부(0:MSR, 1:IC)
|
|
{
|
|
tmrIcCard.Enabled = false;
|
|
|
|
//#20170918 IC 콜백 함수 변경 start
|
|
//포인트창에서 해피제휴 신용카드 리딩시 IC 우선 거래로 인해 '카드를 읽혀 주세요' 팝업 나오는 현상 수정.
|
|
//기존
|
|
m_cDeviceICReader.UnRegIcCallback();
|
|
//변경
|
|
//m_cDeviceICReader.UnRegIcCallbackCardInfo();
|
|
//#20170918 IC 콜백 함수 변경 end
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
}
|
|
}
|
|
|
|
private void txtCardNo_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
//#20170918 IC 콜백 함수 변경 start
|
|
//포인트창에서 해피제휴 신용카드 리딩시 IC 우선 거래로 인해 '카드를 읽혀 주세요' 팝업 나오는 현상 수정.
|
|
/*
|
|
delegate void DelegateWriteLog(int returnValue, StringBuilder returnData);
|
|
/// <summary>
|
|
/// IC리더 콜백 함수(CardInfo)
|
|
/// </summary>
|
|
/// <param name="returnValue"></param>
|
|
/// <param name="returnData"></param>
|
|
public void OnIcReaderCallBackCardInfo(int returnValue, StringBuilder returnData)
|
|
{
|
|
if (txtCardNo.InvokeRequired)
|
|
{
|
|
DelegateWriteLog d = new DelegateWriteLog(OnIcReaderCallBackCardInfo);
|
|
this.Invoke(d, new object[] { returnValue, returnData });
|
|
}
|
|
else
|
|
{
|
|
if (m_bCardInPut) return;
|
|
m_bCardInPut = true;
|
|
|
|
if (returnValue > 0)
|
|
{
|
|
string sRsvStr = returnData.ToString();
|
|
if (CmUtil.MidH(sRsvStr, 0, 2) == "00")
|
|
{
|
|
m_sCardNo = CmUtil.MidH(sRsvStr, 6, 512).Trim();
|
|
txtCardNo.Value = CmUtil.MidH(sRsvStr, 1030, 37).Trim();
|
|
m_sIcChip = CmUtil.MidH(sRsvStr, 518, 512).Trim();
|
|
if (CmUtil.MidH(sRsvStr, 4, 2).Trim() == "02")
|
|
{
|
|
m_InputType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_SWIP;
|
|
}
|
|
else
|
|
{
|
|
m_InputType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_IC;
|
|
}
|
|
m_sServiceCode = CmUtil.MidH(sRsvStr, 1067, 5).Trim();
|
|
m_sFallDiv = CmUtil.MidH(sRsvStr, 3, 1); // == "3" ? "0" : "1";
|
|
|
|
// IC 카드(CardInfo)
|
|
tmrIcCard.Tag = "ICREADER";
|
|
tmrIcCard.Interval = 100;
|
|
tmrIcCard.Enabled = true;
|
|
|
|
m_bCardInPut = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
*/
|
|
//#20170918 IC 콜백 함수 변경 end
|
|
|
|
#endregion
|
|
|
|
//#region 카드번호 첫자리와 끝자리 체크하여 문자인 경우 스페이스로 치환
|
|
///// <summary>
|
|
///// 카드번호 첫자리와 끝자리 체크하여 문자인 경우 스페이스로 치환
|
|
///// </summary>
|
|
///// <param name="sCardNo"></param>
|
|
///// <returns></returns>
|
|
//private string LF_CardNoCheck(string sCardNo, string sValidDate, ref string sInputType)
|
|
//{
|
|
// string sRet = "";
|
|
// string sFirst = CmUtil.MidH(sCardNo, 0, 1);
|
|
// string sLast = CmUtil.MidH(sCardNo, CmUtil.LenH(sCardNo.Trim()) - 1, 1);
|
|
|
|
// try
|
|
// {
|
|
// if (sFirst.Contains("^") == true)
|
|
// return "";
|
|
// else if (sFirst.Contains("%") == true)
|
|
// return "";
|
|
|
|
// sCardNo = sCardNo.Trim();
|
|
|
|
// if (sFirst.Contains(m_cDevStatus.Msr.STX) == true && m_cDevStatus.Msr.STX.Trim() != "")
|
|
// {
|
|
// // 첫자리가 ;, ? 경우 치환
|
|
// sCardNo = CmUtil.MidH(sCardNo, 1, CmUtil.LenH(sCardNo.Trim()));
|
|
// }
|
|
// else if (CmUtil.IsNumber(sFirst) != true)
|
|
// {
|
|
// // 첫자리가 숫자가 아닌 경우 치환
|
|
// sCardNo = CmUtil.MidH(sCardNo, 1, CmUtil.LenH(sCardNo.Trim()));
|
|
// }
|
|
|
|
// if (sLast.Contains(m_cDevStatus.Msr.ETX) == true && m_cDevStatus.Msr.ETX.Trim() != "")
|
|
// {
|
|
// // 끝자리가 ? 경우 치환
|
|
// sCardNo = CmUtil.MidH(sCardNo, 0, CmUtil.LenH(sCardNo.Trim()) - 1);
|
|
// }
|
|
|
|
// if (sCardNo.IndexOf("=") > 0)
|
|
// {
|
|
// if (sCardNo.Trim().Length >= 37)
|
|
// sCardNo = CmUtil.MidH(sCardNo, 0, 37);
|
|
|
|
// sInputType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_SWIP;
|
|
// }
|
|
// else if (sValidDate != null)
|
|
// sInputType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_KEYIN;
|
|
// else
|
|
// {
|
|
// sCardNo = sCardNo + "=" + sValidDate;
|
|
// sInputType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_KEYIN;
|
|
// }
|
|
|
|
// sRet = sCardNo;
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
// System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
// }
|
|
// return sRet;
|
|
//}
|
|
//#endregion
|
|
|
|
}
|
|
}
|