using System;
using System.Collections;
using System.Text;
using Cosmos.UserFrame;
using Cosmos.ServiceProvider;
using Cosmos.Common;
using Cosmos.CommonManager;
using System.Data;
/*-----------------------------------------------------------------------------------------------*/
// 설 명 : SPC 임직원 결제
// 작 성 자 :
// 변경 이력 :
/*-----------------------------------------------------------------------------------------------*/
namespace Cosmos.Service
{
class SPCEmployeeUse : PaymentBase, IPaymentUs
{
private int iRecvTimeOut = 10000;
public SPCEmployeeUse()
{
}
#region SearchPayment 결제 조회
///
/// 결제 조회
///
///
///
///
public string SearchPayment(string[] aParam, ref string[] aRet)
{
string sRet = UserCom.RST_ERR;
string sInPutData = "", sCardData = "";
try
{
sInPutData = aParam[2]; // 입력데이터
sCardData = aParam[3]; // 카드데이터
string sPosMenuKey = aParam[0]; // 메뉴키
string sWCC = aParam[1]; // 입력구분
double nPayAmt = CmUtil.DoubleParse(aParam[4]); // 요청금액
m_cPayItem = new Column.TR_PAYMENT.DATA(); // 결과 저장 변수 생성
m_cPayItem.PAY_WAY_CD = ItemConst.TR_ITEM_ID.EMP_PAY_ITEM; // 결제수단
m_cPayItem.PAY_DTL_CD_01 = ItemConst.TR_ITEM_ID.EMP_PAY.SPC; // 상세코드
string siNqType = PosConst.POS_SPC_EMPLOYEE_INQ_TYPE.SEARCH;
sRet = ExecuteIrt(PosConst.CANCEL_DIV.NORMAL, siNqType, sWCC, sInPutData, sCardData, nPayAmt, "", "");
}
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 sInPutData);
CmUtil.ZeroFillClear(ref sCardData);
CmUtil.ZeroFillClear(ref aParam);
//////////////////////////////////////////////////////////////////////////////////
}
return sRet;
}
#endregion
#region GetPayment 결제 정보 획득
///
/// 결제 정보 획득
///
///
///
public object GetPayment(string[] aParam)
{
return m_cPayItem;
}
#endregion
#region SetPayment 결제 등록
///
/// 결제 등록
///
///
///
public string SetPayment(string[] aParam)
{
string sRet = UserCom.RST_ERR;
string sInPutData = "", sCardData = "";
try
{
sInPutData = aParam[2]; // 입력데이터
sCardData = aParam[3]; // 카드데이터
string sPosMenuKey = aParam[0]; // 메뉴키
string sWCC = aParam[1]; // 입력구분
double nPayAmt = CmUtil.DoubleParse(aParam[4]); // 대상금액
string sApprDate = aParam[5]; // 승인일자
string sApprNo = aParam[6]; // 승인번호
m_cPayItem = new Column.TR_PAYMENT.DATA(); // 결과 저장 변수 생성
m_cPayItem.PAY_WAY_CD = ItemConst.TR_ITEM_ID.EMP_PAY_ITEM; // 결제수단
m_cPayItem.PAY_DTL_CD_01 = ItemConst.TR_ITEM_ID.EMP_PAY.SPC; // 상세코드
string siNqType = "";
if (m_cTrnStatus.Head.TradeDiv == ItemConst.TRAN_DIV.NORMAL)
siNqType = PosConst.POS_SPC_EMPLOYEE_INQ_TYPE.APPROVAL; // 정상
else
siNqType = PosConst.POS_SPC_EMPLOYEE_INQ_TYPE.REFUND; // 반품
// 승인요청
sRet = ExecuteIrt(PosConst.CANCEL_DIV.NORMAL, siNqType, sWCC, sInPutData, sCardData, nPayAmt, sApprDate, sApprNo);
if (sRet != UserCom.RST_OK)
{
// 망취소
if (m_cTrnStatus.Head.TradeDiv == ItemConst.TRAN_DIV.NORMAL)
siNqType = PosConst.POS_SPC_EMPLOYEE_INQ_TYPE.NETCANCEL_APPROVAL; // 정상
else
siNqType = PosConst.POS_SPC_EMPLOYEE_INQ_TYPE.NETCANCEL_REFUND; // 반품
sRet = ExecuteIrt(PosConst.CANCEL_DIV.CANCEL, siNqType, sWCC, sInPutData, sCardData, nPayAmt, sApprDate, sApprNo);
return sRet;
}
// 결제 아이템 추가
ArrayList alPayItem = (ArrayList)StateObject.GetItemObject(Column.TR_PAYMENT.ITEM); // 결제 내역 받아 오기
m_cPayItem.SEQ = alPayItem.Count + 1;
alPayItem.Add(m_cPayItem);
m_cDataService.UpdatePluAmount(); // 상품 합계금액 계산(거래해더)
m_cDataService.UpdatePayAmount(); // 결제 금액 재 계산 처리
}
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 sInPutData);
CmUtil.ZeroFillClear(ref sCardData);
CmUtil.ZeroFillClear(ref aParam);
//////////////////////////////////////////////////////////////////////////////////
}
return sRet;
}
#endregion
#region CancelPayment 결제 취소
///
/// 결제 취소
///
///
///
public string CancelPayment(string[] aParam)
{
string sRet = UserCom.RST_ERR;
string sInPutData = "", sCardData = "";
try
{
if (m_cTrnStatus.Head.TradeDiv != ItemConst.TRAN_DIV.NORMAL) return sRet;
int nPayRow = CmUtil.IntParse(aParam[0]); // 취소할 행번호
// 결제 내역 받아 오기
ArrayList alPayItem = (ArrayList)StateObject.GetItemObject(Column.TR_PAYMENT.ITEM);
m_cPayItem = (Column.TR_PAYMENT.DATA)alPayItem[nPayRow];
sInPutData = m_cPayItem.OCCUR_ENTRY_01; // 입력데이터
sCardData = m_cPayItem.OCCUR_ENTRY_22; // 카드데이터
string sWCC = m_cPayItem.OCCUR_ENTRY_05; // 입력구분
double nPayAmt = m_cPayItem.AMT_ENTRY_01; // 대상금액
string sApprDate = m_cPayItem.OCCUR_ENTRY_03; // 승인일자
string sApprNo = m_cPayItem.OCCUR_ENTRY_02; // 승인번호
string siNqType = PosConst.POS_SPC_EMPLOYEE_INQ_TYPE.REFUND; // 반품
sRet = ExecuteIrt(PosConst.CANCEL_DIV.CANCEL, siNqType, sWCC, sInPutData, sCardData, nPayAmt, sApprDate, sApprNo);
if (sRet != UserCom.RST_OK)
{
// 망취소
siNqType = PosConst.POS_SPC_EMPLOYEE_INQ_TYPE.NETCANCEL_REFUND;
sRet = ExecuteIrt(PosConst.CANCEL_DIV.CANCEL, siNqType, sWCC, sInPutData, sCardData, nPayAmt, sApprDate, sApprNo);
}
m_cPayItem.CANCEL_DIV = PosConst.CANCEL_DIV.CANCEL;
m_cDataService.UpdatePluAmount(); // 상품 합계금액 계산(거래해더)
m_cDataService.UpdatePayAmount(); // 결제 금액 재 계산 처리
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 sInPutData);
CmUtil.ZeroFillClear(ref sCardData);
CmUtil.ZeroFillClear(ref aParam);
//////////////////////////////////////////////////////////////////////////////////
}
return sRet;
}
#endregion
#region RefundPayment 결제 반품
///
/// 결제 반품
///
///
///
public string RefundPayment(string[] aParam)
{
string sRet = UserCom.RST_ERR;
string sInPutData = "", sCardData = "";
try
{
int nPayRow = CmUtil.IntParse(aParam[0]); // 취소할 행번호
// 결제 내역 받아 오기
ArrayList alPayItem = (ArrayList)StateObject.GetItemObject(Column.TR_PAYMENT.ITEM);
m_cPayItem = (Column.TR_PAYMENT.DATA)alPayItem[nPayRow];
if (m_cPayItem.OCCUR_ENTRY_08.ToString() != ItemConst.PAY_APP_DIV.NORMAL)
{
//임의 등록 이면 승인 없이 데이터 처리
//WinManager.ConfirmMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0240));
m_cPayItem.OCCUR_ENTRY_06 = m_cPayItem.OCCUR_ENTRY_02;
m_cPayItem.OCCUR_ENTRY_07 = m_cPayItem.OCCUR_ENTRY_03;
sRet = UserCom.RST_OK;
}
else
{
sInPutData = m_cPayItem.OCCUR_ENTRY_01; // 입력데이터
sCardData = m_cPayItem.OCCUR_ENTRY_22; // 카드데이터
string sWCC = m_cPayItem.OCCUR_ENTRY_05; // 입력구분
double nPayAmt = m_cPayItem.AMT_ENTRY_01; // 대상금액
string sApprDate = m_cPayItem.OCCUR_ENTRY_03; // 승인일자
string sApprNo = m_cPayItem.OCCUR_ENTRY_02; // 승인번호
string siNqType = PosConst.POS_SPC_EMPLOYEE_INQ_TYPE.REFUND; // 반품
sRet = ExecuteIrt(PosConst.CANCEL_DIV.CANCEL, siNqType, sWCC, sInPutData, sCardData, nPayAmt, sApprDate, sApprNo);
if (sRet != UserCom.RST_OK)
{
// 망취소
siNqType = PosConst.POS_SPC_EMPLOYEE_INQ_TYPE.NETCANCEL_REFUND;
sRet = ExecuteIrt(PosConst.CANCEL_DIV.CANCEL, siNqType, sWCC, sInPutData, sCardData, nPayAmt, sApprDate, sApprNo);
}
}
}
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 sInPutData);
CmUtil.ZeroFillClear(ref sCardData);
CmUtil.ZeroFillClear(ref aParam);
//////////////////////////////////////////////////////////////////////////////////
}
return sRet;
}
#endregion
#region SetMenualPayment
public string SetMenualPayment(string[] aParam)
{
throw new NotImplementedException();
}
#endregion
#region 조회 실행
///
/// 조회 실행
///
///
///
///
///
///
///
///
///
public string ExecuteIrt(string sTradeDiv, string siNqType, string sWCC, string sInPutData, string sCardData, double nPayAmt, string sApprDate, string sApprNo)
{
string sRet = UserCom.RST_ERR;
try
{
// 연습모드이면 연습 데이터 설정
if (m_cPosStatus.Base.TrainingFlag == "1" || m_cPosStatus.Mst.TestStorYn == "1" ) return SetTrainingData(siNqType, sWCC, sInPutData, nPayAmt, sApprDate, sApprNo);
string[] aIrtRsp = null;
// 조회
sRet = ExecuteSendRecv(sTradeDiv, siNqType, sWCC, sInPutData, nPayAmt, sApprDate, sApprNo, ref aIrtRsp);
if (sRet != UserCom.RST_OK) return sRet;
// 결제구분 (1:결제, 2:할인)
DataRow dr = PosMstManager.GetMstPayDc(new string[] { m_cPosStatus.Base.CmpCd, m_cPosStatus.Base.StoreNo, m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01 });
m_cPayItem.PAY_AMT = nPayAmt;
m_cPayItem.PAY_DTL_CD_02 = ""; // 캠페인코드
m_cPayItem.PAY_DTL_CD_03 = "0"; // 할인금액 아이템 적용여부
m_cPayItem.PAY_DTL_CD_05 = PosConst.PAY_DC_TYPE.PAY; // 할인결제구분 (1:결제, 2:할인)
m_cPayItem.AMT_ENTRY_01 = nPayAmt; // 받은돈
m_cPayItem.AMT_ENTRY_02 = 0; // 제휴 할인 금액
m_cPayItem.AMT_ENTRY_03 = CmUtil.DoubleParse(aIrtRsp[Column.POS_REQ_SPC_EMPLOYEE_USE.SEQ.BalancePoint]); // 거래전잔액
m_cPayItem.AMT_ENTRY_04 = CmUtil.DoubleParse(aIrtRsp[Column.POS_REQ_SPC_EMPLOYEE_USE.SEQ.ResUsesPoint]); // 거래후잔액
m_cPayItem.AMT_ENTRY_05 = 0;
m_cPayItem.OCCUR_ENTRY_01 = sInPutData; // 카드번호
m_cPayItem.OCCUR_ENTRY_02 = aIrtRsp[Column.POS_REQ_SPC_EMPLOYEE_USE.SEQ.ApprNo].Trim(); // 승인번호
m_cPayItem.OCCUR_ENTRY_03 = aIrtRsp[Column.POS_REQ_SPC_EMPLOYEE_USE.SEQ.ApprDate]; // 승인일자
m_cPayItem.OCCUR_ENTRY_04 = DateTime.Now.ToString("HHmmss"); // 승인시간
m_cPayItem.OCCUR_ENTRY_05 = sWCC; // 입력 구분
m_cPayItem.OCCUR_ENTRY_06 = sApprNo; // 원승인번호
m_cPayItem.OCCUR_ENTRY_07 = sApprDate; // 원승인일자
m_cPayItem.OCCUR_ENTRY_08 = ItemConst.PAY_APP_DIV.NORMAL; // 승인구분
m_cPayItem.OCCUR_ENTRY_10 = aIrtRsp[Column.POS_REQ_SPC_EMPLOYEE_USE.SEQ.ResMsg1].Trim(); // 직원명
m_cPayItem.OCCUR_ENTRY_16 = CmUtil.GetDataRowStr(dr, PosMst.MST_PAY_DC.DATA.APPR_VEND_CD); // VAN 구분
m_cPayItem.OCCUR_ENTRY_20 = GetPayDtlCdToPayDtlName(m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01); // 결제수단명
m_cPayItem.OCCUR_ENTRY_22 = sCardData;
m_cPayItem.CANCEL_DIV = ItemConst.PAY_CANCEL_DIV.NORMAL;
m_cPayItem.BILLSPR_NO = m_cTrnStatus.Sale.BillSplitNo; // 빌분리 번호
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 sInPutData);
CmUtil.ZeroFillClear(ref sCardData);
//////////////////////////////////////////////////////////////////////////////////
}
return sRet;
}
///
/// 연습 데이터 설정
///
///
///
///
///
///
///
///
public string SetTrainingData(string siNqType, string sWCC, string sCardData, double nPayAmt, string sApprDate, string sApprNo)
{
string sRet = UserCom.RST_ERR;
try
{
// 결제구분 (1:결제, 2:할인)
DataRow dr = PosMstManager.GetMstPayDc(new string[] { m_cPosStatus.Base.CmpCd, m_cPosStatus.Base.StoreNo, m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01 });
// 연습모드이면 연습 데이터 설정
m_cPayItem.PAY_AMT = nPayAmt;
m_cPayItem.PAY_DTL_CD_02 = ""; // 캠페인코드
m_cPayItem.PAY_DTL_CD_03 = "0"; // 할인금액 아이템 적용여부
m_cPayItem.PAY_DTL_CD_05 = PosConst.PAY_DC_TYPE.PAY; // 할인결제구분 (1:결제, 2:할인)
m_cPayItem.AMT_ENTRY_01 = nPayAmt; // 사용포인트
m_cPayItem.AMT_ENTRY_02 = 0; // 제휴 할인 금액
m_cPayItem.AMT_ENTRY_03 = 9990; // 총포인트
m_cPayItem.AMT_ENTRY_04 = 9990; // 가용포인트
m_cPayItem.AMT_ENTRY_05 = 0; // 잔여포인트
m_cPayItem.OCCUR_ENTRY_01 = sCardData; // 카드번호
m_cPayItem.OCCUR_ENTRY_02 = "99999999"; // 승인번호
m_cPayItem.OCCUR_ENTRY_03 = DateTime.Now.ToString("yyMMdd"); // 승인일자
m_cPayItem.OCCUR_ENTRY_04 = DateTime.Now.ToString("HHmmss"); // 승인시간
m_cPayItem.OCCUR_ENTRY_05 = sWCC; // 입력 구분
m_cPayItem.OCCUR_ENTRY_06 = sApprNo; // 원승인번호
m_cPayItem.OCCUR_ENTRY_07 = sApprDate; // 원승인일자
m_cPayItem.OCCUR_ENTRY_08 = ItemConst.PAY_APP_DIV.COMPULSION; // 승인구분
m_cPayItem.OCCUR_ENTRY_10 = "TRAINEE"; // 직원명
m_cPayItem.OCCUR_ENTRY_16 = CmUtil.GetDataRowStr(dr, PosMst.MST_PAY_DC.DATA.APPR_VEND_CD); // VAN 구분
m_cPayItem.OCCUR_ENTRY_20 = GetPayDtlCdToPayDtlName(m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01); // 결제수단명
m_cPayItem.OCCUR_ENTRY_22 = sCardData;
m_cPayItem.CANCEL_DIV = ItemConst.PAY_CANCEL_DIV.NORMAL;
m_cPayItem.BILLSPR_NO = m_cTrnStatus.Sale.BillSplitNo; // 빌분리 번호
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 sCardData);
//////////////////////////////////////////////////////////////////////////////////
}
return sRet;
}
#endregion
#region 승인 요청/응답
///
/// 승인 요청/응답
///
///
///
///
///
///
///
///
///
protected string ExecuteSendRecv(string sTradeDiv, string siNqType, string sWCC, string sCardData, double nPayAmt, string sApprDate, string sApprNo, ref string[] aIrtRsp)
{
string sSendData = "", sRecvData = ""; // 송수신 전문
int nNowPos = 0;
string sRet = UserCom.RST_ERR;
string sServerIP = "";
string sServerPort = "";
string sCMPApprID = "";
string sApprID = "";
int iRecvTimeOut = 10000;
try
{
// VAN 정보 조회
if (m_cPayItem.OCCUR_ENTRY_16.Trim().Length != 0)
{
// VAN_ID가 있는 경우 VAN_ID로 VAN 정보 조회
sServerIP = PosMstManager.GetMstVan(m_cPayItem.OCCUR_ENTRY_16.Trim(), PosMst.MST_VAN.DATA.IP);
sServerPort = PosMstManager.GetMstVan(m_cPayItem.OCCUR_ENTRY_16.Trim(), PosMst.MST_VAN.DATA.PORT);
sCMPApprID = PosMstManager.GetMstVan(m_cPayItem.OCCUR_ENTRY_16.Trim(), PosMst.MST_VAN.DATA.CMP_APPR_ID);
sApprID = PosMstManager.GetMstVan(m_cPayItem.OCCUR_ENTRY_16.Trim(), PosMst.MST_VAN.DATA.APPR_ID);
}
else
{
// VAN_ID가 미정인 경우 결제수단으로 VAN 정보 조회
sServerIP = PosMstManager.GetMstVan(m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01, PosMst.MST_VAN.DATA.IP);
sServerPort = PosMstManager.GetMstVan(m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01, PosMst.MST_VAN.DATA.PORT);
sCMPApprID = PosMstManager.GetMstVan(m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01, PosMst.MST_VAN.DATA.CMP_APPR_ID);
sApprID = PosMstManager.GetMstVan(m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01, PosMst.MST_VAN.DATA.APPR_ID);
}
if (sServerIP.Trim() == "")
{
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0565);
return sRet;
}
// 전문 생성
sSendData = GetMakeiNQData(siNqType, sApprID, sCardData, nPayAmt, sApprDate, sApprNo);
// 수신 데이터 길이
int iRecvDataLen = ItemColumn.LenMessage(Column.POS_RES_SPC_EMPLOYEE_USE.LEN);
// 요청 - 승인로그 저장 (판매구분, [0]결제수단, [1]결제상세코드, [2]전문구분, [3]요청구분, [4]카드번호, [5]결제금액, [6]승인번호, [7]승인일자, [8]승인시간, [9]응답상태값, [10]응답메시지, [11]전문)
m_cDataCommon.SetSaleApprLog(sTradeDiv, new string[] { m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01, siNqType, "S", sCardData, nPayAmt.ToString(), "", "", "", "", "", sSendData });
// 전문 송수신
sRet = m_cDataCommon.ExecuteExIrt(sServerIP, CmUtil.IntParse(sServerPort), iRecvTimeOut, sSendData, ref sRecvData, iRecvDataLen, "");
if (sRet != UserCom.RST_OK)
{
WinManager.ErrorMessage(sRet);
return sRet;
}
byte[] bytes = Encoding.Default.GetBytes(sRecvData);
aIrtRsp = new string[Column.POS_REQ_SPC_EMPLOYEE_USE.LEN.Length];
ItemColumn.ParseMessage(Column.POS_REQ_SPC_EMPLOYEE_USE.LEN, Column.POS_REQ_SPC_EMPLOYEE_USE.TYPE, bytes, ref nNowPos, ref aIrtRsp);
// 응답 - 승인로그 저장 (판매구분, [0]결제수단, [1]결제상세코드, [2]전문구분, [3]요청구분, [4]카드번호, [5]결제금액, [6]승인번호, [7]승인일자, [8]승인시간, [9]응답상태값, [10]응답메시지, [11]전문)
m_cDataCommon.SetSaleApprLog(sTradeDiv, new string[] { m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01, siNqType, "R"
, sCardData, nPayAmt.ToString()
, aIrtRsp[Column.POS_REQ_SPC_EMPLOYEE_USE.SEQ.ApprNo].Trim(), aIrtRsp[Column.POS_REQ_SPC_EMPLOYEE_USE.SEQ.ApprDate].Trim(), DateTime.Now.ToString("HHmmss")
, aIrtRsp[Column.POS_REQ_SPC_EMPLOYEE_USE.SEQ.ResStatus].Trim()
, aIrtRsp[Column.POS_REQ_SPC_EMPLOYEE_USE.SEQ.ResMsg1].Trim()
, sRecvData });
// - 'O000' : 승인 그외 : 거절
if (aIrtRsp[Column.POS_REQ_SPC_EMPLOYEE_USE.SEQ.ResStatus].Trim() != "00")
{
sRet = aIrtRsp[Column.POS_REQ_SPC_EMPLOYEE_USE.SEQ.ResStatus].Trim() + " " + aIrtRsp[Column.POS_REQ_SPC_EMPLOYEE_USE.SEQ.ResMsg1].Trim();
WinManager.ErrorMessage(LS_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 sCardData);
//////////////////////////////////////////////////////////////////////////////////
}
return sRet;
}
#endregion
#region 전문 생성
///
/// 전문 생성
///
///
///
///
///
///
///
///
protected string GetMakeiNQData(string siNqType, string sApprID, string sCardData, double nPayAmt, string sApprDate, string sApprNo)
{
string sSendData = string.Empty;
double nBodyLen = 0;
try
{
string[] aIrtBody = new string[Column.POS_RES_SPC_EMPLOYEE_USE.LEN.Length];
aIrtBody[Column.POS_RES_SPC_EMPLOYEE_USE.SEQ.InqType] = siNqType;
aIrtBody[Column.POS_RES_SPC_EMPLOYEE_USE.SEQ.SendDate] = DateTime.Now.ToString("yyyyMMdd");
aIrtBody[Column.POS_RES_SPC_EMPLOYEE_USE.SEQ.SendTime] = DateTime.Now.ToString("HHmmss");
aIrtBody[Column.POS_RES_SPC_EMPLOYEE_USE.SEQ.ResStatus] = "";
aIrtBody[Column.POS_RES_SPC_EMPLOYEE_USE.SEQ.StoreCD] = m_cPosStatus.Base.StoreNo;
aIrtBody[Column.POS_RES_SPC_EMPLOYEE_USE.SEQ.CatID] = sApprID;
aIrtBody[Column.POS_RES_SPC_EMPLOYEE_USE.SEQ.SaleDate] = m_cPosStatus.Base.SaleDate;
aIrtBody[Column.POS_RES_SPC_EMPLOYEE_USE.SEQ.SaleTime] = DateTime.Now.ToString("HHmmss");
aIrtBody[Column.POS_RES_SPC_EMPLOYEE_USE.SEQ.SaleType] = "11";
aIrtBody[Column.POS_RES_SPC_EMPLOYEE_USE.SEQ.CardNo] = sCardData;
aIrtBody[Column.POS_RES_SPC_EMPLOYEE_USE.SEQ.Password] = "";
aIrtBody[Column.POS_RES_SPC_EMPLOYEE_USE.SEQ.SaleAmount] = nPayAmt.ToString();
aIrtBody[Column.POS_RES_SPC_EMPLOYEE_USE.SEQ.SaleQty] = "0";
aIrtBody[Column.POS_RES_SPC_EMPLOYEE_USE.SEQ.ResUsesPoint] = "0";
aIrtBody[Column.POS_RES_SPC_EMPLOYEE_USE.SEQ.BalancePoint] = "0";
aIrtBody[Column.POS_RES_SPC_EMPLOYEE_USE.SEQ.ApprDate] = sApprDate;
aIrtBody[Column.POS_RES_SPC_EMPLOYEE_USE.SEQ.ApprNo] = sApprNo;
aIrtBody[Column.POS_RES_SPC_EMPLOYEE_USE.SEQ.RegMsg1] = "";
aIrtBody[Column.POS_RES_SPC_EMPLOYEE_USE.SEQ.RegMsg2] = "";
nBodyLen = ItemColumn.LenMessage(Column.POS_RES_SPC_EMPLOYEE_USE.LEN);
aIrtBody[Column.POS_RES_SPC_EMPLOYEE_USE.SEQ.BodyLen] = "0202"; // nBodyLen.ToString();
// 요청 전문 생성
sSendData = ItemColumn.MakeMessage(aIrtBody, Column.POS_RES_SPC_EMPLOYEE_USE.LEN, Column.POS_RES_SPC_EMPLOYEE_USE.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);
}
finally
{
//여전법 대응!
//////////////////////////////////////////////////////////////////////////////////
CmUtil.ZeroFillClear(ref sCardData);
//////////////////////////////////////////////////////////////////////////////////
}
return sSendData;
}
#endregion
#region
private string LS_ErrorMessage(string sErrID)
{
string[] aRet = new string[35];
string sRet = "";
try
{
sErrID = sErrID.Replace("\n", "");
sErrID = sErrID.Replace("\r", "");
switch (sErrID.Trim())
{
case "00": { sRet = "정상"; break; }
case "01": { sRet = "전문오류"; break; }
case "11": { sRet = "포인트 충전불가"; break; }
case "12": { sRet = "포인트 사용불가"; break; }
case "13": { sRet = "포인트 취소불가"; break; }
case "14": { sRet = "가용포인트 한도초과"; break; }
case "15": { sRet = "카드번호오류 처리불가"; break; }
case "16": { sRet = "가맹점 오류 처리불가"; break; }
case "17": { sRet = "회원정보 오류 처리불가"; break; }
case "18": { sRet = "카드상태오류 처리불가"; break; }
case "20": { sRet = "포인트 적립 불가 가맹점"; break; }
case "21": { sRet = "포인트 사용 불가 가맹점"; break; }
case "22": { sRet = "판매단가 미등록 오류"; break; }
case "23": { sRet = "포인트사용 비밀번호 오류"; break; }
case "24": { sRet = "원승인거래 없음"; break; }
case "25": { sRet = "취소거래점포 오류"; break; }
case "26": { sRet = "취소거래카드 오류"; break; }
case "27": { sRet = "기취소거래"; break; }
case "28": { sRet = "취소거래금액 오류"; break; }
case "29": { sRet = "포인트중복충전 오류"; break; }
case "30": { sRet = "포인트회수불가"; break; }
case "31": { sRet = "거래금액 오류"; break; }
case "32": { sRet = "결제불가 카드번호"; break; }
case "33": { sRet = "할인불가 카드번호"; break; }
case "34": { sRet = "할인한도 초과"; break; }
case "90": { sRet = "중복거래요청 오류"; break; }
case "91": { sRet = "시스템 오류"; break; }
case "92": { sRet = "데이터베이스 오류"; break; }
case "93": { sRet = "망취소"; break; }
case "94": { sRet = "망취소실패"; break; }
case "99": { sRet = "Timeout"; 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);
}
return "(" + sErrID.Trim() + ") " + sRet;
}
#endregion
}
}