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

1935 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 MobileCouponHappyCon : PaymentBase, IPaymentUs
{
#region HappyconDLL.DLL
/// <summary>
/// 해피콘 요청 함수
/// </summary>
[DllImport("HappyconDLL.dll", CallingConvention = CallingConvention.Cdecl)]
//- dest_ip: 해피콘차세대IP주소
//- dest_port: 해피콘차세대PORT
//- request_data: 평문 전문 데이터
//- request_data_size: 평문 전문 데이터 길이
//- recv_buf: 할당된Receive buffer
//- recv_buf_size: 할당된 버퍼 사이즈
/// int RequestProtocolForAdvancedPos( const char* dest_ip, const short dest_port, const char* request_data, const int request_data_size, char* recv_buf, const int recv_buf_size )
public static extern int RequestProtocolForAdvancedPos(byte[] dest_ip, short dest_port, byte[] request_data, int request_data_size, byte[] recv_buf, int recv_buf_size);
#endregion
#region
// 접속정보
private IDataCommonUs m_cDataCommon = null;
private string[] aIrtRsp_Search = null;
public MobileCouponHappyCon()
{
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 = ""; // 수신자 번호
m_cPayItem = new Column.TR_PAYMENT.DATA(); // 결과 저장 변수 생성
m_cPayItem.PAY_WAY_CD = aParam[8]; // 결제수단
m_cPayItem.PAY_DTL_CD_01 = aParam[9]; // 상세코드
string sSearchType = aParam[10]; // 조회구분
string sCouponinfo = aParam[11]; // 쿠폰번호 + 가상쿠폰번호
string sTrType = GetTranType(sSearchType); // 전문구분
sRet = ExecuteIrt(PosConst.CANCEL_DIV.NORMAL, sTrType, sWCC, sInPutData, sCardData, sReqNo, nPayAmt, sApprDate, "", sApprTime, sCouponinfo, "", "", 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 sCouponInfo = aParam[10]; // 쿠폰정보
string sCouponTypeInfo = aParam[11]; // 쿠폰정보 (물품형, 금액권)
string sProductiTem = aParam[12]; // 프로덕트 상품 정보
string sReqNo = ""; // 수신자 번호
sTrType = GetTranType(PosConst.POS_INQ_MODE.APPROVAL); // 전문구분
// 승인요청
sRet = ExecuteIrt(PosConst.CANCEL_DIV.NORMAL, sTrType, sWCC, sInPutData, sCardData, sReqNo, nPayAmt, sApprDate, sApprNo, sApprTime, sCouponInfo, sCouponTypeInfo, sProductiTem, ref aRet);
if (sRet != UserCom.RST_OK)
{
return sRet;
}
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, ref aRet);
//if (sRet != UserCom.RST_OK) return sRet;
return sRet;
}
m_cPayItem.CANCEL_DIV = PosConst.CANCEL_DIV.CANCEL;
// 할인취소
if (sProductiTem.Trim() != "")
{
// 해피콘할인 구분자 추가(2017.07.14)
ClearPluDcAmount(ItemConst.PLU_DC_DIV.HAPPYCON_DC);
//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_SUBTOT, 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 sCouponTypeInfo, string sProductiTem, ref string[] aIrtRspDTL)
{
string sRet = UserCom.RST_ERR;
string[] aIrtRspHDR = null;
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);
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:
case ItemConst.TR_ITEM_ID.MOBILECON.GIFTCON:
#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 = ""; // 승인시간
//m_cPayItem.AMT_ENTRY_02 = 0; // 제휴 할인 금액
}
// --------------------------------------------------------------------------------------------------------------------------------
break;
}
#endregion
#region
//{
// if (sTrType == PosConst.POS_MOBILECON_GIFTCON_INQ_TYPE.APPROVAL)
// {
// // 승인 응답
// m_cPayItem.OCCUR_ENTRY_02 = aIrtRspHDR[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.AppNo].Trim(); // 승인번호
// m_cPayItem.OCCUR_ENTRY_03 = aIrtRspHDR[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.TranDate].Trim(); // 승인일자
// m_cPayItem.OCCUR_ENTRY_04 = aIrtRspHDR[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.TranTime].Trim(); // 승인시간
// }
// else if (sTrType == PosConst.POS_MOBILECON_GIFTCON_INQ_TYPE.REFUND)
// {
// // 취소 응답
// m_cPayItem.OCCUR_ENTRY_02 = aIrtRspHDR[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.AppNo].Trim(); // 승인번호
// m_cPayItem.OCCUR_ENTRY_03 = aIrtRspHDR[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.TranDate].Trim(); // 승인일자
// m_cPayItem.OCCUR_ENTRY_04 = aIrtRspHDR[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.TranTime].Trim(); // 승인시간
// }
// else if (sTrType == PosConst.POS_MOBILECON_GIFTCON_INQ_TYPE.NETCANCEL)
// {
// // 망취소 응답
// m_cPayItem.OCCUR_ENTRY_02 = aIrtRspHDR[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.AppNo].Trim(); // 승인번호
// m_cPayItem.OCCUR_ENTRY_03 = aIrtRspHDR[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.TranDate].Trim(); // 승인일자
// m_cPayItem.OCCUR_ENTRY_04 = aIrtRspHDR[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 = ""; // 승인시간
// }
// // --------------------------------------------------------------------------------------------------------------------------------
// 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.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.DCAmount]); // 제휴 할인 금액
// 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_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.OCCUR_ENTRY_25 = aIrtRspHDR[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.TranUniqueNo].Trim(); // 추적번호
// break;
//}
#endregion
default:
#region
{
if (sTrType == PosConst.POS_MOBILECON_HPCON_INQ_TYPE_NEW.APPROVAL)
{
// 승인 응답
string sPAY_WAY_CD = m_cPayItem.PAY_WAY_CD; // 결제수단
string sPAY_DTL_CD_01 = m_cPayItem.PAY_DTL_CD_01; // 상세코드
int index = 4;
for (int iLoop = 0; iLoop < CmUtil.DoubleParse(aIrtRspDTL[3].Trim()); iLoop++)
{
string[] aDataCheck = new string[7];
aDataCheck[0] = aIrtRspDTL[index++].Trim(); // 쿠폰번호
aDataCheck[1] = aIrtRspDTL[index++].Trim(); // 가상쿠폰번호
aDataCheck[2] = aIrtRspDTL[index++].Trim(); // 승인번호
aDataCheck[3] = aIrtRspDTL[index++].Trim(); // 구성된 상품순번
aDataCheck[4] = aIrtRspDTL[index++].Trim(); // 사용된 금액
aDataCheck[5] = aIrtRspDTL[index++].Trim(); // 잔액
aDataCheck[6] = aIrtRspDTL[index++].Trim(); // 사용가능여부
m_cPayItem = new Column.TR_PAYMENT.DATA();
m_cPayItem.PAY_WAY_CD = sPAY_WAY_CD; // 결제수단
m_cPayItem.PAY_DTL_CD_01 = sPAY_DTL_CD_01; // 상세코드
m_cPayItem.PAY_DTL_CD_02 = ""; // 캠페인코드
//m_cPayItem.PAY_DTL_CD_03 = "0"; // 할인금액 아이템 적용여부
sCardData = aDataCheck[0]; // 쿠폰번호
m_cPayItem.OCCUR_ENTRY_09 = aDataCheck[1]; // 가상쿠폰번호
m_cPayItem.OCCUR_ENTRY_02 = aDataCheck[2]; // 승인번호
m_cPayItem.PAY_DTL_CD_04 = aDataCheck[3]; // 구성 상품코드
nPayAmt = System.Math.Abs(CmUtil.DoubleParse(aDataCheck[4])); // 사용된 금액
m_cPayItem.AMT_ENTRY_04 = System.Math.Abs(CmUtil.DoubleParse(aDataCheck[5])); // 사용후 잔액
m_cPayItem.OCCUR_ENTRY_14 = aDataCheck[6]; // 사용 가능 여부
m_cPayItem.PAY_AMT = nPayAmt;
m_cPayItem.OCCUR_ENTRY_03 = DateTime.Now.ToString("yyyyMMdd"); // 승인일자
m_cPayItem.OCCUR_ENTRY_04 = DateTime.Now.ToString("hhmm"); // 승인시간
//m_cPayItem.AMT_ENTRY_02 = 0; // 제휴 할인 금액
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 = GetCounponType(aDataCheck[0], aDataCheck[1], sCouponTypeInfo); // 권종구분 (0:상품교환권, 1:금액권)
m_cPayItem.OCCUR_ENTRY_15 = string.IsNullOrEmpty(sProductiTem) ? string.Empty: 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; // 빌분리 번호
// 프로모션 할인 적용
if (!string.IsNullOrEmpty(sProductiTem))
{
sProductiTem = sProductiTem.Trim();
//해피콘할인 구분자 추가(2017.07.14)
//SetPluDcAmount(m_cPayItem.PAY_WAY_CD + m_cPayItem.PAY_DTL_CD_01, sProductiTem, aDataCheck[0], aDataCheck[1]); // 상품아이템에 할인금액 설정
SetPluDcAmount(ItemConst.PLU_DC_DIV.HAPPYCON_DC, sProductiTem, aDataCheck[0], aDataCheck[1]); // 상품아이템에 할인금액 설정
}
// 결제 아이템 추가
ArrayList alPayItem = (ArrayList)StateObject.GetItemObject(Column.TR_PAYMENT.ITEM); // 결제 내역 받아 오기
m_cPayItem.SEQ = alPayItem.Count + 1;
alPayItem.Add(m_cPayItem);
}
sRet = UserCom.RST_OK;
return sRet;
}
else if (sTrType == PosConst.POS_MOBILECON_HPCON_INQ_TYPE_NEW.REFUND)
{
// 취소 응답
string sPAY_WAY_CD = m_cPayItem.PAY_WAY_CD; // 결제수단
string sPAY_DTL_CD_01 = m_cPayItem.PAY_DTL_CD_01; // 상세코드
int index = 4;
for (int iLoop = 0; iLoop < CmUtil.DoubleParse(aIrtRspDTL[3].Trim()); iLoop++)
{
string[] aDataCheck = new string[6];
aDataCheck[0] = aIrtRspDTL[index++].Trim(); // 쿠폰번호
aDataCheck[1] = aIrtRspDTL[index++].Trim(); // 가상쿠폰번호
aDataCheck[2] = aIrtRspDTL[index++].Trim(); // 승인번호
aDataCheck[3] = aIrtRspDTL[index++].Trim(); // 취소된 금액
aDataCheck[4] = aIrtRspDTL[index++].Trim(); // 잔액
aDataCheck[5] = aIrtRspDTL[index++].Trim(); // 사용가능여부
// 결제 내역 검색
ArrayList alPayItem = (ArrayList)StateObject.GetItemObject(Column.TR_PAYMENT.ITEM);
for (int nPayRow = 0; nPayRow < alPayItem.Count; nPayRow++)
{
m_cPayItem = (Column.TR_PAYMENT.DATA)alPayItem[nPayRow];
if (m_cPayItem.CANCEL_DIV == PosConst.CANCEL_DIV.CANCEL) continue;
if (m_cPayItem.PAY_WAY_CD != sPAY_WAY_CD && m_cPayItem.PAY_DTL_CD_01 != sPAY_DTL_CD_01) continue;
if (aDataCheck[0] == m_cPayItem.OCCUR_ENTRY_01.Trim() && aDataCheck[1] == m_cPayItem.OCCUR_ENTRY_09.Trim() && aDataCheck[2] == m_cPayItem.OCCUR_ENTRY_02.Trim())
{
goto OK_Check;
}
}
return sRet;
OK_Check:
m_cPayItem.PAY_WAY_CD = sPAY_WAY_CD; // 결제수단
m_cPayItem.PAY_DTL_CD_01 = sPAY_DTL_CD_01; // 상세코드
m_cPayItem.OCCUR_ENTRY_09 = aDataCheck[1]; // 가상쿠폰번호
m_cPayItem.OCCUR_ENTRY_02 = aDataCheck[2]; // 승인번호
nPayAmt = System.Math.Abs(CmUtil.DoubleParse(aDataCheck[3])); // 사용된 금액
m_cPayItem.AMT_ENTRY_04 = System.Math.Abs(CmUtil.DoubleParse(aDataCheck[4])); // 사용후 잔액
m_cPayItem.OCCUR_ENTRY_14 = aDataCheck[5]; // 사용 가능 여부
m_cPayItem.PAY_AMT = nPayAmt;
m_cPayItem.PAY_DTL_CD_02 = ""; // 캠페인코드
//m_cPayItem.PAY_DTL_CD_03 = "0"; // 할인금액 아이템 적용여부
m_cPayItem.OCCUR_ENTRY_03 = DateTime.Now.ToString("yyyyMMdd"); // 승인일자
m_cPayItem.OCCUR_ENTRY_04 = DateTime.Now.ToString("hhmm"); // 승인시간
//m_cPayItem.AMT_ENTRY_02 = 0; // 제휴 할인 금액
m_cPayItem.PAY_DTL_CD_05 = PosConst.PAY_DC_TYPE.PAY; // 할인결제구분 (1:결제, 2:할인)
m_cPayItem.AMT_ENTRY_01 = nPayAmt; // 받은돈
sCardData = aDataCheck[0];
m_cPayItem.OCCUR_ENTRY_01 = sCardData; // 카드번호
m_cPayItem.OCCUR_ENTRY_05 = sWCC; // 입력 구분
m_cPayItem.OCCUR_ENTRY_06 = aDataCheck[2]; // 원승인번호
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; // 빌분리 번호
if (sTradeDiv == PosConst.CANCEL_DIV.CANCEL)
{
m_cPayItem.CANCEL_DIV = PosConst.CANCEL_DIV.CANCEL;
}
}
sRet = UserCom.RST_OK;
return sRet;
}
else
{
// 조회 응답
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 = 0;
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 sCouponinfo,
ref string[] aIrtRspHDR, ref string[] aIrtRspDTL)
{
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;
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(sTrType, sWCC, sCardData, sReqNo, nPayAmt, sApprDate, sApprNo, sApprTime, sCouponinfo);
if (sTradeDiv == PosConst.CANCEL_DIV.CANCEL_SUBTOT) sTradeDiv = PosConst.CANCEL_DIV.CANCEL;
// 요청 - 승인로그 저장 (판매구분, [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 sRet;
}
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 = "";
}
break;
#endregion
}
case ItemConst.TR_ITEM_ID.MOBILECON.GIFTCON: // 기프티콘
{
#region
// 전문 송수신
if (sTrType == PosConst.POS_MOBILECON_GIFTCON_INQ_TYPE.SEARCH)
sRet = m_cDataCommon.ExecuteExIrt(sServerIP, CmUtil.IntParse(sServerPort), iRecvTimeOut, sSendData, ref sRecvData, 658, "");
else
sRet = m_cDataCommon.ExecuteLenIrt(sServerIP, CmUtil.IntParse(sServerPort), iRecvTimeOut, sSendData, ref sRecvData, 4, 36);
if (sRet != UserCom.RST_OK)
{
//WinManager.ErrorMessage(sRet);
return sRet;
}
bytes = Encoding.Default.GetBytes(sRecvData);
if (sTrType == PosConst.POS_MOBILECON_GIFTCON_INQ_TYPE.SEARCH)
{
// 조회 응답 체크
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)
{
// 승인 정상 상세항목
aIrtRspHDR = 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 aIrtRspHDR);
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)
{
// 취소 정상 상세항목
aIrtRspHDR = 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 aIrtRspHDR);
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)
{
// 망취소 정상 상세항목
aIrtRspHDR = 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 aIrtRspHDR);
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();
}
break;
#endregion
}
default:
{
#region
byte[] bRecvData = new byte[8192]; // 응답 데이터
//WinManager.ShowSearchMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0361));
int iResult = RequestProtocolForAdvancedPos(GetByteArrayFromString(sServerIP), (short)double.Parse(sServerPort), GetByteArrayFromString(sSendData), CmUtil.LenH(sSendData), bRecvData, bRecvData.Length);
sRecvData = ByteToString(bRecvData);
if (sRecvData.Length > 0)
{
if (sTrType == PosConst.POS_MOBILECON_HPCON_INQ_TYPE_NEW.SEARCH)
{
nNowPos = 0;
// 기본 응답값
aIrtRspDTL = new string[Column.POS_REQ_SEL_MOBILECOUPON_HPCON_NEW.LEN.Length];
ItemColumn.ParseMessage(Column.POS_REQ_SEL_MOBILECOUPON_HPCON_NEW.LEN, Column.POS_REQ_SEL_MOBILECOUPON_HPCON_NEW.TYPE, bRecvData, ref nNowPos, ref aIrtRspDTL);
sErrMsg = aIrtRspDTL[Column.POS_REQ_SEL_MOBILECOUPON_HPCON_NEW.SEQ.RecvMsg].Trim();
if (aIrtRspDTL[Column.POS_REQ_SEL_MOBILECOUPON_HPCON_NEW.SEQ.RecvCD].Trim() != "0")
{
// 오류
sRet = aIrtRspDTL[Column.POS_REQ_SEL_MOBILECOUPON_HPCON_NEW.SEQ.RecvMsg].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, DateTime.Now.ToString("yyyyMMdd"), DateTime.Now.ToString("HHmmss")
, aIrtRspDTL[Column.POS_REQ_SEL_MOBILECOUPON_HPCON_NEW.SEQ.RecvCD].Trim()
, sErrMsg
, sRecvData });
//if (sRet.Trim().ToString() == "")
//{
// WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0412);
//}
//else
//{
// sRet = sRet.Replace("\0","");
// if (sRet == "")
// {
// WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0326);
// }
// else
// {
// WinManager.ErrorMessage(sRet);
// }
//}
return sRet;
}
else
{
// 가상 쿠폰번호값
for (int iLoop = 1; iLoop <= CmUtil.IntParse(aIrtRspDTL[Column.POS_REQ_SEL_MOBILECOUPON_HPCON_NEW.SEQ.VirtualCouponNoCnt]); iLoop++)
{
string[] aIrtRspDTL1 = new string[Column.POS_REQ_SEL_DTL_MOBILECOUPON_HPCON_NEW.LEN.Length];
ItemColumn.ParseMessage(Column.POS_REQ_SEL_DTL_MOBILECOUPON_HPCON_NEW.LEN, Column.POS_REQ_SEL_DTL_MOBILECOUPON_HPCON_NEW.TYPE, bRecvData, ref nNowPos, ref aIrtRspDTL1);
int iPrevIndex = aIrtRspDTL.Length;
Array.Resize<string>(ref aIrtRspDTL, aIrtRspDTL.Length + aIrtRspDTL1.Length);
Array.Copy(aIrtRspDTL1, 0, aIrtRspDTL, iPrevIndex, aIrtRspDTL.Length - iPrevIndex);
sErrMsg = aIrtRspDTL1[Column.POS_REQ_SEL_DTL_MOBILECOUPON_HPCON_NEW.SEQ.NotUseReason].Trim();
//if (aIrtRspDTL1[Column.POS_REQ_SEL_DTL_MOBILECOUPON_HPCON.SEQ.VitualCouponState].Trim().ToUpper() != "Y")
//{
// // 사용불가
// // 응답 - 승인로그 저장 (판매구분, [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, DateTime.Now.ToString("yyyyMMdd"), DateTime.Now.ToString("HHmmss")
// , aIrtRspDTL[Column.POS_REQ_SEL_MOBILECOUPON_HPCON.SEQ.RecvCD].Trim()
// , sErrMsg
// , sRecvData });
// WinManager.ErrorMessage(sErrMsg);
// return sRet;
//}
// POS 상품코드 값
for (int iLoop1 = 1; iLoop1 <= CmUtil.IntParse(aIrtRspDTL1[Column.POS_REQ_SEL_DTL_MOBILECOUPON_HPCON_NEW.SEQ.PosiTemCnt]); iLoop1++)
{
string[] aIrtRspDTL2 = new string[Column.POS_REQ_SEL_DTL_POSITEM_MOBILECOUPON_HPCON_NEW.LEN.Length];
ItemColumn.ParseMessage(Column.POS_REQ_SEL_DTL_POSITEM_MOBILECOUPON_HPCON_NEW.LEN, Column.POS_REQ_SEL_DTL_POSITEM_MOBILECOUPON_HPCON_NEW.TYPE, bRecvData, ref nNowPos, ref aIrtRspDTL2);
int iPrevIndex1 = aIrtRspDTL.Length;
Array.Resize<string>(ref aIrtRspDTL, aIrtRspDTL.Length + aIrtRspDTL2.Length);
Array.Copy(aIrtRspDTL2, 0, aIrtRspDTL, iPrevIndex1, aIrtRspDTL.Length - iPrevIndex1);
}
}
// 응답 - 승인로그 저장 (판매구분, [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, DateTime.Now.ToString("yyyyMMdd"), DateTime.Now.ToString("HHmmss")
, aIrtRspDTL[Column.POS_REQ_SEL_MOBILECOUPON_HPCON_NEW.SEQ.RecvCD].Trim()
, sErrMsg
, sRecvData });
}
}
else if (sTrType == PosConst.POS_MOBILECON_HPCON_INQ_TYPE_NEW.APPROVAL || sTrType == PosConst.POS_MOBILECON_HPCON_INQ_TYPE_NEW.REFUND)
{
// 승인/취소
nNowPos = 0;
// 기본 응답값
aIrtRspDTL = new string[Column.POS_REQ_APPR_MOBILECOUPON_HPCON_NEW.LEN.Length];
ItemColumn.ParseMessage(Column.POS_REQ_APPR_MOBILECOUPON_HPCON_NEW.LEN, Column.POS_REQ_APPR_MOBILECOUPON_HPCON_NEW.TYPE, bRecvData, ref nNowPos, ref aIrtRspDTL);
sErrMsg = aIrtRspDTL[Column.POS_REQ_APPR_MOBILECOUPON_HPCON_NEW.SEQ.RecvMsg].Trim();
if (aIrtRspDTL[Column.POS_REQ_APPR_MOBILECOUPON_HPCON_NEW.SEQ.RecvCD].Trim() != "0" && aIrtRspDTL[Column.POS_REQ_APPR_MOBILECOUPON_HPCON_NEW.SEQ.RecvCD].Trim() != "-204006")
{
// 오류
sRet = aIrtRspDTL[Column.POS_REQ_APPR_MOBILECOUPON_HPCON_NEW.SEQ.RecvMsg].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, DateTime.Now.ToString("yyyyMMdd"), DateTime.Now.ToString("HHmmss")
, aIrtRspDTL[Column.POS_REQ_APPR_MOBILECOUPON_HPCON_NEW.SEQ.RecvCD].Trim()
, sErrMsg
, sRecvData });
//WinManager.ErrorMessage(sRet);
return sRet;
}
else
{
if (sTrType == PosConst.POS_MOBILECON_HPCON_INQ_TYPE_NEW.APPROVAL)
{
// 승인 상세
// 가상 쿠폰번호값
for (int iLoop = 1; iLoop <= CmUtil.IntParse(aIrtRspDTL[Column.POS_REQ_APPR_MOBILECOUPON_HPCON_NEW.SEQ.CouponQty]); iLoop++)
{
string[] aIrtRspDTL1 = new string[Column.POS_REQ_APPR_DTL_MOBILECOUPON_HPCON_NEW.LEN.Length];
ItemColumn.ParseMessage(Column.POS_REQ_APPR_DTL_MOBILECOUPON_HPCON_NEW.LEN, Column.POS_REQ_APPR_DTL_MOBILECOUPON_HPCON_NEW.TYPE, bRecvData, ref nNowPos, ref aIrtRspDTL1);
int iPrevIndex = aIrtRspDTL.Length;
Array.Resize<string>(ref aIrtRspDTL, aIrtRspDTL.Length + aIrtRspDTL1.Length);
Array.Copy(aIrtRspDTL1, 0, aIrtRspDTL, iPrevIndex, aIrtRspDTL.Length - iPrevIndex);
}
}
else if (sTrType == PosConst.POS_MOBILECON_HPCON_INQ_TYPE_NEW.REFUND)
{
// 취소 상세
// 가상 쿠폰번호값
for (int iLoop = 1; iLoop <= CmUtil.IntParse(aIrtRspDTL[Column.POS_REQ_APPR_MOBILECOUPON_HPCON_NEW.SEQ.CouponQty]); iLoop++)
{
string[] aIrtRspDTL1 = new string[Column.POS_REQ_CAN_DTL_MOBILECOUPON_HPCON_NEW.LEN.Length];
ItemColumn.ParseMessage(Column.POS_REQ_CAN_DTL_MOBILECOUPON_HPCON_NEW.LEN, Column.POS_REQ_CAN_DTL_MOBILECOUPON_HPCON_NEW.TYPE, bRecvData, ref nNowPos, ref aIrtRspDTL1);
int iPrevIndex = aIrtRspDTL.Length;
Array.Resize<string>(ref aIrtRspDTL, aIrtRspDTL.Length + aIrtRspDTL1.Length);
Array.Copy(aIrtRspDTL1, 0, aIrtRspDTL, iPrevIndex, aIrtRspDTL.Length - iPrevIndex);
}
}
// 응답 - 승인로그 저장 (판매구분, [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, DateTime.Now.ToString("yyyyMMdd"), DateTime.Now.ToString("HHmmss")
, aIrtRspDTL[Column.POS_REQ_APPR_MOBILECOUPON_HPCON_NEW.SEQ.RecvCD].Trim()
, sErrMsg
, sRecvData });
}
}
else if (sTrType == PosConst.POS_MOBILECON_HPCON_INQ_TYPE_NEW.SEARCH_LOG)
{
// 이력조회
nNowPos = 0;
// 기본 응답값
aIrtRspDTL = new string[Column.POS_REQ_SEL_LOG_MOBILECOUPON_HPCON_NEW.LEN.Length];
ItemColumn.ParseMessage(Column.POS_REQ_SEL_LOG_MOBILECOUPON_HPCON_NEW.LEN, Column.POS_REQ_SEL_LOG_MOBILECOUPON_HPCON_NEW.TYPE, bRecvData, ref nNowPos, ref aIrtRspDTL);
sErrMsg = aIrtRspDTL[Column.POS_REQ_SEL_LOG_MOBILECOUPON_HPCON_NEW.SEQ.RecvMsg].Trim();
if (aIrtRspDTL[Column.POS_REQ_SEL_LOG_MOBILECOUPON_HPCON_NEW.SEQ.RecvCD].Trim() != "0")
{
// 오류
sRet = aIrtRspDTL[Column.POS_REQ_SEL_LOG_MOBILECOUPON_HPCON_NEW.SEQ.RecvMsg].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, DateTime.Now.ToString("yyyyMMdd"), DateTime.Now.ToString("HHmmss")
, aIrtRspDTL[Column.POS_REQ_SEL_LOG_MOBILECOUPON_HPCON_NEW.SEQ.RecvCD].Trim()
, sErrMsg
, sRecvData });
//WinManager.ErrorMessage(sRet);
return sRet;
}
else
{
for (int iLoop = 1; iLoop <= CmUtil.IntParse(aIrtRspDTL[Column.POS_REQ_SEL_LOG_MOBILECOUPON_HPCON_NEW.SEQ.iQty]); iLoop++)
{
string[] aIrtRspDTL1 = new string[Column.POS_REQ_SEL_LOG_DTL_MOBILECOUPON_HPCON_NEW.LEN.Length];
ItemColumn.ParseMessage(Column.POS_REQ_SEL_LOG_DTL_MOBILECOUPON_HPCON_NEW.LEN, Column.POS_REQ_SEL_LOG_DTL_MOBILECOUPON_HPCON_NEW.TYPE, bRecvData, ref nNowPos, ref aIrtRspDTL1);
int iPrevIndex = aIrtRspDTL.Length;
Array.Resize<string>(ref aIrtRspDTL, aIrtRspDTL.Length + aIrtRspDTL1.Length);
Array.Copy(aIrtRspDTL1, 0, aIrtRspDTL, iPrevIndex, aIrtRspDTL.Length - iPrevIndex);
}
// 응답 - 승인로그 저장 (판매구분, [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, DateTime.Now.ToString("yyyyMMdd"), DateTime.Now.ToString("HHmmss")
, aIrtRspDTL[Column.POS_REQ_SEL_LOG_MOBILECOUPON_HPCON_NEW.SEQ.RecvCD].Trim()
, sErrMsg
, sRecvData });
}
}
}
else
{
//WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0326);
// 오류시 에러 리턴(2017.05.22)
return sRet;
}
#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);
}
finally
{
//WinManager.HideSearchMessage();
}
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 sTrType, string sWCC, string sCardData, string sReqNo, double nPayAmt, string sApprDate, string sApprNo, string sApprTime, string sCouponInfo)
{
string sSendData = string.Empty;
string sSendData_Body = string.Empty;
double nHeaderLen = 0;
double nBodyLen = 0;
string sCMPApprID = null;
string sApprID = null;
try
{
// 유형별 분기
switch (m_cPayItem.PAY_DTL_CD_01)
{
case ItemConst.TR_ITEM_ID.MOBILECON.GIFTSHOW: // 기프티쇼
{
#region
// 제휴사 코드
sApprID = PosMstManager.GetMstVan(m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01, PosMst.MST_VAN.DATA.APPR_ID);
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] = sCouponInfo;
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] = sCouponInfo;
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
if (sTrType == PosConst.POS_MOBILECON_GIFTCON_INQ_TYPE.SEARCH)
{
// 조회
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] = "00";
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] = "";
// 회사 코드
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);
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] = sApprDate;
aIrtData[Column.POS_RES_SEL_MOBILECOUPON_GIFTCON.SEQ.SaleTime] = sApprTime;
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] = "00";
aIrtData[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.BizNo] = "";
aIrtData[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.TranDate] = m_cPosStatus.Base.SaleDate;
aIrtData[Column.POS_REQ_APP_MOBILECOUPON_GIFTCON.SEQ.TranTime] = sApprTime;
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] = "";
// 회사 코드
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);
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);
}
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] = "00";
aIrtData[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.BizNo] = "";
aIrtData[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.TranDate] = m_cPosStatus.Base.SaleDate;
aIrtData[Column.POS_REQ_CAN_MOBILECOUPON_GIFTCON.SEQ.TranTime] = sApprTime;
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] = "";
// 회사 코드
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);
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);
}
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] = "00";
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] = "";
// 회사 코드
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);
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);
}
break;
#endregion
}
default:
{
#region
// 헤더
string[] aIrtHeader = new string[Column.POS_HDR_MOBILECOUPON_HPCON_NEW.LEN.Length];
// 헤더 길이
nHeaderLen = ItemColumn.LenMessage(Column.POS_HDR_MOBILECOUPON_HPCON_NEW.LEN);
if (sTrType == PosConst.POS_MOBILECON_HPCON_INQ_TYPE_NEW.SEARCH)
{
// 조회
// Body 요청 전문 생성
string[] aIrtBody = new string[Column.POS_RES_SEL_MOBILECOUPON_HPCON_NEW.LEN.Length];
// Body 길이
nBodyLen = ItemColumn.LenMessage(Column.POS_RES_SEL_MOBILECOUPON_HPCON_NEW.LEN);
// Body 정보 설정
aIrtBody[Column.POS_RES_SEL_MOBILECOUPON_HPCON_NEW.SEQ.CouponNo] = sCardData;
aIrtBody[Column.POS_RES_SEL_MOBILECOUPON_HPCON_NEW.SEQ.InType] = sWCC;
sSendData_Body = ItemColumn.MakeMessage(aIrtBody, Column.POS_RES_SEL_MOBILECOUPON_HPCON_NEW.LEN, Column.POS_RES_SEL_MOBILECOUPON_HPCON_NEW.TYPE);
}
else if (sTrType == PosConst.POS_MOBILECON_HPCON_INQ_TYPE_NEW.APPROVAL)
{
// 승인
sSendData_Body = sCouponInfo; // 쿠폰정보
nBodyLen = CmUtil.LenH(sCouponInfo);
}
else if (sTrType == PosConst.POS_MOBILECON_HPCON_INQ_TYPE_NEW.REFUND)
{
// 취소
sSendData_Body = CmUtil.MidH(sCardData, 0, 32) ; // 쿠폰번호
sSendData_Body += CmUtil.MidH(sApprNo, 0, 32); // 승인번호
nBodyLen = CmUtil.LenH(sSendData_Body);
}
else if (sTrType == PosConst.POS_MOBILECON_HPCON_INQ_TYPE_NEW.SEARCH_LOG)
{
// 사용 이력 조회
sSendData_Body = sCouponInfo; // 쿠폰번호 + 가상쿠폰번호
nBodyLen = CmUtil.LenH(sSendData_Body);
}
// 헤더길이를 전체 길이로 변경
nHeaderLen = nBodyLen;
// 제휴사 코드
sApprID = PosMstManager.GetMstVan(m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01, PosMst.MST_VAN.DATA.APPR_ID);
sCMPApprID = PosMstManager.GetMstVan(m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01, PosMst.MST_VAN.DATA.CMP_APPR_ID);
// 헤더 정보 설정
aIrtHeader[Column.POS_HDR_MOBILECOUPON_HPCON_NEW.SEQ.DocVer] = "1";
aIrtHeader[Column.POS_HDR_MOBILECOUPON_HPCON_NEW.SEQ.TranType] = sTrType;
aIrtHeader[Column.POS_HDR_MOBILECOUPON_HPCON_NEW.SEQ.StoreCD] = m_cPosStatus.Base.StoreNo;
aIrtHeader[Column.POS_HDR_MOBILECOUPON_HPCON_NEW.SEQ.StoreNM] = CmUtil.GetDataRowStr(PosMstManager.GetMstStore(), PosMst.MST_STORE.DATA.STORNM);
aIrtHeader[Column.POS_HDR_MOBILECOUPON_HPCON_NEW.SEQ.BrandCD] = sApprID; // m_cPosStatus.Base.BrandCd; // m_cPosStatus.Base.BrandCd = "BR000L"
aIrtHeader[Column.POS_HDR_MOBILECOUPON_HPCON_NEW.SEQ.HeaderLen] = nHeaderLen.ToString();
sSendData = ItemColumn.MakeMessage(aIrtHeader, Column.POS_HDR_MOBILECOUPON_HPCON_NEW.LEN, Column.POS_HDR_MOBILECOUPON_HPCON_NEW.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_NEW.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_NEW.APPROVAL; // 해피콘
}
else
{
// 취소
if (m_cPayItem.PAY_DTL_CD_01 == ItemConst.TR_ITEM_ID.MOBILECON.GIFTCON)
sTrType = PosConst.POS_MOBILECON_GIFTCON_INQ_TYPE.REFUND; // 기프티콘
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_NEW.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; // 기프티콘
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_NEW.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;
}
case PosConst.POS_INQ_MODE.SEARCH_LOG:
{
// 이력 조회
if (m_cPayItem.PAY_DTL_CD_01 != ItemConst.TR_ITEM_ID.MOBILECON.GIFTCON && m_cPayItem.PAY_DTL_CD_01 != ItemConst.TR_ITEM_ID.MOBILECON.GIFTCON)
sTrType = PosConst.POS_MOBILECON_HPCON_INQ_TYPE_NEW.SEARCH_LOG; // 해피콘
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>
/// 쿠폰타입
/// </summary>
/// <param name="sCouponNo"></param>
/// <param name="sVCouponNo"></param>
/// <param name="sCounponInfo"></param>
/// <returns></returns>
private string GetCounponType(string sCouponNo, string sVCouponNo, string sCounponInfo)
{
string sRet = "0";
try
{
string[] aCounponInfo = sCounponInfo.Split(new string[] { "@~" }, StringSplitOptions.None);
for (int iRow = 0; iRow < aCounponInfo.Length; iRow++)
{
string[] aCounponInfo2 = aCounponInfo[iRow].Split(new string[] { "|" }, StringSplitOptions.None);
if (aCounponInfo2.Length > 0)
{
if (aCounponInfo2[0].Trim() == sCouponNo && aCounponInfo2[1].Trim() == sVCouponNo)
{
sRet = aCounponInfo2[2].Trim();
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);
}
return sRet;
}
#endregion
#region
/// <summary>
/// 상품별 할인 금액 설정
/// </summary>
/// <param name="sCoopDcDiv"></param>
/// <param name="sProductiTem"></param>
/// <param name="sCouponNo"></param>
/// <param name="sVCouponNo"></param>
/// <returns></returns>
public string SetPluDcAmount(string sCoopDcDiv, string sProductiTem, string sCouponNo, string sVCouponNo)
{
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 && aProductiTemInfo[1].Trim() == sVCouponNo)
{
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 = sVCouponNo;
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
}
}