705 lines
37 KiB
C#
705 lines
37 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 XCTransaction2;
|
|||
|
|
|||
|
namespace Cosmos.Service
|
|||
|
{
|
|||
|
public partial class frmXCharge : Form
|
|||
|
{
|
|||
|
#region Variable
|
|||
|
|
|||
|
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 IDataCommonUs m_cDataCommon = null; // POS 공통함수 인터페이스
|
|||
|
private IDataProcessUs m_cDataService = null; // 거래데이터 합계금액 계산 및 관리
|
|||
|
|
|||
|
private IXChargeTransaction XCTran;
|
|||
|
private readonly string TRAN_FOLDER = "IP|127.0.0.1|26"; // X-Charge transaction folder, or IP connection string in "IP|<IPAddress>|<Port>" format
|
|||
|
private string m_sTranFolder = "";
|
|||
|
private bool bShowResult = true; // DLL에서 메세지 출력 유무
|
|||
|
|
|||
|
// *************** Param In *************** //
|
|||
|
|
|||
|
private string m_sAppType;
|
|||
|
/// <summary>
|
|||
|
/// 승인구분(0:승인,1:취소)
|
|||
|
/// </summary>
|
|||
|
public string SetAppType { set { this.m_sAppType = value; } }
|
|||
|
|
|||
|
private string m_sOrgCardNo;
|
|||
|
/// <summary>
|
|||
|
/// 원카드번호
|
|||
|
/// </summary>
|
|||
|
public string SetCardNo { set { this.m_sOrgCardNo = value; } }
|
|||
|
|
|||
|
private string m_sAppAmt;
|
|||
|
/// <summary>
|
|||
|
/// 승인금액
|
|||
|
/// </summary>
|
|||
|
public string SetAppAmt { set { this.m_sAppAmt = value; } }
|
|||
|
|
|||
|
private string m_sOrgXcTrandID;
|
|||
|
/// <summary>
|
|||
|
/// 원승인아이디
|
|||
|
/// </summary>
|
|||
|
public string SetXcTrandID { set { this.m_sOrgXcTrandID = value; } }
|
|||
|
|
|||
|
private string m_sReceipt;
|
|||
|
/// <summary>
|
|||
|
/// 거래정보
|
|||
|
/// </summary>
|
|||
|
public string SetReceipt { get { return this.m_sReceipt; } set { this.m_sReceipt = value; } }
|
|||
|
|
|||
|
|
|||
|
// *************** Param Out *************** //
|
|||
|
|
|||
|
private string m_sCardNo;
|
|||
|
/// <summary>
|
|||
|
/// 카드번호
|
|||
|
/// </summary>
|
|||
|
public string GetCardNo { get { return this.m_sCardNo; } }
|
|||
|
|
|||
|
private string m_sValid;
|
|||
|
/// <summary>
|
|||
|
/// 유효기간
|
|||
|
/// </summary>
|
|||
|
public string GetValid { get { return this.m_sValid; } }
|
|||
|
|
|||
|
private string m_sCardNm;
|
|||
|
/// <summary>
|
|||
|
/// 카드명
|
|||
|
/// </summary>
|
|||
|
public string GetCardNm { get { return this.m_sCardNm; } }
|
|||
|
|
|||
|
private string m_sAppNo;
|
|||
|
/// <summary>
|
|||
|
/// 승인번호
|
|||
|
/// </summary>
|
|||
|
public string GetAppNo { get { return this.m_sAppNo; } }
|
|||
|
|
|||
|
private string m_sInputFlag;
|
|||
|
/// <summary>
|
|||
|
/// 입력구분
|
|||
|
/// </summary>
|
|||
|
public string GetInputFlag { get { return this.m_sInputFlag; } }
|
|||
|
|
|||
|
private string m_sXcTrandID;
|
|||
|
/// <summary>
|
|||
|
/// 승인아이디(Void시 필요)
|
|||
|
/// </summary>
|
|||
|
public string GetXcTrandID { get { return this.m_sXcTrandID; } }
|
|||
|
|
|||
|
private string m_sMessage;
|
|||
|
/// <summary>
|
|||
|
/// 메세지
|
|||
|
/// </summary>
|
|||
|
public string GetMessage { get { return this.m_sMessage; } }
|
|||
|
|
|||
|
// ***************************************** //
|
|||
|
|
|||
|
|
|||
|
#endregion 변수 선언
|
|||
|
|
|||
|
#region 생성자 & 소멸자
|
|||
|
public frmXCharge()
|
|||
|
{
|
|||
|
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_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);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
private void frmXCharge_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();
|
|||
|
}
|
|||
|
|
|||
|
private void frmXCharge_FormClosing(object sender, FormClosingEventArgs e)
|
|||
|
{
|
|||
|
VariableClear();
|
|||
|
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 frmXCharge_Activated(object sender, EventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
private void frmXCharge_Deactivate(object sender, EventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
#endregion 생성자 & 소멸자
|
|||
|
|
|||
|
#region 폼 컨트롤 초기화
|
|||
|
/// <summary>
|
|||
|
/// 변수초기화
|
|||
|
/// </summary>
|
|||
|
private void InitControl()
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
FormManager.SetFormAllControlFont(this, m_cPosStatus.Base.FONT);
|
|||
|
FormManager.SetTextBoxGlobalInfo(this, m_cPosStatus.Global.m_stCultureMaster.nGroupingDigits, m_cPosStatus.Global.m_stCultureMaster.strGroupingSymbol
|
|||
|
, m_cPosStatus.Global.m_stCultureMaster.nDecimalDigits, m_cPosStatus.Global.m_stCultureMaster.strDecimalSymbol);
|
|||
|
FormManager.MovePopUpForm(this, false, m_cPosStatus.Sale.ScreenSizeUser);
|
|||
|
|
|||
|
m_sCardNo = "";
|
|||
|
m_sCardNm = "";
|
|||
|
m_sAppNo = "";
|
|||
|
m_sMessage = "";
|
|||
|
m_sXcTrandID = "";
|
|||
|
m_sInputFlag = "";
|
|||
|
m_sValid = "";
|
|||
|
|
|||
|
bShowResult = true;
|
|||
|
|
|||
|
tmrStart.Interval = 300;
|
|||
|
tmrStart.Enabled = 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);
|
|||
|
}
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 입력 변수 초기화
|
|||
|
/// </summary>
|
|||
|
private void VariableClear()
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
m_sOrgCardNo = "";
|
|||
|
m_sAppAmt = "";
|
|||
|
m_sOrgXcTrandID = "";
|
|||
|
}
|
|||
|
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 Control Event
|
|||
|
/// <summary>
|
|||
|
/// 타이머 이벤트
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void tmrStart_Tick(object sender, EventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
string sRet = UserCom.RST_ERR;
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
tmrStart.Enabled = false;
|
|||
|
|
|||
|
//객체 생성 유무 체크
|
|||
|
if (CreateXCTran() == false)
|
|||
|
{
|
|||
|
m_sMessage = "XCTransaction2.XChargeTransactionClass - Object creation error";
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
//승인, 반품 분개 처리
|
|||
|
if (m_sAppType == PosConst.XCHARGE.APPR) //승인
|
|||
|
{
|
|||
|
sRet = CreditCard_Purchase();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
sRet = CreditCard_void();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if (sRet == UserCom.RST_OK)
|
|||
|
this.DialogResult = DialogResult.OK;
|
|||
|
else
|
|||
|
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 User Method
|
|||
|
/// <summary>
|
|||
|
/// 승인 처리
|
|||
|
/// </summary>
|
|||
|
/// <param name="sAmt"></param>
|
|||
|
/// <param name="sReceipt"></param>
|
|||
|
/// <returns></returns>
|
|||
|
private string CreditCard_Purchase()
|
|||
|
{
|
|||
|
string sSwipe = string.Empty;
|
|||
|
string sTrack1 = string.Empty;
|
|||
|
string sTrack2 = string.Empty;
|
|||
|
string sCC = string.Empty;
|
|||
|
string sCCTypeName = string.Empty;
|
|||
|
string sExpirationMonth = string.Empty;
|
|||
|
string sExpirationYear = string.Empty;
|
|||
|
string sCardHolderName = string.Empty;
|
|||
|
string sZIP = string.Empty;
|
|||
|
string sAddress = string.Empty;
|
|||
|
string sCVV = string.Empty;
|
|||
|
|
|||
|
string sErrorMsg = string.Empty;
|
|||
|
string sApprovalCode = string.Empty;
|
|||
|
string sAVSResult = string.Empty;
|
|||
|
string sCVVResult = string.Empty;
|
|||
|
|
|||
|
string sXCTranIDResult = string.Empty;
|
|||
|
string sApprovedAmtResult = string.Empty;
|
|||
|
string sBalanceAmtResult = string.Empty;
|
|||
|
|
|||
|
string sRet = UserCom.RST_ERR;
|
|||
|
|
|||
|
//string sReceipt = STORECD + POSNO + FormatDateTime('DDHHNNSS',now); //5 + 1 + 8 : 14
|
|||
|
string sReceipt = CmUtil.MidH(m_cPosStatus.Base.StoreNo, 2, 5) + CmUtil.MidH(m_cPosStatus.Base.PosNo, 1, 1) + DateTime.Now.ToString("ddHHmmss"); //5 + 1 + 8 : 14
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
m_sTranFolder = GetXChargeTranFolder();
|
|||
|
|
|||
|
if (XCTran.PromptCreditCardEntryEx((int)this.Handle, "Credit Card Purchase Information"
|
|||
|
, false, false, false, false, false, false, false
|
|||
|
, ref sSwipe, ref sTrack1, ref sTrack2, ref sCC, ref sCCTypeName, ref sExpirationMonth
|
|||
|
, ref sExpirationYear, ref sCardHolderName, ref sZIP, ref sAddress, ref sCVV))
|
|||
|
{
|
|||
|
|
|||
|
m_sCardNo = sCC; //카드번호
|
|||
|
m_sCardNm = sCCTypeName; //카드명
|
|||
|
m_sInputFlag = sTrack2.Trim().Length > 20 ? PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_SWIP : PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_KEYIN;
|
|||
|
m_sValid = sExpirationYear + sExpirationMonth;
|
|||
|
|
|||
|
string sEntryEx = " XCTran.PromptCreditCardEntryEx : ";
|
|||
|
sEntryEx += "| Swipe : " + sSwipe;
|
|||
|
sEntryEx += "| Track1 : " + sTrack1;
|
|||
|
sEntryEx += "| Track2 : " + sTrack2;
|
|||
|
sEntryEx += "| CC : " + sCC;
|
|||
|
sEntryEx += "| CCTypeName : " + sCCTypeName;
|
|||
|
sEntryEx += "| ExpirationMonth : " + sExpirationMonth;
|
|||
|
sEntryEx += "| ExpirationYear : " + sExpirationYear;
|
|||
|
sEntryEx += "| CardHolderName : " + sCardHolderName;
|
|||
|
sEntryEx += "| ZIP : " + sZIP;
|
|||
|
sEntryEx += "| Address : " + sAddress;
|
|||
|
sEntryEx += "| CVV : " + sCVV;
|
|||
|
|
|||
|
UserLog.WriteLogFile(UserCom.LOG_DEBUG,
|
|||
|
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 (함수명))
|
|||
|
"<<PromptCreditCardEntryEx>> Successful UserMsg = " + sEntryEx);
|
|||
|
|
|||
|
//연습모드 설정!
|
|||
|
if (m_cPosStatus.Base.TrainingFlag == "1" || m_cPosStatus.Mst.TestStorYn == "1")
|
|||
|
{
|
|||
|
m_sAppNo = "9999999"; //승인번호
|
|||
|
m_sXcTrandID = "9999999"; //승인아이디
|
|||
|
return UserCom.RST_OK;
|
|||
|
}
|
|||
|
|
|||
|
if (XCTran.XCPurchaseEx2((int)this.Handle, TRAN_FOLDER, "Purchase"
|
|||
|
, true, bShowResult, m_cPosStatus.Base.CashierName, sReceipt, sCC, sExpirationMonth + sExpirationYear
|
|||
|
, sSwipe, m_sAppAmt, sZIP, sAddress, sCVV, "Default", "R", false, false, true
|
|||
|
, out sErrorMsg, out sApprovalCode, out sAVSResult, out sCVVResult, out sXCTranIDResult
|
|||
|
, out sApprovedAmtResult, out sBalanceAmtResult
|
|||
|
))
|
|||
|
{
|
|||
|
m_sAppNo = sApprovalCode; //승인번호
|
|||
|
m_sXcTrandID = sXCTranIDResult; //승인아이디
|
|||
|
|
|||
|
sRet = UserCom.RST_OK;
|
|||
|
|
|||
|
string sUserMsg = " XCTran.XCPurchase : \r\n ";
|
|||
|
sUserMsg += "\r\n ApprovalCode : " + sApprovalCode;
|
|||
|
sUserMsg += "\r\n Amount of Purchas : " + m_sAppAmt;
|
|||
|
sUserMsg += "\r\n Swipe : " + sSwipe;
|
|||
|
sUserMsg += "\r\n Track1 : " + sTrack1;
|
|||
|
sUserMsg += "\r\n Track2 : " + sTrack2;
|
|||
|
sUserMsg += "\r\n Receipt : " + sReceipt;
|
|||
|
sUserMsg += "\r\n CC : " + sCC;
|
|||
|
sUserMsg += "\r\n CCTypeName : " + sCCTypeName;
|
|||
|
sUserMsg += "\r\n ExpirationMonth : " + sExpirationMonth;
|
|||
|
sUserMsg += "\r\n ExpirationYear : " + sExpirationYear;
|
|||
|
sUserMsg += "\r\n CardHolderName : " + sCardHolderName;
|
|||
|
sUserMsg += "\r\n ZIP : " + sZIP;
|
|||
|
sUserMsg += "\r\n Address : " + sAddress;
|
|||
|
sUserMsg += "\r\n CVV : " + sCVV;
|
|||
|
sUserMsg += "\r\n ErrorMsg : " + sErrorMsg;
|
|||
|
sUserMsg += "\r\n AVSResult : " + sAVSResult;
|
|||
|
sUserMsg += "\r\n CVVResult : " + sCVVResult;
|
|||
|
sUserMsg += "\r\n XCTranID : " + sXCTranIDResult;
|
|||
|
|
|||
|
UserLog.WriteLogFile(UserCom.LOG_DEBUG,
|
|||
|
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 (함수명))
|
|||
|
"<<XCPurchaseEx2>> UserMsg = " + sUserMsg.Replace("\r\n", " | "));
|
|||
|
MessageBox.Show(sUserMsg);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
|
|||
|
if (bShowResult == false)
|
|||
|
m_sMessage = sErrorMsg; //메세지
|
|||
|
|
|||
|
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
|||
|
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 (함수명))
|
|||
|
"<<XCPurchaseEx2>> Unsuccessful - ErrorMsg : " + sErrorMsg);
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
|||
|
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 (함수명))
|
|||
|
"<<PromptCreditCardEntryEx>> Unsuccessful - Entery Error");
|
|||
|
}
|
|||
|
}
|
|||
|
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;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 반품 처리
|
|||
|
/// </summary>
|
|||
|
/// <param name="sAmt"></param>
|
|||
|
/// <param name="sCardNo"></param>
|
|||
|
/// <param name="sAppNo"></param>
|
|||
|
/// <returns></returns>
|
|||
|
private string CreditCard_void()
|
|||
|
{
|
|||
|
string sSwipe = string.Empty; // 카드를 읽어서 들어온 모든 문자열
|
|||
|
string sTrack1 = string.Empty; // 카드 track 1 데이타
|
|||
|
string sTrack2 = string.Empty; // 카드 track 2 데이타
|
|||
|
string sCC = string.Empty; // 카드 번호 16자리
|
|||
|
string sCCTypeName = string.Empty; // 카드이름(어느카드인가- visa....)
|
|||
|
string sExpirationMonth = string.Empty; // 유효기간(년-yy)
|
|||
|
string sExpirationYear = string.Empty; // 유효기간(월-mm)
|
|||
|
string sCardHolderName = string.Empty; // 카드소지자명
|
|||
|
string sZIP = string.Empty; // 사용한 우편번호
|
|||
|
string sAddress = string.Empty; // 사용한 주소지
|
|||
|
string sCVV = string.Empty; // 미국에서 카드 뒷면에 보면 카드 마다 번호가 있어서 그번호를 말한다.
|
|||
|
|
|||
|
string sErrorMsg = string.Empty; // 메세지
|
|||
|
string sApprovalCode = string.Empty; // 승인코드
|
|||
|
string sAVSResult = string.Empty; //
|
|||
|
string sCVVResult = string.Empty; //
|
|||
|
|
|||
|
string sXCTranIDResult = string.Empty; //
|
|||
|
string sApprovedAmtResult = string.Empty; //
|
|||
|
string sBalanceAmtResult = string.Empty; //
|
|||
|
|
|||
|
string sReceipt = CmUtil.MidH(m_cPosStatus.Base.StoreNo, 2, 5) + CmUtil.MidH(m_cPosStatus.Base.PosNo, 1, 1) + DateTime.Now.ToString("ddHHmmss"); //5 + 1 + 8 : 14
|
|||
|
|
|||
|
string sRet = UserCom.RST_ERR;
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
m_sTranFolder = GetXChargeTranFolder();
|
|||
|
|
|||
|
if (XCTran.PromptCreditCardEntryEx((int)this.Handle, "Credit Card void Information"
|
|||
|
, false, false, false, false, false, false, false
|
|||
|
, ref sSwipe, ref sTrack1, ref sTrack2, ref sCC, ref sCCTypeName, ref sExpirationMonth
|
|||
|
, ref sExpirationYear, ref sCardHolderName, ref sZIP, ref sAddress, ref sCVV))
|
|||
|
{
|
|||
|
|
|||
|
if (sCC.Replace("X", "").Trim() != m_sOrgCardNo.Replace("X", "").Trim())
|
|||
|
{
|
|||
|
//기존 승인 카드 번호와 비교 로직!
|
|||
|
m_sMessage = "This credit card is not match the record."; //메세지
|
|||
|
return sRet;
|
|||
|
}
|
|||
|
|
|||
|
m_sCardNo = sCC; //카드번호
|
|||
|
m_sValid = sExpirationYear + sExpirationMonth;
|
|||
|
m_sInputFlag = sTrack2.Trim().Length > 20 ? PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_SWIP : PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_KEYIN;
|
|||
|
m_sCardNm = sCCTypeName; //카드명
|
|||
|
|
|||
|
string sEntryEx = " XCTran.PromptCreditCardEntryEx : ";
|
|||
|
sEntryEx += "| Swipe : " + sSwipe;
|
|||
|
sEntryEx += "| Track1 : " + sTrack1;
|
|||
|
sEntryEx += "| Track2 : " + sTrack2;
|
|||
|
sEntryEx += "| CC : " + sCC;
|
|||
|
sEntryEx += "| CCTypeName : " + sCCTypeName;
|
|||
|
sEntryEx += "| ExpirationMonth : " + sExpirationMonth;
|
|||
|
sEntryEx += "| ExpirationYear : " + sExpirationYear;
|
|||
|
sEntryEx += "| CardHolderName : " + sCardHolderName;
|
|||
|
sEntryEx += "| ZIP : " + sZIP;
|
|||
|
sEntryEx += "| Address : " + sAddress;
|
|||
|
sEntryEx += "| CVV : " + sCVV;
|
|||
|
|
|||
|
UserLog.WriteLogFile(UserCom.LOG_DEBUG,
|
|||
|
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 (함수명))
|
|||
|
"<<PromptCreditCardEntryEx>> Successful UserMsg = " + sEntryEx);
|
|||
|
|
|||
|
//연습모드 설정!
|
|||
|
if (m_cPosStatus.Base.TrainingFlag == "1" || m_cPosStatus.Mst.TestStorYn == "1")
|
|||
|
{
|
|||
|
m_sAppNo = "9999999"; //승인번호
|
|||
|
m_sXcTrandID = "9999999"; //승인아이디
|
|||
|
return UserCom.RST_OK;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
if (XCTran.XCVoidEx((int)this.Handle // 1. hHandle
|
|||
|
, TRAN_FOLDER // 2. TranFolder
|
|||
|
, "Credit Card Void " // 3. TranCaption
|
|||
|
, true // 4. ShowStatusWindow
|
|||
|
, false // 5. ShowResult
|
|||
|
, m_cPosStatus.Base.CashierName // 6. Clerk
|
|||
|
, m_sReceipt // 7. ReceiptToVoid
|
|||
|
, sCC // 8. CC
|
|||
|
, sExpirationYear + sExpirationMonth // 9. Expiration
|
|||
|
, sSwipe //10. Swipe
|
|||
|
, m_sOrgXcTrandID //11. XCTranID -- 원승인아이디
|
|||
|
, m_sAppAmt //12. Amount
|
|||
|
, "Default" //13. MID
|
|||
|
, "R" //14. MarketType
|
|||
|
, out sErrorMsg //15. ErrorMsg
|
|||
|
, out sApprovalCode //16. ApprovalCode
|
|||
|
, out sXCTranIDResult //17. XCTranIDResult
|
|||
|
))
|
|||
|
{
|
|||
|
m_sAppNo = sApprovalCode; //승인번호
|
|||
|
m_sXcTrandID = sXCTranIDResult; //승인아이디
|
|||
|
|
|||
|
sRet = UserCom.RST_OK;
|
|||
|
|
|||
|
string sUserMsg = " XCTran.XCVoidEx : Completed \r\n ";
|
|||
|
sUserMsg += "\r\n ApprovalCode : " + sApprovalCode;
|
|||
|
sUserMsg += "\r\n Amount of Purchas : " + m_sAppAmt;
|
|||
|
sUserMsg += "\r\n Swipe : " + sSwipe;
|
|||
|
sUserMsg += "\r\n Track1 : " + sTrack1;
|
|||
|
sUserMsg += "\r\n Track2 : " + sTrack2;
|
|||
|
sUserMsg += "\r\n Receipt : " + sReceipt;
|
|||
|
sUserMsg += "\r\n CC : " + sCC;
|
|||
|
sUserMsg += "\r\n CCTypeName : " + sCCTypeName;
|
|||
|
sUserMsg += "\r\n ExpirationMonth : " + sExpirationMonth;
|
|||
|
sUserMsg += "\r\n ExpirationYear : " + sExpirationYear;
|
|||
|
sUserMsg += "\r\n CardHolderName : " + sCardHolderName;
|
|||
|
sUserMsg += "\r\n ZIP : " + sZIP;
|
|||
|
sUserMsg += "\r\n Address : " + sAddress;
|
|||
|
sUserMsg += "\r\n CVV : " + sCVV;
|
|||
|
sUserMsg += "\r\n ErrorMsg : " + sErrorMsg;
|
|||
|
sUserMsg += "\r\n AVSResult : " + sAVSResult;
|
|||
|
sUserMsg += "\r\n CVVResult : " + sCVVResult;
|
|||
|
sUserMsg += "\r\n XCTranID : " + sXCTranIDResult;
|
|||
|
|
|||
|
UserLog.WriteLogFile(UserCom.LOG_DEBUG,
|
|||
|
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 (함수명))
|
|||
|
"<<PromptCreditCardEntryEx>> Successful UserMsg = " + sUserMsg.Replace("\r\n", " | "));
|
|||
|
MessageBox.Show(sUserMsg);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
|||
|
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 (함수명))
|
|||
|
"<<XCVoidEx>> Unsuccessful = sErrorMsg : " + sErrorMsg + " / sApprovalCode : " + sApprovalCode + " / sXCTranIDResult : " + sXCTranIDResult);
|
|||
|
|
|||
|
sErrorMsg = ""; sApprovalCode = ""; sXCTranIDResult = "";
|
|||
|
|
|||
|
if (XCTran.XCReturnEx((int)this.Handle // 1. hHandle
|
|||
|
, TRAN_FOLDER // 2. TranFolder
|
|||
|
, "Credit Card Void " // 3. TranCaption
|
|||
|
, true // 4. ShowStatusWindow
|
|||
|
, bShowResult // 5. ShowResult
|
|||
|
, m_cPosStatus.Base.CashierName // 6. Clerk
|
|||
|
, sReceipt // 7. Receipt
|
|||
|
, sCC // 8. CC
|
|||
|
, sExpirationYear + sExpirationMonth // 9. Exp
|
|||
|
, sSwipe //10. Swipe
|
|||
|
, m_sAppAmt //11. Amount
|
|||
|
, "Default" //12. MID
|
|||
|
, "R" //13. MarketType
|
|||
|
, false //14. AllowDuplicate
|
|||
|
, out sErrorMsg //15. ErrorMsg
|
|||
|
, out sApprovalCode //16. ApprovalCode
|
|||
|
, out sXCTranIDResult)) //17. XCTranIDResult
|
|||
|
{
|
|||
|
m_sAppNo = sApprovalCode; //승인번호
|
|||
|
m_sXcTrandID = sXCTranIDResult; //승인아이디
|
|||
|
m_sReceipt = sReceipt;
|
|||
|
|
|||
|
sRet = UserCom.RST_OK;
|
|||
|
|
|||
|
string sUserMsg = " XCTran.XCReturnEX : Completed \r\n ";
|
|||
|
sUserMsg += "\r\n ApprovalCode : " + sApprovalCode;
|
|||
|
sUserMsg += "\r\n Amount of Purchas : " + m_sAppAmt;
|
|||
|
sUserMsg += "\r\n Swipe : " + sSwipe;
|
|||
|
sUserMsg += "\r\n Track1 : " + sTrack1;
|
|||
|
sUserMsg += "\r\n Track2 : " + sTrack2;
|
|||
|
sUserMsg += "\r\n Receipt : " + sReceipt;
|
|||
|
sUserMsg += "\r\n CC : " + sCC;
|
|||
|
sUserMsg += "\r\n CCTypeName : " + sCCTypeName;
|
|||
|
sUserMsg += "\r\n ExpirationMonth : " + sExpirationMonth;
|
|||
|
sUserMsg += "\r\n ExpirationYear : " + sExpirationYear;
|
|||
|
sUserMsg += "\r\n CardHolderName : " + sCardHolderName;
|
|||
|
sUserMsg += "\r\n ZIP : " + sZIP;
|
|||
|
sUserMsg += "\r\n Address : " + sAddress;
|
|||
|
sUserMsg += "\r\n CVV : " + sCVV;
|
|||
|
sUserMsg += "\r\n ErrorMsg : " + sErrorMsg;
|
|||
|
sUserMsg += "\r\n AVSResult : " + sAVSResult;
|
|||
|
sUserMsg += "\r\n CVVResult : " + sCVVResult;
|
|||
|
sUserMsg += "\r\n XCTranID : " + sXCTranIDResult;
|
|||
|
|
|||
|
UserLog.WriteLogFile(UserCom.LOG_DEBUG,
|
|||
|
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 (함수명))
|
|||
|
"<<XCReturnEx>> Successful UserMsg = " + sUserMsg.Replace("\r\n", " | "));
|
|||
|
MessageBox.Show(sUserMsg);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (bShowResult == false)
|
|||
|
m_sMessage = sErrorMsg;
|
|||
|
|
|||
|
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
|||
|
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 (함수명))
|
|||
|
"<<XCReturnEx>> Unsuccessful = sErrorMsg : " + sErrorMsg + "/ sApprovalCode : " + sApprovalCode + "/ sXCTranIDResult : " + sXCTranIDResult);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
|||
|
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 (함수명))
|
|||
|
"<<PromptCreditCardEntryEx>> Unsuccessful - Entery Error");
|
|||
|
}
|
|||
|
}
|
|||
|
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;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 객체 생성
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
private bool CreateXCTran()
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
if (XCTran == null)
|
|||
|
XCTran = new XCTransaction2.XChargeTransactionClass();
|
|||
|
|
|||
|
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;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 폴더 체크
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
private string GetXChargeTranFolder()
|
|||
|
{
|
|||
|
|
|||
|
string sRet = "";
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
//레지스트리 읽기
|
|||
|
sRet = CmUtil.GetRegistryString(@"HKEY_LOCAL_MACHINE\", @"SOFTWARE\X-Charge", "InstallDir");
|
|||
|
|
|||
|
if (string.IsNullOrEmpty(sRet) == true)
|
|||
|
{
|
|||
|
|
|||
|
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
|||
|
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 (함수명))
|
|||
|
"Registry not found! ### Set Application Path ###");
|
|||
|
|
|||
|
//없으면 실행파일 실행파일 위치에 폴더 셋팅
|
|||
|
sRet = Application.StartupPath + "\\LocalTran";
|
|||
|
}
|
|||
|
|
|||
|
//폴더 만들기
|
|||
|
if (sRet != "") CmUtil.MakeDir(sRet);
|
|||
|
|
|||
|
}
|
|||
|
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 User Method
|
|||
|
|
|||
|
#region DeviceEvent 관련
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|