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

1034 lines
62 KiB
C#
Raw Normal View History

2019-06-16 05:12:09 +00:00
using System;
using System.Collections;
using System.Text;
using Cosmos.UserFrame;
using Cosmos.ServiceProvider;
using Cosmos.Common;
using Cosmos.CommonManager;
using System.Data;
/*-----------------------------------------------------------------------------------------------*/
// 설 명 : 해피 기프트
// 작 성 자 :
// 변경 이력 :
/*-----------------------------------------------------------------------------------------------*/
namespace Cosmos.Service
{
class HappyGiftReChange : PaymentBase, IPaymentUs
{
#region
// 접속정보
private IDataCommonUs m_cDataCommon = null;
private string[] aIrtRsp_Search = null;
private IMasterUs m_cMstService = null; // 마스터 인터페이스
private Column.TR_ETC.DATA m_cPayEtc = null;
public HappyGiftReChange()
{
m_cDataCommon = (IDataCommonUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.DATA_COMMON);
m_cMstService = (IMasterUs)sManager.InitServiceInstance(ServiceLists.ASV_MASTER.DLL, ServiceLists.ASV_MASTER.POS_MASTER);
}
#endregion
#region SearchPayment
/// <summary>
/// 결제 조회
/// </summary>
/// <param name="aParam"></param>
/// <param name="aRet"></param>
/// <returns></returns>
public string SearchPayment(string[] aParam, ref string[] aRet)
{
string sRet = UserCom.RST_ERR;
string sPosMenuKey = "", sWCC = "", sInPutData = "", sCardData = "", sApprNo = "", sApprDate = "", sApprTime = "", sReqNo = "", sTrType = "";
string sSearchType = "", sSearchMode = "", sStrDate = "", sEndDate = "";
double nPayAmt = 0;
try
{
sPosMenuKey = aParam[0]; // 메뉴키
sWCC = aParam[1]; // 입력구분
sInPutData = aParam[2]; // 입력데이터
sCardData = aParam[3]; // 카드데이터
nPayAmt = CmUtil.DoubleParse(aParam[4]); // 대상금액
sApprNo = aParam[6]; // 승인번호
sApprDate = DateTime.Now.ToString("yyyyMMdd"); // 승인일자
sApprTime = DateTime.Now.ToString("HHmmss"); // 승인시간
sReqNo = ""; // 수신자 번호
m_cPayEtc = new Column.TR_ETC.DATA(); // 결과 저장 변수 생성
m_cPayEtc.ETC_WAY_CD = aParam[8]; // 결제수단
m_cPayEtc.ETC_DTL_CD_01 = aParam[9]; // 상세코드
sSearchType = aParam[10]; // 조회구분 (0:거래조회 1:승인조회)
sSearchMode = aParam[11]; // 조회모드 (0:전체, 1:충전, 2:충전취소 3:환전, 4:환전취소)
sStrDate = aParam[12]; // 조회 시작일
sEndDate = aParam[13]; // 조회 종료일
//sTrType = PosConst.POS_HAPPYGIFT_INQ_TYPE.SEARCH; // 전문구분
sTrType = PosConst.POS_VAN_MASTER.TRADE_ID.VAN_POT_QRY_A;
if (sSearchType == "0")
{
Hashtable htRecvData = new Hashtable();
// 거래 이력 조회 요청
sRet = ExecuteHostIrt(ItemConst.IRT_INQ_TYPE.HAPPY_GIFT_RECHANGE, sSearchMode, sInPutData, sStrDate, sEndDate, ref htRecvData);
if (sRet != UserCom.RST_OK) return sRet;
aRet = htRecvData[Column.IQ_HAPPYGIFT_RECHANGE_TRAN_RSP.DATA.VALUE].ToString().Split(new string[] { "#~" }, StringSplitOptions.None);
}
else
{
sRet = ExecuteIrt(PosConst.CANCEL_DIV.NORMAL, sTrType, sWCC, sInPutData, sCardData, sReqNo, nPayAmt, 0, 0, "", "", "", "", "");
}
}
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
/// <summary>
/// 결제 정보 획득
/// </summary>
/// <param name="aParam"></param>
/// <returns></returns>
public object GetPayment(string[] aParam)
{
return m_cPayEtc;
}
#endregion
#region SetPayment
/// <summary>
/// 결제 등록
/// </summary>
/// <param name="aParam"></param>
/// <returns></returns>
public string SetPayment(string[] aParam)
{
string sRet = UserCom.RST_ERR;
string sTrType = null;
string sPosMenuKey = "", sWCC = "", sInPutData = "", sCardData = "", sApprNo = "", sApprDate = "", sApprTime = "", mExp_DT = "";
double nPayAmt = 0, nReMainAmt = 0;
try
{
sPosMenuKey = aParam[0]; // 메뉴키
sWCC = aParam[1]; // 입력구분
sInPutData = aParam[2]; // 입력데이터
sCardData = aParam[3]; // 카드데이터
nPayAmt = CmUtil.DoubleParse(aParam[4]); // 대상금액
sApprNo = aParam[6]; // 승인번호
sApprDate = aParam[7]; // 승인번호
sApprTime = DateTime.Now.ToString("HHmmss"); // 승인시간
m_cPayEtc = new Column.TR_ETC.DATA(); // 결과 저장 변수 생성
m_cPayEtc.ETC_WAY_CD = aParam[8]; // 결제수단
m_cPayEtc.ETC_DTL_CD_01 = aParam[9]; // 상세코드
//sTrType = aParam[10]; // 전문구분
if (aParam[10] == PosConst.POS_HAPPYGIFT_INQ_TYPE.RECHANGE)
sTrType = PosConst.POS_VAN_MASTER.TRADE_ID.VAN_POT_ACC_A;
else if (aParam[10] == PosConst.POS_HAPPYGIFT_INQ_TYPE.RECHANGE_CANCEL)
sTrType = PosConst.POS_VAN_MASTER.TRADE_ID.VAN_POT_ACC_C;
nReMainAmt = CmUtil.DoubleParse(aParam[11]); // 잔액
mExp_DT = aParam[12]; // 유효기간
// 승인요청
sRet = ExecuteIrt(PosConst.CANCEL_DIV.NORMAL, sTrType, sWCC, sInPutData, sCardData, "", nPayAmt, 0, nReMainAmt, sApprDate, sApprNo, sApprTime, "1", mExp_DT);
if (sRet != UserCom.RST_OK)
{
////sTrType = PosConst.POS_HAPPYGIFT_INQ_TYPE.RECHANGE_CANCEL; // 전문구분
//sTrType = PosConst.POS_VAN_MASTER.TRADE_ID.VAN_POT_ACC_C;
//// 망취소 요청
//sRet = ExecuteIrt(PosConst.CANCEL_DIV.CANCEL, sTrType, sWCC, sInPutData, sCardData, "", nPayAmt, 0, nReMainAmt, sApprDate, sApprNo, sApprTime, "2", mExp_DT);
//if (sRet != UserCom.RST_OK) return sRet;
return sRet;
}
// 결제 아이템 추가
ArrayList alEtcItem = (ArrayList)StateObject.GetItemObject(Column.TR_ETC.ITEM); // 결제 내역 받아 오기
m_cPayEtc.SEQ = alEtcItem.Count + 1;
alEtcItem.Add(m_cPayEtc);
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
/// <summary>
/// 결제 취소
/// </summary>
/// <param name="aParam"></param>
/// <returns></returns>
public string CancelPayment(string[] aParam)
{
string sRet = UserCom.RST_ERR;
string sTrType = null;
string sWCC = "", sInPutData = "", sCardData = "", sApprNo = "", sApprDate = "", sApprTime = "", sReqNo = "", sExp_DT = "";
double nPayAmt = 0, nBeforeAmt = 0, nAfterAmt = 0;
try
{
if (m_cTrnStatus.Head.TradeDiv != ItemConst.TRAN_DIV.NORMAL) return sRet;
int nPayRow = CmUtil.IntParse(aParam[0]); // 취소할 행번호
// 결제 내역 받아 오기
ArrayList alEtcItem = (ArrayList)StateObject.GetItemObject(Column.TR_ETC.ITEM);
m_cPayEtc = (Column.TR_ETC.DATA)alEtcItem[nPayRow];
sWCC = m_cPayEtc.OCCUR_ENTRY_05; // 입력구분
sInPutData = m_cPayEtc.OCCUR_ENTRY_01; // 입력데이터
sCardData = m_cPayEtc.OCCUR_ENTRY_22; // 카드데이터
nPayAmt = m_cPayEtc.AMT_ENTRY_01; // 대상금액
nBeforeAmt = m_cPayEtc.AMT_ENTRY_03; // 거래전잔액
nAfterAmt = m_cPayEtc.AMT_ENTRY_04; // 거래후잔액
sApprNo = m_cPayEtc.OCCUR_ENTRY_02; // 승인번호
sApprDate = m_cPayEtc.OCCUR_ENTRY_03; // 승인일자
sApprTime = m_cPayEtc.OCCUR_ENTRY_04; // 승인시간
sExp_DT = m_cPayEtc.OCCUR_ENTRY_11; // 유효기간
sReqNo = ""; // 수신자 번호
//sTrType = PosConst.POS_HAPPYGIFT_INQ_TYPE.RECHANGE_CANCEL; // 전문구분
sTrType = PosConst.POS_VAN_MASTER.TRADE_ID.VAN_POT_ACC_C;
sRet = ExecuteIrt(PosConst.CANCEL_DIV.CANCEL, sTrType, sWCC, sInPutData, sCardData, sReqNo, nPayAmt, nBeforeAmt, nAfterAmt, sApprDate, sApprNo, sApprTime, "1", sExp_DT);
if (sRet != UserCom.RST_OK)
{
//sTrType = PosConst.POS_HAPPYGIFT_INQ_TYPE.RECHANGE_CANCEL; // 전문구분
// 망취소 요청
//sRet = ExecuteIrt(PosConst.CANCEL_DIV.CANCEL, sTrType, sWCC, sInPutData, sCardData, sReqNo, nPayAmt, nBeforeAmt, nAfterAmt, sApprDate, sApprNo, sApprTime, "2", sExp_DT);
//if (sRet != UserCom.RST_OK) return sRet;
}
m_cPayEtc.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
/// <summary>
/// 결제 반품
/// </summary>
/// <param name="aParam"></param>
/// <returns></returns>
public string RefundPayment(string[] aParam)
{
string sRet = UserCom.RST_ERR;
string sTrType = null;
string sWCC = "", sInPutData = "", sCardData = "", sApprNo = "", sApprDate = "", sApprTime = "", sReqNo = "", sExp_DT = "";
double nPayAmt = 0, nBeforeAmt = 0, nAfterAmt = 0;
try
{
int nPayRow = CmUtil.IntParse(aParam[0]); // 취소할 행번호
// 결제 내역 받아 오기
ArrayList alEtcItem = (ArrayList)StateObject.GetItemObject(Column.TR_ETC.ITEM);
m_cPayEtc = (Column.TR_ETC.DATA)alEtcItem[nPayRow];
if (m_cPayEtc.OCCUR_ENTRY_08.ToString() != ItemConst.PAY_APP_DIV.NORMAL)
{
//임의 등록 이면 승인 없이 데이터 처리
//WinManager.ConfirmMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0240));
m_cPayEtc.OCCUR_ENTRY_06 = m_cPayEtc.OCCUR_ENTRY_02;
m_cPayEtc.OCCUR_ENTRY_07 = m_cPayEtc.OCCUR_ENTRY_03;
sRet = UserCom.RST_OK;
}
else
{
sWCC = m_cPayEtc.OCCUR_ENTRY_05; // 입력구분
sInPutData = m_cPayEtc.OCCUR_ENTRY_01; // 입력데이터
sCardData = m_cPayEtc.OCCUR_ENTRY_22; // 카드데이터
nPayAmt = m_cPayEtc.AMT_ENTRY_01; // 대상금액
nBeforeAmt = m_cPayEtc.AMT_ENTRY_03; // 거래전잔액
nAfterAmt = m_cPayEtc.AMT_ENTRY_04; // 거래후잔액
sApprNo = m_cPayEtc.OCCUR_ENTRY_02; // 승인번호
sApprDate = m_cPayEtc.OCCUR_ENTRY_03; // 승인일자
sApprTime = m_cPayEtc.OCCUR_ENTRY_04; // 승인시간
sExp_DT = m_cPayEtc.OCCUR_ENTRY_11; // 유효기간
sReqNo = ""; // 수신자 번호
//sTrType = PosConst.POS_HAPPYGIFT_INQ_TYPE.RECHANGE_CANCEL; // 전문구분
sTrType = PosConst.POS_VAN_MASTER.TRADE_ID.VAN_POT_ACC_C;
sRet = ExecuteIrt(PosConst.CANCEL_DIV.CANCEL, sTrType, sWCC, sInPutData, sCardData, sReqNo, nPayAmt, nBeforeAmt, nAfterAmt, sApprDate, sApprNo, sApprTime, "1", sExp_DT);
if (sRet != UserCom.RST_OK)
{
//sTrType = PosConst.POS_HAPPYGIFT_INQ_TYPE.RECHANGE_CANCEL; // 전문구분
// 망취소 요청
//sRet = ExecuteIrt(PosConst.CANCEL_DIV.CANCEL, sTrType, sWCC, sInPutData, sCardData, sReqNo, nPayAmt, nBeforeAmt, nAfterAmt, sApprDate, sApprNo, sApprTime, "2", sExp_DT);
}
}
}
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
/// <summary>
/// 조회 실행
/// </summary>
/// <param name="sTrType"></param>
/// <param name="sWCC"></param>
/// <param name="sInPutData"></param>
/// <param name="sCardData"></param>
/// <param name="sReqNo"></param>
/// <param name="nPayAmt"></param>
/// <param name="nBeforeAmt"></param>
/// <param name="nAfterAmt"></param>
/// <param name="sApprDate"></param>
/// <param name="sApprNo"></param>
/// <param name="sApprTime"></param>
/// <param name="sCancelType"></param>
/// <param name="mExp_DT"></param>
/// <returns></returns>
public string ExecuteIrt(string sTradeDiv, string sTrType, string sWCC, string sInPutData, string sCardData, string sReqNo, double nPayAmt, double nBeforeAmt, double nAfterAmt, string sApprDate, string sApprNo, string sApprTime, string sCancelType, string sExp_DT)
{
string sRet = UserCom.RST_ERR;
string[] aIrtRspDTL = null;
string sAddInfo = "";
try
{
// 연습모드이면 연습 데이터 설정
if (m_cPosStatus.Base.TrainingFlag == "1" || m_cPosStatus.Mst.TestStorYn == "1" ) return SetTrainingData(sTrType, sWCC, sInPutData, sReqNo, nPayAmt, nBeforeAmt, nAfterAmt, sApprDate, sApprNo, sApprTime, sCancelType, sExp_DT);
// 승인업체 코드 조회
//string sCMPApprID = PosMstManager.GetMstVan(ItemConst.TR_ITEM_ID.PPCARD_ITEM , ItemConst.TR_ITEM_ID.PPCARD.HP_GIFT, PosMst.MST_VAN.DATA.CMP_APPR_ID);
string sVanCD = PosMstManager.GetMstPayDc(ItemConst.TR_ITEM_ID.PPCARD_ITEM, ItemConst.TR_ITEM_ID.PPCARD.HP_GIFT, PosMst.MST_PAY_DC.DATA.APPR_VEND_CD);
sAddInfo = "";
sAddInfo += CmUtil.MidH("0003", 0, 4); // 버전
sAddInfo += CmUtil.MidH(m_cPosStatus.Base.StoreNo, 0, 10); // 지점코드
//sAddInfo += CmUtil.MidH(CmUtil.GetDataRowStr(PosMstManager.GetMstStore(), PosMst.MST_STORE.DATA.STORNM), 0, 20); // 지점명칭
sAddInfo += CmUtil.MidH("", 0, 20);
sAddInfo += CmUtil.MidH(sApprNo, 0, 20); // 승인번호
sAddInfo += CmUtil.MidH(m_cPosStatus.Base.PosNo, 0, 10); // POS NO
//sAddInfo += CmUtil.MidH("", 0, 136); // Filler
string sProductCode = PosMstManager.GetMstVan(ItemConst.TR_ITEM_ID.PPCARD_ITEM, ItemConst.TR_ITEM_ID.PPCARD.HP_GIFT, PosMst.MST_VAN.DATA.HOME_PAGE);
if (sProductCode.Trim().Length == 0) sProductCode = "TT0000"; // 브랜드코드
string sPointType = GetMenuKeyToPointType(PosKey.MENU_KEY.HAPPY_GIFTCARD);
// 조회
//sRet = ExecuteSendRecv(sTradeDiv, sTrType, sWCC, sInPutData, sReqNo, nPayAmt, sApprDate, sApprNo, sApprTime, sCancelType, ref aIrtRspHDR, ref aIrtRspDTL, ref sRecvData);
sRet = ExecutePointIrt(sTradeDiv, m_cPayEtc.ETC_WAY_CD, m_cPayEtc.ETC_DTL_CD_01, sVanCD, sTrType, sPointType, sWCC, sInPutData, sCardData, nPayAmt, sApprDate, CmUtil.MidH(sApprNo, 0, 12), "", sProductCode, "", "", sAddInfo, ref aIrtRspDTL, "", "");
if (sRet != UserCom.RST_OK) return sRet;
// 결제구분 (1:결제, 2:할인)
DataRow dr = PosMstManager.GetMstPayDc(new string[] { m_cPosStatus.Base.CmpCd, m_cPosStatus.Base.StoreNo, m_cPayEtc.ETC_WAY_CD, m_cPayEtc.ETC_DTL_CD_01 });
m_cPayEtc.ETC_AMT = nPayAmt;
m_cPayEtc.ETC_DTL_CD_02 = ""; // 캠페인코드
m_cPayEtc.ETC_DTL_CD_03 = "0"; // 할인금액 아이템 적용여부
// --------------------------------------------------------------------------------------------------------------------------------
// 해피 기프트
// --------------------------------------------------------------------------------------------------------------------------------
//if (sTrType == PosConst.POS_HAPPYGIFT_INQ_TYPE.RECHANGE)
if (sTrType == PosConst.POS_VAN_MASTER.TRADE_ID.VAN_POT_ACC_A)
{
// 충전 응답
int nNowPos = 0;
aIrtRsp_Search = new string[Column.POS_RES_RECHANGE_DTL_HAPPYGIFT.LEN.Length];
byte[] bData = Encoding.Default.GetBytes(aIrtRspDTL[Column.POS_RES_POINT.SEQ.ResAddRespon].Trim());
ItemColumn.ParseMessage(Column.POS_RES_RECHANGE_DTL_HAPPYGIFT.LEN, Column.POS_RES_RECHANGE_DTL_HAPPYGIFT.TYPE, bData, ref nNowPos, ref aIrtRsp_Search);
m_cPayEtc.OCCUR_ENTRY_02 = aIrtRsp_Search[Column.POS_RES_RECHANGE_DTL_HAPPYGIFT.SEQ.ApprNo].Trim(); // 승인번호
m_cPayEtc.OCCUR_ENTRY_03 = CmUtil.MidH(aIrtRspDTL[Column.POS_RES_POINT.SEQ.ResTrDate], 0, 6); // 승인일자
m_cPayEtc.OCCUR_ENTRY_04 = CmUtil.MidH(aIrtRspDTL[Column.POS_RES_POINT.SEQ.ResTrDate], 6, 4); // 승인시간
m_cPayEtc.OCCUR_ENTRY_11 = aIrtRsp_Search[Column.POS_RES_RECHANGE_DTL_HAPPYGIFT.SEQ.Exp_DT].Trim(); // 유효기간
m_cPayEtc.AMT_ENTRY_04 = nPayAmt; // 상품권잔액
}
//else if (sTrType == PosConst.POS_HAPPYGIFT_INQ_TYPE.RECHANGE_CANCEL)
else if (sTrType == PosConst.POS_VAN_MASTER.TRADE_ID.VAN_POT_ACC_C)
{
// 충전 취소 응답
int nNowPos = 0;
aIrtRsp_Search = new string[Column.POS_RES_RECHANGE_CAN_DTL_HAPPYGIFT.LEN.Length];
byte[] bData = Encoding.Default.GetBytes(aIrtRspDTL[Column.POS_RES_POINT.SEQ.ResAddRespon].Trim());
ItemColumn.ParseMessage(Column.POS_RES_RECHANGE_CAN_DTL_HAPPYGIFT.LEN, Column.POS_RES_RECHANGE_CAN_DTL_HAPPYGIFT.TYPE, bData, ref nNowPos, ref aIrtRsp_Search);
m_cPayEtc.OCCUR_ENTRY_02 = aIrtRsp_Search[Column.POS_RES_RECHANGE_CAN_DTL_HAPPYGIFT.SEQ.ApprNo].Trim(); // 승인번호
m_cPayEtc.OCCUR_ENTRY_03 = CmUtil.MidH(aIrtRspDTL[Column.POS_RES_POINT.SEQ.ResTrDate], 0, 6); // 승인일자
m_cPayEtc.OCCUR_ENTRY_04 = CmUtil.MidH(aIrtRspDTL[Column.POS_RES_POINT.SEQ.ResTrDate], 6, 4); // 승인시간
m_cPayEtc.AMT_ENTRY_04 = 0;
//m_cPayEtc.AMT_ENTRY_04 = CmUtil.DoubleParse(aIrtRspDTL[Column.POS_RES_POINT.SEQ.ResSavePoint].Trim()); // 상품권잔액
}
else
{
// 조회 응답
int nNowPos = 0;
aIrtRsp_Search = new string[Column.POS_RES_SEL_DTL_HAPPYGIFT.LEN.Length];
byte[] bData = Encoding.Default.GetBytes(aIrtRspDTL[Column.POS_RES_POINT.SEQ.ResAddRespon].Trim());
ItemColumn.ParseMessage(Column.POS_RES_SEL_DTL_HAPPYGIFT.LEN, Column.POS_RES_SEL_DTL_HAPPYGIFT.TYPE, bData, ref nNowPos, ref aIrtRsp_Search);
m_cPayEtc.OCCUR_ENTRY_10 = CmUtil.DoubleParse(aIrtRsp_Search[Column.POS_RES_SEL_DTL_HAPPYGIFT.SEQ.GiftBalAmt].Trim()).ToString(); // 상품권금액-최초충전금액
m_cPayEtc.AMT_ENTRY_04 = CmUtil.DoubleParse(aIrtRspDTL[Column.POS_RES_POINT.SEQ.ResSavePoint].Trim()); // 상품권잔액
m_cPayEtc.OCCUR_ENTRY_11 = aIrtRsp_Search[Column.POS_RES_SEL_DTL_HAPPYGIFT.SEQ.Exp_DT].Trim(); // 유효기간
m_cPayEtc.OCCUR_ENTRY_12 = aIrtRsp_Search[Column.POS_RES_SEL_DTL_HAPPYGIFT.SEQ.Reg_Dt].Trim(); // 최초 등록일
m_cPayEtc.OCCUR_ENTRY_13 = aIrtRsp_Search[Column.POS_RES_SEL_DTL_HAPPYGIFT.SEQ.Gift_State].Trim(); // 상품권 상태 (00:대기,10:사용가능,20:만기)
m_cPayEtc.OCCUR_ENTRY_14 = aIrtRsp_Search[Column.POS_RES_SEL_DTL_HAPPYGIFT.SEQ.ReChangeYN].Trim(); // 충전가능여부
m_cPayEtc.OCCUR_ENTRY_02 = ""; // 승인번호
m_cPayEtc.OCCUR_ENTRY_03 = ""; // 승인일자
m_cPayEtc.OCCUR_ENTRY_04 = ""; // 승인시간
}
// --------------------------------------------------------------------------------------------------------------------------------
m_cPayEtc.ETC_DTL_CD_05 = PosConst.PAY_DC_TYPE.PAY; // 할인결제구분 (1:결제, 2:할인)
m_cPayEtc.AMT_ENTRY_01 = nPayAmt; // 받은돈
m_cPayEtc.OCCUR_ENTRY_01 = sInPutData; // 카드번호
m_cPayEtc.OCCUR_ENTRY_05 = sWCC; // 입력 구분
m_cPayEtc.OCCUR_ENTRY_06 = sApprNo; // 원승인번호
m_cPayEtc.OCCUR_ENTRY_07 = sApprDate; // 원승인일자
m_cPayEtc.OCCUR_ENTRY_08 = ItemConst.PAY_APP_DIV.NORMAL; // 승인구분
m_cPayEtc.OCCUR_ENTRY_10 = sTrType; // 전문구분
m_cPayEtc.OCCUR_ENTRY_16 = CmUtil.GetDataRowStr(dr, PosMst.MST_PAY_DC.DATA.APPR_VEND_CD); // VAN 구분
m_cPayEtc.OCCUR_ENTRY_20 = GetPayDtlCdToPayDtlName(m_cPayEtc.ETC_WAY_CD, m_cPayEtc.ETC_DTL_CD_01); // 결제수단명
m_cPayEtc.CANCEL_DIV = ItemConst.PAY_CANCEL_DIV.NORMAL;
m_cPayEtc.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;
}
/// <summary>
/// 연습 데이터 설정
/// </summary>
/// <param name="sTrType"></param>
/// <param name="sWCC"></param>
/// <param name="sCardData"></param>
/// <param name="sReqNo"></param>
/// <param name="nPayAmt"></param>
/// <param name="nBeforeAmt"></param>
/// <param name="nAfterAmt"></param>
/// <param name="sApprDate"></param>
/// <param name="sApprNo"></param>
/// <param name="sApprTime"></param>
/// <param name="sCancelType"></param>
/// <param name="sExp_DT"></param>
/// <returns></returns>
public string SetTrainingData(string sTrType, string sWCC, string sCardData, string sReqNo, double nPayAmt, double nBeforeAmt, double nAfterAmt, string sApprDate, string sApprNo, string sApprTime, string sCancelType, string sExp_DT)
{
string sRet = UserCom.RST_ERR;
try
{
// 결제구분 (1:결제, 2:할인)
DataRow dr = PosMstManager.GetMstPayDc(new string[] { m_cPosStatus.Base.CmpCd, m_cPosStatus.Base.StoreNo, m_cPayEtc.ETC_WAY_CD, m_cPayEtc.ETC_DTL_CD_01 });
// 연습모드이면 연습 데이터 설정
m_cPayEtc.ETC_AMT = nPayAmt;
m_cPayEtc.ETC_DTL_CD_02 = ""; // 캠페인코드
m_cPayEtc.ETC_DTL_CD_03 = "0"; // 할인금액 아이템 적용여부
m_cPayEtc.ETC_DTL_CD_05 = PosConst.PAY_DC_TYPE.PAY; // 할인결제구분 (1:결제, 2:할인)
m_cPayEtc.QTY_ENTRY_01 = 3; // 무료횟수
m_cPayEtc.QTY_ENTRY_02 = 6; // 총사용횟수
m_cPayEtc.AMT_ENTRY_01 = nPayAmt; // 사용포인트
m_cPayEtc.AMT_ENTRY_02 = 0; // 제휴 할인 금액
m_cPayEtc.AMT_ENTRY_03 = nBeforeAmt; // 총포인트
m_cPayEtc.AMT_ENTRY_04 = nAfterAmt; // 가용포인트
m_cPayEtc.AMT_ENTRY_05 = 0; // 잔여포인트
m_cPayEtc.AMT_ENTRY_08 = 0;
m_cPayEtc.OCCUR_ENTRY_01 = sCardData; // 카드번호
m_cPayEtc.OCCUR_ENTRY_02 = "99999999"; // 승인번호
m_cPayEtc.OCCUR_ENTRY_03 = DateTime.Now.ToString("yyMMdd"); // 승인일자
m_cPayEtc.OCCUR_ENTRY_04 = DateTime.Now.ToString("HHmmss"); // 승인시간
m_cPayEtc.OCCUR_ENTRY_05 = sWCC; // 입력 구분
m_cPayEtc.OCCUR_ENTRY_06 = sApprNo; // 원승인번호
m_cPayEtc.OCCUR_ENTRY_07 = sApprDate; // 원승인일자
m_cPayEtc.OCCUR_ENTRY_08 = ItemConst.PAY_APP_DIV.COMPULSION; // 승인구분
m_cPayEtc.OCCUR_ENTRY_09 = ""; // 직원카드번호
m_cPayEtc.OCCUR_ENTRY_10 = ""; // 대상 상품 코드
m_cPayEtc.OCCUR_ENTRY_11 = sExp_DT;
m_cPayEtc.OCCUR_ENTRY_16 = CmUtil.GetDataRowStr(dr, PosMst.MST_PAY_DC.DATA.APPR_VEND_CD); // VAN 구분
m_cPayEtc.OCCUR_ENTRY_20 = GetPayDtlCdToPayDtlName(m_cPayEtc.ETC_WAY_CD, m_cPayEtc.ETC_DTL_CD_01); // 결제수단명
m_cPayEtc.OCCUR_ENTRY_22 = sCardData;
m_cPayEtc.CANCEL_DIV = ItemConst.PAY_CANCEL_DIV.NORMAL;
m_cPayEtc.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 /
/// <summary>
/// 승인 요청/응답
/// </summary>
/// <param name="sTrType"></param>
/// <param name="siNqType"></param>
/// <param name="sWCC"></param>
/// <param name="sCardData"></param>
/// <param name="nPayAmt"></param>
/// <param name="sApprDate"></param>
/// <param name="sApprNo"></param>
/// <param name="aIrtRsp"></param>
/// <returns></returns>
protected string ExecuteSendRecv(string sTradeDiv, string sTrType, string sWCC, string sCardData, string sReqNo, double nPayAmt, string sApprDate, string sApprNo, string sApprTime, string sCancelType,
ref string[] aIrtRspHDR, ref string[] aIrtRspDTL, ref string sRecvData)
{
string sSendData = ""; // 송수신 전문
int nNowPos = 0;
string sServerIP = "";
string sServerPort = "";
string sCMPApprID = "";
string sApprID = "";
int iRecvTimeOut = 10000;
string sRecvAppNo = "";
string sErrMsg = "";
byte[] bytes = null;
string sRet = UserCom.RST_ERR;
try
{
// -----------------------------------------------------------------------------------------------------------------------------
// VAN 정보 조회
// -----------------------------------------------------------------------------------------------------------------------------
if (m_cPayEtc.OCCUR_ENTRY_16.Trim().Length != 0)
{
// VAN_ID가 있는 경우 VAN_ID로 VAN 정보 조회
sServerIP = PosMstManager.GetMstVan(m_cPayEtc.OCCUR_ENTRY_16.Trim(), PosMst.MST_VAN.DATA.IP);
sServerPort = PosMstManager.GetMstVan(m_cPayEtc.OCCUR_ENTRY_16.Trim(), PosMst.MST_VAN.DATA.PORT);
sCMPApprID = PosMstManager.GetMstVan(m_cPayEtc.OCCUR_ENTRY_16.Trim(), PosMst.MST_VAN.DATA.CMP_APPR_ID);
sApprID = PosMstManager.GetMstVan(m_cPayEtc.OCCUR_ENTRY_16.Trim(), PosMst.MST_VAN.DATA.APPR_ID);
}
else
{
// VAN_ID가 미정인 경우 결제수단으로 VAN 정보 조회
sServerIP = PosMstManager.GetMstVan(m_cPayEtc.ETC_WAY_CD, m_cPayEtc.ETC_DTL_CD_01, PosMst.MST_VAN.DATA.IP);
sServerPort = PosMstManager.GetMstVan(m_cPayEtc.ETC_WAY_CD, m_cPayEtc.ETC_DTL_CD_01, PosMst.MST_VAN.DATA.PORT);
sCMPApprID = PosMstManager.GetMstVan(m_cPayEtc.ETC_WAY_CD, m_cPayEtc.ETC_DTL_CD_01, PosMst.MST_VAN.DATA.CMP_APPR_ID);
sApprID = PosMstManager.GetMstVan(m_cPayEtc.ETC_WAY_CD, m_cPayEtc.ETC_DTL_CD_01, PosMst.MST_VAN.DATA.APPR_ID);
}
// -----------------------------------------------------------------------------------------------------------------------------
if (sServerIP.Trim() == "")
{
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0565);
return sRet;
}
// 전문 생성
sSendData = GetMakeiNQData(sTrType, sCancelType, sCardData, sReqNo, nPayAmt, sApprDate, sApprNo, sApprTime);
// 요청 - 승인로그 저장 (판매구분, [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, sTrType, "S", sCardData, nPayAmt.ToString(), "", "", "", "", "", sSendData });
// 전문 송수신
sRet = m_cDataCommon.ExecuteLenIrt(sServerIP, CmUtil.IntParse(sServerPort), iRecvTimeOut, sSendData, ref sRecvData, 8, 0);
if (sRet != UserCom.RST_OK)
{
WinManager.ErrorMessage(sRet);
return sRet;
}
bytes = Encoding.Default.GetBytes(sRecvData);
aIrtRspHDR = new string[Column.POS_HDR_HAPPYGIFT.LEN.Length];
ItemColumn.ParseMessage(Column.POS_HDR_HAPPYGIFT.LEN, Column.POS_HDR_HAPPYGIFT.TYPE, bytes, ref nNowPos, ref aIrtRspHDR);
nNowPos = 0;
// - 'O00' : 승인 그외 : 거절, 기취소 (E0010)
if (aIrtRspHDR[Column.POS_HDR_HAPPYGIFT.SEQ.ResStatus].Trim() != "000")
{
if (aIrtRspHDR[Column.POS_HDR_HAPPYGIFT.SEQ.ErrCD].Trim() == "E0010")
{
// 기타 오류
bytes = Encoding.Default.GetBytes(CmUtil.MidH(sRecvData, 88, sRecvData.Length));
aIrtRspDTL = new string[Column.POS_RES_ERR_DTL_HAPPYGIFT.LEN.Length];
ItemColumn.ParseMessage(Column.POS_RES_ERR_DTL_HAPPYGIFT.LEN, Column.POS_RES_ERR_DTL_HAPPYGIFT.TYPE, bytes, ref nNowPos, ref aIrtRspDTL);
sErrMsg = aIrtRspDTL[Column.POS_RES_ERR_DTL_HAPPYGIFT.SEQ.ErrMesg].Trim();
sRet = aIrtRspDTL[Column.POS_RES_ERR_DTL_HAPPYGIFT.SEQ.ErrMesg].Trim();
WinManager.ErrorMessage(sRet);
sRet = UserCom.RST_OK;
return sRet;
}
else
{
// 기타 오류
bytes = Encoding.Default.GetBytes(CmUtil.MidH(sRecvData, 88, sRecvData.Length));
aIrtRspDTL = new string[Column.POS_RES_ERR_DTL_HAPPYGIFT.LEN.Length];
ItemColumn.ParseMessage(Column.POS_RES_ERR_DTL_HAPPYGIFT.LEN, Column.POS_RES_ERR_DTL_HAPPYGIFT.TYPE, bytes, ref nNowPos, ref aIrtRspDTL);
sErrMsg = aIrtRspDTL[Column.POS_RES_ERR_DTL_HAPPYGIFT.SEQ.ErrMesg].Trim();
sRet = aIrtRspDTL[Column.POS_RES_ERR_DTL_HAPPYGIFT.SEQ.ErrMesg].Trim();
WinManager.ErrorMessage(sRet);
}
// 응답 - 승인로그 저장 (판매구분, [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, sTrType, "R"
, sCardData, nPayAmt.ToString()
, sRecvAppNo, aIrtRspHDR[Column.POS_HDR_HAPPYGIFT.SEQ.SaleDate].Trim(), aIrtRspHDR[Column.POS_HDR_HAPPYGIFT.SEQ.SaleTime].Trim()
, aIrtRspHDR[Column.POS_HDR_HAPPYGIFT.SEQ.ResStatus].Trim()
, sRet
, sRecvData });
return sRet;
}
//if (aIrtRspHDR[Column.POS_HDR_HAPPYGIFT.SEQ.TranType].Trim() == PosConst.POS_HAPPYGIFT_INQ_TYPE.SEARCH)
if (aIrtRspHDR[Column.POS_HDR_HAPPYGIFT.SEQ.TranType].Trim() == PosConst.POS_VAN_MASTER.TRADE_ID.VAN_POT_QRY_A)
{
// 조회 정상 상세항목
bytes = Encoding.Default.GetBytes(CmUtil.MidH(sRecvData, 88, sRecvData.Length));
aIrtRspDTL = new string[Column.POS_RES_SEL_DTL_HAPPYGIFT.LEN.Length];
ItemColumn.ParseMessage(Column.POS_RES_SEL_DTL_HAPPYGIFT.LEN, Column.POS_RES_SEL_DTL_HAPPYGIFT.TYPE, bytes, ref nNowPos, ref aIrtRspDTL);
}
//else if (aIrtRspHDR[Column.POS_HDR_HAPPYGIFT.SEQ.TranType].Trim() == PosConst.POS_HAPPYGIFT_INQ_TYPE.APPROVAL)
else if (aIrtRspHDR[Column.POS_HDR_HAPPYGIFT.SEQ.TranType].Trim() == PosConst.POS_VAN_MASTER.TRADE_ID.VAN_POT_ACC_A)
{
// 승인 상세항목
bytes = Encoding.Default.GetBytes(CmUtil.MidH(sRecvData, 88, sRecvData.Length));
aIrtRspDTL = new string[Column.POS_RES_APP_DTL_HAPPYGIFT.LEN.Length];
ItemColumn.ParseMessage(Column.POS_RES_APP_DTL_HAPPYGIFT.LEN, Column.POS_RES_APP_DTL_HAPPYGIFT.TYPE, bytes, ref nNowPos, ref aIrtRspDTL);
sRecvAppNo = aIrtRspDTL[Column.POS_RES_APP_DTL_HAPPYGIFT.SEQ.ApprNo].Trim();
}
//else if (aIrtRspHDR[Column.POS_HDR_HAPPYGIFT.SEQ.TranType].Trim() == PosConst.POS_HAPPYGIFT_INQ_TYPE.APPROVAL_CANCEL)
else if (aIrtRspHDR[Column.POS_HDR_HAPPYGIFT.SEQ.TranType].Trim() == PosConst.POS_VAN_MASTER.TRADE_ID.VAN_POT_ACC_C)
{
// 승인취소 상세항목
bytes = Encoding.Default.GetBytes(CmUtil.MidH(sRecvData, 88, sRecvData.Length));
aIrtRspDTL = new string[Column.POS_RES_CAN_DTL_HAPPYGIFT.LEN.Length];
ItemColumn.ParseMessage(Column.POS_RES_CAN_DTL_HAPPYGIFT.LEN, Column.POS_RES_CAN_DTL_HAPPYGIFT.TYPE, bytes, ref nNowPos, ref aIrtRspDTL);
sRecvAppNo = aIrtRspDTL[Column.POS_RES_CAN_DTL_HAPPYGIFT.SEQ.ApprNo].Trim();
}
//else if (aIrtRspHDR[Column.POS_HDR_HAPPYGIFT.SEQ.TranType].Trim() == PosConst.POS_HAPPYGIFT_INQ_TYPE.RECHANGE)
else if (aIrtRspHDR[Column.POS_HDR_HAPPYGIFT.SEQ.TranType].Trim() == PosConst.POS_VAN_MASTER.TRADE_ID.VAN_POT_ACC_A)
{
// 승인 상세항목
bytes = Encoding.Default.GetBytes(CmUtil.MidH(sRecvData, 88, sRecvData.Length));
aIrtRspDTL = new string[Column.POS_RES_RECHANGE_DTL_HAPPYGIFT.LEN.Length];
ItemColumn.ParseMessage(Column.POS_RES_RECHANGE_DTL_HAPPYGIFT.LEN, Column.POS_RES_RECHANGE_DTL_HAPPYGIFT.TYPE, bytes, ref nNowPos, ref aIrtRspDTL);
sRecvAppNo = aIrtRspDTL[Column.POS_RES_RECHANGE_DTL_HAPPYGIFT.SEQ.ApprNo].Trim();
}
//else if (aIrtRspHDR[Column.POS_HDR_HAPPYGIFT.SEQ.TranType].Trim() == PosConst.POS_HAPPYGIFT_INQ_TYPE.RECHANGE_CANCEL)
else if (aIrtRspHDR[Column.POS_HDR_HAPPYGIFT.SEQ.TranType].Trim() == PosConst.POS_VAN_MASTER.TRADE_ID.VAN_POT_ACC_C)
{
// 승인취소 상세항목
bytes = Encoding.Default.GetBytes(CmUtil.MidH(sRecvData, 88, sRecvData.Length));
aIrtRspDTL = new string[Column.POS_RES_RECHANGE_CAN_DTL_HAPPYGIFT.LEN.Length];
ItemColumn.ParseMessage(Column.POS_RES_RECHANGE_CAN_DTL_HAPPYGIFT.LEN, Column.POS_RES_RECHANGE_CAN_DTL_HAPPYGIFT.TYPE, bytes, ref nNowPos, ref aIrtRspDTL);
sRecvAppNo = aIrtRspDTL[Column.POS_RES_RECHANGE_CAN_DTL_HAPPYGIFT.SEQ.ApprNo].Trim();
}
// 응답 - 승인로그 저장 (판매구분, [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, sTrType, "R"
, sCardData, nPayAmt.ToString()
, sRecvAppNo, aIrtRspHDR[Column.POS_HDR_HAPPYGIFT.SEQ.SaleDate].Trim(), aIrtRspHDR[Column.POS_HDR_HAPPYGIFT.SEQ.SaleTime].Trim()
, aIrtRspHDR[Column.POS_HDR_HAPPYGIFT.SEQ.ResStatus].Trim()
, sErrMsg
, sRecvData });
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
/// <summary>
/// 전문 생성
/// </summary>
/// <param name="sTrType"></param>
/// <param name="siNqType"></param>
/// <param name="sWCC"></param>
/// <param name="sCardData"></param>
/// <param name="nPayAmt"></param>
/// <param name="sApprDate"></param>
/// <param name="sApprNo"></param>
/// <returns></returns>
protected string GetMakeiNQData(string sTrType, string sCancelType, string sCardData, string sReqNo, double nPayAmt, string sApprDate, string sApprNo, string sApprTime)
{
string sSendData = string.Empty;
string sSendData_Body = string.Empty;
double nHeaderLen = 0;
double nBodyLen = 0;
string sApprID = null;
try
{
// -----------------------------------------------------------------------------------------
// 해피 기프트
// -----------------------------------------------------------------------------------------
// 헤더
string[] aIrtHeader = new string[Column.POS_HDR_HAPPYGIFT.LEN.Length];
// 헤더 길이
nHeaderLen = ItemColumn.LenMessage(Column.POS_HDR_HAPPYGIFT.LEN);
//if (sTrType == PosConst.POS_HAPPYGIFT_INQ_TYPE.SEARCH)
if (sTrType == PosConst.POS_VAN_MASTER.TRADE_ID.VAN_POT_QRY_A)
{
// 조회
// Body 요청 전문 생성
string[] aIrtBody = new string[Column.POS_RES_SEL_DTL_HAPPYGIFT.LEN.Length];
// Body 길이
nBodyLen = ItemColumn.LenMessage(Column.POS_RES_SEL_DTL_HAPPYGIFT.LEN);
// Body 정보 설정
//aIrtBody[Column.POS_RES_SEL_DTL_HAPPYGIFT.SEQ.GiftNo] = sCardData;
//aIrtBody[Column.POS_RES_SEL_DTL_HAPPYGIFT.SEQ.GiftAmt] = "0";
aIrtBody[Column.POS_RES_SEL_DTL_HAPPYGIFT.SEQ.GiftBalAmt] = "0";
aIrtBody[Column.POS_RES_SEL_DTL_HAPPYGIFT.SEQ.Exp_DT] = "";
aIrtBody[Column.POS_RES_SEL_DTL_HAPPYGIFT.SEQ.Reg_Dt] = "";
aIrtBody[Column.POS_RES_SEL_DTL_HAPPYGIFT.SEQ.Gift_State ] = "";
aIrtBody[Column.POS_RES_SEL_DTL_HAPPYGIFT.SEQ.ReChangeYN] = "";
sSendData_Body = ItemColumn.MakeMessage(aIrtBody, Column.POS_RES_SEL_DTL_HAPPYGIFT.LEN, Column.POS_RES_SEL_DTL_HAPPYGIFT.TYPE);
}
//else if (sTrType == PosConst.POS_HAPPYGIFT_INQ_TYPE.APPROVAL)
else if (sTrType == PosConst.POS_VAN_MASTER.TRADE_ID.VAN_POT_USE_A)
{
// 승인
// Body 요청 전문 생성
string[] aIrtBody = new string[Column.POS_RES_APP_DTL_HAPPYGIFT.LEN.Length];
// Body 길이
nBodyLen = ItemColumn.LenMessage(Column.POS_RES_APP_DTL_HAPPYGIFT.LEN);
// Body 정보 설정
aIrtBody[Column.POS_RES_APP_DTL_HAPPYGIFT.SEQ.GiftNo] = sCardData;
aIrtBody[Column.POS_RES_APP_DTL_HAPPYGIFT.SEQ.ApprNo] = "";
aIrtBody[Column.POS_RES_APP_DTL_HAPPYGIFT.SEQ.PayAmt] = nPayAmt.ToString();
aIrtBody[Column.POS_RES_APP_DTL_HAPPYGIFT.SEQ.BalanceAmt] = "0";
aIrtBody[Column.POS_RES_APP_DTL_HAPPYGIFT.SEQ.iTemNm] = "";
aIrtBody[Column.POS_RES_APP_DTL_HAPPYGIFT.SEQ.Exp_DT] = "";
sSendData_Body = ItemColumn.MakeMessage(aIrtBody, Column.POS_RES_APP_DTL_HAPPYGIFT.LEN, Column.POS_RES_APP_DTL_HAPPYGIFT.TYPE);
}
//else if (sTrType == PosConst.POS_HAPPYGIFT_INQ_TYPE.APPROVAL_CANCEL)
else if (sTrType == PosConst.POS_VAN_MASTER.TRADE_ID.VAN_POT_USE_C)
{
// 취소
// Body 요청 전문 생성
string[] aIrtBody = new string[Column.POS_RES_CAN_DTL_HAPPYGIFT.LEN.Length];
// Body 길이
nBodyLen = ItemColumn.LenMessage(Column.POS_RES_CAN_DTL_HAPPYGIFT.LEN);
// Body 정보 설정
aIrtBody[Column.POS_RES_CAN_DTL_HAPPYGIFT.SEQ.GiftNo] = sCardData;
aIrtBody[Column.POS_RES_CAN_DTL_HAPPYGIFT.SEQ.ApprNo] = sApprNo;
aIrtBody[Column.POS_RES_CAN_DTL_HAPPYGIFT.SEQ.PayAmt] = nPayAmt.ToString();
aIrtBody[Column.POS_RES_CAN_DTL_HAPPYGIFT.SEQ.CancelType] = sCancelType;
aIrtBody[Column.POS_RES_CAN_DTL_HAPPYGIFT.SEQ.BalanceAmt] = "0";
aIrtBody[Column.POS_RES_CAN_DTL_HAPPYGIFT.SEQ.Exp_DT] = "";
sSendData_Body = ItemColumn.MakeMessage(aIrtBody, Column.POS_RES_CAN_DTL_HAPPYGIFT.LEN, Column.POS_RES_CAN_DTL_HAPPYGIFT.TYPE);
}
//else if (sTrType == PosConst.POS_HAPPYGIFT_INQ_TYPE.RECHANGE)
else if (sTrType == PosConst.POS_VAN_MASTER.TRADE_ID.VAN_POT_ACC_A)
{
// 승인
// Body 요청 전문 생성
string[] aIrtBody = new string[Column.POS_RES_RECHANGE_DTL_HAPPYGIFT.LEN.Length];
// Body 길이
nBodyLen = ItemColumn.LenMessage(Column.POS_RES_RECHANGE_DTL_HAPPYGIFT.LEN);
// Body 정보 설정
//aIrtBody[Column.POS_RES_RECHANGE_DTL_HAPPYGIFT.SEQ.GiftNo] = sCardData;
aIrtBody[Column.POS_RES_RECHANGE_DTL_HAPPYGIFT.SEQ.ApprNo] = "";
//aIrtBody[Column.POS_RES_RECHANGE_DTL_HAPPYGIFT.SEQ.Pay_Type] = "H";
//aIrtBody[Column.POS_RES_RECHANGE_DTL_HAPPYGIFT.SEQ.PayAmt] = nPayAmt.ToString();
aIrtBody[Column.POS_RES_RECHANGE_DTL_HAPPYGIFT.SEQ.Exp_DT] = "";
sSendData_Body = ItemColumn.MakeMessage(aIrtBody, Column.POS_RES_RECHANGE_DTL_HAPPYGIFT.LEN, Column.POS_RES_RECHANGE_DTL_HAPPYGIFT.TYPE);
}
//else if (sTrType == PosConst.POS_HAPPYGIFT_INQ_TYPE.RECHANGE_CANCEL)
else if (sTrType == PosConst.POS_VAN_MASTER.TRADE_ID.VAN_POT_ACC_C)
{
// 취소
// Body 요청 전문 생성
string[] aIrtBody = new string[Column.POS_RES_RECHANGE_CAN_DTL_HAPPYGIFT.LEN.Length];
// Body 길이
nBodyLen = ItemColumn.LenMessage(Column.POS_RES_RECHANGE_CAN_DTL_HAPPYGIFT.LEN);
// Body 정보 설정
//aIrtBody[Column.POS_RES_RECHANGE_CAN_DTL_HAPPYGIFT.SEQ.GiftNo] = sCardData;
aIrtBody[Column.POS_RES_RECHANGE_CAN_DTL_HAPPYGIFT.SEQ.ApprNo] = sApprNo;
//aIrtBody[Column.POS_RES_RECHANGE_CAN_DTL_HAPPYGIFT.SEQ.CancelType] = sCancelType;
//aIrtBody[Column.POS_RES_RECHANGE_CAN_DTL_HAPPYGIFT.SEQ.PayAmt] = nPayAmt.ToString();
//aIrtBody[Column.POS_RES_RECHANGE_CAN_DTL_HAPPYGIFT.SEQ.BalanceAmt] = "0";
sSendData_Body = ItemColumn.MakeMessage(aIrtBody, Column.POS_RES_RECHANGE_CAN_DTL_HAPPYGIFT.LEN, Column.POS_RES_RECHANGE_CAN_DTL_HAPPYGIFT.TYPE);
}
// 헤더길이를 전체 길이로 변경
nHeaderLen += nBodyLen;
// 제휴사 코드
sApprID = PosMstManager.GetMstVan(m_cPayEtc.ETC_WAY_CD, m_cPayEtc.ETC_DTL_CD_01, PosMst.MST_VAN.DATA.APPR_ID);
// 헤더 정보 설정
aIrtHeader[Column.POS_HDR_HAPPYGIFT.SEQ.HeadLen] = nHeaderLen.ToString();
aIrtHeader[Column.POS_HDR_HAPPYGIFT.SEQ.DocVer] = "0003";
aIrtHeader[Column.POS_HDR_HAPPYGIFT.SEQ.BrandID] = sApprID;
aIrtHeader[Column.POS_HDR_HAPPYGIFT.SEQ.TranType] = sTrType;
aIrtHeader[Column.POS_HDR_HAPPYGIFT.SEQ.StoreCD] = m_cPosStatus.Base.StoreNo;
aIrtHeader[Column.POS_HDR_HAPPYGIFT.SEQ.StoreNM] = CmUtil.GetDataRowStr(PosMstManager.GetMstStore(), PosMst.MST_STORE.DATA.STORNM);
aIrtHeader[Column.POS_HDR_HAPPYGIFT.SEQ.PosNo] = m_cPosStatus.Base.PosNo;
aIrtHeader[Column.POS_HDR_HAPPYGIFT.SEQ.ReqNoChk] = "2";
aIrtHeader[Column.POS_HDR_HAPPYGIFT.SEQ.SaleDate] = sApprDate;
aIrtHeader[Column.POS_HDR_HAPPYGIFT.SEQ.SaleTime] = sApprTime;
aIrtHeader[Column.POS_HDR_HAPPYGIFT.SEQ.ResStatus] = "";
aIrtHeader[Column.POS_HDR_HAPPYGIFT.SEQ.ErrCD] = "";
aIrtHeader[Column.POS_HDR_HAPPYGIFT.SEQ.BodyLen] = nBodyLen.ToString();
sSendData = ItemColumn.MakeMessage(aIrtHeader, Column.POS_HDR_HAPPYGIFT.LEN, Column.POS_HDR_HAPPYGIFT.TYPE);
sSendData += sSendData_Body;
// -----------------------------------------------------------------------------------------
}
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 Host
/// <summary>
/// Host 조회 실행
/// </summary>
public string ExecuteHostIrt(string sPosMenuKey, string sInqFlag, string sCardNo, string sStrDate, string sEndDate, ref Hashtable htRecvData)
{
int iRecvTimeOut = 10000;
string sRet = UserCom.RST_ERR;
Hashtable htSendData = new Hashtable();
try
{
// 조회
htSendData.Add(Column.IQ_HAPPYGIFT_RECHANGE_TRAN_REQ.DATA.INQ_TYPE, sPosMenuKey);
htSendData.Add(Column.IQ_HAPPYGIFT_RECHANGE_TRAN_REQ.DATA.STOR_CD, m_cPosStatus.Base.StoreNo);
htSendData.Add(Column.IQ_HAPPYGIFT_RECHANGE_TRAN_REQ.DATA.INQ_FLAG, sInqFlag);
htSendData.Add(Column.IQ_HAPPYGIFT_RECHANGE_TRAN_REQ.DATA.STR_DATE, sStrDate);
htSendData.Add(Column.IQ_HAPPYGIFT_RECHANGE_TRAN_REQ.DATA.END_DATE, sEndDate);
htSendData.Add(Column.IQ_HAPPYGIFT_RECHANGE_TRAN_REQ.DATA.CARD_NO, sCardNo);
sRet = m_cDataCommon.ExecutePosIrt(ItemConst.COMM_MSG_TYPE.POSIRT, m_cPosStatus.Base.CommSvrIp, (int)m_cPosStatus.Base.BizInqPort, iRecvTimeOut, htSendData, ref htRecvData);
if (sRet != UserCom.RST_OK)
{
WinManager.ErrorMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0259));
sRet = UserCom.RST_ERR;
return sRet;
}
if (htRecvData[Column.IQ_HAPPYGIFT_RECHANGE_TRAN_RSP.DATA.RES_CD].ToString() != "00")
{
WinManager.ErrorMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0269) + " (" + htRecvData[Column.IQ_HAPPYGIFT_RECHANGE_TRAN_RSP.DATA.RES_CD].ToString() + ")" + "\n\r");
sRet = UserCom.RST_ERR;
return sRet;
}
sRet = UserCom.RST_OK;
return 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);
}
finally
{
//여전법 대응!
//////////////////////////////////////////////////////////////////////////////////
CmUtil.ZeroFillClear(ref sCardNo);
//////////////////////////////////////////////////////////////////////////////////
}
return sRet;
}
#endregion
}
}