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

1185 lines
69 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;
/*-----------------------------------------------------------------------------------------------*/
// 설 명 : 해피포인트 사용
// 작 성 자 :
// 변경 이력 :
/*-----------------------------------------------------------------------------------------------*/
namespace Cosmos.Service
{
class PointHappyPointUse : PaymentBase, IPaymentUs
{
private IOCBDirect m_OCBDirect = null;
public PointHappyPointUse()
{
m_OCBDirect = (IOCBDirect)sManager.InitServiceInstance(ServiceLists.AGENT_OLEDEVICE.DLL, ServiceLists.AGENT_OLEDEVICE.OCB_DIRECT);
}
#region SearchPayment
/// <summary>
/// 결제 조회
/// </summary>
/// <param name="aParam"></param>
/// <param name="aRet"></param>
/// <returns></returns>
public string SearchPayment(string[] aParam, ref string[] aRet)
{
string sRet = UserCom.RST_ERR;
string sPosMenuKey = "", sInPutType = "", sInPutData = "", sInEncData = "", sPointType = "", sAppCardNo = "";
try
{
sPosMenuKey = aParam[0]; // 메뉴키
sInPutType = aParam[1]; // 입력구분
sInPutData = aParam[2]; // 입력데이터
sInEncData = aParam[3]; // 카드데이터
bool bForceSearch = false; // 강제조회여부
if (aParam.Length > 4 && aParam[4] == "1") bForceSearch = true;
if (aParam.Length > 5) sAppCardNo = aParam[5]; // 승인카드번호
sPointType = GetMenuKeyToPointType(sPosMenuKey);
m_cPayItem = new Column.TR_PAYMENT.DATA(); // 결과 저장 변수 생성
m_cPayItem.PAY_WAY_CD = GetMenuKeyToPayWayCd(sPosMenuKey);
m_cPayItem.PAY_DTL_CD_01 = GetMenuKeyToPayDtlCd(sPosMenuKey);
bool bAlreadSearch = false;
if (bForceSearch == false)
{
// 해피포인트 적립카드로 조회된 내역이 있는지 체크
ArrayList alEtcItem = (ArrayList)StateObject.GetItemObject(Column.TR_ETC.ITEM); // 기타 내역 받아 오기
foreach (Column.TR_ETC.DATA cEtcItem in alEtcItem)
{
if (cEtcItem.CANCEL_DIV == PosConst.CANCEL_DIV.CANCEL) continue;
if (cEtcItem.ETC_WAY_CD == ItemConst.TR_ITEM_ID.ETC_INFO_ITEM && cEtcItem.ETC_DTL_CD_01 == ItemConst.TR_ITEM_ID.ETC_INFO.SAVEPOINT)
{
if (cEtcItem.CanFiller1 == sInEncData)
{
m_cPayItem.AMT_ENTRY_03 = cEtcItem.AMT_ENTRY_03; // 총포인트
m_cPayItem.AMT_ENTRY_04 = cEtcItem.AMT_ENTRY_04; // 가용포인트
m_cPayItem.AMT_ENTRY_05 = cEtcItem.AMT_ENTRY_05; // 잔여포인트
m_cPayItem.HP_ADD_INFO_SCH = cEtcItem.HP_ADD_INFO_SCH; // 추가응답정보
m_cPayItem.HP_RESERVED = cEtcItem.HP_RESERVED; // 예약필드
m_cPayItem.HP_CAMPAIGN_INFO = cEtcItem.HP_CAMPAIGN_INFO; // 캠페인정보
m_cPayItem.OCCUR_ENTRY_14 = cEtcItem.OCCUR_ENTRY_14; // 승인카드번호
m_cPayItem.OCCUR_ENTRY_15 = cEtcItem.OCCUR_ENTRY_15; // 고객등급코드
//#20171017 전자영수증 발행 start, phj
if (cEtcItem.HP_ADD_INFO_SCH != "")
{
m_cPayItem.OCCUR_ENTRY_23 = CmUtil.MidH(cEtcItem.HP_ADD_INFO_SCH, 144, 1).Trim();
}
//#20171017 전자영수증 발행 end, phj
bAlreadSearch = true;
}
}
}
}
if (bAlreadSearch == false)
{
if (sPosMenuKey == PosKey.MENU_KEY.OKCASHBACK && PosMstManager.GetPosOption(POS_OPTION.OPT326) != "0" && PosMstManager.GetPosOption(POS_OPTION.OPT326) != "" && m_cDevStatus.ICReader.UseYn != true) // OCB 직통신
{
sRet = ExecutePointOCBDirectIrt(PosConst.CANCEL_DIV.NORMAL, PosConst.POS_OCB_DIRECT.INQ_POINT, sInPutType, sInPutData, sInEncData,"", m_cTrnStatus.Sale.NetSaleAmt, "", "", "");
}
else
{
sRet = ExecuteHappyPointUseIrt(PosConst.CANCEL_DIV.NORMAL, PosConst.POS_VAN_MASTER.TRADE_ID.VAN_POT_QRY_A, sPointType, sInPutType, sInPutData, sInEncData, 0, "", "", "", "");
}
if (sRet != UserCom.RST_OK) return sRet;
}
if (sPosMenuKey == PosKey.MENU_KEY.OKCASHBACK && PosMstManager.GetPosOption(POS_OPTION.OPT326) != "0" && PosMstManager.GetPosOption(POS_OPTION.OPT326) != "" && m_cDevStatus.ICReader.UseYn != true) // OCB 직통신
{
}
else
{
if (m_cPayItem.HP_ADD_INFO_SCH.Trim() != "")
{
int nNowPos = 0;
string[] aIrtRsp = new string[Column.POINT_ADD_INFO_SEARCH.LEN.Length];
ItemColumn.ParseMessage(Column.POINT_ADD_INFO_SEARCH.LEN, Column.POINT_ADD_INFO_SEARCH.TYPE, Encoding.Default.GetBytes(m_cPayItem.HP_ADD_INFO_SCH), ref nNowPos, ref aIrtRsp);
// 앱고객 여부(N:일반, Y:앱고객)
//m_cPayItem.OCCUR_ENTRY_12 = aIrtRsp[Column.POINT_ADD_INFO_SEARCH.SEQ.pointHPAPPYN];
//#20181210 핸드폰번호로 해피포인트 등록,사용 시 해피APP고객 여부 'N' 처리 Start, srlee
// 기존
// 앱고객 여부(N:일반, Y:앱고객)
//m_cPayItem.OCCUR_ENTRY_12 = aIrtRsp[Column.POINT_ADD_INFO_SEARCH.SEQ.pointHPAPPYN];
// 변경
if (sInPutData.StartsWith("010") == true || sInPutData.StartsWith("011") == true || sInPutData.StartsWith("017") == true ||
sInPutData.StartsWith("016") == true || sInPutData.StartsWith("018") == true || sInPutData.StartsWith("019") == true)
{
// 앱고객 여부(N:일반, Y:앱고객)
m_cPayItem.OCCUR_ENTRY_12 = "N"; // 핸드폰번호로 조회 할 경우 앱고객 'N' 처리
}
else
{
m_cPayItem.OCCUR_ENTRY_12 = aIrtRsp[Column.POINT_ADD_INFO_SEARCH.SEQ.pointHPAPPYN];
}
//#20181210 핸드폰번호로 해피포인트 등록,사용 시 해피APP고객 여부 'N' 처리 End, srlee
// 고객명 설정
string sCustInfo = aIrtRsp[Column.POINT_ADD_INFO_SEARCH.SEQ.pointMEMINFO];
if (sCustInfo != "" && CmUtil.IntParse(sCustInfo.Substring(0, 1)) > 0)
{
m_cPayItem.HP_CUST_NAME = CmUtil.MidH(sCustInfo, 17, 20).Trim(); // 고객명
m_cPayItem.OCCUR_ENTRY_10 = CmUtil.MidH(sCustInfo, 45, 35).Trim(); // 회원번호
}
// 해피사용시비번사용여부(N:미사용, Y:사용)
m_cPayItem.OCCUR_ENTRY_13 = aIrtRsp[Column.POINT_ADD_INFO_SEARCH.SEQ.pointHPUSEPWYN];
// 소멸예정포인트
m_cPayItem.HP_EXT_POINT = CmUtil.LongParse(aIrtRsp[Column.POINT_ADD_INFO_SEARCH.SEQ.pointDELHPPOINT]);
// 회원등급코드
m_cPayItem.OCCUR_ENTRY_15 = aIrtRsp[Column.POINT_ADD_INFO_SEARCH.SEQ.pointMEMGB].Trim();
//#20171017 전자영수증 발행 start, phj
m_cPayItem.OCCUR_ENTRY_23 = CmUtil.MidH(m_cPayItem.HP_ADD_INFO_SCH, 144, 1).Trim();
//#20171017 전자영수증 발행 end, phj
}
}
sRet = UserCom.RST_OK;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
finally
{
//여전법 대응!
//////////////////////////////////////////////////////////////////////////////////
CmUtil.ZeroFillClear(ref sInPutData);
CmUtil.ZeroFillClear(ref sInEncData);
CmUtil.ZeroFillClear(ref aParam);
//////////////////////////////////////////////////////////////////////////////////
}
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 sPosMenuKey = "", sInPutType = "", sInPutData = "", sInEncData = "", sAppCardNo = "";
try
{
if (aParam.Length > 0 && aParam[0] == PosConst.POS_CAT_MASTER.TRAN_TYPE) //단말기승인
{
m_cPayItem = new Column.TR_PAYMENT.DATA();
m_cPayItem.PAY_WAY_CD = GetMenuKeyToPayWayCd(aParam[12]);
m_cPayItem.PAY_DTL_CD_01 = GetMenuKeyToPayDtlCd(aParam[12]);
sRet = CatExecuteIrt(aParam[1], aParam);
if (sRet != UserCom.RST_OK) return sRet;
// 결제 아이템 추가
ArrayList alPayItem = (ArrayList)StateObject.GetItemObject(Column.TR_PAYMENT.ITEM);
m_cPayItem.SEQ = alPayItem.Count + 1;
alPayItem.Add(m_cPayItem);
}
else
{
sPosMenuKey = aParam[0]; // 메뉴키
sInPutType = aParam[1]; // 입력구분
sInPutData = aParam[2]; // 입력데이터
sInEncData = aParam[3]; // 카드데이터
double nPayAmt = CmUtil.DoubleParse(aParam[4]); // 사용금액
string sPassWord = aParam[5]; // 비밀번호
if (aParam.Length > 6) sAppCardNo = aParam[6]; // 승인카드번호
string sPointType = GetMenuKeyToPointType(sPosMenuKey);
//m_cPayItem = new Column.TR_PAYMENT.DATA();
m_cPayItem.PAY_WAY_CD = GetMenuKeyToPayWayCd(sPosMenuKey);
m_cPayItem.PAY_DTL_CD_01 = GetMenuKeyToPayDtlCd(sPosMenuKey);
string sHpStampPlu = m_cCampaingMain.GetCampaignHappyStampInfo(); // 스탬프캠페인 상품 획득
if (sPosMenuKey == PosKey.MENU_KEY.OKCASHBACK && PosMstManager.GetPosOption(POS_OPTION.OPT326) != "0" && PosMstManager.GetPosOption(POS_OPTION.OPT326) != "" && m_cDevStatus.ICReader.UseYn != true) // OCB 직통신
{
sRet = ExecutePointOCBDirectIrt(PosConst.CANCEL_DIV.NORMAL, PosConst.POS_OCB_DIRECT.USE_POINT, sInPutType, sInPutData, sInEncData, sPassWord, nPayAmt, "", "", "");
}
else
{
sRet = ExecuteHappyPointUseIrt(PosConst.CANCEL_DIV.NORMAL, PosConst.POS_VAN_MASTER.TRADE_ID.VAN_POT_USE_A, sPointType, sInPutType, sInPutData, sInEncData, nPayAmt, sPassWord, sHpStampPlu, "", "");
}
if (sRet != UserCom.RST_OK) return sRet;
string sStampCntInfo = ""; // 스템프정보(구매,잔여,누적)
if (m_cPayItem.HP_ADD_INFO_USE.Trim() != "")
{
int nNowPos = 0;
string[] aIrtRsp = new string[Column.POINT_ADD_INFO_USE.LEN.Length];
ItemColumn.ParseMessage(Column.POINT_ADD_INFO_USE.LEN, Column.POINT_ADD_INFO_USE.TYPE, Encoding.Default.GetBytes(m_cPayItem.HP_ADD_INFO_USE), ref nNowPos, ref aIrtRsp);
sStampCntInfo = aIrtRsp[Column.POINT_ADD_INFO_USE.SEQ.StampInfo].Trim(); // 스템프정보(구매,잔여,누적)
// 고객명 설정
m_cPayItem.HP_CUST_NAME = aIrtRsp[Column.POINT_ADD_INFO_USE.SEQ.CustName].Trim();
}
m_cPayItem.OCCUR_ENTRY_14 = sAppCardNo; // 승인카드번호
// 스템프 캠페인 정보 설정
if (m_cPayItem.HP_CAMPAIGN_INFO.Length >= 16)
{
m_cCampaingMain.SetCampaignHappyStampInfo(m_cPayItem.HP_CAMPAIGN_INFO, sStampCntInfo, m_cPayItem.OCCUR_ENTRY_10);
}
// 캠페인 성립 금액 설정
SetUseCamaignAmount(m_cPayItem);
// 결제 아이템 추가
ArrayList alPayItem = (ArrayList)StateObject.GetItemObject(Column.TR_PAYMENT.ITEM);
m_cPayItem.SEQ = alPayItem.Count + 1;
alPayItem.Add(m_cPayItem);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 적립 카드를 등록 처리 한다.
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool bSaveCardExist = false;
Column.TR_ETC.DATA cEtcItemHP = null; // 결과 저장 변수 생성
ArrayList alEtcItem = (ArrayList)StateObject.GetItemObject(Column.TR_ETC.ITEM);
foreach (Column.TR_ETC.DATA cEtcItem in alEtcItem)
{
if (cEtcItem.CANCEL_DIV == PosConst.CANCEL_DIV.CANCEL) continue;
// OKCASHBACK 적립
if (cEtcItem.ETC_WAY_CD == ItemConst.TR_ITEM_ID.ETC_INFO_ITEM && cEtcItem.ETC_DTL_CD_01 == ItemConst.TR_ITEM_ID.ETC_INFO.OCB_SAVE)
{
m_cDataService.UpdatePluAmount(); // 상품 합계금액 계산(거래해더)
m_cDataService.UpdatePayAmount(); // 결제 금액 재 계산 처리
return UserCom.RST_OK;
}
else if (cEtcItem.ETC_WAY_CD == ItemConst.TR_ITEM_ID.ETC_INFO_ITEM && cEtcItem.ETC_DTL_CD_01 == ItemConst.TR_ITEM_ID.ETC_INFO.SAVEPOINT)
{
cEtcItemHP = cEtcItem;
bSaveCardExist = true;
break;
}
}
if (cEtcItemHP == null) cEtcItemHP = new Column.TR_ETC.DATA(); // 결과 저장 변수 생성
if (m_cPayItem.HP_ADD_INFO_SCH.Trim() != "")
{
int nNowPos = 0;
string[] aIrtRsp = new string[Column.POINT_ADD_INFO_SEARCH.LEN.Length];
ItemColumn.ParseMessage(Column.POINT_ADD_INFO_SEARCH.LEN, Column.POINT_ADD_INFO_SEARCH.TYPE, Encoding.Default.GetBytes(m_cPayItem.HP_ADD_INFO_SCH), ref nNowPos, ref aIrtRsp);
// 포인트 적립가능여부
if (aIrtRsp[Column.POINT_ADD_INFO_SEARCH.SEQ.pointHPADDYN] != "Y")
{
m_cDataService.UpdatePluAmount(); // 상품 합계금액 계산(거래해더)
m_cDataService.UpdatePayAmount(); // 결제 금액 재 계산 처리
return UserCom.RST_ERR;
}
//#20181210 핸드폰번호로 해피포인트 등록,사용 시 해피APP고객 여부 'N' 처리 Start, srlee
// 기존
// 앱고객 여부(N:일반, Y:앱고객)
//cEtcItemHP.OCCUR_ENTRY_12 = aIrtRsp[Column.POINT_ADD_INFO_SEARCH.SEQ.pointHPAPPYN];
// 변경
if (sInPutData.StartsWith("010") == true || sInPutData.StartsWith("011") == true || sInPutData.StartsWith("017") == true ||
sInPutData.StartsWith("016") == true || sInPutData.StartsWith("018") == true || sInPutData.StartsWith("019") == true)
{
// 앱고객 여부(N:일반, Y:앱고객)
cEtcItemHP.OCCUR_ENTRY_12 = "N"; // 핸드폰번호로 조회 할 경우 앱고객 'N' 처리
}
else
{
cEtcItemHP.OCCUR_ENTRY_12 = aIrtRsp[Column.POINT_ADD_INFO_SEARCH.SEQ.pointHPAPPYN];
}
//#20181210 핸드폰번호로 해피포인트 등록,사용 시 해피APP고객 여부 'N' 처리 End, srlee
// 고객명 설정
string sCustInfo = aIrtRsp[Column.POINT_ADD_INFO_SEARCH.SEQ.pointMEMINFO];
if (sCustInfo != "" && CmUtil.IntParse(sCustInfo.Substring(0, 1)) > 0)
{
cEtcItemHP.HP_CUST_NAME = CmUtil.MidH(sCustInfo, 17, 20).Trim();
cEtcItemHP.OCCUR_ENTRY_10 = CmUtil.MidH(sCustInfo, 45, 35).Trim();
}
//#19043 해피포인트 적립률 변경 Start,srlee 20190328
cEtcItemHP.OCCUR_ENTRY_13 = CmUtil.MidH(sCustInfo, 57, 1).Trim();
//#19043 해피포인트 적립률 변경 End,srlee 20190328
// 소멸예정포인트
cEtcItemHP.HP_EXT_POINT = CmUtil.LongParse(aIrtRsp[Column.POINT_ADD_INFO_SEARCH.SEQ.pointDELHPPOINT]);
// 비밀번호 사용여부
cEtcItemHP.HP_PASSWORD_YN = aIrtRsp[Column.POINT_ADD_INFO_SEARCH.SEQ.pointHPUSEPWYN];
//#20171017 전자영수증 발행 start, phj
cEtcItemHP.OCCUR_ENTRY_23 = CmUtil.MidH(m_cPayItem.HP_ADD_INFO_SCH, 144, 1).Trim();
//#20171017 전자영수증 발행 end, phj
}
cEtcItemHP.ETC_WAY_CD = ItemConst.TR_ITEM_ID.ETC_INFO_ITEM;
cEtcItemHP.ETC_DTL_CD_01 = ItemConst.TR_ITEM_ID.ETC_INFO.SAVEPOINT; // 2019-04-17 - 1997fx11 : 결재 후 해피포인트 적립여부
cEtcItemHP.ETC_DTL_CD_05 = PosConst.PAY_DC_TYPE.NORMAL; // 할인결제구분 (1:결제, 2:할인)
cEtcItemHP.OCCUR_ENTRY_01 = sInPutData.Length > 16 ? sInPutData.Substring(0, 16) : sInPutData; // 카드번호
cEtcItemHP.OCCUR_ENTRY_05 = sInPutType; // 입력 구분
cEtcItemHP.OCCUR_ENTRY_14 = sAppCardNo; // 승인카드번호
cEtcItemHP.AMT_ENTRY_03 = m_cPayItem.AMT_ENTRY_03; // 총포인트
cEtcItemHP.AMT_ENTRY_04 = m_cPayItem.AMT_ENTRY_04; // 가용포인트
cEtcItemHP.AMT_ENTRY_05 = m_cPayItem.AMT_ENTRY_05; // 잔여포인트
cEtcItemHP.CANCEL_DIV = ItemConst.PAY_CANCEL_DIV.NORMAL;
cEtcItemHP.BILLSPR_NO = m_cTrnStatus.Sale.BillSplitNo; // 빌분리 번호
cEtcItemHP.CanFiller1 = sInEncData;
cEtcItemHP.CanFiller3 = m_cPayItem.CanFiller3;
cEtcItemHP.HP_ADD_INFO_SCH = m_cPayItem.HP_ADD_INFO_SCH; // 추가응답정보
cEtcItemHP.HP_RESERVED = m_cPayItem.HP_RESERVED; // 예약필드
cEtcItemHP.HP_CAMPAIGN_INFO = m_cPayItem.HP_CAMPAIGN_INFO; // 캠페인정보
if (bSaveCardExist == false)
{
cEtcItemHP.SEQ = alEtcItem.Count + 1;
alEtcItem.Add(cEtcItemHP);
}
}
m_cDataService.UpdatePluAmount(); // 상품 합계금액 계산(거래해더)
m_cDataService.UpdatePayAmount(); // 결제 금액 재 계산 처리
sRet = UserCom.RST_OK;
//WinManager.ConfirmMessage(sPointType + " " + MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0067));
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
finally
{
//여전법 대응!
//////////////////////////////////////////////////////////////////////////////////
CmUtil.ZeroFillClear(ref sInPutData);
CmUtil.ZeroFillClear(ref sInEncData);
CmUtil.ZeroFillClear(ref aParam);
//////////////////////////////////////////////////////////////////////////////////
}
return sRet;
}
#endregion
#region CancelPayment
/// <summary>
/// 결제 취소
/// </summary>
/// <param name="aParam"></param>
/// <returns></returns>
public string CancelPayment(string[] aParam)
{
string sRet = UserCom.RST_ERR;
string sInPutType = "", sInPutData = "", sInEncData = "";
try
{
if (m_cTrnStatus.Head.TradeDiv != ItemConst.TRAN_DIV.NORMAL) return sRet;
int nPayRow = CmUtil.IntParse(aParam[0]); // 취소할 행번호
// 결제 내역 받아 오기
ArrayList alPayItem = (ArrayList)StateObject.GetItemObject(Column.TR_PAYMENT.ITEM);
m_cPayItem = (Column.TR_PAYMENT.DATA)alPayItem[nPayRow];
if (m_cPayItem.OCCUR_ENTRY_08.ToString() == ItemConst.PAY_APP_DIV.CAT_TERMINAL)
{
string[] m_aParam = new string[16];
//InParam
// 0.전문구분,1.거래유형, 2.할부개월, 3.승인금액 , 4.봉사료, 5.세금, 6.원승인번호, 7.원거래일자, 8.포인트거래구분, 9.상품코드,
//10.전표인쇄여부,11.추가항목,12.제휴할인코드,13.제휴할인금액,14.예비1
string sAppId = PosConst.POS_CAT_MASTER.TRADE_ID.CAT_HAPPY_USE_CANCEL;
m_aParam[0] = PosConst.POS_CAT_MASTER.TRAN_TYPE;
m_aParam[1] = sAppId;
m_aParam[2] = "00";
m_aParam[3] = m_cPayItem.AMT_ENTRY_10.ToString();
m_aParam[4] = "0"; //봉사료
m_aParam[5] = "0"; //세금
m_aParam[6] = m_cPayItem.OCCUR_ENTRY_02;
m_aParam[7] = m_cPayItem.OCCUR_ENTRY_03;
m_aParam[8] = "";
m_aParam[9] = "";
m_aParam[10] = "";
m_aParam[11] = "";
m_aParam[12] = "";
m_aParam[13] = "";
m_aParam[14] = "";
m_aParam[15] = "";
sRet = CatExecuteIrt(m_aParam[1], m_aParam);
if (sRet != UserCom.RST_OK) return sRet;
}
else
{
sInPutType = m_cPayItem.OCCUR_ENTRY_05; // 입력구분
sInPutData = m_cPayItem.OCCUR_ENTRY_01; // 입력데이터
sInEncData = m_cPayItem.CanFiller1; // 카드데이터
double nPayAmt = m_cPayItem.PAY_AMT; // 대상금액
string sApprDate = m_cPayItem.OCCUR_ENTRY_03; // 승인일자
string sApprNo = m_cPayItem.OCCUR_ENTRY_02; // 승인번호
string sPointType = GetPayDtlCdToPointType(m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01);
if (m_cPayItem.OCCUR_ENTRY_08.ToString() == ItemConst.PAY_APP_DIV.COMPULSION)
{
m_cPayItem.OCCUR_ENTRY_06 = m_cPayItem.OCCUR_ENTRY_02; // 원승인번호
m_cPayItem.OCCUR_ENTRY_07 = m_cPayItem.OCCUR_ENTRY_03; // 원승인일자
}
else
{
if (sPointType == "OCB" && PosMstManager.GetPosOption(POS_OPTION.OPT326) != "0" && PosMstManager.GetPosOption(POS_OPTION.OPT326) != "" && m_cDevStatus.ICReader.UseYn != true) // OCB 직통신
{
sRet = ExecutePointOCBDirectIrt(PosConst.CANCEL_DIV.CANCEL, PosConst.POS_OCB_DIRECT.USE_CAN_POINT, sInPutType, sInPutData, sInEncData, "", nPayAmt, sApprDate, sApprNo, m_cPayItem.OCCUR_ENTRY_17);
}
else
{
sRet = ExecuteHappyPointUseIrt(PosConst.CANCEL_DIV.CANCEL, PosConst.POS_VAN_MASTER.TRADE_ID.VAN_POT_USE_C, sPointType, sInPutType, sInPutData, sInEncData, nPayAmt, "", "", sApprDate, sApprNo);
}
if (sRet != UserCom.RST_OK) return sRet;
}
ICampaignUs cCampaingMain = (ICampaignUs)sManager.InitServiceInstance(ServiceLists.ASV_CAMPAIGN.DLL, ServiceLists.ASV_CAMPAIGN.CAMPAIGN_MAIN);
// 캠페인 취소 처리
cCampaingMain.CancelCampaignPayment(aParam[0], "");
}
m_cTrnStatus.Sale.HappyBuzzMemNo = "";
m_cPayItem.CANCEL_DIV = PosConst.CANCEL_DIV.CANCEL;
m_cDataService.UpdatePluAmount(); // 상품 합계금액 계산(거래해더)
m_cDataService.UpdatePayAmount(); // 결제 금액 재 계산 처리
//WinManager.ConfirmMessage(sPointType + " " + MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0068));
// 여전법 대응 ///////////////////////////////////////////////////////////////////
CmUtil.ZeroFillClear(ref m_cPayItem.CanFiller1);
//////////////////////////////////////////////////////////////////////////////////
sRet = UserCom.RST_OK;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
finally
{
//여전법 대응!
//////////////////////////////////////////////////////////////////////////////////
CmUtil.ZeroFillClear(ref sInPutData);
CmUtil.ZeroFillClear(ref sInEncData);
CmUtil.ZeroFillClear(ref aParam);
//////////////////////////////////////////////////////////////////////////////////
}
return sRet;
}
#endregion
#region RefundPayment
/// <summary>
/// 결제 반품
/// </summary>
/// <param name="aParam"></param>
/// <returns></returns>
public string RefundPayment(string[] aParam)
{
string sRet = UserCom.RST_ERR;
string sInPutType = "", sInMskData = "", sInEncData = "";
try
{
int nPayRow = CmUtil.IntParse(aParam[0]); // 취소할 행번호
// 결제 내역 받아 오기
ArrayList alPayItem = (ArrayList)StateObject.GetItemObject(Column.TR_PAYMENT.ITEM);
m_cPayItem = (Column.TR_PAYMENT.DATA)alPayItem[nPayRow];
if (m_cPayItem.OCCUR_ENTRY_08.ToString() == ItemConst.PAY_APP_DIV.CAT_TERMINAL)
{
string[] m_aParam = new string[16];
//InParam
// 0.전문구분,1.거래유형, 2.할부개월, 3.승인금액 , 4.봉사료, 5.세금, 6.원승인번호, 7.원거래일자, 8.포인트거래구분, 9.상품코드,
//10.전표인쇄여부,11.추가항목,12.제휴할인코드,13.제휴할인금액,14.예비1
string sAppId = PosConst.POS_CAT_MASTER.TRADE_ID.CAT_HAPPY_USE_CANCEL;
m_aParam[0] = PosConst.POS_CAT_MASTER.TRAN_TYPE;
m_aParam[1] = sAppId;
m_aParam[2] = "00";
m_aParam[3] = m_cPayItem.AMT_ENTRY_10.ToString();
m_aParam[4] = "0"; //봉사료
m_aParam[5] = "0"; //세금
m_aParam[6] = m_cPayItem.OCCUR_ENTRY_02;
m_aParam[7] = m_cPayItem.OCCUR_ENTRY_03;
m_aParam[8] = "";
m_aParam[9] = "";
m_aParam[10] = "";
m_aParam[11] = "";
m_aParam[12] = "";
m_aParam[13] = "";
m_aParam[14] = "";
m_aParam[15] = "";
sRet = CatExecuteIrt(m_aParam[1], m_aParam);
if (sRet != UserCom.RST_OK) return sRet;
}
else
{
sInPutType = m_cPayItem.OCCUR_ENTRY_05; // 입력구분
sInMskData = m_cPayItem.OCCUR_ENTRY_01; // 입력데이터(마스킹)
sInEncData = m_cPayItem.CanFiller1; // 카드데이터(암호화)
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; // 원승인일자
}
else
{
double nPayAmt = m_cPayItem.PAY_AMT; // 대상금액
string sApprDate = m_cPayItem.OCCUR_ENTRY_03; // 승인일자
string sApprNo = m_cPayItem.OCCUR_ENTRY_02; // 승인번호
string sPointType = GetPayDtlCdToPointType(m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01);
if (sPointType == "OCB" && PosMstManager.GetPosOption(POS_OPTION.OPT326) != "0" && PosMstManager.GetPosOption(POS_OPTION.OPT326) != "" && m_cDevStatus.ICReader.UseYn != true) // OCB 직통신
{
sRet = ExecutePointOCBDirectIrt(PosConst.CANCEL_DIV.CANCEL, PosConst.POS_OCB_DIRECT.USE_CAN_POINT, sInPutType, sInEncData, sInEncData, "", nPayAmt, sApprDate, sApprNo, m_cPayItem.OCCUR_ENTRY_17);
}
else
{
sRet = ExecuteHappyPointUseIrt(PosConst.CANCEL_DIV.CANCEL, PosConst.POS_VAN_MASTER.TRADE_ID.VAN_POT_USE_C, sPointType, sInPutType, sInMskData, sInEncData, nPayAmt, "", "", sApprDate, sApprNo);
}
if (sRet != UserCom.RST_OK) return sRet;
if (m_cPayItem.HP_ADD_INFO_USE.Trim() != "")
{
int nNowPos = 0;
string[] aIrtRsp = new string[Column.POINT_ADD_INFO_USE.LEN.Length];
ItemColumn.ParseMessage(Column.POINT_ADD_INFO_USE.LEN, Column.POINT_ADD_INFO_USE.TYPE, Encoding.Default.GetBytes(m_cPayItem.HP_ADD_INFO_USE), ref nNowPos, ref aIrtRsp);
// 고객명 설정
m_cPayItem.HP_CUST_NAME = aIrtRsp[Column.POINT_ADD_INFO_USE.SEQ.CustName].Trim();
}
}
}
// 여전법 대응 ///////////////////////////////////////////////////////////////////
CmUtil.ZeroFillClear(ref m_cPayItem.CanFiller1);
//////////////////////////////////////////////////////////////////////////////////
sRet = UserCom.RST_OK;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
finally
{
//여전법 대응!
//////////////////////////////////////////////////////////////////////////////////
CmUtil.ZeroFillClear(ref sInMskData);
CmUtil.ZeroFillClear(ref sInEncData);
CmUtil.ZeroFillClear(ref aParam);
//////////////////////////////////////////////////////////////////////////////////
}
return sRet;
}
#endregion
#region SetMenualPayment
public string SetMenualPayment(string[] aParam)
{
string sRet = UserCom.RST_ERR;
string sPosMenuKey = "", sInPutType = "", sInPutData = "", sInEncData = "", sAppCardNo = "";
try
{
sPosMenuKey = aParam[0]; // 메뉴키
sInPutType = aParam[1]; // 입력구분
sInPutData = aParam[2]; // 입력데이터
sInEncData = aParam[3]; // 카드데이터
double nPayAmt = CmUtil.DoubleParse(aParam[4]); // 사용금액
string sPassWord = aParam[5]; // 비밀번호
string sApprNo = aParam[6]; // 승인번호
if (aParam.Length > 7) sAppCardNo = aParam[7]; // 승인카드번호
if (sInPutData.Length >= 6)
sInPutData = sInPutData.Substring(0, 6).PadRight(sInPutData.Length, '*');
else
sInPutData = "000000".PadRight(16, '*');
string sPointType = GetMenuKeyToPointType(sPosMenuKey);
m_cPayItem = new Column.TR_PAYMENT.DATA(); // 결과 저장 변수 생성
m_cPayItem.PAY_WAY_CD = GetMenuKeyToPayWayCd(sPosMenuKey);
m_cPayItem.PAY_DTL_CD_01 = GetMenuKeyToPayDtlCd(sPosMenuKey);
sRet = SetTrainingData(PosConst.POS_VAN_MASTER.TRADE_ID.VAN_POT_USE_A, sPointType, sInPutType, sInPutData, sInEncData, nPayAmt, sPassWord, "", "");
if (sRet != UserCom.RST_OK) return sRet;
m_cPayItem.PAY_AMT = nPayAmt; // 사용포인트(할인금액)
m_cPayItem.AMT_ENTRY_01 = m_cPayItem.PAY_AMT; // 사용포인트(할인금액)
m_cPayItem.AMT_ENTRY_03 = 0; // 총포인트
m_cPayItem.AMT_ENTRY_04 = 0; // 가용포인트(할인후결제금액)
m_cPayItem.AMT_ENTRY_05 = 0; // 잔여포인트
m_cPayItem.OCCUR_ENTRY_02 = sApprNo; // 승인번호
m_cPayItem.OCCUR_ENTRY_08 = ItemConst.PAY_APP_DIV.COMPULSION; // 승인구분
m_cPayItem.OCCUR_ENTRY_14 = sAppCardNo; // 승인카드번호
// 캠페인 성립 금액 설정
SetUseCamaignAmount(m_cPayItem);
// 결제 아이템 추가
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(); // 결제 금액 재 계산 처리
sRet = UserCom.RST_OK;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
finally
{
//여전법 대응!
//////////////////////////////////////////////////////////////////////////////////
CmUtil.ZeroFillClear(ref sInPutData);
CmUtil.ZeroFillClear(ref sInEncData);
CmUtil.ZeroFillClear(ref aParam);
//////////////////////////////////////////////////////////////////////////////////
}
return sRet;
}
#endregion
#region ,
/// <summary>
/// 해피포인트 조회,사용
/// </summary>
public string ExecuteHappyPointUseIrt(string sTradeDiv, string sTrType, string sPointType, string sInPutType, string sInPutData, string sInEncData, double nPayAmt, string sPassWord
, string sHpStampPlu, string sApprDate, string sApprNo)
{
string sRet = UserCom.RST_ERR;
try
{
if (sInPutData.Length >= 6) sInPutData = sInPutData.Substring(0, 6).PadRight(sInPutData.Length, '*');
// 연습모드이면 연습 데이터 설정
if (m_cPosStatus.Base.TrainingFlag == "1" || m_cPosStatus.Mst.TestStorYn == "1" ) return SetTrainingData(sTrType, sPointType, sInPutType, sInPutData, sInEncData, nPayAmt, sPassWord, sApprDate, sApprNo);
string sAddInfo = "";
if (sTrType == PosConst.POS_VAN_MASTER.TRADE_ID.VAN_POT_QRY_A)
{
// 조회
if (sPointType == "HPY")
{
sAddInfo += CmUtil.RPadH("", 10); // 요청 사용자 ID
sAddInfo += CmUtil.RPadH(m_cPosStatus.Base.StoreNo, 10); // 점포코드
sAddInfo += CmUtil.RPadH(m_cPosStatus.Base.PosNo, 2); // 포스번호
sAddInfo += CmUtil.RPadH("", 178); // VReserved
}
}
else if (sTrType == PosConst.POS_VAN_MASTER.TRADE_ID.VAN_POT_USE_A || sTrType == PosConst.POS_VAN_MASTER.TRADE_ID.VAN_POT_USE_C)
{
// 사용,사용취소
sAddInfo += "N"; // 쿠폰거래유무
sAddInfo += CmUtil.RPadH("", 10); // 요청 사용자 ID
sAddInfo += CmUtil.RPadH(m_cPosStatus.Base.SaleDate, 8); // POS 영업일자 - POS 매출일자 8자리
sAddInfo += "2001"; // 거래사유코드 - 2001:대금결제
sAddInfo += CmUtil.RPadH(m_cPosStatus.Base.SaleDate, 10); // SAP 코드 - POS 매출일자 10자리
sAddInfo += CmUtil.RPadH(m_cPosStatus.Base.PosNo, 2); // POS 번호
sAddInfo += string.Format("{0:D10}", (long)nPayAmt); // 사용대상거래금액
sAddInfo += CmUtil.RPadH("", 20); // 결제카드번호 - 신용 결제한 카드번호
sAddInfo += CmUtil.RPadH("", 135); ; // VReserved
}
string sVanCD = GetPayDtlCdToVanCode(m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01); // 승인업체 코드 조회
if (sVanCD == "")
{
//WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0563);
sRet = POS_MESSAGE.ERROR.MSG_0563;
return sRet;
}
// 포인트 조회,사용,사용취소
string[] aIrtRsp = null;
//sRet = ExecutePointIrt(sTradeDiv, m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01, sVanCD, sTrType, sPointType, sInPutType, sInPutData, sInEncData, nPayAmt, sApprDate, sApprNo, sPassWord, "", "", sHpStampPlu, sAddInfo, ref aIrtRsp, "", m_cPayItem.OCCUR_ENTRY_10,"",false);
sRet = ExecutePointIrt(sTradeDiv, m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01, sVanCD, sTrType, sPointType, sInPutType, sInPutData, sInEncData, nPayAmt, sApprDate, sApprNo, sPassWord, "", "", sHpStampPlu, sAddInfo, ref aIrtRsp, "", m_cPayItem.OCCUR_ENTRY_10);
if (sRet != UserCom.RST_OK) return sRet;
if (sTradeDiv == PosConst.CANCEL_DIV.NORMAL)
{
m_cPayItem.PAY_AMT = nPayAmt;
m_cPayItem.PAY_DTL_CD_03 = "0"; // 할인금액 아이템 적용여부(0:미적용, 1:적용)
m_cPayItem.PAY_DTL_CD_05 = PosConst.PAY_DC_TYPE.PAY; // 할인결제구분 (1:결제, 2:할인)
m_cPayItem.AMT_ENTRY_01 = m_cPayItem.PAY_AMT; // 사용포인트
m_cPayItem.AMT_ENTRY_03 = CmUtil.DoubleParse(aIrtRsp[Column.POS_RES_POINT.SEQ.ResSavePoint]); // 총포인트
if (sTrType == PosConst.POS_VAN_MASTER.TRADE_ID.VAN_POT_QRY_A)
m_cPayItem.AMT_ENTRY_04 = CmUtil.DoubleParse(aIrtRsp[Column.POS_RES_POINT.SEQ.ResUsesPoint]); // 가용포인트
m_cPayItem.AMT_ENTRY_05 = CmUtil.DoubleParse(aIrtRsp[Column.POS_RES_POINT.SEQ.ResSavePoint]); // 잔여포인트
m_cPayItem.OCCUR_ENTRY_01 = sInPutData; // 카드번호
m_cPayItem.OCCUR_ENTRY_02 = aIrtRsp[Column.POS_RES_POINT.SEQ.ResApprNo].Trim(); // 승인번호
m_cPayItem.OCCUR_ENTRY_03 = CmUtil.MidH(aIrtRsp[Column.POS_RES_POINT.SEQ.ResTrDate], 0, 6); // 승인일자
m_cPayItem.OCCUR_ENTRY_04 = CmUtil.MidH(aIrtRsp[Column.POS_RES_POINT.SEQ.ResTrDate], 6, 4); // 승인시간
m_cPayItem.OCCUR_ENTRY_05 = sInPutType; // 입력 구분
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_16 = sVanCD; // VAN 구분
m_cPayItem.OCCUR_ENTRY_18 = aIrtRsp[Column.POS_RES_POINT.SEQ.ResStoreNo]; // 가맹점번호
m_cPayItem.OCCUR_ENTRY_20 = GetPayDtlCdToPayDtlName(m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01); // 결제수단명
m_cPayItem.OCCUR_ENTRY_21 = GetPayDtlCdToCashBillYn(m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01); // 현금영수증 발행여부
m_cPayItem.CANCEL_DIV = ItemConst.PAY_CANCEL_DIV.NORMAL;
m_cPayItem.BILLSPR_NO = m_cTrnStatus.Sale.BillSplitNo; // 빌분리 번호
m_cPayItem.CanFiller1 = sInEncData;
m_cPayItem.HP_RESERVED = aIrtRsp[Column.POS_RES_POINT.SEQ.ResReserved].Trim(); // 예약필드
m_cPayItem.HP_CAMPAIGN_INFO = aIrtRsp[Column.POS_RES_POINT.SEQ.ResCampaign].Trim(); // 캠페인정보
if (sTrType == PosConst.POS_VAN_MASTER.TRADE_ID.VAN_POT_QRY_A)
m_cPayItem.HP_ADD_INFO_SCH = aIrtRsp[Column.POS_RES_POINT.SEQ.ResAddRespon].Trim(); // 추가응답정보
else
m_cPayItem.HP_ADD_INFO_USE = aIrtRsp[Column.POS_RES_POINT.SEQ.ResAddRespon].Trim(); // 추가응답정보
//#20171017 전자영수증 발행 start, phj
if (sTrType == PosConst.POS_VAN_MASTER.TRADE_ID.VAN_POT_QRY_A)
{
if (m_cPayItem.HP_ADD_INFO_SCH != "")
{
m_cPayItem.OCCUR_ENTRY_23 = CmUtil.MidH(m_cPayItem.HP_ADD_INFO_SCH, 144, 1).Trim();
}
}
//#20171017 전자영수증 발행 end, phj
}
else
{
m_cPayItem.AMT_ENTRY_03 = CmUtil.DoubleParse(aIrtRsp[Column.POS_RES_POINT.SEQ.ResSavePoint]); // 총포인트
m_cPayItem.AMT_ENTRY_05 = CmUtil.DoubleParse(aIrtRsp[Column.POS_RES_POINT.SEQ.ResSavePoint]); // 잔여포인트
m_cPayItem.OCCUR_ENTRY_01 = sInPutData; // 카드번호
m_cPayItem.OCCUR_ENTRY_02 = aIrtRsp[Column.POS_RES_POINT.SEQ.ResApprNo].Trim(); // 승인번호
m_cPayItem.OCCUR_ENTRY_03 = CmUtil.MidH(aIrtRsp[Column.POS_RES_POINT.SEQ.ResTrDate], 0, 6); // 승인일자
m_cPayItem.OCCUR_ENTRY_04 = CmUtil.MidH(aIrtRsp[Column.POS_RES_POINT.SEQ.ResTrDate], 6, 4); // 승인시간
m_cPayItem.OCCUR_ENTRY_05 = sInPutType; // 입력 구분
m_cPayItem.OCCUR_ENTRY_06 = sApprNo; // 원승인번호
m_cPayItem.OCCUR_ENTRY_07 = sApprDate; // 원승인일자
m_cPayItem.HP_ADD_INFO_USE = aIrtRsp[Column.POS_RES_POINT.SEQ.ResAddRespon].Trim(); // 추가응답정보
}
sRet = UserCom.RST_OK;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
finally
{
//여전법 대응!
//////////////////////////////////////////////////////////////////////////////////
CmUtil.ZeroFillClear(ref sInPutData);
CmUtil.ZeroFillClear(ref sInEncData);
//////////////////////////////////////////////////////////////////////////////////
}
return sRet;
}
/// <summary>
/// 연습 데이터 설정
/// </summary>
public string SetTrainingData(string sTrType, string sPointType, string sInPutType, string sInPutData, string sInEncData, double nPayAmt, string sPassWord, string sApprDate, string sApprNo)
{
string sRet = UserCom.RST_ERR;
try
{
// 연습모드이면 연습 데이터 설정
string sVanCD = GetPayDtlCdToVanCode(m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01); // 승인업체 코드 조회
if (sVanCD == "")
{
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0563);
return sRet;
}
m_cPayItem.PAY_AMT = nPayAmt;
m_cPayItem.PAY_DTL_CD_03 = "0"; // 할인금액 아이템 적용여부(0:미적용, 1:적용)
m_cPayItem.PAY_DTL_CD_05 = PosConst.PAY_DC_TYPE.PAY; // 할인결제구분 (1:결제, 2:할인)
m_cPayItem.AMT_ENTRY_01 = m_cPayItem.PAY_AMT; // 사용포인트
m_cPayItem.AMT_ENTRY_03 = 99990; // 총포인트
m_cPayItem.AMT_ENTRY_04 = 99990; // 가용포인트
m_cPayItem.AMT_ENTRY_05 = 99990; // 잔여포인트
m_cPayItem.OCCUR_ENTRY_01 = sInPutData; // 카드번호
m_cPayItem.OCCUR_ENTRY_02 = "99999999"; // 승인번호
m_cPayItem.OCCUR_ENTRY_03 = DateTime.Now.ToString("yyMMdd"); // 승인일자
m_cPayItem.OCCUR_ENTRY_04 = DateTime.Now.ToString("HHmm"); // 승인시간
m_cPayItem.OCCUR_ENTRY_05 = sInPutType; // 입력 구분
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_16 = sVanCD; // VAN 구분
m_cPayItem.OCCUR_ENTRY_18 = ""; // 가맹점번호
m_cPayItem.OCCUR_ENTRY_20 = GetPayDtlCdToPayDtlName(m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01); // 결제수단명
m_cPayItem.OCCUR_ENTRY_21 = GetPayDtlCdToCashBillYn(m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01); // 현금영수증 발행여부
m_cPayItem.CANCEL_DIV = ItemConst.PAY_CANCEL_DIV.NORMAL;
m_cPayItem.BILLSPR_NO = m_cTrnStatus.Sale.BillSplitNo; // 빌분리 번호
m_cPayItem.CanFiller1 = sInEncData;
sRet = UserCom.RST_OK;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
finally
{
//여전법 대응!
//////////////////////////////////////////////////////////////////////////////////
CmUtil.ZeroFillClear(ref sInPutData);
CmUtil.ZeroFillClear(ref sInEncData);
//////////////////////////////////////////////////////////////////////////////////
}
return sRet;
}
#endregion
/// <summary>
/// 포인트 사용 캠페인 금액 설정
/// </summary>
/// <param name="cPayItem"></param>
private void SetUseCamaignAmount(Column.TR_PAYMENT.DATA cPayItem)
{
try
{
// 캠페인 성립 금액 설정
double nCampaignAmt = 0; // 사용캠페인 금액
double nCampignUseAmt = 0; // 유효포인트 사용 캠페인 금액
ArrayList alTrPluItem = (ArrayList)StateObject.GetItemObject(Column.TR_PLU.ITEM); // 상품 아이템
foreach (Column.TR_PLU.DATA cSaleItem in alTrPluItem)
{
if (cSaleItem.CANCEL_DIV == PosConst.CANCEL_DIV.CANCEL || cSaleItem.CANCEL_DIV_MAIN == PosConst.CANCEL_DIV.CANCEL) continue; // 지정취소
if (cSaleItem.BILLSPR_NO != m_cTrnStatus.Sale.BillSplitNo) continue; // 빌분리번호
if (cSaleItem.SALE_PRC == 0) continue;
if (cSaleItem.alTrSaleCpi == null) continue;
foreach (Column.TR_SALE_CPI_RSLT.DATA cTrSaleCpi in cSaleItem.alTrSaleCpi)
{
if (cTrSaleCpi.TRGT_CUST_TYPE != ItemConst.CPI_TRGT_CUST_TYPE.HPC_PAY) continue;
if (cTrSaleCpi.DC_SUM_AMT > 0)
{
nCampaignAmt = CmUtil.DoubleAdd(nCampaignAmt, cTrSaleCpi.DC_SUM_AMT);
if (cTrSaleCpi.CPI_CUST_BNFT_TYPE == ItemConst.CPI_CUST_BNFT.DIS_POINT)
{
nCampignUseAmt = CmUtil.DoubleAdd(nCampignUseAmt, cTrSaleCpi.DC_SUM_AMT);
}
}
}
}
cPayItem.AMT_ENTRY_02 = nCampaignAmt; // 캠페인할인금액
if (nCampignUseAmt > 0 && cPayItem.HP_EXT_POINT > 0)
{
// 유효포인트사용금액
cPayItem.AMT_ENTRY_06 = cPayItem.HP_EXT_POINT > cPayItem.PAY_AMT ? cPayItem.PAY_AMT : cPayItem.HP_EXT_POINT;
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
#region CAT
/// <summary>
/// CAT 단말기 승인
/// </summary>
/// <param name="sAppType"></param>
/// <param name="aParam"></param>
/// <returns></returns>
public string CatExecuteIrt(string sAppType, string[] aParam)
{
string sRet = UserCom.RST_ERR;
string sSendData = string.Empty;
try
{
// 연습모드이면 연습 데이터 설정
if (m_cPosStatus.Base.TrainingFlag == "1" || m_cPosStatus.Mst.TestStorYn == "1") return SetTrainingData(sAppType, "", "K", "999999*********", "", CmUtil.DoubleParse(aParam[3]), "", DateTime.Now.ToString("yyyyMMdd"), "99999999");
string sRecvdData = "";
string sAppLogDiv = "";
string sInputType = "";
if (sAppType == PosConst.POS_CAT_MASTER.TRADE_ID.CAT_HAPPY_USE )
{
sAppLogDiv = PosConst.CANCEL_DIV.NORMAL;
}
else
{
sAppLogDiv = PosConst.CANCEL_DIV.CANCEL;
}
string[] aIrtDTLRsp = new string[Column.POS_RES_SPCN_CAT.LEN.Length];
//전문 송/수신
if (CatTerminalExecuteIrtCom(sAppType, sAppLogDiv, aParam, m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01, ref aIrtDTLRsp, ref sRecvdData, ref sInputType) == false)
{
//WinManager.ErrorMessage(sRecvdData);
return sRet;
}
if (sAppLogDiv == PosConst.CANCEL_DIV.NORMAL)
{
m_cPayItem.PAY_AMT = CmUtil.DoubleParse(aIrtDTLRsp[Column.POS_RES_SPCN_CAT.SEQ.TotAmt]); // 사용포인트(할인금액)
m_cPayItem.PAY_DTL_CD_03 = "0"; // 할인금액아이템적용여부 (0:미적용, 1:적용)
m_cPayItem.PAY_DTL_CD_05 = PosConst.PAY_DC_TYPE.PAY; // 할인결제구분 (1:결제, 2:할인)
if (PosMstManager.GetMstPayDc(m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01, PosMst.MST_PAY_DC.DATA.PAY_DC_TYPE) == PosConst.PAY_DC_TYPE.DC)
{
m_cPayItem.PAY_DTL_CD_03 = "1"; // 할인금액아이템적용여부 (0:미적용, 1:적용)
m_cPayItem.PAY_DTL_CD_05 = PosConst.PAY_DC_TYPE.DC; // 할인결제구분 (1:결제, 2:할인)
}
m_cPayItem.AMT_ENTRY_01 = m_cPayItem.PAY_AMT; // 사용포인트(할인금액)
m_cPayItem.AMT_ENTRY_03 = CmUtil.DoubleParse(CmUtil.MidH(aIrtDTLRsp[Column.POS_RES_SPCN_CAT.SEQ.AddItem], 18, 9)); // 총포인트
m_cPayItem.AMT_ENTRY_04 = CmUtil.DoubleParse(CmUtil.MidH(aIrtDTLRsp[Column.POS_RES_SPCN_CAT.SEQ.AddItem], 9, 9)); // 가용포인트(할인후결제금액)
m_cPayItem.AMT_ENTRY_05 = CmUtil.DoubleParse(CmUtil.MidH(aIrtDTLRsp[Column.POS_RES_SPCN_CAT.SEQ.AddItem], 18, 9)); // 잔여포인트
m_cPayItem.AMT_ENTRY_10 = CmUtil.DoubleParse(aParam[3]);
m_cPayItem.OCCUR_ENTRY_01 = aIrtDTLRsp[Column.POS_RES_SPCN_CAT.SEQ.CardBinData].Trim().Length == 6 ? aIrtDTLRsp[Column.POS_RES_SPCN_CAT.SEQ.CardBinData].Trim() + "*********" : aIrtDTLRsp[Column.POS_RES_SPCN_CAT.SEQ.CardBinData].Trim(); // 카드번호
m_cPayItem.OCCUR_ENTRY_02 = aIrtDTLRsp[Column.POS_RES_SPCN_CAT.SEQ.AppNo].Trim(); // 승인번호
m_cPayItem.OCCUR_ENTRY_03 = CmUtil.MidH(aIrtDTLRsp[Column.POS_RES_SPCN_CAT.SEQ.AppDatatime], 0, 6); // 승인일자
m_cPayItem.OCCUR_ENTRY_04 = CmUtil.MidH(aIrtDTLRsp[Column.POS_RES_SPCN_CAT.SEQ.AppDatatime], 6, 4); // 승인시간
m_cPayItem.OCCUR_ENTRY_05 = sInputType; // 입력 구분
m_cPayItem.OCCUR_ENTRY_06 = ""; // 원승인번호
m_cPayItem.OCCUR_ENTRY_07 = ""; // 원승인일자
m_cPayItem.OCCUR_ENTRY_08 = ItemConst.PAY_APP_DIV.CAT_TERMINAL; // 승인구분
m_cPayItem.OCCUR_ENTRY_16 = GetPayDtlCdToVanCode(m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01); // VAN 구분
m_cPayItem.OCCUR_ENTRY_18 = aIrtDTLRsp[Column.POS_RES_SPCN_CAT.SEQ.FranchiseNo]; // 가맹점번호
m_cPayItem.OCCUR_ENTRY_20 = GetPayDtlCdToPayDtlName(m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01); // 결제수단명
m_cPayItem.OCCUR_ENTRY_21 = GetPayDtlCdToCashBillYn(m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01); // 현금영수증 발행여부
m_cPayItem.CANCEL_DIV = ItemConst.PAY_CANCEL_DIV.NORMAL;
m_cPayItem.BILLSPR_NO = m_cTrnStatus.Sale.BillSplitNo; // 빌분리 번호
}
else
{
m_cPayItem.AMT_ENTRY_03 = CmUtil.DoubleParse(CmUtil.MidH(aIrtDTLRsp[Column.POS_RES_SPCN_CAT.SEQ.AddItem], 18, 9)); // 총포인트
m_cPayItem.AMT_ENTRY_05 = CmUtil.DoubleParse(CmUtil.MidH(aIrtDTLRsp[Column.POS_RES_SPCN_CAT.SEQ.AddItem], 18, 9)); // 잔여포인트
m_cPayItem.OCCUR_ENTRY_01 = aIrtDTLRsp[Column.POS_RES_SPCN_CAT.SEQ.CardBinData].Trim() + "*********"; //카드번호
m_cPayItem.OCCUR_ENTRY_06 = m_cPayItem.OCCUR_ENTRY_02; // 원승인번호
m_cPayItem.OCCUR_ENTRY_07 = m_cPayItem.OCCUR_ENTRY_03; // 원승인일자
m_cPayItem.OCCUR_ENTRY_02 = aIrtDTLRsp[Column.POS_RES_SPCN_CAT.SEQ.AppNo].Trim(); // 승인번호
m_cPayItem.OCCUR_ENTRY_03 = CmUtil.MidH(aIrtDTLRsp[Column.POS_RES_SPCN_CAT.SEQ.AppDatatime], 0, 6); // 승인일자
m_cPayItem.OCCUR_ENTRY_04 = CmUtil.MidH(aIrtDTLRsp[Column.POS_RES_SPCN_CAT.SEQ.AppDatatime], 6, 4); // 승인시간
m_cPayItem.OCCUR_ENTRY_05 = sInputType; // 입력 구분
}
sRet = UserCom.RST_OK;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
finally
{
CmUtil.ZeroFillClear(ref sSendData);
}
return sRet;
}
#endregion
#region OCB
/// <summary>
/// OCB 직통신
/// </summary>
public string ExecutePointOCBDirectIrt(string sTradeDiv, string sTrType, string sInPutType, string sInPutData, string sInEncData, string sCardPwd, double nPayAmt, string sApprDate, string sApprNo, string sUniqueID)
{
string sRet = UserCom.RST_ERR;
string sResMsg = "";
try
{
if (sInPutData.Length >= 6) sInPutData = sInPutData.Substring(0, 6).PadRight(sInPutData.Length, '*');
// 연습모드이면 연습 데이터 설정
if (m_cPosStatus.Base.TrainingFlag == "1" || m_cPosStatus.Mst.TestStorYn == "1") return SetTrainingData(sTrType, "OCB", sInPutType, sInPutData, sInEncData, nPayAmt, sCardPwd, sApprDate, sApprNo);
// 포인트 조회
string[] aIrtRsp = null;
sRet = m_OCBDirect.OCB_Direct_Point(sTradeDiv, m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01, sTrType, sInEncData, sCardPwd, nPayAmt.ToString(), sApprDate, sApprNo, sUniqueID, ref sResMsg, ref aIrtRsp);
if (sRet != UserCom.RST_OK)
{
if (sResMsg.Trim() != "")
WinManager.ErrorMessage(sResMsg);
return sRet;
}
// 가맹점번호
string sCMPApprID = PosMstManager.GetMstVan(PosMstManager.GetPosOption(POS_OPTION.OPT326), PosMst.MST_VAN.DATA.CMP_APPR_ID);
if (sTradeDiv == PosConst.CANCEL_DIV.NORMAL)
{
if (sTrType == PosConst.POS_OCB_DIRECT.INQ_POINT)
{
// 포인트 조회
m_cPayItem.AMT_ENTRY_03 = CmUtil.DoubleParse(aIrtRsp[Column.POS_REQ_OCB_INQPOINT.SEQ.ACC_POINT1]); // 총포인트(누적포인트)
m_cPayItem.AMT_ENTRY_04 = CmUtil.DoubleParse(aIrtRsp[Column.POS_REQ_OCB_INQPOINT.SEQ.REM_POINT1]); // 가용포인트
m_cPayItem.AMT_ENTRY_05 = CmUtil.DoubleParse(aIrtRsp[Column.POS_REQ_OCB_INQPOINT.SEQ.ACC_POINT1]); // 누적포인트
m_cPayItem.OCCUR_ENTRY_13 = CmUtil.MidH(aIrtRsp[Column.POS_REQ_OCB_INQPOINT.SEQ.SAVEPOINT_YN], 0, 1); // 적립가능여부
m_cPayItem.OCCUR_ENTRY_14 = CmUtil.MidH(aIrtRsp[Column.POS_REQ_OCB_INQPOINT.SEQ.USEPOINT_YN], 0, 1); // 사용가능여부
}
else
{
// 포인트 사용
m_cPayItem.AMT_ENTRY_01 = CmUtil.DoubleParse(aIrtRsp[Column.POS_REQ_OCB_POINT.SEQ.CUR_POINT1]); // 적립포인트
m_cPayItem.AMT_ENTRY_03 = CmUtil.DoubleParse(aIrtRsp[Column.POS_REQ_OCB_POINT.SEQ.ACC_POINT1]); // 총포인트(누적포인트)
m_cPayItem.AMT_ENTRY_04 = CmUtil.DoubleParse(aIrtRsp[Column.POS_REQ_OCB_POINT.SEQ.REM_POINT1]); // 가용포인트
m_cPayItem.AMT_ENTRY_05 = CmUtil.DoubleParse(aIrtRsp[Column.POS_REQ_OCB_POINT.SEQ.ACC_POINT1]); // 누적포인트
m_cPayItem.AMT_ENTRY_06 = CmUtil.DoubleParse(aIrtRsp[Column.POS_REQ_OCB_POINT.SEQ.FEE_AMT1]); // 가맹점수수료
m_cPayItem.OCCUR_ENTRY_02 = aIrtRsp[Column.POS_REQ_OCB_POINT.SEQ.APPR_NO].Trim(); // 승인번호
m_cPayItem.OCCUR_ENTRY_03 = CmUtil.MidH(aIrtRsp[Column.POS_REQ_OCB_POINT.SEQ.APPR_DATE], 0, 8); // 승인일자
m_cPayItem.OCCUR_ENTRY_04 = CmUtil.MidH(aIrtRsp[Column.POS_REQ_OCB_POINT.SEQ.APPR_TIME], 0, 6); // 승인시간
}
m_cPayItem.PAY_AMT = nPayAmt;
m_cPayItem.PAY_DTL_CD_03 = "0"; // 할인금액 아이템 적용여부(0:미적용, 1:적용)
m_cPayItem.PAY_DTL_CD_05 = PosConst.PAY_DC_TYPE.PAY; // 할인결제구분 (1:결제, 2:할인)
m_cPayItem.AMT_ENTRY_01 = m_cPayItem.PAY_AMT; // 사용포인트
m_cPayItem.OCCUR_ENTRY_01 = sInPutData; // 카드번호
m_cPayItem.OCCUR_ENTRY_05 = sInPutType; // 입력 구분
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_16 = PosMstManager.GetPosOption(POS_OPTION.OPT326); // VAN 구분
m_cPayItem.OCCUR_ENTRY_17 = sUniqueID; // UniqueID
m_cPayItem.OCCUR_ENTRY_18 = sCMPApprID; // 가맹점번호
m_cPayItem.OCCUR_ENTRY_20 = GetPayDtlCdToPayDtlName(m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01); // 결제수단명
m_cPayItem.OCCUR_ENTRY_21 = GetPayDtlCdToCashBillYn(m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01); // 현금영수증 발행여부
m_cPayItem.CANCEL_DIV = ItemConst.PAY_CANCEL_DIV.NORMAL;
m_cPayItem.BILLSPR_NO = m_cTrnStatus.Sale.BillSplitNo; // 빌분리 번호
m_cPayItem.CanFiller1 = sInEncData;
}
else
{
m_cPayItem.AMT_ENTRY_03 = CmUtil.DoubleParse(aIrtRsp[Column.POS_REQ_OCB_CANPOINT.SEQ.ACC_POINT1]); // 총포인트(누적포인트)
m_cPayItem.AMT_ENTRY_04 = CmUtil.DoubleParse(aIrtRsp[Column.POS_REQ_OCB_CANPOINT.SEQ.REM_POINT1]); // 가용포인트
m_cPayItem.AMT_ENTRY_05 = CmUtil.DoubleParse(aIrtRsp[Column.POS_REQ_OCB_CANPOINT.SEQ.ACC_POINT1]); // 누적포인트
m_cPayItem.AMT_ENTRY_06 = CmUtil.DoubleParse(aIrtRsp[Column.POS_REQ_OCB_CANPOINT.SEQ.CAN_POINT1]); // 실차감포인트
m_cPayItem.OCCUR_ENTRY_01 = sInPutData.Length > 16 ? sInPutData.Substring(0, 16) : sInPutData; // 카드번호
m_cPayItem.OCCUR_ENTRY_02 = aIrtRsp[Column.POS_REQ_OCB_CANPOINT.SEQ.APPR_NO].Trim(); // 승인번호
m_cPayItem.OCCUR_ENTRY_03 = CmUtil.MidH(aIrtRsp[Column.POS_REQ_OCB_CANPOINT.SEQ.APPR_DATE], 0, 8); // 승인일자
m_cPayItem.OCCUR_ENTRY_04 = CmUtil.MidH(aIrtRsp[Column.POS_REQ_OCB_CANPOINT.SEQ.APPR_TIME], 0, 6); // 승인시간
m_cPayItem.OCCUR_ENTRY_01 = sInPutData; // 카드번호
m_cPayItem.OCCUR_ENTRY_05 = sInPutType; // 입력 구분
m_cPayItem.OCCUR_ENTRY_06 = sApprNo; // 원승인번호
m_cPayItem.OCCUR_ENTRY_07 = sApprDate; // 원승인일자
}
sRet = UserCom.RST_OK;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
finally
{
//여전법 대응!
//////////////////////////////////////////////////////////////////////////////////
CmUtil.ZeroFillClear(ref sInPutData);
CmUtil.ZeroFillClear(ref sInEncData);
//////////////////////////////////////////////////////////////////////////////////
}
return sRet;
}
#endregion
}
}