spc-kiosk-pb/Service/BsvPayment/MobileCoupon.cs
2019-06-16 14:12:09 +09:00

1975 lines
137 KiB
C#

using System;
using System.Collections;
using System.Text;
using Cosmos.UserFrame;
using Cosmos.ServiceProvider;
using Cosmos.Common;
using Cosmos.CommonManager;
using System.Data;
using System.Runtime.InteropServices;
/*-----------------------------------------------------------------------------------------------*/
// 설 명 : 모바일쿠폰
// 작 성 자 :
// 변경 이력 :
/*-----------------------------------------------------------------------------------------------*/
namespace Cosmos.Service
{
class MobileCoupon : PaymentBase, IPaymentUs
{
#region
// 접속정보
private IDataCommonUs m_cDataCommon = null;
private string[] aIrtRsp_Search = null;
public MobileCoupon()
{
m_cDataCommon = (IDataCommonUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.DATA_COMMON);
}
#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;
try
{
string sPosMenuKey = aParam[0]; // 메뉴키
string sWCC = aParam[1]; // 입력구분
string sInPutData = aParam[2]; // 입력데이터
string sCardData = aParam[3]; // 카드데이터
double nPayAmt = CmUtil.DoubleParse(aParam[4]); // 대상금액
string sApprNo = aParam[6]; // 승인번호
string sApprDate = DateTime.Now.ToString("yyyyMMdd"); // 승인일자
string sApprTime = DateTime.Now.ToString("HHmmss"); // 승인시간
string sReqNo = ""; // 수신자 번호
string siTemCD = ""; // 상품코드
string sCouponType = "0"; // 권종구분 (0:상품교환권, 1:금액권)
m_cPayItem = new Column.TR_PAYMENT.DATA(); // 결과 저장 변수 생성
m_cPayItem.PAY_WAY_CD = aParam[8]; // 결제수단
m_cPayItem.PAY_DTL_CD_01 = aParam[9]; // 상세코드
string sTrType = GetTranType(PosConst.POS_INQ_MODE.SEARCH); // 전문구분
sRet = ExecuteIrt(PosConst.CANCEL_DIV.NORMAL, sTrType, sWCC, sInPutData, sCardData, sReqNo, nPayAmt, sApprDate, "", sApprTime, siTemCD, "", ref aRet);
}
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 GetPayment
/// <summary>
/// 결제 정보 획득
/// </summary>
/// <param name="aParam"></param>
/// <returns></returns>
public object GetPayment(string[] aParam)
{
return m_cPayItem;
}
#endregion
#region SetPayment
/// <summary>
/// 결제 등록
/// </summary>
/// <param name="aParam"></param>
/// <returns></returns>
public string SetPayment(string[] aParam)
{
string sRet = UserCom.RST_ERR;
string sTrType = null;
try
{
string[] aRet = null;
string sPosMenuKey = aParam[0]; // 메뉴키
string sWCC = aParam[1]; // 입력구분
string sInPutData = aParam[2]; // 입력데이터
string sCardData = aParam[3]; // 카드데이터
double nPayAmt = CmUtil.DoubleParse(aParam[4]); // 대상금액
string sApprNo = aParam[6]; // 승인번호
string sApprDate = DateTime.Now.ToString("yyyyMMdd"); // 승인일자
string sApprTime = DateTime.Now.ToString("HHmmss"); // 승인시간
//m_cPayItem = new Column.TR_PAYMENT.DATA(); // 결과 저장 변수 생성
m_cPayItem.PAY_WAY_CD = aParam[8]; // 결제수단
m_cPayItem.PAY_DTL_CD_01 = aParam[9]; // 상세코드
string sReqNo = ""; // 수신자 번호
string sCouponType = "0"; // 권종구분 (0:상품교환권, 1:금액권)
string siTemCD = aParam[10]; // 상품코드
string sProductiTem = aParam[11]; // 프로덕트 상품 정보
sTrType = GetTranType(PosConst.POS_INQ_MODE.APPROVAL); // 전문구분
// 승인요청
sRet = ExecuteIrt(PosConst.CANCEL_DIV.NORMAL, sTrType, sWCC, sInPutData, sCardData, sReqNo, nPayAmt, sApprDate, sApprNo, sApprTime, siTemCD, sProductiTem, ref aRet);
if (sRet != UserCom.RST_OK)
{
sTrType = GetTranType(PosConst.POS_INQ_MODE.NETCANCEL); // 전문구분
// 망취소 요청
sRet = ExecuteIrt(PosConst.CANCEL_DIV.CANCEL, sTrType, sWCC, sInPutData, sCardData, sReqNo, nPayAmt, sApprDate, sApprNo, sApprTime, siTemCD, sProductiTem, ref aRet);
if (sRet != UserCom.RST_OK) return sRet;
return sRet;
}
// 프로모션 할인 적용
if (sProductiTem.Trim() != "")
{
if (m_cPayItem.PAY_DTL_CD_01 == ItemConst.TR_ITEM_ID.MOBILECON.GIFTSHOW)
{
SetPluDcAmount(ItemConst.PLU_DC_DIV.GIFTSHOW_DC, sProductiTem, sCardData);
}
else
{
SetPluDcAmount(m_cPayItem.PAY_WAY_CD + m_cPayItem.PAY_DTL_CD_01, sProductiTem, sCardData); // 상품아이템에 할인금액 설정
}
}
// 결제 아이템 추가
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);
}
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;
try
{
string[] aRet = null;
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];
string sWCC = m_cPayItem.OCCUR_ENTRY_05; // 입력구분
string sInPutData = m_cPayItem.OCCUR_ENTRY_01; // 입력데이터
string sCardData = m_cPayItem.OCCUR_ENTRY_22; // 카드데이터
double nPayAmt = m_cPayItem.AMT_ENTRY_01; // 대상금액
string sApprDate = m_cPayItem.OCCUR_ENTRY_03; // 승인일자
string sApprNo = m_cPayItem.OCCUR_ENTRY_02; // 승인번호
string sApprTime = m_cPayItem.OCCUR_ENTRY_04; // 승인시간
string sReqNo = ""; // 수신자 번호
string siTemCD = m_cPayItem.OCCUR_ENTRY_09; // 상품코드
string sCouponType = m_cPayItem.OCCUR_ENTRY_10; // 권종구분 (0:상품교환권, 1:금액권)
string sProductiTem = m_cPayItem.OCCUR_ENTRY_15; // 프로덕트 상품정보
sTrType = GetTranType(PosConst.POS_INQ_MODE.REFUND); // 전문구분
sRet = ExecuteIrt(PosConst.CANCEL_DIV.CANCEL, sTrType, sWCC, sInPutData, sCardData, sReqNo, nPayAmt, sApprDate, sApprNo, sApprTime, siTemCD, sProductiTem, ref aRet);
if (sRet != UserCom.RST_OK)
{
sTrType = GetTranType(PosConst.POS_INQ_MODE.NETCANCEL); // 전문구분
// 망취소 요청
sRet = ExecuteIrt(PosConst.CANCEL_DIV.CANCEL, sTrType, sWCC, sInPutData, sCardData, sReqNo, nPayAmt, sApprDate, sApprNo, sApprTime, siTemCD, sProductiTem, ref aRet);
if (sRet != UserCom.RST_OK) return sRet;
}
m_cPayItem.CANCEL_DIV = PosConst.CANCEL_DIV.CANCEL;
// 할인취소
if (sProductiTem.Trim() != "")
{
if (m_cPayItem.PAY_DTL_CD_01 == ItemConst.TR_ITEM_ID.MOBILECON.GIFTSHOW)
{
ClearPluDcAmount(ItemConst.PLU_DC_DIV.GIFTSHOW_DC);
}
else
{
ClearPluDcAmount(m_cPayItem.PAY_WAY_CD + m_cPayItem.PAY_DTL_CD_01);
}
}
m_cDataService.UpdatePluAmount(); // 상품 합계금액 계산(거래해더)
m_cDataService.UpdatePayAmount(); // 결제 금액 재 계산 처리
//WinManager.ConfirmMessage(sPointType + " " + MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0068));
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 RefundPayment
/// <summary>
/// 결제 반품
/// </summary>
/// <param name="aParam"></param>
/// <returns></returns>
public string RefundPayment(string[] aParam)
{
string sRet = UserCom.RST_ERR;
string sTrType = null;
try
{
string[] aRet = null;
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
{
string sWCC = m_cPayItem.OCCUR_ENTRY_05; // 입력구분
string sInPutData = m_cPayItem.OCCUR_ENTRY_01; // 입력데이터
string sCardData = m_cPayItem.OCCUR_ENTRY_22; // 카드데이터
double nPayAmt = m_cPayItem.AMT_ENTRY_01; // 대상금액
string sApprDate = m_cPayItem.OCCUR_ENTRY_03; // 승인일자
string sApprNo = m_cPayItem.OCCUR_ENTRY_02; // 승인번호
string sApprTime = m_cPayItem.OCCUR_ENTRY_04; // 승인시간
string sReqNo = ""; // 수신자 번호
string siTemCD = m_cPayItem.OCCUR_ENTRY_09; // 상품코드
string sCouponType = m_cPayItem.OCCUR_ENTRY_10; // 권종구분 (0:상품교환권, 1:금액권)
string sProductiTem = m_cPayItem.OCCUR_ENTRY_15; // 프로덕트 상품정보
sTrType = GetTranType(PosConst.POS_INQ_MODE.REFUND); // 전문구분
sRet = ExecuteIrt(PosConst.CANCEL_DIV.CANCEL, sTrType, sWCC, sInPutData, sCardData, sReqNo, nPayAmt, sApprDate, sApprNo, sApprTime, siTemCD, sProductiTem, ref aRet);
if (sRet != UserCom.RST_OK)
{
sTrType = GetTranType(PosConst.POS_INQ_MODE.NETCANCEL); // 전문구분
// 망취소 요청
sRet = ExecuteIrt(PosConst.CANCEL_DIV.CANCEL, sTrType, sWCC, sInPutData, sCardData, sReqNo, nPayAmt, sApprDate, sApprNo, sApprTime, siTemCD, sProductiTem, ref aRet);
}
}
}
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 SetMenualPayment
public string SetMenualPayment(string[] aParam)
{
throw new NotImplementedException();
}
#endregion
#region
/// <summary>
/// 조회 실행
/// </summary>
/// <param name="sTradeDiv"></param>
/// <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="sApprDate"></param>
/// <param name="sApprNo"></param>
/// <param name="sApprTime"></param>
/// <param name="siTemCD"></param>
/// <returns></returns>
public string ExecuteIrt(string sTradeDiv, string sTrType, string sWCC, string sInPutData, string sCardData, string sReqNo, double nPayAmt, string sApprDate, string sApprNo, string sApprTime, string siTemCD, string sProductiTem, ref string[] aIrtRspDTL)
{
string sRet = UserCom.RST_ERR;
string[] aIrtRspHDR = null;
byte[] bRecvData = null;
string[] aRecvCost = null;
double nRecvCost = 0;
try
{
// 연습모드이면 연습 데이터 설정
if (m_cPosStatus.Base.TrainingFlag == "1" || m_cPosStatus.Mst.TestStorYn == "1") return SetTrainingData(sTrType, sWCC, sInPutData, sReqNo, nPayAmt, sApprDate, sApprNo, sApprTime, siTemCD, sProductiTem);
// 조회
sRet = ExecuteSendRecv(sTradeDiv, sTrType, sWCC, sInPutData, sReqNo, nPayAmt, sApprDate, sApprNo, sApprTime, siTemCD, ref aIrtRspHDR, ref aIrtRspDTL, ref bRecvData);
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;
//if (m_cPayItem.PAY_AMT <= 0) return UserCom.RST_ERR;
m_cPayItem.PAY_DTL_CD_02 = ""; // 캠페인코드
//m_cPayItem.PAY_DTL_CD_03 = "0"; // 할인금액 아이템 적용여부
switch (m_cPayItem.PAY_DTL_CD_01)
{
case ItemConst.TR_ITEM_ID.MOBILECON.GIFTSHOW:
#region
{
if (sTrType != PosConst.POS_MOBILECON_GIFTSHOW_INQ_TYPE.SEARCH)
{
// 승인/취소 응답
m_cPayItem.OCCUR_ENTRY_02 = aIrtRspDTL[Column.POS_REQ_APP_MOBILECOUPON_GIFTSHOW_NORMAL.SEQ.ApprNo].Trim(); // 승인번호
//m_cPayItem.PAY_DTL_CD_04 = ""; // 프로덕트 코드
//m_cPayItem.OCCUR_ENTRY_09 = ""; // 대상 상품 코드
m_cPayItem.OCCUR_ENTRY_03 = DateTime.Now.ToString("yyyyMMdd"); // 승인일자
m_cPayItem.OCCUR_ENTRY_04 = DateTime.Now.ToString("hhmm"); // 승인시간
//m_cPayItem.AMT_ENTRY_02 = 0; // 제휴 할인 금액
}
else
{
// 조회 응답
aIrtRsp_Search = aIrtRspDTL;
m_cPayItem.PAY_DTL_CD_04 = aIrtRspDTL[Column.POS_REQ_SEL_MOBILECOUPON_GIFTSHOW_NORMAL.SEQ.ProductID].Trim(); // 프로덕트 코드
m_cPayItem.OCCUR_ENTRY_09 = aIrtRspDTL[Column.POS_REQ_SEL_MOBILECOUPON_GIFTSHOW_NORMAL.SEQ.ProductBarcode].Trim(); // 대상 상품 코드
m_cPayItem.OCCUR_ENTRY_02 = ""; // 승인번호
m_cPayItem.OCCUR_ENTRY_03 = ""; // 승인일자
m_cPayItem.OCCUR_ENTRY_04 = ""; // 승인시간
//#11077_[BR] 모바일쿠폰(기프티쇼) 조회시 금액 비정상 출력_hs
//기프트쇼 금액 계산변경
//br의 경우는 상품수량 곱
m_cPayItem.AMT_ENTRY_07 = CmUtil.DoubleParse(aIrtRspDTL[Column.POS_REQ_SEL_MOBILECOUPON_GIFTSHOW_NORMAL.SEQ.Cost])
+ CmUtil.DoubleParse(aIrtRspDTL[Column.POS_REQ_SEL_MOBILECOUPON_GIFTSHOW_NORMAL.SEQ.VenderAmt])
+ CmUtil.DoubleParse(aIrtRspDTL[Column.POS_REQ_SEL_MOBILECOUPON_GIFTSHOW_NORMAL.SEQ.CatCompAmt]); // 사용금액
if (m_cPosStatus.Mst.CorpDiv == ItemConst.CORP_DIV.BR)
{
m_cPayItem.AMT_ENTRY_07 = m_cPayItem.AMT_ENTRY_07 * CmUtil.DoubleParse(aIrtRspDTL[Column.POS_REQ_SEL_MOBILECOUPON_GIFTSHOW_NORMAL.SEQ.ProductCnt]); // 사용금액
}
//#11077_[BR] 모바일쿠폰(기프티쇼) 조회시 금액 비정상 출력
//if (m_cPosStatus.Mst.CorpDiv == ItemConst.CORP_DIV.BR)
//{
// m_cPayItem.AMT_ENTRY_07 = CmUtil.DoubleParse(aIrtRspDTL[Column.POS_REQ_SEL_MOBILECOUPON_GIFTSHOW_NORMAL.SEQ.VenderAmt]); // 사용금액
//}
//else
//{
// m_cPayItem.AMT_ENTRY_07 = CmUtil.DoubleParse(aIrtRspDTL[Column.POS_REQ_SEL_MOBILECOUPON_GIFTSHOW_NORMAL.SEQ.Cost]); // 사용금액
//}
m_cPayItem.PAY_AMT = m_cPayItem.AMT_ENTRY_07;
//m_cPayItem.AMT_ENTRY_02 = 0; // 제휴 할인 금액
}
// --------------------------------------------------------------------------------------------------------------------------------
break;
}
#endregion
case ItemConst.TR_ITEM_ID.MOBILECON.GIFTCON:
#region
{
if (sTrType == PosConst.POS_MOBILECON_GIFTCON_INQ_TYPE.APPROVAL)
{
// 승인 응답
m_cPayItem.OCCUR_ENTRY_02 = aIrtRspDTL[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.AppNo].Trim(); // 승인번호
m_cPayItem.OCCUR_ENTRY_03 = aIrtRspDTL[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.TranDate].Trim(); // 승인일자
m_cPayItem.OCCUR_ENTRY_04 = aIrtRspDTL[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.TranTime].Trim(); // 승인시간
}
else if (sTrType == PosConst.POS_MOBILECON_GIFTCON_INQ_TYPE.REFUND)
{
// 취소 응답
m_cPayItem.OCCUR_ENTRY_02 = aIrtRspDTL[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.AppNo].Trim(); // 승인번호
m_cPayItem.OCCUR_ENTRY_03 = aIrtRspDTL[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.TranDate].Trim(); // 승인일자
m_cPayItem.OCCUR_ENTRY_04 = aIrtRspDTL[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.TranTime].Trim(); // 승인시간
}
else if (sTrType == PosConst.POS_MOBILECON_GIFTCON_INQ_TYPE.NETCANCEL)
{
// 망취소 응답
m_cPayItem.OCCUR_ENTRY_02 = aIrtRspDTL[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.AppNo].Trim(); // 승인번호
m_cPayItem.OCCUR_ENTRY_03 = aIrtRspDTL[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.TranDate].Trim(); // 승인일자
m_cPayItem.OCCUR_ENTRY_04 = aIrtRspDTL[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.TranTime].Trim(); // 승인시간
}
else
{
// 조회 응답
aIrtRsp_Search = aIrtRspDTL;
m_cPayItem.OCCUR_ENTRY_02 = ""; // 승인번호
m_cPayItem.OCCUR_ENTRY_03 = ""; // 승인일자
m_cPayItem.OCCUR_ENTRY_04 = ""; // 승인시간
aRecvCost = new string[6];
aRecvCost[0] = GetBigEndian(bRecvData, 576 + 0, 4).ToString(); // 원가
aRecvCost[1] = GetBigEndian(bRecvData, 576 + 4, 4).ToString(); // 제휴사부담금
aRecvCost[2] = GetBigEndian(bRecvData, 580 + 4, 4).ToString(); // 공급사부담금
aRecvCost[3] = GetBigEndian(bRecvData, 590 + 0, 4).ToString(); // 최소구매금액
aRecvCost[4] = GetBigEndian(bRecvData, 594 + 4, 4).ToString(); // 할인금액
aRecvCost[5] = GetBigEndian(bRecvData, 752 + 0, 4).ToString(); // Balance
// 쿠폰금액
nRecvCost = 0;
nRecvCost = CmUtil.DoubleAdd(CmUtil.DoubleParse(aRecvCost[0]), nRecvCost); // 원가
nRecvCost = CmUtil.DoubleAdd(CmUtil.DoubleParse(aRecvCost[1]), nRecvCost); // 제휴사부담금
nRecvCost = CmUtil.DoubleAdd(CmUtil.DoubleParse(aRecvCost[2]), nRecvCost); // 공급사부담금
m_cPayItem.PAY_DTL_CD_04 = aIrtRsp_Search[Column.POS_REQ_SEL_BODY_MOBILECOUPON_GIFTCON.SEQ.iTemCD].Trim(); // 상품코드
m_cPayItem.OCCUR_ENTRY_09 = aIrtRsp_Search[Column.POS_REQ_SEL_BODY_MOBILECOUPON_GIFTCON.SEQ.iTemBarCD].Trim(); // 대상 상품 코드
m_cPayItem.OCCUR_ENTRY_10 = aIrtRsp_Search[Column.POS_REQ_SEL_BODY_MOBILECOUPON_GIFTCON.SEQ.iTemType].Trim(); // 상품종류 (01: 일반상품, 02: 상품권(Gifticon을 종이상품권으로), 03: 정액 할인, 04: 특정 상품 할인, 05: 배송 상품, 06: 금액 차감권, 07: 수량 차감권, 08: 정기권)
m_cPayItem.OCCUR_ENTRY_11 = aIrtRsp_Search[Column.POS_REQ_SEL_BODY_MOBILECOUPON_GIFTCON.SEQ.LimitTenderType].Trim(); // 결제유형제한 : 다중일 경우 콜론(:)으로 구분 (00 : 제약없음, 01 : SKT 소액결제, 02 : KT 소액결제, 03 ; LGU 소액결제, 04 : 실시간 계좌이체, 05 : 하나SK카드, 06 : 신한카드, 07 : 삼성카드, 08 : 현대카드, 09 : 농협카드, 10 : BC카드, 11 : 롯데카드, 12 : 외환카드, 13 : KB국민카드, 14 : 시티카드, 15 : 기타카드사)
m_cPayItem.OCCUR_ENTRY_12 = aIrtRsp_Search[Column.POS_REQ_SEL_BODY_MOBILECOUPON_GIFTCON.SEQ.ValidStartDate].Trim(); // 유효기간 시작
m_cPayItem.OCCUR_ENTRY_13 = aIrtRsp_Search[Column.POS_REQ_SEL_BODY_MOBILECOUPON_GIFTCON.SEQ.ValidEndDate].Trim(); // 유효기간 종료
m_cPayItem.AMT_ENTRY_07 = nRecvCost; // 원가
m_cPayItem.AMT_ENTRY_03 = CmUtil.DoubleParse(aRecvCost[3]); // 제약사항 - 할인권의 경우 최소구매금액
m_cPayItem.AMT_ENTRY_04 = CmUtil.DoubleParse(aRecvCost[1]); // 제휴사 부담금
m_cPayItem.AMT_ENTRY_05 = CmUtil.DoubleParse(aRecvCost[2]); // 공급사 부담금
m_cPayItem.AMT_ENTRY_06 = CmUtil.DoubleParse(aRecvCost[5]); // Balance (금액 차감권: 남은 금액, 수량 차감권: 남은 횟수, 기간권: 사용 횟수) m_cPayItem.AMT_ENTRY_02 = CmUtil.DoubleParse ( aIrtRsp_Search[Column.POS_REQ_SEL_BODY_MOBILECOUPON_GIFTCON.SEQ.DCAmount]); // 제휴 할인 금액
m_cPayItem.PAY_AMT = nRecvCost;
//m_cPayItem.AMT_ENTRY_02 = 0; // 제휴 할인 금액
}
// --------------------------------------------------------------------------------------------------------------------------------
//m_cPayItem.QTY_ENTRY_01 = CmUtil.DoubleParse(aIrtRsp_Search[Column.POS_REQ_SEL_BODY_MOBILECOUPON_GIFTCON.SEQ.Balance]); // Balance (금액 차감권: 남은 금액, 수량 차감권: 남은 횟수, 기간권: 사용 횟수) m_cPayItem.AMT_ENTRY_02 = CmUtil.DoubleParse ( aIrtRsp_Search[Column.POS_REQ_SEL_BODY_MOBILECOUPON_GIFTCON.SEQ.DCAmount]); // 제휴 할인 금액
//m_cPayItem.AMT_ENTRY_02 = CmUtil.DoubleParse(aIrtRsp_Search[Column.POS_REQ_SEL_BODY_MOBILECOUPON_GIFTCON.SEQ.DCAmt]); // 제휴 할인 금액
//m_cPayItem.AMT_ENTRY_03 = CmUtil.DoubleParse(aIrtRsp_Search[Column.POS_REQ_SEL_BODY_MOBILECOUPON_GIFTCON.SEQ.LimitMessage]); // 제약사항 - 할인권의 경우 최소구매금액
//m_cPayItem.AMT_ENTRY_04 = CmUtil.DoubleParse(aIrtRsp_Search[Column.POS_REQ_SEL_BODY_MOBILECOUPON_GIFTCON.SEQ.CatCompAmt]); // 제휴사 부담금
//m_cPayItem.AMT_ENTRY_05 = CmUtil.DoubleParse(aIrtRsp_Search[Column.POS_REQ_SEL_BODY_MOBILECOUPON_GIFTCON.SEQ.VenderAmt]); // 공급사 부담금
m_cPayItem.OCCUR_ENTRY_25 = aIrtRspHDR[Column.POS_REQ_SEL_HDR_MOBILECOUPON_GIFTCON.SEQ.TranUniqueNo].Trim(); // 추적번호
break;
}
#endregion
default:
#region
{
// if (sTrType != PosConst.POS_MOBILECON_HPCON_INQ_TYPE.SEARCH)
// {
// // 승인/취소 응답
// if (aIrtRspHDR[Column.POS_HDR_MOBILECOUPON_HPCON_NEW.SEQ.ErrCD].Trim() == "E0010")
// // 기취소
// m_cPayItem.OCCUR_ENTRY_02 = sApprNo;
// else
// m_cPayItem.OCCUR_ENTRY_02 = aIrtRspDTL[Column.POS_RES_APP_DTL_MOBILECOUPON_HPCON_NEW.SEQ.AppNo].Trim(); // 승인번호
// m_cPayItem.PAY_DTL_CD_04 = aIrtRsp_Search[Column.POS_RES_SEL_DTL_MOBILECOUPON_HPCON_NEW.SEQ.Product_ID].Trim(); // 프로덕트 코드
// m_cPayItem.OCCUR_ENTRY_09 = aIrtRsp_Search[Column.POS_RES_SEL_DTL_MOBILECOUPON_HPCON_NEW.SEQ.Product_Barcode].Trim(); // 대상 상품 코드
// m_cPayItem.OCCUR_ENTRY_03 = DateTime.Now.ToString("yyyyMMdd"); // 승인일자
// m_cPayItem.OCCUR_ENTRY_04 = DateTime.Now.ToString("hhmm"); // 승인시간
// m_cPayItem.AMT_ENTRY_02 = 0; // 제휴 할인 금액
// }
// else
// {
// // 조회 응답
// aIrtRsp_Search = aIrtRspDTL;
// m_cPayItem.PAY_DTL_CD_04 = aIrtRspDTL[Column.POS_RES_SEL_DTL_MOBILECOUPON_HPCON_NEW.SEQ.Product_ID].Trim(); // 프로덕트 코드
// m_cPayItem.OCCUR_ENTRY_09 = aIrtRspDTL[Column.POS_RES_SEL_DTL_MOBILECOUPON_HPCON_NEW.SEQ.Product_Barcode].Trim(); // 대상 상품 코드
// m_cPayItem.OCCUR_ENTRY_02 = ""; // 승인번호
// m_cPayItem.OCCUR_ENTRY_03 = ""; // 승인일자
// m_cPayItem.OCCUR_ENTRY_04 = ""; // 승인시간
// m_cPayItem.AMT_ENTRY_02 = 0; // 제휴 할인 금액
// }
// // --------------------------------------------------------------------------------------------------------------------------------
break;
}
#endregion
}
m_cPayItem.PAY_DTL_CD_05 = PosConst.PAY_DC_TYPE.PAY; // 할인결제구분 (1:결제, 2:할인)
m_cPayItem.AMT_ENTRY_01 = nPayAmt; // 받은돈
m_cPayItem.OCCUR_ENTRY_01 = sCardData; // 카드번호
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 = "0"; // 권종구분 (0:상품교환권, 1:금액권)
m_cPayItem.OCCUR_ENTRY_15 = sProductiTem; // 프로덕트 상품정보
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_21 = CmUtil.GetDataRowStr(dr, PosMst.MST_PAY_DC.DATA.CASH_BILL_ISSUE_YN); // 현금영수증 발행여부
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);
}
return sRet;
}
/// <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>
public string SetTrainingData(string sTrType, string sWCC, string sCardData, string sReqNo, double nPayAmt, string sApprDate, string sApprNo, string sApprTime, string siTemCD, string sProductiTem)
{
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.QTY_ENTRY_01 = 3; // 무료횟수
m_cPayItem.QTY_ENTRY_02 = 6; // 총사용횟수
m_cPayItem.AMT_ENTRY_01 = nPayAmt; // 사용포인트
//m_cPayItem.AMT_ENTRY_02 = 0; // 제휴 할인 금액
m_cPayItem.AMT_ENTRY_03 = 0; // 총포인트
m_cPayItem.AMT_ENTRY_04 = 0; // 가용포인트
m_cPayItem.AMT_ENTRY_05 = 0; // 잔여포인트
m_cPayItem.AMT_ENTRY_07 = nPayAmt;
m_cPayItem.AMT_ENTRY_08 = 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_09 = ""; // 직원카드번호
m_cPayItem.OCCUR_ENTRY_10 = "0"; // 권종구분 (0:상품교환권, 1:금액권)
m_cPayItem.OCCUR_ENTRY_11 = "";
m_cPayItem.OCCUR_ENTRY_15 = sProductiTem; // 프로덕트 상품정보
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);
}
return sRet;
}
#endregion
#region /
/// <summary>
/// 승인 요청/응답
/// </summary>
/// <param name="sTradeDiv"></param>
/// <param name="sTrType"></param>
/// <param name="sWCC"></param>
/// <param name="sCardData"></param>
/// <param name="sReqNo"></param>
/// <param name="nPayAmt"></param>
/// <param name="sApprDate"></param>
/// <param name="sApprNo"></param>
/// <param name="sApprTime"></param>
/// <param name="siTemCD"></param>
/// <param name="aIrtRspHDR"></param>
/// <param name="aIrtRspDTL"></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 siTemCD,
ref string[] aIrtRspHDR, ref string[] aIrtRspDTL, ref byte[] bRecvData)
{
string sSendData = "", sRecvData = ""; // 송수신 전문
int nNowPos = 0;
string sServerIP = "";
string sServerPort = "";
string sCMPApprID = "";
string sApprID = "";
int iRecvTimeOut = 10000;
string sRecvAppNo = "";
string sRecvAppDT = "";
string sRecvAppTime = "";
string sErrMsg = "";
byte[] bytes = null;
byte[] bSendData = null;
string sRet = UserCom.RST_ERR;
try
{
if (m_cPayItem.PAY_WAY_CD != ItemConst.TR_ITEM_ID.MOBILECON_ITEM) return null;
// -----------------------------------------------------------------------------------------------------------------------------
// 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().Length == 0)
sServerIP = PosMstManager.GetMstVan(m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01, PosMst.MST_VAN.DATA.HOME_PAGE);
// -----------------------------------------------------------------------------------------------------------------------------
if (sServerIP.Trim() == "")
{
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0565);
return sRet;
}
// 전문 생성
sSendData = GetMakeiNQData(sCMPApprID, sApprID, sTrType, sWCC, sCardData, sReqNo, nPayAmt, sApprDate, sApprNo, sApprTime, siTemCD, ref bSendData);
// 요청 - 승인로그 저장 (판매구분, [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 });
// 유형별 분기 처리
switch (m_cPayItem.PAY_DTL_CD_01)
{
case ItemConst.TR_ITEM_ID.MOBILECON.GIFTSHOW: // 기프티쇼
{
#region
// 전문 송수신
sRet = m_cDataCommon.ExecuteLenIrt(sServerIP, CmUtil.IntParse(sServerPort), iRecvTimeOut, sSendData, ref sRecvData, 4, 76);
if (sRet != UserCom.RST_OK)
{
WinManager.ErrorMessage(sRet);
return sRet;
}
bytes = Encoding.Default.GetBytes(sRecvData);
// 조회 응답 헤더 체크
aIrtRspHDR = new string[Column.POS_RES_SEL_MOBILECOUPON_GIFTSHOW_HEADER.LEN.Length];
nNowPos = 0;
ItemColumn.ParseMessage(Column.POS_RES_SEL_MOBILECOUPON_GIFTSHOW_HEADER.LEN, Column.POS_RES_SEL_MOBILECOUPON_GIFTSHOW_HEADER.TYPE, bytes, ref nNowPos, ref aIrtRspHDR);
if (sTrType == PosConst.POS_MOBILECON_GIFTSHOW_INQ_TYPE.SEARCH)
{
// - 'O0' : 승인 그외 : 거절, 기취소 (E0010)
if (aIrtRspHDR[Column.POS_RES_SEL_MOBILECOUPON_GIFTSHOW_HEADER.SEQ.ResStatus].Trim() != "000")
{
// 오류
if (aIrtRspHDR[Column.POS_RES_SEL_MOBILECOUPON_GIFTSHOW_HEADER.SEQ.ErrCD].Trim() == "E0006")
{
// 이미 다름 점포에서 사용 완료
aIrtRspDTL = new string[Column.POS_REQ_SEL_MOBILECOUPON_GIFTSHOW_E0006.LEN.Length];
ItemColumn.ParseMessage(Column.POS_REQ_SEL_MOBILECOUPON_GIFTSHOW_E0006.LEN, Column.POS_REQ_SEL_MOBILECOUPON_GIFTSHOW_E0006.TYPE, bytes, ref nNowPos, ref aIrtRspDTL);
sRet = "";
sRet += MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0147) + "\n";
sRet += MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0143) + " ";
sRet += "(" + aIrtRspDTL[Column.POS_REQ_SEL_MOBILECOUPON_GIFTSHOW_E0006.SEQ.UseStoreCD].Trim() + ") " + aIrtRspDTL[Column.POS_REQ_SEL_MOBILECOUPON_GIFTSHOW_E0006.SEQ.UseStoreNM].Trim() + "\n";
sRet += MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0145) + " ";
sRet += string.Format("{0:0000/00/00}", CmUtil.DoubleParse(aIrtRspDTL[Column.POS_REQ_SEL_MOBILECOUPON_GIFTSHOW_E0006.SEQ.UseDate].Trim())) + "," + string.Format("{0:00:00:00}", CmUtil.DoubleParse(aIrtRspDTL[Column.POS_REQ_SEL_MOBILECOUPON_GIFTSHOW_E0006.SEQ.UseTime].Trim())) + "\n";
}
else
{
aIrtRspDTL = new string[Column.POS_REQ_SEL_MOBILECOUPON_GIFTSHOW_ERR.LEN.Length];
ItemColumn.ParseMessage(Column.POS_REQ_SEL_MOBILECOUPON_GIFTSHOW_ERR.LEN, Column.POS_REQ_SEL_MOBILECOUPON_GIFTSHOW_ERR.TYPE, bytes, ref nNowPos, ref aIrtRspDTL);
sRet = aIrtRspDTL[Column.POS_REQ_SEL_MOBILECOUPON_GIFTSHOW_ERR.SEQ.ReqMessage].Trim();
sErrMsg = aIrtRspDTL[Column.POS_REQ_SEL_MOBILECOUPON_GIFTSHOW_ERR.SEQ.ReqMessage].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_RES_SEL_MOBILECOUPON_GIFTSHOW_HEADER.SEQ.TranDate].Trim(), aIrtRspHDR[Column.POS_RES_SEL_MOBILECOUPON_GIFTSHOW_HEADER.SEQ.TranTime].Trim()
, aIrtRspHDR[Column.POS_RES_SEL_MOBILECOUPON_GIFTSHOW_HEADER.SEQ.ResStatus].Trim()
, sErrMsg
, sRecvData });
WinManager.ErrorMessage(sRet);
return sRet;
}
// 조회 정상 상세항목
bytes = Encoding.Default.GetBytes(CmUtil.MidH(sRecvData, nNowPos, sRecvData.Length));
aIrtRspDTL = new string[Column.POS_REQ_SEL_MOBILECOUPON_GIFTSHOW_NORMAL.LEN.Length];
nNowPos = 0;
ItemColumn.ParseMessage(Column.POS_REQ_SEL_MOBILECOUPON_GIFTSHOW_NORMAL.LEN, Column.POS_REQ_SEL_MOBILECOUPON_GIFTSHOW_NORMAL.TYPE, bytes, ref nNowPos, ref aIrtRspDTL);
}
else if (sTrType == PosConst.POS_MOBILECON_GIFTSHOW_INQ_TYPE.APPROVAL || sTrType == PosConst.POS_MOBILECON_GIFTSHOW_INQ_TYPE.REFUND)
{
// 승인/취소 정상 상세항목
// - 'O0' : 승인 그외 : 거절
if (aIrtRspHDR[Column.POS_RES_SEL_MOBILECOUPON_GIFTSHOW_HEADER.SEQ.ResStatus].Trim() != "000")
{
aIrtRspDTL = new string[Column.POS_REQ_APP_MOBILECOUPON_GIFTSHOW_ERROR.LEN.Length];
ItemColumn.ParseMessage(Column.POS_REQ_APP_MOBILECOUPON_GIFTSHOW_ERROR.LEN, Column.POS_REQ_APP_MOBILECOUPON_GIFTSHOW_ERROR.TYPE, bytes, ref nNowPos, ref aIrtRspDTL);
sRecvAppNo = "";
sRecvAppDT = "";
sRecvAppTime = "";
sErrMsg = aIrtRspDTL[Column.POS_REQ_APP_MOBILECOUPON_GIFTSHOW_ERROR.SEQ.Message].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_RES_SEL_MOBILECOUPON_GIFTSHOW_HEADER.SEQ.TranDate].Trim(), aIrtRspHDR[Column.POS_RES_SEL_MOBILECOUPON_GIFTSHOW_HEADER.SEQ.TranTime].Trim()
, aIrtRspHDR[Column.POS_RES_SEL_MOBILECOUPON_GIFTSHOW_HEADER.SEQ.ResStatus].Trim()
, sErrMsg
, sRecvData });
WinManager.ErrorMessage(sErrMsg);
return UserCom.RST_ERR;
}
aIrtRspDTL = new string[Column.POS_REQ_APP_MOBILECOUPON_GIFTSHOW_NORMAL.LEN.Length];
ItemColumn.ParseMessage(Column.POS_REQ_APP_MOBILECOUPON_GIFTSHOW_NORMAL.LEN, Column.POS_REQ_APP_MOBILECOUPON_GIFTSHOW_NORMAL.TYPE, bytes, ref nNowPos, ref aIrtRspDTL);
sRecvAppNo = aIrtRspDTL[Column.POS_REQ_APP_MOBILECOUPON_GIFTSHOW_NORMAL.SEQ.ApprNo].Trim();
sRecvAppDT = aIrtRspHDR[Column.POS_RES_SEL_MOBILECOUPON_GIFTSHOW_HEADER.SEQ.TranDate].Trim();
sRecvAppTime = aIrtRspHDR[Column.POS_RES_SEL_MOBILECOUPON_GIFTSHOW_HEADER.SEQ.TranTime].Trim();
sErrMsg = "";
// 응답 - 승인로그 저장 (판매구분, [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_RES_SEL_MOBILECOUPON_GIFTSHOW_HEADER.SEQ.TranDate].Trim(), aIrtRspHDR[Column.POS_RES_SEL_MOBILECOUPON_GIFTSHOW_HEADER.SEQ.TranTime].Trim()
, aIrtRspHDR[Column.POS_RES_SEL_MOBILECOUPON_GIFTSHOW_HEADER.SEQ.ResStatus].Trim()
, sErrMsg
, sRecvData });
}
break;
#endregion
}
case ItemConst.TR_ITEM_ID.MOBILECON.GIFTCON: // 기프티콘
{
#region
// 전문 송수신
sRet = m_cDataCommon.ExecuteByteIrt(sServerIP, CmUtil.IntParse(sServerPort), iRecvTimeOut, bSendData, ref bRecvData, 4095);
//if (sTrType == PosConst.POS_MOBILECON_GIFTCON_INQ_TYPE.SEARCH)
// //sRet = m_cDataCommon.ExecuteExIrt(sServerIP, CmUtil.IntParse(sServerPort), iRecvTimeOut, sSendData, ref sRecvData, 658, "", true);
// sRet = m_cDataCommon.ExecuteExIrt(sServerIP, CmUtil.IntParse(sServerPort), iRecvTimeOut, sSendData, ref sRecvData, 802, "", true);
//else if (sTrType == PosConst.POS_MOBILECON_GIFTCON_INQ_TYPE.APPROVAL)
// sRet = m_cDataCommon.ExecuteExIrt(sServerIP, CmUtil.IntParse(sServerPort), iRecvTimeOut, sSendData, ref sRecvData, 369, "");
//else if (sTrType == PosConst.POS_MOBILECON_GIFTCON_INQ_TYPE.REFUND)
// sRet = m_cDataCommon.ExecuteExIrt(sServerIP, CmUtil.IntParse(sServerPort), iRecvTimeOut, sSendData, ref sRecvData, 351, "");
//else
// sRet = m_cDataCommon.ExecuteLenIrt(sServerIP, CmUtil.IntParse(sServerPort), iRecvTimeOut, sSendData, ref sRecvData, 4, 35);
if (sRet != UserCom.RST_OK)
{
WinManager.ErrorMessage(sRet);
return sRet;
}
//bytes = Encoding.Default.GetBytes(sRecvData);
bytes = bRecvData;
sRecvData = ByteToString(bRecvData);
// 조회 응답 체크
aIrtRspHDR = new string[Column.POS_REQ_SEL_HDR_MOBILECOUPON_GIFTCON.LEN.Length];
nNowPos = 0;
ItemColumn.ParseMessage(Column.POS_REQ_SEL_HDR_MOBILECOUPON_GIFTCON.LEN, Column.POS_REQ_SEL_HDR_MOBILECOUPON_GIFTCON.TYPE, bytes, ref nNowPos, ref aIrtRspHDR);
if (sTrType == PosConst.POS_MOBILECON_GIFTCON_INQ_TYPE.SEARCH)
{
//string aaa = string.Format("{0:0000}", GetBigEndian(bRecvData, 36, 4));
//byte[] bGetData = Encoding.Default.GetBytes(string.Format("{0:0000}", GetBigEndian(bRecvData, 36, 4)) );
//ByteDimCopy(ref bytes, bGetData, 36, 4, 4);
// 조회 응답 체크
aIrtRspHDR = new string[Column.POS_REQ_SEL_HDR_MOBILECOUPON_GIFTCON.LEN.Length];
nNowPos = 0;
ItemColumn.ParseMessage(Column.POS_REQ_SEL_HDR_MOBILECOUPON_GIFTCON.LEN, Column.POS_REQ_SEL_HDR_MOBILECOUPON_GIFTCON.TYPE, bytes, ref nNowPos, ref aIrtRspHDR);
// - 'O0' : 승인 그외 : 거절, 기취소 (E0010)
if (aIrtRspHDR[Column.POS_REQ_SEL_HDR_MOBILECOUPON_GIFTCON.SEQ.ResStatus].Trim() != "00")
{
// 오류
if (aIrtRspHDR[Column.POS_REQ_SEL_HDR_MOBILECOUPON_GIFTCON.SEQ.UseFranChiseCD].Trim().Length > 0)
{
// 이미 사용된 쿠폰
sRet = "";
sRet += MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0147) + "\n";
sRet += MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0143) + " ";
sRet += "(" + aIrtRspHDR[Column.POS_REQ_SEL_HDR_MOBILECOUPON_GIFTCON.SEQ.UseFranChiseCD].Trim() + ") " + aIrtRspHDR[Column.POS_REQ_SEL_HDR_MOBILECOUPON_GIFTCON.SEQ.UseFranChiseNM].Trim() + "\n";
sRet += MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0145) + " ";
sRet += string.Format("{0:0000/00/00}", CmUtil.DoubleParse(aIrtRspHDR[Column.POS_REQ_SEL_HDR_MOBILECOUPON_GIFTCON.SEQ.CouponUseDate].Trim())) + "," + string.Format("{0:00:00:00}", CmUtil.DoubleParse(aIrtRspHDR[Column.POS_REQ_SEL_HDR_MOBILECOUPON_GIFTCON.SEQ.CouponUseTime].Trim())) + "\n";
}
else
{
sRet = aIrtRspHDR[Column.POS_REQ_SEL_HDR_MOBILECOUPON_GIFTCON.SEQ.ReqMessage].Trim();
sErrMsg = aIrtRspHDR[Column.POS_REQ_SEL_HDR_MOBILECOUPON_GIFTCON.SEQ.ReqMessage].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_REQ_SEL_HDR_MOBILECOUPON_GIFTCON.SEQ.SaleDate].Trim(), aIrtRspHDR[Column.POS_REQ_SEL_HDR_MOBILECOUPON_GIFTCON.SEQ.SaleTime].Trim()
, aIrtRspHDR[Column.POS_REQ_SEL_HDR_MOBILECOUPON_GIFTCON.SEQ.ResStatus].Trim()
, sErrMsg
, sRecvData });
WinManager.ErrorMessage(sRet);
return sRet;
}
// 조회 정상 상세항목
//bytes = Encoding.Default.GetBytes(CmUtil.MidH(sRecvData, nNowPos, sRecvData.Length));
aIrtRspDTL = new string[Column.POS_REQ_SEL_BODY_MOBILECOUPON_GIFTCON.LEN.Length];
//nNowPos = 0;
ItemColumn.ParseMessage(Column.POS_REQ_SEL_BODY_MOBILECOUPON_GIFTCON.LEN, Column.POS_REQ_SEL_BODY_MOBILECOUPON_GIFTCON.TYPE, bytes, ref nNowPos, ref aIrtRspDTL);
}
else if (sTrType == PosConst.POS_MOBILECON_GIFTCON_INQ_TYPE.APPROVAL)
{
// 승인 정상 상세항목
aIrtRspDTL = new string[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.LEN.Length];
nNowPos = 0;
ItemColumn.ParseMessage(Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.LEN, Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.TYPE, bytes, ref nNowPos, ref aIrtRspDTL);
sRecvAppNo = aIrtRspDTL[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.AppNo].Trim();
sRecvAppDT = aIrtRspDTL[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.SaleDate].Trim();
sRecvAppTime = aIrtRspDTL[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.SaleTime].Trim();
sErrMsg = aIrtRspDTL[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.ReqMessage].Trim();
}
else if (sTrType == PosConst.POS_MOBILECON_GIFTCON_INQ_TYPE.REFUND)
{
// 취소 정상 상세항목
aIrtRspDTL = new string[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.LEN.Length];
nNowPos = 0;
ItemColumn.ParseMessage(Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.LEN, Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.TYPE, bytes, ref nNowPos, ref aIrtRspDTL);
sRecvAppNo = aIrtRspDTL[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.AppNo].Trim();
sRecvAppDT = aIrtRspDTL[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.SaleDate].Trim();
sRecvAppTime = aIrtRspDTL[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.SaleTime].Trim();
sErrMsg = aIrtRspDTL[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.ReqMessage].Trim();
}
else if (sTrType == PosConst.POS_MOBILECON_GIFTCON_INQ_TYPE.NETCANCEL)
{
// 망취소 정상 상세항목
aIrtRspDTL = new string[Column.POS_REQ_NET_MOBILECOUPON_GIFTCON.LEN.Length];
nNowPos = 0;
ItemColumn.ParseMessage(Column.POS_REQ_NET_MOBILECOUPON_GIFTCON.LEN, Column.POS_REQ_NET_MOBILECOUPON_GIFTCON.TYPE, bytes, ref nNowPos, ref aIrtRspDTL);
sRecvAppNo = aIrtRspDTL[Column.POS_REQ_NET_MOBILECOUPON_GIFTCON.SEQ.AppNo].Trim();
sRecvAppDT = aIrtRspDTL[Column.POS_REQ_NET_MOBILECOUPON_GIFTCON.SEQ.SaleDate].Trim();
sRecvAppTime = aIrtRspDTL[Column.POS_REQ_NET_MOBILECOUPON_GIFTCON.SEQ.SaleTime].Trim();
sErrMsg = aIrtRspDTL[Column.POS_REQ_NET_MOBILECOUPON_GIFTCON.SEQ.ReqMessage].Trim();
}
if (sTrType != PosConst.POS_MOBILECON_GIFTCON_INQ_TYPE.SEARCH)
{
// - 'O0' : 승인 그외 : 거절, 기취소 (E0010)
if (aIrtRspHDR[Column.POS_REQ_SEL_HDR_MOBILECOUPON_GIFTCON.SEQ.ResStatus].Trim() != "00")
{
// 응답 - 승인로그 저장 (판매구분, [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_REQ_SEL_HDR_MOBILECOUPON_GIFTCON.SEQ.SaleDate].Trim(), aIrtRspHDR[Column.POS_REQ_SEL_HDR_MOBILECOUPON_GIFTCON.SEQ.SaleTime].Trim()
, aIrtRspHDR[Column.POS_REQ_SEL_HDR_MOBILECOUPON_GIFTCON.SEQ.ResStatus].Trim()
, sErrMsg
, sRecvData });
WinManager.ErrorMessage(sErrMsg);
return sErrMsg;
}
}
// 응답 - 승인로그 저장 (판매구분, [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_REQ_SEL_HDR_MOBILECOUPON_GIFTCON.SEQ.SaleDate].Trim(), aIrtRspHDR[Column.POS_REQ_SEL_HDR_MOBILECOUPON_GIFTCON.SEQ.SaleTime].Trim()
, aIrtRspHDR[Column.POS_REQ_SEL_HDR_MOBILECOUPON_GIFTCON.SEQ.ResStatus].Trim()
, sErrMsg
, sRecvData });
break;
#endregion
}
default:
{
#region
// 전문 송수신
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_MOBILECOUPON_HPCON.LEN.Length];
ItemColumn.ParseMessage(Column.POS_HDR_MOBILECOUPON_HPCON.LEN, Column.POS_HDR_MOBILECOUPON_HPCON.TYPE, bytes, ref nNowPos, ref aIrtRspHDR);
nNowPos = 0;
// - 'O00' : 승인 그외 : 거절, 기취소 (E0010)
if (aIrtRspHDR[Column.POS_HDR_MOBILECOUPON_HPCON.SEQ.ResStatus].Trim() != "000")
{
if (aIrtRspHDR[Column.POS_HDR_MOBILECOUPON_HPCON.SEQ.ErrCD].Trim() == "E0006")
{
// 이미 다름 점포에서 사용 완료
bytes = Encoding.Default.GetBytes(CmUtil.MidH(sRecvData, 88, sRecvData.Length));
aIrtRspDTL = new string[Column.POS_RES_ERR2_DTL_MOBILECOUPON_HPCON.LEN.Length];
ItemColumn.ParseMessage(Column.POS_RES_ERR2_DTL_MOBILECOUPON_HPCON.LEN, Column.POS_RES_ERR2_DTL_MOBILECOUPON_HPCON.TYPE, bytes, ref nNowPos, ref aIrtRspDTL);
sRet = "";
sRet += MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0147) + "\n";
sRet += MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0143) + " ";
sRet += "(" + aIrtRspDTL[Column.POS_RES_ERR2_DTL_MOBILECOUPON_HPCON.SEQ.UseStoreCD].Trim() + ") " + aIrtRspDTL[Column.POS_RES_ERR2_DTL_MOBILECOUPON_HPCON.SEQ.UseStoreNM].Trim() + "\n";
sRet += MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0145) + " ";
sRet += string.Format("{0:0000/00/00}", CmUtil.DoubleParse(aIrtRspDTL[Column.POS_RES_ERR2_DTL_MOBILECOUPON_HPCON.SEQ.UseDate].Trim())) + "," + string.Format("{0:00:00:00}", CmUtil.DoubleParse(aIrtRspDTL[Column.POS_RES_ERR2_DTL_MOBILECOUPON_HPCON.SEQ.UseTime].Trim())) + "\n";
WinManager.ErrorMessage(sRet);
}
else if (aIrtRspHDR[Column.POS_HDR_MOBILECOUPON_HPCON.SEQ.ErrCD].Trim() == "E0010")
{
// 기타 오류
bytes = Encoding.Default.GetBytes(CmUtil.MidH(sRecvData, 88, sRecvData.Length));
aIrtRspDTL = new string[Column.POS_RES_ERR_DTL_MOBILECOUPON_HPCON.LEN.Length];
ItemColumn.ParseMessage(Column.POS_RES_ERR_DTL_MOBILECOUPON_HPCON.LEN, Column.POS_RES_ERR_DTL_MOBILECOUPON_HPCON.TYPE, bytes, ref nNowPos, ref aIrtRspDTL);
sRet = aIrtRspDTL[Column.POS_RES_ERR_DTL_MOBILECOUPON_HPCON.SEQ.ErrMesg].Trim();
sErrMsg = aIrtRspDTL[Column.POS_RES_ERR_DTL_MOBILECOUPON_HPCON.SEQ.ErrMesg].Trim();
WinManager.ErrorMessage(sRet);
sRet = UserCom.RST_OK;
}
else
{
// 기타 오류
bytes = Encoding.Default.GetBytes(CmUtil.MidH(sRecvData, 88, sRecvData.Length));
aIrtRspDTL = new string[Column.POS_RES_ERR_DTL_MOBILECOUPON_HPCON.LEN.Length];
ItemColumn.ParseMessage(Column.POS_RES_ERR_DTL_MOBILECOUPON_HPCON.LEN, Column.POS_RES_ERR_DTL_MOBILECOUPON_HPCON.TYPE, bytes, ref nNowPos, ref aIrtRspDTL);
sRet = aIrtRspDTL[Column.POS_RES_ERR_DTL_MOBILECOUPON_HPCON.SEQ.ErrMesg].Trim();
sErrMsg = aIrtRspDTL[Column.POS_RES_ERR_DTL_MOBILECOUPON_HPCON.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_MOBILECOUPON_HPCON.SEQ.SaleDate].Trim(), aIrtRspHDR[Column.POS_HDR_MOBILECOUPON_HPCON.SEQ.SaleTime].Trim()
, aIrtRspHDR[Column.POS_HDR_MOBILECOUPON_HPCON.SEQ.ResStatus].Trim()
, sErrMsg
, sRecvData });
return sRet;
}
if (aIrtRspHDR[Column.POS_HDR_MOBILECOUPON_HPCON.SEQ.TranType].Trim() == PosConst.POS_MOBILECON_HPCON_INQ_TYPE.SEARCH)
{
// 조회 정상 상세항목
bytes = Encoding.Default.GetBytes(CmUtil.MidH(sRecvData, 88, sRecvData.Length));
aIrtRspDTL = new string[Column.POS_RES_SEL_DTL_MOBILECOUPON_HPCON.LEN.Length];
ItemColumn.ParseMessage(Column.POS_RES_SEL_DTL_MOBILECOUPON_HPCON.LEN, Column.POS_RES_SEL_DTL_MOBILECOUPON_HPCON.TYPE, bytes, ref nNowPos, ref aIrtRspDTL);
}
else
{
// 승인/취소 정상 상세항목
bytes = Encoding.Default.GetBytes(CmUtil.MidH(sRecvData, 88, sRecvData.Length));
aIrtRspDTL = new string[Column.POS_RES_APP_DTL_MOBILECOUPON_HPCON.LEN.Length];
ItemColumn.ParseMessage(Column.POS_RES_APP_DTL_MOBILECOUPON_HPCON.LEN, Column.POS_RES_APP_DTL_MOBILECOUPON_HPCON.TYPE, bytes, ref nNowPos, ref aIrtRspDTL);
sRecvAppNo = aIrtRspDTL[Column.POS_RES_APP_DTL_MOBILECOUPON_HPCON.SEQ.AppNo].Trim();
sRecvAppDT = aIrtRspDTL[Column.POS_HDR_HAPPYGIFT.SEQ.SaleDate].Trim();
sRecvAppTime = aIrtRspDTL[Column.POS_HDR_HAPPYGIFT.SEQ.SaleTime].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_MOBILECOUPON_HPCON.SEQ.SaleDate].Trim(), aIrtRspHDR[Column.POS_HDR_MOBILECOUPON_HPCON.SEQ.SaleTime].Trim()
, aIrtRspHDR[Column.POS_HDR_MOBILECOUPON_HPCON.SEQ.ResStatus].Trim()
, sErrMsg
, sRecvData });
#endregion
break;
}
}
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
/// <summary>
/// 전문생성
/// </summary>
/// <param name="sTrType"></param>
/// <param name="sWCC"></param>
/// <param name="sCardData"></param>
/// <param name="sReqNo"></param>
/// <param name="nPayAmt"></param>
/// <param name="sApprDate"></param>
/// <param name="sApprNo"></param>
/// <param name="sApprTime"></param>
/// <param name="siTemCD"></param>
/// <returns></returns>
protected string GetMakeiNQData(string sCMPApprID, string sApprID, string sTrType, string sWCC, string sCardData, string sReqNo, double nPayAmt, string sApprDate, string sApprNo, string sApprTime, string siTemCD, ref byte[] bSendData)
{
string sSendData = string.Empty;
string sSendData_Body = string.Empty;
double nHeaderLen = 0;
double nBodyLen = 0;
byte[] bChangData = null;
try
{
// 유형별 분기
switch (m_cPayItem.PAY_DTL_CD_01)
{
case ItemConst.TR_ITEM_ID.MOBILECON.GIFTSHOW: // 기프티쇼
{
#region
string[] aIrtHeader = new string[Column.POS_RES_SEL_MOBILECOUPON_GIFTSHOW_HEADER.LEN.Length];
// 길이
nHeaderLen = ItemColumn.LenMessage(Column.POS_RES_SEL_MOBILECOUPON_GIFTSHOW_HEADER.LEN);
// 헤더 Data 정보 설정
aIrtHeader[Column.POS_RES_SEL_MOBILECOUPON_GIFTSHOW_HEADER.SEQ.CommVer] = "0002";
aIrtHeader[Column.POS_RES_SEL_MOBILECOUPON_GIFTSHOW_HEADER.SEQ.TID] = sApprID;
aIrtHeader[Column.POS_RES_SEL_MOBILECOUPON_GIFTSHOW_HEADER.SEQ.TrType] = sTrType;
aIrtHeader[Column.POS_RES_SEL_MOBILECOUPON_GIFTSHOW_HEADER.SEQ.StoreCD] = m_cPosStatus.Base.StoreNo;
aIrtHeader[Column.POS_RES_SEL_MOBILECOUPON_GIFTSHOW_HEADER.SEQ.StoreNM] = CmUtil.GetDataRowStr(PosMstManager.GetMstStore(), PosMst.MST_STORE.DATA.STORNM);
aIrtHeader[Column.POS_RES_SEL_MOBILECOUPON_GIFTSHOW_HEADER.SEQ.PosNo] = m_cPosStatus.Base.PosNo;
aIrtHeader[Column.POS_RES_SEL_MOBILECOUPON_GIFTSHOW_HEADER.SEQ.RecvNoProc] = "2";
aIrtHeader[Column.POS_RES_SEL_MOBILECOUPON_GIFTSHOW_HEADER.SEQ.TranDate] = DateTime.Now.ToString("yyyyMMdd");
aIrtHeader[Column.POS_RES_SEL_MOBILECOUPON_GIFTSHOW_HEADER.SEQ.TranTime] = DateTime.Now.ToString("HHmmss");
aIrtHeader[Column.POS_RES_SEL_MOBILECOUPON_GIFTSHOW_HEADER.SEQ.ResStatus] = "";
aIrtHeader[Column.POS_RES_SEL_MOBILECOUPON_GIFTSHOW_HEADER.SEQ.ErrCD] = "";
if (sTrType == PosConst.POS_MOBILECON_GIFTSHOW_INQ_TYPE.SEARCH)
{
// 조회요청
// Body 요청 전문 생성
string[] aIrtBody = new string[Column.POS_RES_SEL_MOBILECOUPON_GIFTSHOW.LEN.Length];
// Body 길이
nBodyLen = ItemColumn.LenMessage(Column.POS_RES_SEL_MOBILECOUPON_GIFTSHOW.LEN);
// Body 정보 설정
aIrtBody[Column.POS_RES_SEL_MOBILECOUPON_GIFTSHOW.SEQ.CouponNo] = sCardData;
aIrtBody[Column.POS_RES_SEL_MOBILECOUPON_GIFTSHOW.SEQ.InType] = sWCC;
aIrtBody[Column.POS_RES_SEL_MOBILECOUPON_GIFTSHOW.SEQ.ReqNo] = sReqNo;
sSendData_Body = ItemColumn.MakeMessage(aIrtBody, Column.POS_RES_SEL_MOBILECOUPON_GIFTSHOW.LEN, Column.POS_RES_SEL_MOBILECOUPON_GIFTSHOW.TYPE);
}
else if (sTrType == PosConst.POS_MOBILECON_GIFTSHOW_INQ_TYPE.APPROVAL || sTrType == PosConst.POS_MOBILECON_GIFTSHOW_INQ_TYPE.REFUND)
{
// 승인/취소 요청
// Body 요청 전문 생성
string[] aIrtBody = new string[Column.POS_RES_APP_MOBILECOUPON_GIFTSHOW.LEN.Length];
// Body 길이
nBodyLen = ItemColumn.LenMessage(Column.POS_RES_APP_MOBILECOUPON_GIFTSHOW.LEN);
// Body 정보 설정
aIrtBody[Column.POS_RES_APP_MOBILECOUPON_GIFTSHOW.SEQ.CouponNo] = sCardData;
aIrtBody[Column.POS_RES_APP_MOBILECOUPON_GIFTSHOW.SEQ.ApprNo] = sApprNo;
aIrtBody[Column.POS_RES_APP_MOBILECOUPON_GIFTSHOW.SEQ.ReqNo] = sReqNo;
sSendData_Body = ItemColumn.MakeMessage(aIrtBody, Column.POS_RES_APP_MOBILECOUPON_GIFTSHOW.LEN, Column.POS_RES_APP_MOBILECOUPON_GIFTSHOW.TYPE);
}
else if (sTrType == PosConst.POS_MOBILECON_GIFTSHOW_INQ_TYPE.APPROVAL_AMT)
{
// 금액권 차감 요청
// Body 요청 전문 생성
string[] aIrtBody = new string[Column.POS_RES_APP_AMT_MOBILECOUPON_GIFTSHOW.LEN.Length];
// Body 길이
nBodyLen = ItemColumn.LenMessage(Column.POS_RES_APP_AMT_MOBILECOUPON_GIFTSHOW.LEN);
// Body 정보 설정
aIrtBody[Column.POS_RES_APP_AMT_MOBILECOUPON_GIFTSHOW.SEQ.CouponNo] = sCardData;
aIrtBody[Column.POS_RES_APP_AMT_MOBILECOUPON_GIFTSHOW.SEQ.SaleAmt] = nPayAmt.ToString();
aIrtBody[Column.POS_RES_APP_AMT_MOBILECOUPON_GIFTSHOW.SEQ.ItemCD] = siTemCD;
aIrtBody[Column.POS_RES_APP_AMT_MOBILECOUPON_GIFTSHOW.SEQ.ReqNo] = sReqNo;
sSendData_Body = ItemColumn.MakeMessage(aIrtBody, Column.POS_RES_APP_AMT_MOBILECOUPON_GIFTSHOW.LEN, Column.POS_RES_APP_AMT_MOBILECOUPON_GIFTSHOW.TYPE);
}
else if (sTrType == PosConst.POS_MOBILECON_GIFTSHOW_INQ_TYPE.REFUND_AMT)
{
// 금액권 차감 취소 요청
// Body 요청 전문 생성
string[] aIrtBody = new string[Column.POS_RES_CAN_AMT_MOBILECOUPON_GIFTSHOW.LEN.Length];
// Body 길이
nBodyLen = ItemColumn.LenMessage(Column.POS_RES_CAN_AMT_MOBILECOUPON_GIFTSHOW.LEN);
// Body 정보 설정
aIrtBody[Column.POS_RES_CAN_AMT_MOBILECOUPON_GIFTSHOW.SEQ.CouponNo] = sCardData;
aIrtBody[Column.POS_RES_CAN_AMT_MOBILECOUPON_GIFTSHOW.SEQ.ApprNo] = sApprNo;
aIrtBody[Column.POS_RES_CAN_AMT_MOBILECOUPON_GIFTSHOW.SEQ.SaleAmt] = nPayAmt.ToString();
aIrtBody[Column.POS_RES_CAN_AMT_MOBILECOUPON_GIFTSHOW.SEQ.ItemCD] = siTemCD;
aIrtBody[Column.POS_RES_CAN_AMT_MOBILECOUPON_GIFTSHOW.SEQ.ReqNo] = sReqNo;
sSendData_Body = ItemColumn.MakeMessage(aIrtBody, Column.POS_RES_CAN_AMT_MOBILECOUPON_GIFTSHOW.LEN, Column.POS_RES_CAN_AMT_MOBILECOUPON_GIFTSHOW.TYPE);
}
aIrtHeader[Column.POS_RES_SEL_MOBILECOUPON_GIFTSHOW_HEADER.SEQ.BodyLen] = nBodyLen.ToString();
sSendData = ItemColumn.MakeMessage(aIrtHeader, Column.POS_RES_SEL_MOBILECOUPON_GIFTSHOW_HEADER.LEN, Column.POS_RES_SEL_MOBILECOUPON_GIFTSHOW_HEADER.TYPE);
sSendData += sSendData_Body;
break;
#endregion
}
case ItemConst.TR_ITEM_ID.MOBILECON.GIFTCON: // 기프티콘
{
#region
sSendData = "";
sSendData += CmUtil.MidH(sTrType, 0, 4); // 전문번호
sSendData += CmUtil.MidH("05", 0, 2); // 전문상위버전
sSendData += CmUtil.MidH("10", 0, 2); // 전문하위버전
sSendData += CmUtil.MidH("", 0, 4); // 기관코드
sSendData += CmUtil.MidH(DateTime.Now.ToString("yyyyMMdd"), 0, 8); // 전송일자
sSendData += CmUtil.MidH(DateTime.Now.ToString("HHmmss"), 0, 6); // 전송시간
sSendData += CmUtil.MidH(DateTime.Now.ToString("HHmmssfff"), 0, 10); // 추적번호
sSendData += CmUtil.MidH("0000", 0, 4); // 본문길이
sSendData += CmUtil.MidH("", 0, 2); // 응답코드
sSendData += CmUtil.MidH("", 0, 2); // 오류코드
sSendData += CmUtil.MidH("", 0, 10); // Filler
if (sTrType == PosConst.POS_MOBILECON_GIFTCON_INQ_TYPE.SEARCH)
{
sSendData += CmUtil.MidH(sApprID, 0, 6); // 제휴사코드
sSendData += CmUtil.MidH(m_cPosStatus.Base.StoreNo, 0, 10); // 가맹점ID
sSendData += CmUtil.MidH(CmUtil.GetDataRowStr(PosMstManager.GetMstStore(), PosMst.MST_STORE.DATA.STORNM), 0, 80); // 가맹점 명칭
sSendData += CmUtil.MidH(m_cPosStatus.Base.PosNo, 0, 16); // POS NO
sSendData += CmUtil.MidH(DateTime.Now.ToString("yyyyMMdd"), 0, 8); // 요청일자
sSendData += CmUtil.MidH(DateTime.Now.ToString("HHmmss"), 0, 6); // 요청시간
sSendData += CmUtil.MidH(sCardData, 0, 20); // 쿠폰번호
sSendData += CmUtil.MidH(sWCC, 0, 1); // 입력구분
sSendData += CmUtil.MidH("1", 0, 1); // 보안설정
sSendData += CmUtil.MidH("", 0, 11); // 수신자번호
sSendData += CmUtil.MidH("", 0, 50); // Filler
bSendData = null;
bSendData = Encoding.Default.GetBytes(sSendData);
SetBigEndian(ref bSendData, 36, 4, CmUtil.LenH(sSendData)); // 전문길이 설정
//// 조회
//string[] aIrtData = new string[Column.POS_RES_SEL_MOBILECOUPON_GIFTCON.LEN.Length];
//// 길이
//nHeaderLen = ItemColumn.LenMessage(Column.POS_RES_SEL_MOBILECOUPON_GIFTCON.LEN);
//// Data 정보 설정
//aIrtData[Column.POS_RES_SEL_MOBILECOUPON_GIFTCON.SEQ.TranType] = sTrType;
//aIrtData[Column.POS_RES_SEL_MOBILECOUPON_GIFTCON.SEQ.CommTopVer] = "05";
//aIrtData[Column.POS_RES_SEL_MOBILECOUPON_GIFTCON.SEQ.CommLowVer] = "10";
//aIrtData[Column.POS_RES_SEL_MOBILECOUPON_GIFTCON.SEQ.BizNo] = "";
//aIrtData[Column.POS_RES_SEL_MOBILECOUPON_GIFTCON.SEQ.TranDate] = DateTime.Now.ToString("yyyyMMdd");
//aIrtData[Column.POS_RES_SEL_MOBILECOUPON_GIFTCON.SEQ.TranTime] = DateTime.Now.ToString("HHmmss");
//aIrtData[Column.POS_RES_SEL_MOBILECOUPON_GIFTCON.SEQ.TranUniqueNo] = DateTime.Now.ToString("HHmmssfff");
//aIrtData[Column.POS_RES_SEL_MOBILECOUPON_GIFTCON.SEQ.HeaderLen] = nHeaderLen.ToString();
//aIrtData[Column.POS_RES_SEL_MOBILECOUPON_GIFTCON.SEQ.ResStatus] = "";
//aIrtData[Column.POS_RES_SEL_MOBILECOUPON_GIFTCON.SEQ.ErrStatus] = "";
//aIrtData[Column.POS_RES_SEL_MOBILECOUPON_GIFTCON.SEQ.HeaderFiller] = "";
//aIrtData[Column.POS_RES_SEL_MOBILECOUPON_GIFTCON.SEQ.PartnerShipCD] = sApprID;
//aIrtData[Column.POS_RES_SEL_MOBILECOUPON_GIFTCON.SEQ.FranChiseCD] = m_cPosStatus.Base.StoreNo;
//aIrtData[Column.POS_RES_SEL_MOBILECOUPON_GIFTCON.SEQ.FranChiseNM] = CmUtil.GetDataRowStr(PosMstManager.GetMstStore(), PosMst.MST_STORE.DATA.STORNM);
//aIrtData[Column.POS_RES_SEL_MOBILECOUPON_GIFTCON.SEQ.PosNo] = m_cPosStatus.Base.PosNo;
//aIrtData[Column.POS_RES_SEL_MOBILECOUPON_GIFTCON.SEQ.SaleDate] = DateTime.Now.ToString("yyyyMMdd");
//aIrtData[Column.POS_RES_SEL_MOBILECOUPON_GIFTCON.SEQ.SaleTime] = DateTime.Now.ToString("HHmmss");
//aIrtData[Column.POS_RES_SEL_MOBILECOUPON_GIFTCON.SEQ.CouponNo] = sCardData;
//aIrtData[Column.POS_RES_SEL_MOBILECOUPON_GIFTCON.SEQ.Wcc] = sWCC;
//aIrtData[Column.POS_RES_SEL_MOBILECOUPON_GIFTCON.SEQ.SecurityType] = "1";
//aIrtData[Column.POS_RES_SEL_MOBILECOUPON_GIFTCON.SEQ.ReqNo] = "";
//aIrtData[Column.POS_RES_SEL_MOBILECOUPON_GIFTCON.SEQ.BodyFiller] = "";
//sSendData = ItemColumn.MakeMessage(aIrtData, Column.POS_RES_SEL_MOBILECOUPON_GIFTCON.LEN, Column.POS_RES_SEL_MOBILECOUPON_GIFTCON.TYPE);
}
else if (sTrType == PosConst.POS_MOBILECON_GIFTCON_INQ_TYPE.APPROVAL)
{
//// 승인
//string[] aIrtData = new string[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.LEN.Length];
//// 길이
//nHeaderLen = ItemColumn.LenMessage(Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.LEN);
//// Data 정보 설정
//aIrtData[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.TranType] = sTrType;
//aIrtData[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.CommTopVer] = "05";
//aIrtData[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.CommLowVer] = "10";
//aIrtData[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.BizNo] = "";
//aIrtData[Column.POS_RES_SEL_MOBILECOUPON_GIFTCON.SEQ.TranDate] = DateTime.Now.ToString("yyyyMMdd");
//aIrtData[Column.POS_RES_SEL_MOBILECOUPON_GIFTCON.SEQ.TranTime] = DateTime.Now.ToString("HHmmss");
//aIrtData[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.TranUniqueNo] = DateTime.Now.ToString("HHmmssfff");
//aIrtData[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.HeaderLen] = nHeaderLen.ToString();
//aIrtData[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.ResStatus] = "";
//aIrtData[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.ErrStatus] = "";
//aIrtData[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.HeaderFiller] = "";
//aIrtData[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.PartnerShipCD] = sApprID;
//aIrtData[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.FranChiseCD] = m_cPosStatus.Base.StoreNo;
//aIrtData[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.FranChiseNM] = CmUtil.GetDataRowStr(PosMstManager.GetMstStore(), PosMst.MST_STORE.DATA.STORNM);
//aIrtData[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.PosNo] = m_cPosStatus.Base.PosNo;
//aIrtData[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.SaleDate] = sApprDate;
//aIrtData[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.SaleTime] = sApprTime;
//aIrtData[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.CouponNo] = sCardData;
//aIrtData[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.Wcc] = sWCC;
//aIrtData[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.SecurityType] = "1";
//aIrtData[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.ReqNo] = "";
//aIrtData[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.LimitTenderType] = "00";
//aIrtData[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.UseAmount] = nPayAmt.ToString();
//aIrtData[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.Cost] = "0";
//aIrtData[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.CatCompAmt] = "0";
//aIrtData[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.VenderAmt] = "0";
//aIrtData[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.AppNo] = "";
//aIrtData[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.ReqMessage] = "";
//aIrtData[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.Balance] = "0";
//aIrtData[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.BodyFiller] = "";
//sSendData = ItemColumn.MakeMessage(aIrtData, Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.LEN, Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.TYPE);
sSendData += CmUtil.MidH(sApprID, 0, 6); // 제휴사코드
sSendData += CmUtil.MidH(m_cPosStatus.Base.StoreNo, 0, 10); // 가맹점ID
sSendData += CmUtil.MidH(CmUtil.GetDataRowStr(PosMstManager.GetMstStore(), PosMst.MST_STORE.DATA.STORNM), 0, 80); // 가맹점 명칭
sSendData += CmUtil.MidH(m_cPosStatus.Base.PosNo, 0, 16); // POS NO
sSendData += CmUtil.MidH(DateTime.Now.ToString("yyyyMMdd"), 0, 8); // 요청일자
sSendData += CmUtil.MidH(DateTime.Now.ToString("HHmmss"), 0, 6); // 요청시간
sSendData += CmUtil.MidH(sCardData, 0, 20); // 쿠폰번호
sSendData += CmUtil.MidH(sWCC, 0, 1); // 입력구분
sSendData += CmUtil.MidH("1", 0, 1); // 보안설정
sSendData += CmUtil.MidH("", 0, 11); // 수신자번호
sSendData += CmUtil.MidH(m_cPayItem.OCCUR_ENTRY_10, 0, 2); // 결제유형
sSendData += CmUtil.MidH("0000", 0, 4); // 사용금액
sSendData += CmUtil.MidH("0000", 0, 4); // 원가
sSendData += CmUtil.MidH("0000", 0, 4); // 제휴사부담금
sSendData += CmUtil.MidH("0000", 0, 4); // 공급사부담금
sSendData += CmUtil.MidH("", 0, 20); // 승인번호
sSendData += CmUtil.MidH("", 0, 64); // 승인메시지
sSendData += CmUtil.MidH("0000", 0, 4); // Balance
sSendData += CmUtil.MidH("", 0, 50); // Filler
bSendData = null;
bSendData = Encoding.Default.GetBytes(sSendData);
SetBigEndian(ref bSendData, 36, 4, CmUtil.LenH(sSendData)); // 전문길이 설정
bChangData = Encoding.Default.GetBytes("0000");
SetByteChange(ref bSendData, bChangData, 215 + 0, 4); // 사용금액
double nCost = 0;
nCost = CmUtil.DoubleSubtraction(m_cPayItem.AMT_ENTRY_07, m_cPayItem.AMT_ENTRY_04);
nCost = CmUtil.DoubleSubtraction(nCost, m_cPayItem.AMT_ENTRY_05);
bChangData = Encoding.Default.GetBytes(nCost.ToString());
SetByteChange(ref bSendData, bChangData, 215 + 4, 4); // 원가
bChangData = Encoding.Default.GetBytes(m_cPayItem.AMT_ENTRY_04.ToString());
SetByteChange(ref bSendData, bChangData, 219 + 4, 4); // 제휴사부담금
bChangData = Encoding.Default.GetBytes(m_cPayItem.AMT_ENTRY_05.ToString());
SetByteChange(ref bSendData, bChangData, 223 + 4, 4); // 공급사부담금
bChangData = Encoding.Default.GetBytes(m_cPayItem.AMT_ENTRY_06.ToString());
SetByteChange(ref bSendData, bChangData, 315 + 0, 4); // Balance
}
else if (sTrType == PosConst.POS_MOBILECON_GIFTCON_INQ_TYPE.REFUND)
{
// 취소
//string[] aIrtData = new string[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.LEN.Length];
//// 길이
//nHeaderLen = ItemColumn.LenMessage(Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.LEN);
//// Data 정보 설정
//aIrtData[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.TranType] = sTrType;
//aIrtData[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.CommTopVer] = "05";
//aIrtData[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.CommLowVer] = "10";
//aIrtData[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.BizNo] = "";
//aIrtData[Column.POS_RES_SEL_MOBILECOUPON_GIFTCON.SEQ.TranDate] = DateTime.Now.ToString("yyyyMMdd");
//aIrtData[Column.POS_RES_SEL_MOBILECOUPON_GIFTCON.SEQ.TranTime] = DateTime.Now.ToString("HHmmss");
//aIrtData[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.TranUniqueNo] = DateTime.Now.ToString("HHmmssfff");
//aIrtData[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.HeaderLen] = nHeaderLen.ToString();
//aIrtData[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.ResStatus] = "";
//aIrtData[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.ErrStatus] = "";
//aIrtData[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.HeaderFiller] = "";
//aIrtData[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.PartnerShipCD] = sApprID;
//aIrtData[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.FranChiseCD] = m_cPosStatus.Base.StoreNo;
//aIrtData[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.FranChiseNM] = CmUtil.GetDataRowStr(PosMstManager.GetMstStore(), PosMst.MST_STORE.DATA.STORNM);
//aIrtData[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.PosNo] = m_cPosStatus.Base.PosNo;
//aIrtData[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.SaleDate] = sApprDate;
//aIrtData[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.SaleTime] = sApprTime;
//aIrtData[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.CouponNo] = sCardData;
//aIrtData[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.Wcc] = sWCC;
//aIrtData[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.SecurityType] = "1";
//aIrtData[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.ReqNo] = "";
//aIrtData[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.AppNo] = sApprNo;
//aIrtData[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.ReqMessage] = "";
//aIrtData[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.Balance] = "0";
//aIrtData[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.BodyFiller] = "";
//sSendData = ItemColumn.MakeMessage(aIrtData, Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.LEN, Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.TYPE);
sSendData += CmUtil.MidH(sApprID, 0, 6); // 제휴사코드
sSendData += CmUtil.MidH(m_cPosStatus.Base.StoreNo, 0, 10); // 가맹점ID
sSendData += CmUtil.MidH(CmUtil.GetDataRowStr(PosMstManager.GetMstStore(), PosMst.MST_STORE.DATA.STORNM), 0, 80); // 가맹점 명칭
sSendData += CmUtil.MidH(m_cPosStatus.Base.PosNo, 0, 16); // POS NO
sSendData += CmUtil.MidH(sApprDate, 0, 8); // 요청일자
sSendData += CmUtil.MidH(sApprTime, 0, 6); // 요청시간
sSendData += CmUtil.MidH(sCardData, 0, 20); // 쿠폰번호
sSendData += CmUtil.MidH(sWCC, 0, 1); // 입력구분
sSendData += CmUtil.MidH("1", 0, 1); // 보안설정
sSendData += CmUtil.MidH("", 0, 11); // 수신자번호
sSendData += CmUtil.MidH(sApprNo, 0, 20); // 승인번호
sSendData += CmUtil.MidH("", 0, 64); // 승인메시지
sSendData += CmUtil.MidH("0000", 0, 4); // Balance
sSendData += CmUtil.MidH("", 0, 50); // Filler
bSendData = null;
bSendData = Encoding.Default.GetBytes(sSendData);
SetBigEndian(ref bSendData, 36, 4, CmUtil.LenH(sSendData)); // 전문길이 설정
//bChangData = Encoding.Default.GetBytes(m_cPayItem.AMT_ENTRY_06.ToString());
//SetByteChange(ref bSendData, bChangData, 297 + 0, 4); // Balance
}
else if (sTrType == PosConst.POS_MOBILECON_GIFTCON_INQ_TYPE.NETCANCEL)
{
// 망취소
//string[] aIrtData = new string[Column.POS_REQ_NET_MOBILECOUPON_GIFTCON.LEN.Length];
//// 길이
//nHeaderLen = ItemColumn.LenMessage(Column.POS_REQ_NET_MOBILECOUPON_GIFTCON.LEN);
//// Data 정보 설정
//aIrtData[Column.POS_REQ_NET_MOBILECOUPON_GIFTCON.SEQ.TranType] = sTrType;
//aIrtData[Column.POS_REQ_NET_MOBILECOUPON_GIFTCON.SEQ.CommTopVer] = "05";
//aIrtData[Column.POS_REQ_NET_MOBILECOUPON_GIFTCON.SEQ.CommLowVer] = "10";
//aIrtData[Column.POS_REQ_NET_MOBILECOUPON_GIFTCON.SEQ.BizNo] = "";
//aIrtData[Column.POS_REQ_NET_MOBILECOUPON_GIFTCON.SEQ.TranDate] = m_cPosStatus.Base.SaleDate;
//aIrtData[Column.POS_REQ_NET_MOBILECOUPON_GIFTCON.SEQ.TranTime] = sApprTime;
//aIrtData[Column.POS_REQ_NET_MOBILECOUPON_GIFTCON.SEQ.TranUniqueNo] = DateTime.Now.ToString("HHmmssfff");
//aIrtData[Column.POS_REQ_NET_MOBILECOUPON_GIFTCON.SEQ.HeaderLen] = nHeaderLen.ToString();
//aIrtData[Column.POS_REQ_NET_MOBILECOUPON_GIFTCON.SEQ.ResStatus] = "";
//aIrtData[Column.POS_REQ_NET_MOBILECOUPON_GIFTCON.SEQ.ErrStatus] = "";
//aIrtData[Column.POS_REQ_NET_MOBILECOUPON_GIFTCON.SEQ.HeaderFiller] = "";
//aIrtData[Column.POS_REQ_NET_MOBILECOUPON_GIFTCON.SEQ.PartnerShipCD] = sApprID;
//aIrtData[Column.POS_REQ_NET_MOBILECOUPON_GIFTCON.SEQ.FranChiseCD] = m_cPosStatus.Base.StoreNo;
//aIrtData[Column.POS_REQ_NET_MOBILECOUPON_GIFTCON.SEQ.FranChiseNM] = CmUtil.GetDataRowStr(PosMstManager.GetMstStore(), PosMst.MST_STORE.DATA.STORNM);
//aIrtData[Column.POS_REQ_NET_MOBILECOUPON_GIFTCON.SEQ.PosNo] = m_cPosStatus.Base.PosNo;
//aIrtData[Column.POS_REQ_NET_MOBILECOUPON_GIFTCON.SEQ.SaleDate] = sApprDate;
//aIrtData[Column.POS_REQ_NET_MOBILECOUPON_GIFTCON.SEQ.SaleTime] = sApprTime;
//aIrtData[Column.POS_REQ_NET_MOBILECOUPON_GIFTCON.SEQ.CouponNo] = sCardData;
//aIrtData[Column.POS_REQ_NET_MOBILECOUPON_GIFTCON.SEQ.Wcc] = sWCC;
//aIrtData[Column.POS_REQ_NET_MOBILECOUPON_GIFTCON.SEQ.SecurityType] = "1";
//aIrtData[Column.POS_REQ_NET_MOBILECOUPON_GIFTCON.SEQ.ReqNo] = "";
//aIrtData[Column.POS_REQ_NET_MOBILECOUPON_GIFTCON.SEQ.UseAmount] = "0";
//aIrtData[Column.POS_REQ_NET_MOBILECOUPON_GIFTCON.SEQ.AppNo] = sApprNo;
//aIrtData[Column.POS_REQ_NET_MOBILECOUPON_GIFTCON.SEQ.ReqMessage] = "";
//aIrtData[Column.POS_REQ_NET_MOBILECOUPON_GIFTCON.SEQ.Balance] = "0";
//aIrtData[Column.POS_REQ_NET_MOBILECOUPON_GIFTCON.SEQ.BodyFiller] = "";
//sSendData = ItemColumn.MakeMessage(aIrtData, Column.POS_REQ_NET_MOBILECOUPON_GIFTCON.LEN, Column.POS_REQ_NET_MOBILECOUPON_GIFTCON.TYPE);
sSendData += CmUtil.MidH(sApprID, 0, 6); // 제휴사코드
sSendData += CmUtil.MidH(m_cPosStatus.Base.StoreNo, 0, 10); // 가맹점ID
sSendData += CmUtil.MidH(CmUtil.GetDataRowStr(PosMstManager.GetMstStore(), PosMst.MST_STORE.DATA.STORNM), 0, 80); // 가맹점 명칭
sSendData += CmUtil.MidH(m_cPosStatus.Base.PosNo, 0, 16); // POS NO
sSendData += CmUtil.MidH(sApprDate, 0, 8); // 요청일자
sSendData += CmUtil.MidH(sApprTime, 0, 6); // 요청시간
sSendData += CmUtil.MidH(sCardData, 0, 20); // 쿠폰번호
sSendData += CmUtil.MidH(sWCC, 0, 1); // 입력구분
sSendData += CmUtil.MidH("1", 0, 1); // 보안설정
sSendData += CmUtil.MidH("", 0, 11); // 수신자번호
sSendData += CmUtil.MidH("0000", 0, 4); // 사용금액
sSendData += CmUtil.MidH(sApprNo, 0, 20); // 승인번호
sSendData += CmUtil.MidH("", 0, 64); // 승인메시지
sSendData += CmUtil.MidH("0000", 0, 4); // Balance
sSendData += CmUtil.MidH("", 0, 50); // Filler
bSendData = null;
bSendData = Encoding.Default.GetBytes(sSendData);
SetBigEndian(ref bSendData, 36, 4, CmUtil.LenH(sSendData)); // 전문길이 설정
//bChangData = Encoding.Default.GetBytes("0000");
//SetByteChange(ref bSendData, bChangData, 213 + 0, 4); // 사용금액
//bChangData = Encoding.Default.GetBytes(m_cPayItem.AMT_ENTRY_06.ToString());
//SetByteChange(ref bSendData, bChangData, 301 + 0, 4); // Balance
}
break;
#endregion
}
default:
{
#region
// 헤더
string[] aIrtHeader = new string[Column.POS_HDR_MOBILECOUPON_HPCON.LEN.Length];
// 헤더 길이
nHeaderLen = ItemColumn.LenMessage(Column.POS_HDR_MOBILECOUPON_HPCON.LEN);
if (sTrType == PosConst.POS_MOBILECON_HPCON_INQ_TYPE.SEARCH)
{
// 조회
// Body 요청 전문 생성
string[] aIrtBody = new string[Column.POS_REQ_SEL_DTL_MOBILECOUPON_HPCON.LEN.Length];
// Body 길이
nBodyLen = ItemColumn.LenMessage(Column.POS_REQ_SEL_DTL_MOBILECOUPON_HPCON.LEN);
// Body 정보 설정
aIrtBody[Column.POS_REQ_SEL_DTL_MOBILECOUPON_HPCON.SEQ.CouponNo] = sCardData;
aIrtBody[Column.POS_REQ_SEL_DTL_MOBILECOUPON_HPCON.SEQ.InType] = sWCC;
aIrtBody[Column.POS_REQ_SEL_DTL_MOBILECOUPON_HPCON.SEQ.ReqNo] = sReqNo;
sSendData_Body = ItemColumn.MakeMessage(aIrtBody, Column.POS_REQ_SEL_DTL_MOBILECOUPON_HPCON.LEN, Column.POS_REQ_SEL_DTL_MOBILECOUPON_HPCON.TYPE);
}
else
{
// 승인/취소
// Body 요청 전문 생성
string[] aIrtBody = new string[Column.POS_REQ_APP_DTL_MOBILECOUPON_HPCON.LEN.Length];
// Body 길이
nBodyLen = ItemColumn.LenMessage(Column.POS_REQ_APP_DTL_MOBILECOUPON_HPCON.LEN);
// Body 정보 설정
aIrtBody[Column.POS_REQ_APP_DTL_MOBILECOUPON_HPCON.SEQ.CouponNo] = sCardData;
aIrtBody[Column.POS_REQ_APP_DTL_MOBILECOUPON_HPCON.SEQ.AppNo] = sApprNo;
aIrtBody[Column.POS_REQ_APP_DTL_MOBILECOUPON_HPCON.SEQ.ReqNo] = sReqNo;
aIrtBody[Column.POS_REQ_APP_DTL_MOBILECOUPON_HPCON.SEQ.PayAmt] = nPayAmt.ToString();
sSendData_Body = ItemColumn.MakeMessage(aIrtBody, Column.POS_REQ_APP_DTL_MOBILECOUPON_HPCON.LEN, Column.POS_REQ_APP_DTL_MOBILECOUPON_HPCON.TYPE);
}
// 헤더길이를 전체 길이로 변경
nHeaderLen += nBodyLen;
// 헤더 정보 설정
aIrtHeader[Column.POS_HDR_MOBILECOUPON_HPCON.SEQ.HeadLen] = nHeaderLen.ToString();
aIrtHeader[Column.POS_HDR_MOBILECOUPON_HPCON.SEQ.DocVer] = "0003";
aIrtHeader[Column.POS_HDR_MOBILECOUPON_HPCON.SEQ.BrandID] = sApprID;
aIrtHeader[Column.POS_HDR_MOBILECOUPON_HPCON.SEQ.TranType] = sTrType;
aIrtHeader[Column.POS_HDR_MOBILECOUPON_HPCON.SEQ.StoreCD] = m_cPosStatus.Base.StoreNo;
aIrtHeader[Column.POS_HDR_MOBILECOUPON_HPCON.SEQ.StoreNM] = CmUtil.GetDataRowStr(PosMstManager.GetMstStore(), PosMst.MST_STORE.DATA.STORNM);
aIrtHeader[Column.POS_HDR_MOBILECOUPON_HPCON.SEQ.PosNo] = m_cPosStatus.Base.PosNo;
aIrtHeader[Column.POS_HDR_MOBILECOUPON_HPCON.SEQ.ReqNoChk] = "2";
aIrtHeader[Column.POS_HDR_MOBILECOUPON_HPCON.SEQ.SaleDate] = sApprDate;
aIrtHeader[Column.POS_HDR_MOBILECOUPON_HPCON.SEQ.SaleTime] = sApprTime;
aIrtHeader[Column.POS_HDR_MOBILECOUPON_HPCON.SEQ.ResStatus] = "";
aIrtHeader[Column.POS_HDR_MOBILECOUPON_HPCON.SEQ.ErrCD] = "";
aIrtHeader[Column.POS_HDR_MOBILECOUPON_HPCON.SEQ.BodyLen] = nBodyLen.ToString();
sSendData = ItemColumn.MakeMessage(aIrtHeader, Column.POS_HDR_MOBILECOUPON_HPCON.LEN, Column.POS_HDR_MOBILECOUPON_HPCON.TYPE);
sSendData += sSendData_Body;
break;
#endregion
}
}
}
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
private string GetTranType(string sInqType)
{
string sTrType = null;
try
{
// 전문구분 설정
switch (sInqType)
{
case PosConst.POS_INQ_MODE.SEARCH:
{
// 조회
if (m_cPayItem.PAY_DTL_CD_01 == ItemConst.TR_ITEM_ID.MOBILECON.GIFTCON)
sTrType = PosConst.POS_MOBILECON_GIFTCON_INQ_TYPE.SEARCH; // 기프티콘
else if (m_cPayItem.PAY_DTL_CD_01 == ItemConst.TR_ITEM_ID.MOBILECON.GIFTSHOW)
sTrType = PosConst.POS_MOBILECON_GIFTSHOW_INQ_TYPE.SEARCH; // 기프티쇼
else
sTrType = PosConst.POS_MOBILECON_HPCON_INQ_TYPE.SEARCH; // 해피콘 이외
break;
}
case PosConst.POS_INQ_MODE.APPROVAL:
{
if (m_cTrnStatus.Head.TradeDiv == ItemConst.TRAN_DIV.NORMAL)
{
// 승인
if (m_cPayItem.PAY_DTL_CD_01 == ItemConst.TR_ITEM_ID.MOBILECON.GIFTCON)
sTrType = PosConst.POS_MOBILECON_GIFTCON_INQ_TYPE.APPROVAL; // 기프티콘
else if (m_cPayItem.PAY_DTL_CD_01 == ItemConst.TR_ITEM_ID.MOBILECON.GIFTSHOW)
sTrType = PosConst.POS_MOBILECON_GIFTSHOW_INQ_TYPE.APPROVAL; // 기프티쇼
else
sTrType = PosConst.POS_MOBILECON_HPCON_INQ_TYPE.APPROVAL; // 해피콘 이외
}
else
{
// 취소
if (m_cPayItem.PAY_DTL_CD_01 == ItemConst.TR_ITEM_ID.MOBILECON.GIFTCON)
sTrType = PosConst.POS_MOBILECON_GIFTCON_INQ_TYPE.REFUND; // 기프티콘
else if (m_cPayItem.PAY_DTL_CD_01 == ItemConst.TR_ITEM_ID.MOBILECON.GIFTSHOW)
sTrType = PosConst.POS_MOBILECON_GIFTSHOW_INQ_TYPE.REFUND; // 기프티쇼
else
sTrType = PosConst.POS_MOBILECON_HPCON_INQ_TYPE.REFUND; // 해피콘 이외
}
break;
}
case PosConst.POS_INQ_MODE.REFUND:
{
// 취소
if (m_cPayItem.PAY_DTL_CD_01 == ItemConst.TR_ITEM_ID.MOBILECON.GIFTCON)
sTrType = PosConst.POS_MOBILECON_GIFTCON_INQ_TYPE.REFUND; // 기프티콘
else if (m_cPayItem.PAY_DTL_CD_01 == ItemConst.TR_ITEM_ID.MOBILECON.GIFTSHOW)
sTrType = PosConst.POS_MOBILECON_GIFTSHOW_INQ_TYPE.REFUND; // 기프티쇼
else
sTrType = PosConst.POS_MOBILECON_HPCON_INQ_TYPE.REFUND; // 해피콘 이외
break;
}
case PosConst.POS_INQ_MODE.NETCANCEL:
{
// 망취소
if (m_cPayItem.PAY_DTL_CD_01 == ItemConst.TR_ITEM_ID.MOBILECON.GIFTCON)
sTrType = PosConst.POS_MOBILECON_GIFTCON_INQ_TYPE.NETCANCEL; // 기프티콘
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 sTrType;
}
#endregion
#region
/// <summary>
/// 전문구분, 오류코드
/// </summary>
/// <param name="sTrType"></param>
/// <param name="sErrCode"></param>
/// <returns></returns>
private string GMarket_ErrCodeToMsg(string sTrType, string sErrCode)
{
string sMsg = string.Empty;
try
{
switch (sTrType)
{
case PosConst.POS_MOBILECON_GIFTCON_INQ_TYPE.SEARCH:
{
// 조회 응답 메시지
switch (sErrCode)
{
case "00": sMsg = "인증 가능"; break;
case "10": sMsg = "이미 사용한 쿠폰"; break;
case "20": sMsg = "인증번호 오류"; break;
case "30": sMsg = "유효기간 경과된 쿠폰"; break;
case "40": sMsg = "존재하지 않는 쿠폰"; break;
default: sMsg = "처리오류(기타사유)"; break;
}
break;
}
case PosConst.POS_MOBILECON_GIFTCON_INQ_TYPE.APPROVAL:
{
// 승인 응답 메시지
switch (sErrCode)
{
case "00": sMsg = "인증 성공"; break;
case "10": sMsg = "이미 사용한 쿠폰"; break;
case "20": sMsg = "존재하지 않는 쿠폰"; break;
case "30": sMsg = "처리실패 (인증실패)"; break;
case "40": sMsg = "처리오류 (배송완료 실패)"; break;
case "50": sMsg = "처리오류 (지점코드 오류)"; break;
case "60": sMsg = "판매자 ID오류"; break;
default: sMsg = "처리오류(기타사유)"; break;
}
break;
}
default:
{
// 취소 응답 메시지
switch (sErrCode)
{
case "00": sMsg = "취소 성공"; break;
case "10": sMsg = "배송완료 상태로 취소 거절"; break;
case "30": sMsg = "해당 쿠폰 없음"; break;
case "40": sMsg = "아이디 체크 오류"; break;
default: sMsg = "처리오류(기타사유)"; break;
}
break;
}
}
sMsg = string.Format("{0}:{1}", sErrCode, sMsg);
}
catch { }
return sMsg;
}
private byte[] GetByteArrayFromString(string src)
{
return System.Text.Encoding.Default.GetBytes(src);
}
#endregion
#region
/// <summary>
/// Byte 배열 복사
/// </summary>
/// <param name="byValue"></param>
/// <param name="nIndex"></param>
/// <param name="nLength"></param>
/// <returns></returns>
public byte[] ByteCopy(byte[] byValue, int nIndex, int nLength)
{
byte[] byReturn = new byte[nLength];
try
{
for (int nLoop = 0; nLoop < nLength; nLoop++)
{
byReturn[nLoop] = byValue[nIndex + nLoop];
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
}
return byReturn;
}
/// <summary>
/// GetBigEndian
/// </summary>
/// <param name="bytData"></param>
/// <param name="nindex"></param>
/// <param name="nLength"></param>
/// <returns></returns>
public int GetBigEndian(byte[] bytData, int nindex, int nLength)
{
if (nLength == 4)
{
byte[] bytBigEndian = ByteCopy(bytData, nindex, nLength);
if (BitConverter.IsLittleEndian) Array.Reverse(bytBigEndian);
return BitConverter.ToInt32(bytBigEndian, 0);
}
return 0;
}
/// <summary>
/// SetBigEndian
/// </summary>
/// <param name="bytData"></param>
/// <param name="nindex"></param>
/// <param name="nLength"></param>
/// <param name="nValue"></param>
public void SetBigEndian(ref byte[] bytData, int nindex, int nLength, int nValue)
{
try
{
if (nLength == 4)
{
byte[] bytBigEndian = BitConverter.GetBytes((Int32)nValue);
if (BitConverter.IsLittleEndian) Array.Reverse(bytBigEndian);
for (int i = 0; i < bytBigEndian.Length; i++)
{
bytData[nindex + i] = bytBigEndian[i];
}
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
public void SetByteChange(ref byte[] bscrData, byte[] bDestData, int nindex, int nLength)
{
try
{
for (int i = nindex; i < nLength; i++)
{
bscrData[nindex + i] = bDestData[i];
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
public void ByteDimCopy(ref byte[] bsrcData, byte[] bChangeData, int nPoint, int nDataLen, int nAddLen)
{
try
{
int isrcIndex = 0;
byte[] bdestData = new byte[bsrcData.Length + nDataLen];
for (int i = 0; i < bsrcData.Length; i++)
{
if (i >= nPoint && i < nPoint + nDataLen)
{
bdestData[i] = 48;
}
else if (i == nPoint + nDataLen)
{
for (int j = 0; j < bChangeData.Length; j++)
{
bdestData[i + j] = bChangeData[j];
isrcIndex = j;
}
}
else if (i < nPoint || i >= nPoint + nDataLen)
{
bdestData[i + isrcIndex] = bsrcData[i];
}
}
bsrcData = bdestData;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
#endregion
#region
/// <summary>
/// 상품별 할인 금액 설정
/// </summary>
/// <param name="sCoopDcDiv"></param>
/// <param name="sProductiTem"></param>
/// <param name="sCouponNo"></param>
/// <returns></returns>
public string SetPluDcAmount(string sCoopDcDiv, string sProductiTem, string sCouponNo)
{
string sRet = UserCom.RST_ERR;
try
{
string[] aProductiTem = sProductiTem.Split(new string[] { "$~" }, StringSplitOptions.None);
for (int iRow = 0; iRow < aProductiTem.Length; iRow++)
{
string[] aProductiTemInfo = aProductiTem[iRow].Split(new string[] { "!~" }, StringSplitOptions.None);
if (aProductiTemInfo.Length > 0)
{
// 쿠폰번호/가상쿠폰번호 체크
if (aProductiTemInfo[0].Trim() == sCouponNo)
{
ArrayList alSaleItem = (ArrayList)StateObject.GetItemObject(Column.TR_PLU.ITEM);
for (int i = 0; i < alSaleItem.Count; i++)
{
Column.TR_PLU.DATA cPluItem = (Column.TR_PLU.DATA)alSaleItem[i];
if (cPluItem.CANCEL_DIV == PosConst.CANCEL_DIV.CANCEL || cPluItem.CANCEL_DIV_MAIN == PosConst.CANCEL_DIV.CANCEL) continue; // 지정취소
if (cPluItem.DC_PRMT_YN != "0") continue;
if (cPluItem.ITEM_PLU_CD != aProductiTemInfo[3].Trim()) continue;
if (cPluItem.CPN_DC_DIV == ItemConst.PLU_CPN_DC_TYPE.NORMAL || cPluItem.CPN_DC_DIV == sCoopDcDiv)
{
cPluItem.CPN_DC_AMT += CmUtil.DoubleParse(aProductiTemInfo[5]);
cPluItem.CPN_DC_DIV = sCoopDcDiv;
cPluItem.CPN_NO = sCouponNo;
m_cPayItem.PAY_DTL_CD_03 = "1"; // 할인금액 아이템 적용여부
m_cPayItem.AMT_ENTRY_02 = cPluItem.CPN_DC_AMT; // 할인금액
m_cPayItem.OCCUR_ENTRY_17 = aProductiTemInfo[2].Trim(); // 프로덕트 코드
m_cPayItem.OCCUR_ENTRY_18 = aProductiTemInfo[3].Trim(); // 프로덕트 적용 상품코드
m_cPayItem.OCCUR_ENTRY_19 = "0"; // b2b 여부 (1:b2b, 0:일반)
if (m_cPayItem.OCCUR_ENTRY_17 != "") m_cPayItem.OCCUR_ENTRY_19 = "1";
m_cDataService.UpdatePluItemAmount(cPluItem);
}
}
}
}
}
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;
}
/// <summary>
/// 상품별 할인 금액 삭제
/// </summary>
/// <returns></returns>
public double ClearPluDcAmount(string sCoopDcDiv)
{
try
{
ArrayList alSaleItem = (ArrayList)StateObject.GetItemObject(Column.TR_PLU.ITEM);
for (int i = 0; i < alSaleItem.Count; i++)
{
Column.TR_PLU.DATA cPluItem = (Column.TR_PLU.DATA)alSaleItem[i];
if (cPluItem.CANCEL_DIV == PosConst.CANCEL_DIV.CANCEL || cPluItem.CANCEL_DIV_MAIN == PosConst.CANCEL_DIV.CANCEL) continue; // 지정취소
if (cPluItem.CPN_DC_DIV == sCoopDcDiv && cPluItem.CPN_DC_AMT > 0)
{
cPluItem.CPN_DC_AMT -= m_cPayItem.AMT_ENTRY_02;
if (cPluItem.CPN_DC_AMT <= 0)
{
cPluItem.CPN_DC_DIV = ItemConst.PLU_CPN_DC_TYPE.NORMAL; // 쿠폰 할인 구분
m_cPayItem.PAY_DTL_CD_03 = "0"; // 할인금액 아이템 적용여부
m_cPayItem.OCCUR_ENTRY_17 = "";
m_cPayItem.OCCUR_ENTRY_18 = "";
m_cPayItem.OCCUR_ENTRY_19 = "0";
cPluItem.CPN_NO = "";
}
m_cPayItem.AMT_ENTRY_02 = cPluItem.CPN_DC_AMT; // 할인금액
m_cDataService.UpdatePluItemAmount(cPluItem);
}
}
}
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 0;
}
#endregion
#region Byte
/// <summary>
/// Byte배열을 string으로 변환 (Byte배열의 null(0x00)값 제거)
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
private string ByteToString(byte[] data)
{
int inx = Array.FindIndex(data, 0, (x) => x == 0x0);
if (inx >= 0)
{
return Encoding.Default.GetString(data, 0, inx);
}
else
{
return Encoding.Default.GetString(data);
}
}
#endregion
}
}