spc-kiosk-pb/Service/BsvPayment/CashBill.cs

892 lines
45 KiB
C#
Raw Normal View History

2019-06-16 05:12:09 +00:00
using System;
using System.Collections;
//using System.Windows.Forms;
using Cosmos.UserFrame;
using Cosmos.ServiceProvider;
using Cosmos.Common;
using Cosmos.CommonManager;
using System.Text;
/*-----------------------------------------------------------------------------------------------*/
// 설 명 : 현금영수증
// 작 성 자 :
// 변경 이력 :
/*-----------------------------------------------------------------------------------------------*/
namespace Cosmos.Service
{
class CashBill : PaymentBase, IPaymentUs
{
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 IDataProcessUs m_cDataSrv = null; // 거래데이터 합계금액 계산 및 관리
private IDataCommonUs m_cDataCommon = null; // POS 공통함수 인터페이스
/// <summary>
/// 현재 등록중인 결제 정보
/// </summary>
private Column.TR_ETC.DATA m_cEtcItem = new Column.TR_ETC.DATA();
public CashBill()
{
m_cPosStatus = (PosStatus)StateObject.POS; // POS 기본정보
m_cTrnStatus = (TranStatus)StateObject.TRAN; // POS 거래정보
m_cDevStatus = (DeviceStatus)StateObject.DEVICE;
m_cDataSrv = (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);
}
#region
/// <summary>
/// 결제 조회
/// </summary>
/// <param name="aParam"></param>
/// <param name="aRet"></param>
/// <returns></returns>
public string SearchPayment(string[] aParam, ref string[] aRet)
{
throw new NotImplementedException();
}
#endregion
#region
/// <summary>
/// 결제 정보 획득
/// </summary>
/// <param name="aParam"></param>
/// <returns></returns>
public object GetPayment(string[] aParam)
{
try
{
return m_cEtcItem;
}
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 null;
}
#endregion
#region
/// <summary>
/// 결제 등록
/// </summary>
/// <param name="aParam">현금 결제금액(0), 현금,수표구분(1)</param>
/// <returns></returns>
public string SetPayment(string[] aParam)
{
string sRet = UserCom.RST_ERR;
try
{
m_cEtcItem = new Column.TR_ETC.DATA(); // 결과 저장 변수 생성
m_cEtcItem.ETC_WAY_CD = ItemConst.TR_ITEM_ID.ETC_INFO_ITEM;
m_cEtcItem.ETC_DTL_CD_01 = ItemConst.TR_ITEM_ID.ETC_INFO.CASHBILL;
if (aParam.Length > 0 && aParam[0] == PosConst.POS_CAT_MASTER.TRAN_TYPE) //단말기승인
{
// 0.전문구분,1.거래유형, 2.할부개월, 3.승인금액 , 4.봉사료, 5.세금, 6.원승인번호, 7.원거래일자, 8.포인트거래구분, 9.상품코드,
//10.전표인쇄여부, 11.추가항목, 12.제휴할인코드, 13.제휴할인금액, 14.예비1, 15.예비2
sRet = CatExecuteIrt(aParam[1], aParam);
}
else
{
sRet = ExecuteIrt(PosConst.POS_VAN_MASTER.TRADE_ID.VAN_CASH_AGREE, aParam);
}
if (sRet != UserCom.RST_OK) return sRet;
// 결제 아이템 추가
ArrayList alEtcItem = (ArrayList)StateObject.GetItemObject(Column.TR_ETC.ITEM); // 결제 내역 받아 오기
m_cEtcItem.SEQ = alEtcItem.Count + 1;
alEtcItem.Add(m_cEtcItem);
}
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 aParam);
//////////////////////////////////////////////////////////////////////////////////
}
return sRet;
}
#endregion
#region
/// <summary>
/// 결제 취소
/// </summary>
/// <param name="aParam"></param>
/// <returns></returns>
public string CancelPayment(string[] aParam)
{
throw new NotImplementedException();
}
#endregion
#region
/// <summary>
/// 결제 반품
/// </summary>
/// <param name="aParam"></param>
/// <returns></returns>
public string RefundPayment(string[] aParam)
{
string sRet = UserCom.RST_ERR;
string sRecvdData = "";
string sSendData = string.Empty;
try
{
//#20180410 인천공항 반품 시 원승인번호,원거래일자 저장 start,phj
//기존
//#20171227 인천공항 포스연동 start, phj
if (PosMstManager.GetPosOption(POS_OPTION.OPT512) == "1")
{
sRet = UserCom.RST_OK;
return sRet;
}
//#20171227 인천공항 포스연동 end, phj
//#20180410 인천공항 반품 시 원승인번호,원거래일자 저장 end,phj
// 취소할 행번호
int nPayRow = CmUtil.IntParse(aParam[0]);
//결제 내역 받아 오기
ArrayList alEtcItem = (ArrayList)StateObject.GetItemObject(Column.TR_ETC.ITEM);
m_cEtcItem = (Column.TR_ETC.DATA)alEtcItem[nPayRow];
string[] m_aParam = new string[17];
if (m_cEtcItem.OCCUR_ENTRY_08.ToString() == ItemConst.PAY_APP_DIV.CAT_TERMINAL)
{
//InParam
// 0.전문구분,1.거래유형, 2.할부개월, 3.승인금액 , 4.봉사료, 5.세금, 6.원승인번호, 7.원거래일자, 8.포인트거래구분, 9.상품코드,
//10.전표인쇄여부, 11.추가항목, 12.제휴할인코드, 13.제휴할인금액, 14.예비1, 15.예비2
string aAppType = "";
if (m_cEtcItem.OCCUR_ENTRY_10 == "1")
{
aAppType = "02";
}
else
{
aAppType = m_cEtcItem.OCCUR_ENTRY_11.PadLeft(2, '0');
}
m_aParam[0] = PosConst.POS_CAT_MASTER.TRAN_TYPE;
m_aParam[1] = PosConst.POS_CAT_MASTER.TRADE_ID.CAT_CASH_CANCEL;
m_aParam[2] = aAppType;
m_aParam[3] = m_cEtcItem.ETC_AMT.ToString();
m_aParam[4] = m_cEtcItem.AMT_ENTRY_04.ToString(); //봉사료
m_aParam[5] = m_cEtcItem.AMT_ENTRY_03.ToString(); //세금
m_aParam[6] = m_cEtcItem.OCCUR_ENTRY_02;
m_aParam[7] = m_cEtcItem.OCCUR_ENTRY_03;
m_aParam[8] = "";
m_aParam[9] = "";
m_aParam[10] = "";
m_aParam[11] = "";
m_aParam[12] = "";
m_aParam[13] = "";
m_aParam[14] = "";
m_aParam[15] = "";
sRet = CatExecuteIrt(PosConst.POS_CAT_MASTER.TRADE_ID.CAT_CASH_CANCEL, m_aParam);
if (sRet != UserCom.RST_OK) return sRet;
}
else
{
//강제 승인일 경우!
if (m_cEtcItem.OCCUR_ENTRY_08 != ItemConst.PAY_APP_DIV.NORMAL) return UserCom.RST_OK;
string sEncData = m_cEtcItem.CanFiller1;
//if (m_cDevStatus.ICReader.UseYn != true) // 여전법 인증여부(0:MSR, 1:IC)
//{
// // MSR
// m_cEtcItem.OCCUR_ENTRY_05 = CmUtil.MidH(m_cEtcItem.CanFiller1, 1, 1).Trim();
// sEncData = CmUtil.MidH(m_cEtcItem.CanFiller1, 2, 512).Trim();
//}
//if (cEtcItem.OCCUR_ENTRY_05 == "K")
//{
// m_aParam[1] = sEncData;
//}
//else
//{
// m_aParam[1] = CmUtil.MidH(sEncData, 6, 512).Trim();
//}
m_aParam[0] = m_cEtcItem.OCCUR_ENTRY_05.ToString();
m_aParam[1] = sEncData;
m_aParam[2] = m_cEtcItem.AMT_ENTRY_02.ToString();
m_aParam[3] = m_cEtcItem.AMT_ENTRY_03.ToString();
m_aParam[4] = m_cEtcItem.AMT_ENTRY_04.ToString();
m_aParam[5] = m_cEtcItem.AMT_ENTRY_01.ToString();
m_aParam[6] = m_cEtcItem.OCCUR_ENTRY_11.ToString();
m_aParam[7] = m_cEtcItem.OCCUR_ENTRY_09.ToString();
m_aParam[8] = "";
m_aParam[9] = "";
m_aParam[10] = "";
m_aParam[11] = "";
m_aParam[12] = "";
m_aParam[13] = "";
m_aParam[14] = m_cEtcItem.OCCUR_ENTRY_02.ToString();
m_aParam[15] = "";
m_aParam[16] = m_cEtcItem.OCCUR_ENTRY_03.ToString();
sRet = ExecuteIrt(PosConst.POS_VAN_MASTER.TRADE_ID.VAN_CASH_CANCEL, m_aParam);
if (sRet != UserCom.RST_OK)
{
WinManager.ErrorMessage(sRet);
return sRet;
}
}
sRet = UserCom.RST_OK;
}
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 aParam);
//////////////////////////////////////////////////////////////////////////////////
}
return sRet;
}
#endregion
#region ()
/// <summary>
/// 결제 수기 등록(임의등록)
/// </summary>
/// <param name="aParam"></param>
/// <returns></returns>
public string SetMenualPayment(string[] aParam)
{
throw new NotImplementedException();
}
#endregion ()
#region
/// <summary>
/// 전문 바디 생성
/// </summary>
/// <param name="aParam"></param>
/// <returns></returns>
private string MakeCashBillBody(string sAppType, string[] aParam)
{
string sSendData = string.Empty;
try
{
if (sAppType == PosConst.POS_VAN_MASTER.TRADE_ID.VAN_CASH_AGREE)
{
string[] aIrtBody = new string[Column.POS_REQ_CASHBILL.LEN.Length];
if (m_cDevStatus.ICReader.UseYn == true) // 여신전문금융업법 적용여부 체크
aIrtBody[Column.POS_REQ_CASHBILL.SEQ.DocVer] = PosConst.POS_VAN_MASTER.IRT_VERSION_02;
aIrtBody[Column.POS_REQ_CASHBILL.SEQ.TrandKind] = PosConst.POS_VAN_MASTER.CASHBILL_DIV_ONLY;
aIrtBody[Column.POS_REQ_CASHBILL.SEQ.EntryMode] = aParam[0];
if (m_cDevStatus.ICReader.UseYn == true) // 여신전문금융업법 적용여부 체크
aIrtBody[Column.POS_REQ_CASHBILL.SEQ.CustmerInfo] = aParam[1];
else
aIrtBody[Column.POS_REQ_CASHBILL.SEQ.CustmerInfo] = CmUtil.MidH(aParam[1], 0, 37);
aIrtBody[Column.POS_REQ_CASHBILL.SEQ.CustmerInfoFs] = PosConst.VAN_HEXA.FS;
aIrtBody[Column.POS_REQ_CASHBILL.SEQ.NetSaleAmt] = aParam[2];
aIrtBody[Column.POS_REQ_CASHBILL.SEQ.Vat] = aParam[3];
aIrtBody[Column.POS_REQ_CASHBILL.SEQ.ServiceAmt] = aParam[4];
aIrtBody[Column.POS_REQ_CASHBILL.SEQ.TotAmt] = aParam[5];
aIrtBody[Column.POS_REQ_CASHBILL.SEQ.TradDiv] = aParam[6];
aIrtBody[Column.POS_REQ_CASHBILL.SEQ.PointEntryMode] = aParam[8];
if (m_cDevStatus.ICReader.UseYn == true) // 여신전문금융업법 적용여부 체크
aIrtBody[Column.POS_REQ_CASHBILL.SEQ.PointTrackII] = aParam[9];
else
aIrtBody[Column.POS_REQ_CASHBILL.SEQ.PointTrackII] = CmUtil.MidH(aParam[9], 0, 37);
aIrtBody[Column.POS_REQ_CASHBILL.SEQ.PointTrackIIFS] = PosConst.VAN_HEXA.FS;
aIrtBody[Column.POS_REQ_CASHBILL.SEQ.ItemCode] = aParam[10];
aIrtBody[Column.POS_REQ_CASHBILL.SEQ.StoreUserID] = aParam[11];
aIrtBody[Column.POS_REQ_CASHBILL.SEQ.StoreUseFild] = aParam[12];
aIrtBody[Column.POS_REQ_CASHBILL.SEQ.Filler] = aParam[13];
aIrtBody[Column.POS_REQ_CASHBILL.SEQ.ETX] = PosConst.VAN_HEXA.ETX;
aIrtBody[Column.POS_REQ_CASHBILL.SEQ.CR] = PosConst.VAN_HEXA.CR;
// 수표 조회 요청 전문 생성
sSendData = ItemColumn.MakeMessage(aIrtBody, Column.POS_REQ_CASHBILL.LEN, Column.POS_REQ_CASHBILL.TYPE);
}
else
{
string[] aIrtBody = new string[Column.POS_REQ_CASHBILL_CANCEL.LEN.Length];
if (m_cDevStatus.ICReader.UseYn == true) // 여신전문금융업법 적용여부 체크
aIrtBody[Column.POS_REQ_CASHBILL_CANCEL.SEQ.DocVer] = PosConst.POS_VAN_MASTER.IRT_VERSION_02;
aIrtBody[Column.POS_REQ_CASHBILL_CANCEL.SEQ.TrandKind] = PosConst.POS_VAN_MASTER.CASHBILL_DIV_ONLY;
aIrtBody[Column.POS_REQ_CASHBILL_CANCEL.SEQ.EntryMode] = aParam[0];
if (m_cDevStatus.ICReader.UseYn == true) // 여신전문금융업법 적용여부 체크
aIrtBody[Column.POS_REQ_CASHBILL_CANCEL.SEQ.CustmerInfo] = aParam[1];
else
aIrtBody[Column.POS_REQ_CASHBILL_CANCEL.SEQ.CustmerInfo] = CmUtil.MidH(aParam[1], 0, 37);
aIrtBody[Column.POS_REQ_CASHBILL_CANCEL.SEQ.CustmerInfoFs] = PosConst.VAN_HEXA.FS;
aIrtBody[Column.POS_REQ_CASHBILL_CANCEL.SEQ.NetSaleAmt] = aParam[2];
aIrtBody[Column.POS_REQ_CASHBILL_CANCEL.SEQ.Vat] = aParam[3];
aIrtBody[Column.POS_REQ_CASHBILL_CANCEL.SEQ.ServiceAmt] = aParam[4];
aIrtBody[Column.POS_REQ_CASHBILL_CANCEL.SEQ.TotAmt] = aParam[5];
aIrtBody[Column.POS_REQ_CASHBILL_CANCEL.SEQ.TradDiv] = aParam[6];
aIrtBody[Column.POS_REQ_CASHBILL_CANCEL.SEQ.OrgAppNo] = aParam[14];
aIrtBody[Column.POS_REQ_CASHBILL_CANCEL.SEQ.OrgAppNoPoint] = aParam[15];
aIrtBody[Column.POS_REQ_CASHBILL_CANCEL.SEQ.OrgAppDate] = aParam[16];
aIrtBody[Column.POS_REQ_CASHBILL_CANCEL.SEQ.PointEntryMode] = aParam[8];
if (m_cDevStatus.ICReader.UseYn == true) // 여신전문금융업법 적용여부 체크
aIrtBody[Column.POS_REQ_CASHBILL_CANCEL.SEQ.PointTrackII] = aParam[9];
else
aIrtBody[Column.POS_REQ_CASHBILL_CANCEL.SEQ.PointTrackII] = CmUtil.MidH(aParam[9], 0, 37);
aIrtBody[Column.POS_REQ_CASHBILL_CANCEL.SEQ.PointTrackIIFS] = PosConst.VAN_HEXA.FS;
aIrtBody[Column.POS_REQ_CASHBILL_CANCEL.SEQ.ItemCode] = aParam[10];
aIrtBody[Column.POS_REQ_CASHBILL_CANCEL.SEQ.StoreUserID] = aParam[11];
aIrtBody[Column.POS_REQ_CASHBILL_CANCEL.SEQ.StoreUseFild] = aParam[12];
aIrtBody[Column.POS_REQ_CASHBILL_CANCEL.SEQ.CancelReasonCode] = "1";
aIrtBody[Column.POS_REQ_CASHBILL_CANCEL.SEQ.Filler] = aParam[13];
aIrtBody[Column.POS_REQ_CASHBILL_CANCEL.SEQ.ETX] = PosConst.VAN_HEXA.ETX;
aIrtBody[Column.POS_REQ_CASHBILL_CANCEL.SEQ.CR] = PosConst.VAN_HEXA.CR;
// 수표 조회 요청 전문 생성
sSendData = ItemColumn.MakeMessage(aIrtBody, Column.POS_REQ_CASHBILL_CANCEL.LEN, Column.POS_REQ_CASHBILL_CANCEL.TYPE);
}
}
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 sSendData;
}
#endregion
#region
/// <summary>
/// 조회 실행
/// </summary>
/// <param name="sAppType"></param>
/// <param name="aParam"></param>
/// <returns></returns>
public string ExecuteIrt(string sAppType, string[] aParam)
{
string sRet = UserCom.RST_ERR;
string[] aIrtDTLRsp = null;
try
{
// 연습모드이면 연습 데이터 설정
if (m_cPosStatus.Base.TrainingFlag == "1" || m_cPosStatus.Mst.TestStorYn == "1") return SetTrainingData(sAppType, aParam);
string sRecvData = "";
string sSendData = string.Empty;
sSendData = MakeCashBillBody(sAppType, aParam);
// 가맹점 정보 획득(회사승인ID,점포승인ID)
string sCmpApprID = PosMstManager.GetMstVan(ItemConst.TR_ITEM_ID.ETC_INFO_ITEM, ItemConst.TR_ITEM_ID.ETC_INFO.CASHBILL, PosMst.MST_VAN.DATA.CMP_APPR_ID);
string sApprID = PosMstManager.GetMstVan(ItemConst.TR_ITEM_ID.ETC_INFO_ITEM, ItemConst.TR_ITEM_ID.ETC_INFO.CASHBILL, PosMst.MST_VAN.DATA.APPR_ID);
// 승인 전문 헤더 생성
sSendData = m_cDataCommon.MakeCreditCardHeader(sAppType, sSendData.Length, sCmpApprID, sApprID) + sSendData;
string sVanCD = GetPayDtlCdToVanCode(m_cEtcItem.ETC_WAY_CD, m_cEtcItem.ETC_DTL_CD_01); // 승인업체 코드 조회
if (sVanCD == "")
{
//WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0563);
//return sRet;
return POS_MESSAGE.ERROR.MSG_0563;
}
// 승인데이터 중 카드번호 마스킹 처리(2017.05.25)
string sWriteSendData = CmUtil.MakeLogDataToMask(m_cDevStatus.ICReader.UseYn, aParam[1], sSendData);
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
"[SEND:" + sWriteSendData);
// 요청 - 승인로그 저장 (판매구분, [0]결제수단, [1]결제상세코드, [2]전문구분, [3]요청구분, [4]카드번호, [5]결제금액, [6]승인번호, [7]승인일자, [8]승인시간, [9]응답상태값, [10]응답메시지, [11]전문)
m_cDataCommon.SetSaleApprLog("0", new string[] { m_cEtcItem.ETC_WAY_CD, m_cEtcItem.ETC_DTL_CD_01, sAppType, "S", aParam[14], CmUtil.DoubleParse(aParam[4]).ToString(), "", "", "", "", "", sWriteSendData });
//전문전송
string sIrtRet = m_cDataCommon.ExecuteCardIrt(sAppType, sSendData, ref sRecvData, true, "");
if (sIrtRet != UserCom.RST_OK)
{
return sRet + sIrtRet.ToString();
}
byte[] bytes = Encoding.Default.GetBytes(sRecvData);
int nNowPos = 0;
string sRetCD = "";
if (m_cDevStatus.ICReader.UseYn == true) // 여신전문금융업법 적용여부 체크
{
aIrtDTLRsp = new string[Column.POS_RES_CASHBILL.LEN.Length];
ItemColumn.ParseMessage(Column.POS_RES_CASHBILL.LEN, Column.POS_RES_CASHBILL.TYPE, bytes, ref nNowPos, ref aIrtDTLRsp);
sRetCD = aIrtDTLRsp[Column.POS_RES_CASHBILL.SEQ.Status];
// 승인데이터 중 카드번호 마스킹 처리(2017.05.25)
string sWriteRecvData = CmUtil.MakeLogDataToMask(m_cDevStatus.ICReader.UseYn, aParam[1], sRecvData);
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
"[RECV:" + sWriteRecvData);
// 응답 - 승인로그 저장 (판매구분, [0]결제수단, [1]결제상세코드, [2]전문구분, [3]요청구분, [4]카드번호, [5]결제금액, [6]승인번호, [7]승인일자, [8]승인시간, [9]응답상태값, [10]응답메시지, [11]전문)
m_cDataCommon.SetSaleApprLog("0", new string[] { m_cEtcItem.ETC_WAY_CD, m_cEtcItem.ETC_DTL_CD_01, sAppType, "R"
, aParam[14], CmUtil.DoubleParse(aParam[4]).ToString()
, aIrtDTLRsp[Column.POS_RES_CASHBILL.SEQ.CashAppNo], CmUtil.MidH(aIrtDTLRsp[Column.POS_RES_CASHBILL.SEQ.AppDatatime], 0, 6), CmUtil.MidH(aIrtDTLRsp[Column.POS_RES_CASHBILL.SEQ.AppDatatime], 6, 4)
, aIrtDTLRsp[Column.POS_RES_CASHBILL.SEQ.Status].Trim()
, aIrtDTLRsp[Column.POS_RES_CASHBILL.SEQ.Message1].Trim() + aIrtDTLRsp[Column.POS_RES_CASHBILL.SEQ.Message2].Trim()
, sWriteRecvData });
}
else
{
aIrtDTLRsp = new string[Column.POS_RES_CASHBILL_MSR.LEN.Length];
ItemColumn.ParseMessage(Column.POS_RES_CASHBILL_MSR.LEN, Column.POS_RES_CASHBILL_MSR.TYPE, bytes, ref nNowPos, ref aIrtDTLRsp);
sRetCD = aIrtDTLRsp[Column.POS_RES_CASHBILL_MSR.SEQ.Status];
// 승인데이터 중 카드번호 마스킹 처리(2017.05.25)
string sWriteRecvData = CmUtil.MakeLogDataToMask(m_cDevStatus.ICReader.UseYn, aParam[1], sRecvData);
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
"[RECV:" + sWriteRecvData);
// 응답 - 승인로그 저장 (판매구분, [0]결제수단, [1]결제상세코드, [2]전문구분, [3]요청구분, [4]카드번호, [5]결제금액, [6]승인번호, [7]승인일자, [8]승인시간, [9]응답상태값, [10]응답메시지, [11]전문)
m_cDataCommon.SetSaleApprLog("0", new string[] { m_cEtcItem.ETC_WAY_CD, m_cEtcItem.ETC_DTL_CD_01, sAppType, "R"
, aParam[14], CmUtil.DoubleParse(aParam[4]).ToString()
, aIrtDTLRsp[Column.POS_RES_CASHBILL_MSR.SEQ.CashAppNo], CmUtil.MidH(aIrtDTLRsp[Column.POS_RES_CASHBILL_MSR.SEQ.AppDatatime], 0, 6), CmUtil.MidH(aIrtDTLRsp[Column.POS_RES_CASHBILL_MSR.SEQ.AppDatatime], 6, 4)
, aIrtDTLRsp[Column.POS_RES_CASHBILL_MSR.SEQ.Status].Trim()
, aIrtDTLRsp[Column.POS_RES_CASHBILL_MSR.SEQ.Message1].Trim() + aIrtDTLRsp[Column.POS_RES_CASHBILL_MSR.SEQ.Message2].Trim()
, sWriteRecvData });
}
if (sRetCD == "O")
{
//#20180426 현금영수증 마스킹 변경 및 영수증 문구 변경 start
string sMaskCardNo = aParam[14];
//소득공제
if (aParam[6] == "0")
{
//실물카드(1544 2020 **** 123456 (앞 8자리 이후 4개))
if (sMaskCardNo.Length == 19)
{
sMaskCardNo = sMaskCardNo.Substring( 0,18);
sMaskCardNo = CmUtil.LeftH(sMaskCardNo, 8) + "****" + CmUtil.RightH(sMaskCardNo, 6);
}
//휴대폰번호 10자리(011***1234 (앞 3자리 이후 3개)
else if (sMaskCardNo.Length == 10)
{
sMaskCardNo = CmUtil.LeftH(sMaskCardNo, 3) + "***" + CmUtil.RightH(sMaskCardNo, 4);
}
//휴대폰번호 11자리010****4567 (앞 3자리 이후 4개)
else if (sMaskCardNo.Length == 11)
{
sMaskCardNo = CmUtil.LeftH(sMaskCardNo, 3) + "****" + CmUtil.RightH(sMaskCardNo, 4);
}
//이외(710011******* (앞 6자리 이후))
else
{
sMaskCardNo = CmUtil.MidH(sMaskCardNo, 0, 6) + new string('*', sMaskCardNo.Length - 6);
}
}
//지출증빙
else if (aParam[6] == "1")
{
//사업자등록번호(12****1234 (앞 2자리 이후 4개))
if (sMaskCardNo.Length == 10)
{
sMaskCardNo = CmUtil.LeftH(sMaskCardNo, 2) + "****" + CmUtil.RightH(sMaskCardNo, 4);
}
//이외(710011******* (앞 6자리 이후))
else
{
sMaskCardNo = CmUtil.MidH(sMaskCardNo, 0, 6) + new string('*', sMaskCardNo.Length - 6);
}
}
//#20180426 현금영수증 마스킹 변경 및 영수증 문구 변경 end
//ArrayList aEtcItem = (ArrayList)StateObject.GetItemObject(Column.TR_ETC.ITEM);
//m_cEtcItem.ETC_WAY_CD = ItemConst.TR_ITEM_ID.ETC_INFO_ITEM;
//m_cEtcItem.ETC_DTL_CD_01 = ItemConst.TR_ITEM_ID.ETC_INFO.CASHBILL;
m_cEtcItem.ETC_AMT = CmUtil.DoubleParse(aParam[5]);
m_cEtcItem.QTY_ENTRY_01 = 0;
m_cEtcItem.QTY_ENTRY_02 = 0;
m_cEtcItem.QTY_ENTRY_03 = 0;
m_cEtcItem.QTY_ENTRY_04 = 0;
m_cEtcItem.QTY_ENTRY_05 = 0;
m_cEtcItem.AMT_ENTRY_01 = CmUtil.DoubleParse(aParam[5]); //TOT AMT
m_cEtcItem.AMT_ENTRY_02 = CmUtil.DoubleParse(aParam[2]); //NET SALE
m_cEtcItem.AMT_ENTRY_03 = CmUtil.DoubleParse(aParam[3]); //VAT
m_cEtcItem.AMT_ENTRY_04 = CmUtil.DoubleParse(aParam[4]); //SERVICE
m_cEtcItem.AMT_ENTRY_05 = 0;
m_cEtcItem.AMT_ENTRY_06 = 0;
m_cEtcItem.AMT_ENTRY_07 = 0;
m_cEtcItem.AMT_ENTRY_08 = 0;
m_cEtcItem.AMT_ENTRY_09 = 0;
m_cEtcItem.AMT_ENTRY_10 = 0;
if (sAppType == PosConst.POS_VAN_MASTER.TRADE_ID.VAN_CASH_AGREE)
{
//#20180426 현금영수증 마스킹 변경 및 영수증 문구 변경 start
//기존
//m_cEtcItem.OCCUR_ENTRY_01 = aParam[14]; //사용자정보
//변경
m_cEtcItem.OCCUR_ENTRY_01 = sMaskCardNo; //사용자정보
//#20180426 현금영수증 마스킹 변경 및 영수증 문구 변경 end
m_cEtcItem.OCCUR_ENTRY_06 = "";
m_cEtcItem.OCCUR_ENTRY_07 = "";
m_cEtcItem.OCCUR_ENTRY_10 = aParam[15]; //자진발급구분(0:일반, 1:자진발금)
}
else
{
m_cEtcItem.OCCUR_ENTRY_06 = m_cEtcItem.OCCUR_ENTRY_02; // 원승인번호
m_cEtcItem.OCCUR_ENTRY_07 = m_cEtcItem.OCCUR_ENTRY_03; // 원승인일자
}
if (m_cDevStatus.ICReader.UseYn == true) // 여신전문금융업법 적용여부 체크
{
m_cEtcItem.OCCUR_ENTRY_02 = aIrtDTLRsp[Column.POS_RES_CASHBILL.SEQ.CashAppNo];
m_cEtcItem.OCCUR_ENTRY_03 = CmUtil.MidH(aIrtDTLRsp[Column.POS_RES_CASHBILL.SEQ.AppDatatime], 0, 6);
m_cEtcItem.OCCUR_ENTRY_04 = CmUtil.MidH(aIrtDTLRsp[Column.POS_RES_CASHBILL.SEQ.AppDatatime], 6, 4);
}
else
{
m_cEtcItem.OCCUR_ENTRY_02 = aIrtDTLRsp[Column.POS_RES_CASHBILL_MSR.SEQ.CashAppNo];
m_cEtcItem.OCCUR_ENTRY_03 = CmUtil.MidH(aIrtDTLRsp[Column.POS_RES_CASHBILL_MSR.SEQ.AppDatatime], 0, 6);
m_cEtcItem.OCCUR_ENTRY_04 = CmUtil.MidH(aIrtDTLRsp[Column.POS_RES_CASHBILL_MSR.SEQ.AppDatatime], 6, 4);
}
m_cEtcItem.OCCUR_ENTRY_05 = aParam[0]; //입력구분
m_cEtcItem.OCCUR_ENTRY_08 = ItemConst.PAY_APP_DIV.NORMAL; //승인구분 0:정상,1:임의승인
m_cEtcItem.OCCUR_ENTRY_09 = aParam[7]; //사후거래 구분(0:일반, 1:사후)
m_cEtcItem.OCCUR_ENTRY_11 = aParam[6]; //거래자 구분 - "0" : 개인이 사용한 경우- "1" : 사업자가 사용한 경우
m_cEtcItem.OCCUR_ENTRY_12 = "";
m_cEtcItem.OCCUR_ENTRY_13 = "";
m_cEtcItem.OCCUR_ENTRY_14 = "";
m_cEtcItem.OCCUR_ENTRY_15 = "";
m_cEtcItem.OCCUR_ENTRY_16 = sVanCD; //VAN 구분
m_cEtcItem.OCCUR_ENTRY_17 = "";
m_cEtcItem.OCCUR_ENTRY_18 = "";
m_cEtcItem.OCCUR_ENTRY_19 = "";
m_cEtcItem.OCCUR_ENTRY_20 = GetPayDtlCdToPayDtlName(m_cEtcItem.ETC_WAY_CD, m_cEtcItem.ETC_DTL_CD_01); //결제 수단명
m_cEtcItem.OCCUR_ENTRY_21 = "";
m_cEtcItem.OCCUR_ENTRY_22 = "";
m_cEtcItem.OCCUR_ENTRY_23 = "";
m_cEtcItem.OCCUR_ENTRY_24 = "";
m_cEtcItem.OCCUR_ENTRY_25 = "";
m_cEtcItem.BILLSPR_NO = m_cTrnStatus.Sale.BillSplitNo; // 빌분리 번호
m_cEtcItem.CANCEL_DIV = PosConst.CANCEL_DIV.NORMAL;
}
else
{
//WinManager.ErrorMessage(aIrtDTLRsp[Column.POS_RES_CASHBILL.SEQ.Message1] + aIrtDTLRsp[Column.POS_RES_CASHBILL.SEQ.Message2]);
if (m_cDevStatus.ICReader.UseYn == true) // 여신전문금융업법 적용여부 체크
{
return sRet + aIrtDTLRsp[Column.POS_RES_CASHBILL.SEQ.Message1] + aIrtDTLRsp[Column.POS_RES_CASHBILL.SEQ.Message2];
}
else
{
return sRet + aIrtDTLRsp[Column.POS_RES_CASHBILL_MSR.SEQ.Message1] + aIrtDTLRsp[Column.POS_RES_CASHBILL_MSR.SEQ.Message2];
}
}
sRet = UserCom.RST_OK;
}
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
#region Cat단말기
/// <summary>
/// 조회 실행
/// </summary>
/// <param name="sAppType"></param>
/// <param name="aParam"></param>
/// <returns></returns>
public string CatExecuteIrt(string sAppType, string[] aParam)
{
string sRet = UserCom.RST_ERR;
try
{
// 연습모드이면 연습 데이터 설정
if (m_cPosStatus.Base.TrainingFlag == "1" || m_cPosStatus.Mst.TestStorYn == "1") return SetTrainingData(sAppType, aParam);
string sRecvdData = "";
string sAppLogDiv = "";
string sInputType = "";
if (sAppType == PosConst.POS_CAT_MASTER.TRADE_ID.CAT_CASH_AGREE)
{
sAppLogDiv = PosConst.CANCEL_DIV.NORMAL;
}
else
{
sAppLogDiv = PosConst.CANCEL_DIV.CANCEL;
}
string[] aIrtDTLRsp = new string[Column.POS_RES_SPCN_CAT.LEN.Length];
//전문 송/수신
if (CatTerminalExecuteIrtCom(sAppType, sAppLogDiv, aParam, m_cEtcItem.ETC_WAY_CD, m_cEtcItem.ETC_DTL_CD_01, ref aIrtDTLRsp, ref sRecvdData, ref sInputType) == false)
{
return sRet;
}
m_cEtcItem.ETC_AMT = CmUtil.DoubleParse(aParam[3]);
m_cEtcItem.QTY_ENTRY_01 = 0;
m_cEtcItem.QTY_ENTRY_02 = 0;
m_cEtcItem.QTY_ENTRY_03 = 0;
m_cEtcItem.QTY_ENTRY_04 = 0;
m_cEtcItem.QTY_ENTRY_05 = 0;
m_cEtcItem.AMT_ENTRY_01 = CmUtil.DoubleParse(aParam[3]); //TOT AMT
m_cEtcItem.AMT_ENTRY_02 = CmUtil.DoubleSubtraction(CmUtil.DoubleParse(aParam[3]), CmUtil.DoubleParse(aParam[5])); //NET SALE
m_cEtcItem.AMT_ENTRY_03 = CmUtil.DoubleParse(aParam[5]); //VAT
m_cEtcItem.AMT_ENTRY_04 = CmUtil.DoubleParse(aParam[4]); //SERVICE
m_cEtcItem.AMT_ENTRY_05 = 0;
m_cEtcItem.AMT_ENTRY_06 = 0;
m_cEtcItem.AMT_ENTRY_07 = 0;
m_cEtcItem.AMT_ENTRY_08 = 0;
m_cEtcItem.AMT_ENTRY_09 = 0;
m_cEtcItem.AMT_ENTRY_10 = 0;
if (sAppType == PosConst.POS_CAT_MASTER.TRADE_ID.CAT_CASH_AGREE)
{
m_cEtcItem.OCCUR_ENTRY_01 = aIrtDTLRsp[Column.POS_RES_SPCN_CAT.SEQ.CardBinData].Trim().Length == 6 ? aIrtDTLRsp[Column.POS_RES_SPCN_CAT.SEQ.CardBinData].Trim() + "*********" : aIrtDTLRsp[Column.POS_RES_SPCN_CAT.SEQ.CardBinData].Trim(); //사용자정보
m_cEtcItem.OCCUR_ENTRY_06 = "";
m_cEtcItem.OCCUR_ENTRY_07 = "";
m_cEtcItem.OCCUR_ENTRY_10 = aParam[2] == "02" ? "1" : "0"; //자진발급구분(0:일반, 1:자진발금)
}
else
{
m_cEtcItem.OCCUR_ENTRY_06 = m_cEtcItem.OCCUR_ENTRY_02; // 원승인번호
m_cEtcItem.OCCUR_ENTRY_07 = m_cEtcItem.OCCUR_ENTRY_03; // 원승인일자
}
m_cEtcItem.OCCUR_ENTRY_02 = aIrtDTLRsp[Column.POS_RES_SPCN_CAT.SEQ.AppNo].Trim();
m_cEtcItem.OCCUR_ENTRY_03 = CmUtil.MidH(aIrtDTLRsp[Column.POS_RES_SPCN_CAT.SEQ.AppDatatime], 0, 6);
m_cEtcItem.OCCUR_ENTRY_04 = CmUtil.MidH(aIrtDTLRsp[Column.POS_RES_SPCN_CAT.SEQ.AppDatatime], 6, 4);
m_cEtcItem.OCCUR_ENTRY_05 = sInputType; //입력구분
m_cEtcItem.OCCUR_ENTRY_08 = ItemConst.PAY_APP_DIV.CAT_TERMINAL; //승인구분 0:정상,1:임의승인
m_cEtcItem.OCCUR_ENTRY_09 = aParam[12]; //사후거래 구분(0:일반, 1:사후)
m_cEtcItem.OCCUR_ENTRY_11 = aIrtDTLRsp[Column.POS_RES_SPCN_CAT.SEQ.DivMonth].Trim() == "02" || aIrtDTLRsp[Column.POS_RES_SPCN_CAT.SEQ.DivMonth].Trim() == "00" ? "0" : "1"; //거래자 구분 - "0" : 개인이 사용한 경우- "1" : 사업자가 사용한 경우
m_cEtcItem.OCCUR_ENTRY_12 = "";
m_cEtcItem.OCCUR_ENTRY_13 = "";
m_cEtcItem.OCCUR_ENTRY_14 = "";
m_cEtcItem.OCCUR_ENTRY_15 = "";
m_cEtcItem.OCCUR_ENTRY_16 = GetPayDtlCdToVanCode(m_cEtcItem.ETC_WAY_CD, m_cEtcItem.ETC_DTL_CD_01); // 승인업체 코드 조회
m_cEtcItem.OCCUR_ENTRY_17 = "";
m_cEtcItem.OCCUR_ENTRY_18 = "";
m_cEtcItem.OCCUR_ENTRY_19 = "";
m_cEtcItem.OCCUR_ENTRY_20 = GetPayDtlCdToPayDtlName(m_cEtcItem.ETC_WAY_CD, m_cEtcItem.ETC_DTL_CD_01); //결제 수단명
m_cEtcItem.OCCUR_ENTRY_21 = "";
m_cEtcItem.OCCUR_ENTRY_22 = "";
m_cEtcItem.OCCUR_ENTRY_23 = "";
m_cEtcItem.OCCUR_ENTRY_24 = "";
m_cEtcItem.OCCUR_ENTRY_25 = "";
m_cEtcItem.BILLSPR_NO = m_cTrnStatus.Sale.BillSplitNo; // 빌분리 번호
m_cEtcItem.CANCEL_DIV = PosConst.CANCEL_DIV.NORMAL;
sRet = UserCom.RST_OK;
}
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
/// <summary>
/// 연습 데이터 설정
/// </summary>
public string SetTrainingData(string sAppType, string[] aParam)
{
string sRet = UserCom.RST_ERR;
try
{
// 연습모드이면 연습 데이터 설정
//string sVanCD = GetPayDtlCdToVanCode(m_cEtcItem.ETC_WAY_CD, m_cEtcItem.ETC_DTL_CD_01); // 승인업체 코드 조회
//if (sVanCD == "")
//{
// WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0563);
// return sRet;
//}
double dPayAmt = 0;
double dNetSale = 0;
double dVat = 0;
string sCardNo = "";
string sPersonal = "";
if (aParam.Length > 0 && aParam[0] == PosConst.POS_CAT_MASTER.TRAN_TYPE) //단말기승인
{
// 0.전문구분,1.거래유형, 2.할부개월, 3.승인금액 , 4.봉사료, 5.세금, 6.원승인번호, 7.원거래일자, 8.포인트거래구분, 9.상품코드,
//10.전표인쇄여부,11.추가항목,12.제휴할인코드,13.제휴할인금액,14.예비1
dPayAmt = CmUtil.DoubleParse(aParam[3]);
dNetSale = CmUtil.DoubleSubtraction(CmUtil.DoubleParse(aParam[3]), CmUtil.DoubleParse(aParam[5]));
dVat = CmUtil.DoubleParse(aParam[5]);
sCardNo = "01000*****";
sPersonal = aParam[2] == "02" || aParam[2] == "00" ? "1" : "0";
}
else
{
dPayAmt = CmUtil.DoubleParse(aParam[5]);
dNetSale = CmUtil.DoubleParse(aParam[2]);
dVat = CmUtil.DoubleParse(aParam[3]);
sCardNo = aParam[14];
sPersonal = aParam[6];
}
m_cEtcItem.ETC_AMT = dPayAmt;
m_cEtcItem.QTY_ENTRY_01 = 0;
m_cEtcItem.QTY_ENTRY_02 = 0;
m_cEtcItem.QTY_ENTRY_03 = 0;
m_cEtcItem.QTY_ENTRY_04 = 0;
m_cEtcItem.QTY_ENTRY_05 = 0;
m_cEtcItem.AMT_ENTRY_01 = dPayAmt; //TOT AMT
m_cEtcItem.AMT_ENTRY_02 = dNetSale; //NET SALE
m_cEtcItem.AMT_ENTRY_03 = dVat; //VAT
m_cEtcItem.AMT_ENTRY_04 = 0; //SERVICE
m_cEtcItem.AMT_ENTRY_05 = 0;
m_cEtcItem.AMT_ENTRY_06 = 0;
m_cEtcItem.AMT_ENTRY_07 = 0;
m_cEtcItem.AMT_ENTRY_08 = 0;
m_cEtcItem.AMT_ENTRY_09 = 0;
m_cEtcItem.AMT_ENTRY_10 = 0;
m_cEtcItem.OCCUR_ENTRY_01 = sCardNo; //사용자정보
if (sAppType == PosConst.POS_VAN_MASTER.TRADE_ID.VAN_CASH_AGREE || sAppType == PosConst.POS_CAT_MASTER.TRADE_ID.CAT_CASH_AGREE)
{
m_cEtcItem.OCCUR_ENTRY_06 = "";
m_cEtcItem.OCCUR_ENTRY_07 = "";
}
else
{
m_cEtcItem.OCCUR_ENTRY_06 = m_cEtcItem.OCCUR_ENTRY_02; // 원승인번호
m_cEtcItem.OCCUR_ENTRY_07 = m_cEtcItem.OCCUR_ENTRY_03; // 원승인일자
}
m_cEtcItem.OCCUR_ENTRY_02 = "99999999"; // 승인번호
m_cEtcItem.OCCUR_ENTRY_03 = DateTime.Now.ToString("yyMMdd"); // 승인일자
m_cEtcItem.OCCUR_ENTRY_04 = DateTime.Now.ToString("HHmmss"); // 승인시간
m_cEtcItem.OCCUR_ENTRY_05 = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_KEYIN; //입력구분
m_cEtcItem.OCCUR_ENTRY_08 = ItemConst.PAY_APP_DIV.COMPULSION;
m_cEtcItem.OCCUR_ENTRY_09 = "0"; //사후거래 구분(0:일반, 1:사후)
m_cEtcItem.OCCUR_ENTRY_10 = "";
m_cEtcItem.OCCUR_ENTRY_11 = sPersonal; //거래자 구분 - "0" : 개인이 사용한 경우- "1" : 사업자가 사용한 경우
m_cEtcItem.OCCUR_ENTRY_12 = "";
m_cEtcItem.OCCUR_ENTRY_13 = "";
m_cEtcItem.OCCUR_ENTRY_14 = "";
m_cEtcItem.OCCUR_ENTRY_15 = "";
m_cEtcItem.OCCUR_ENTRY_16 = ""; //VAN 구분
m_cEtcItem.OCCUR_ENTRY_17 = "";
m_cEtcItem.OCCUR_ENTRY_18 = "";
m_cEtcItem.OCCUR_ENTRY_19 = "";
m_cEtcItem.OCCUR_ENTRY_20 = GetPayDtlCdToPayDtlName(m_cEtcItem.ETC_WAY_CD, m_cEtcItem.ETC_DTL_CD_01); //결제 수단명
m_cEtcItem.OCCUR_ENTRY_21 = "";
m_cEtcItem.OCCUR_ENTRY_22 = "";
m_cEtcItem.OCCUR_ENTRY_23 = "";
m_cEtcItem.OCCUR_ENTRY_24 = "";
m_cEtcItem.OCCUR_ENTRY_25 = "";
m_cEtcItem.BILLSPR_NO = m_cTrnStatus.Sale.BillSplitNo; // 빌분리 번호
m_cEtcItem.CANCEL_DIV = PosConst.CANCEL_DIV.NORMAL;
sRet = UserCom.RST_OK;
}
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;
}
}
}