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 PointHPRegularCust : PaymentBase, IPaymentUs
    {
        /// <summary>
        /// 현재 등록중인 기타 정보
        /// </summary>
        protected Column.TR_ETC.DATA m_cEtcItem = null;

        public PointHPRegularCust()
        {
        }

        #region SearchPayment 결제 조회
        /// <summary>
        /// 결제 조회
        /// </summary>
        /// <param name="aParam"></param>
        /// <param name="aRet"></param>
        /// <returns></returns>
        public string SearchPayment(string[] aParam, ref string[] aRet)
        {
            return UserCom.RST_ERR;
        }
        #endregion

        #region GetPayment 결제 정보 획득
        /// <summary>
        /// 결제 정보 획득
        /// </summary>
        /// <param name="aParam"></param>
        /// <returns></returns>
        public object GetPayment(string[] aParam)
        {
            string sRet = UserCom.RST_ERR;

            try
            {

            }
            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 SetPayment 결제 등록
        /// <summary>
        /// 결제 등록(해피포인트 사후 적립)
        /// </summary>
        /// <param name="aParam"></param>
        /// <returns></returns>
        public string SetPayment(string[] aParam)
        {
            string sRet = UserCom.RST_ERR;
            string sInPutType = "", sInPutData = "", sInEncData = "", sReqDivCd = "";

            try
            {
                sInPutType = aParam[0];                     // 입력구분
                sInPutData = aParam[1];                     // 입력데이터(마스킹)
                sInEncData = aParam[2];                     // 카드데이터(암호화)
                sReqDivCd = aParam[3];                      // 요청구분코드

                m_cEtcItem = new Column.TR_ETC.DATA();      // 결과 저장 변수 생성
                m_cEtcItem.ETC_WAY_CD = ItemConst.TR_ITEM_ID.ETC_INFO_ITEM;
                m_cEtcItem.ETC_DTL_CD_01 = ItemConst.TR_ITEM_ID.ETC_INFO.SAVEPOINT;

                sRet = ExecutePointHappyPointIrt(PosConst.CANCEL_DIV.NORMAL, PosConst.POS_VAN_MASTER.TRADE_ID.VAN_POT_QRY_A, "HPY", sInPutType, sInPutData, sInEncData, sReqDivCd);
                if (sRet != UserCom.RST_OK) return sRet;
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                   System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
            finally
            {
                //여전법 대응!
                //////////////////////////////////////////////////////////////////////////////////
                CmUtil.ZeroFillClear(ref 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;

            try
            {
                
            }
            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 CompletePayment 결제 확정
        /// <summary>
        /// 결제 확정
        /// </summary>
        /// <param name="aParam"></param>
        /// <returns></returns>
        public string CompletePayment(string[] aParam)
        {
            string sRet = UserCom.RST_ERR;
            try
            {
                
            }
            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;
            try
            {
 
            }
            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>
        public string ExecutePointHappyPointIrt(string sTradeDiv, string sTrType, string sPointType, string sInPutType, string sInPutData, string sInEncData, string sReqDivCd)
        {
            string sRet = UserCom.RST_ERR;
            try
            {
                // 연습모드이면 연습 데이터 설정
                if (m_cPosStatus.Base.TrainingFlag == "1" || m_cPosStatus.Mst.TestStorYn == "1") return UserCom.RST_OK;

                string sAddInfo = "";
                sAddInfo += CmUtil.RPadH("", 10);                           // 요청 사용자 ID                               
                sAddInfo += CmUtil.RPadH(sReqDivCd, 2);                     // 요청구분코드 = 10:단골등록, 11:단골해지
                sAddInfo += CmUtil.RPadH("", 188);                          // VReserved

                string sVanCD = GetPayDtlCdToVanCode(m_cEtcItem.ETC_WAY_CD, m_cEtcItem.ETC_DTL_CD_01);    // 승인업체 코드 조회
                if (sVanCD == "")
                {
                    //WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0563);
                    return POS_MESSAGE.ERROR.MSG_0563;
                }

                // 포인트 조회
                string[] aIrtRsp = null;
                sRet = ExecutePointIrt(sTradeDiv, m_cEtcItem.ETC_WAY_CD, m_cEtcItem.ETC_DTL_CD_01, sVanCD, sTrType, sPointType, sInPutType, sInPutData, sInEncData, 0, "", "", "", "", "", "", sAddInfo, ref aIrtRsp, "", "");
                if (sRet != UserCom.RST_OK) return sRet;

                sRet = UserCom.RST_OK;
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
            finally
            {
                //여전법 대응!
                //////////////////////////////////////////////////////////////////////////////////
                CmUtil.ZeroFillClear(ref sInPutData);
                CmUtil.ZeroFillClear(ref sInEncData);
                //////////////////////////////////////////////////////////////////////////////////
            }
            return sRet;
        }
        #endregion

    }
}
