Example #1
0
        /// <summary>
        /// 승인을 요청합니다.
        /// </summary>
        /// <param name="Project">업무구분 [PROJECT_D ,  PROJECT_H ...]</param>
        /// <param name="kind">현금인지  /  카드인지 구분</param>
        /// <param name="cashKind">현금영주증  중 개인/법인구분</param>
        /// <param name="cardno">카드번호  / 식별번호</param>
        /// <param name="scope">유효기간</param>
        /// <param name="amtSplit">할부개월</param>
        /// <param name="amt">승인금액</param>
        /// <param name="vanSeq">POS  에서  밴 거래시  일련번호</param>
        /// <param name="SignDataString">싸인이미지</param>
        /// <returns></returns>
        public Van.RecivedData SendData(string Project,
                                        Van.JobKind kind,
                                        CashKind cashKind,
                                        string cardno,
                                        string scope,
                                        string amtSplit,
                                        string amt,
                                        string vanSeq,
                                        string SignDataString,
                                        string OrgAgreeNo,
                                        string OrgAgreeDate
                                        , CashGbn cashgbn)
        {
            try
            {
                BizCommon.VanType type    = VanType.NONE;
                string            svrIP   = "";
                string            svrPort = "";
                string            tid     = "";

                SignPad pad         = SignPad.NONE;
                string  signcomport = "";

                type = BizVan.GetProjectVaninfo(Project, kind, ref svrIP, ref svrPort, ref tid, ref pad, ref signcomport);

                return(MySendData(type, svrIP, svrPort, kind, cashKind, tid, cardno, scope, amtSplit, amt, vanSeq, SignDataString, OrgAgreeNo, OrgAgreeDate, cashgbn));
            }
            catch (Exception ex)
            {
                throw  ex;
            }
        }
Example #2
0
        /// <summary>
        /// 실제적인 승인처리 현금영수 - 카드 승인/취소 공통이다.
        /// </summary>
        /// <param name="Project">The project.</param>
        /// <param name="kind">종류 /  카드승인/카드취소/현금승인/현금취소등</param>
        /// <param name="cashKind">현금영수증일대  구분</param>
        /// <param name="cardno">카드번호 /  식별번호</param>
        /// <param name="scope">유효기간</param>
        /// <param name="amtSplit">할부개월</param>
        /// <param name="amt">금액</param>
        /// <param name="vanSeq">밴일련번호 - pos에서  밴거래시  1씩증가</param>
        /// <param name="SignDataString">싸인데이터</param>
        /// <param name="OrgAgreeNo">The org agree no.</param>
        /// <param name="OrgAgreeDate">The org agree date.</param>
        /// <returns></returns>
        public string GetVanMakeCardProtocol(string Project,
                                             Van.JobKind kind,
                                             CashKind cashKind,
                                             string cardno,
                                             string scope,
                                             string amtSplit,
                                             string amt,
                                             string vanSeq,
                                             string SignDataString,
                                             string OrgAgreeNo,
                                             string OrgAgreeDate
                                             , CashGbn cashgbn)
        {
            try
            {
                string svrIP   = "";
                string svrPort = "";
                string tid     = "";

                SignPad pad         = SignPad.NONE;
                string  signcomport = "";

                BizCommon.VanType rtype = BizVan.GetProjectVaninfo(Project, kind, ref svrIP, ref svrPort, ref tid, ref pad, ref signcomport);

                Van.VanType type = BizVan.ConvertToVanType(rtype);

                if (tid == "")
                {
                    throw new Exception("밴 터미널 아이디가 등록되지 않았습니다.");
                }
                else if (rtype != VanType.KIS && (type == Van.VanType.NONE || svrIP == "" || svrPort == ""))
                {
                    throw new Exception("밴 환경설정이 없습니다.");
                }
                string str = "";

                if (kind == JobKind.RegCard || kind == JobKind.RegCash)
                {
                    //현금영수증 부가세 관련현 수정
                    string strVat = "";// intVat = 0;
                    if (amt == null || amt == "0" || amt == "")
                    {
                        strVat = "";
                    }
                    else
                    {
                        strVat = ((int)(Convert.ToDouble(amt) - Convert.ToDouble(amt) / 1.1)).ToString();
                    }

                    switch (type)
                    {
                    case Van.VanType.KICC:
                        str = Van.KICC.Reg(kind,
                                           cashKind,
                                           tid,
                                           cardno,
                                           scope,
                                           Basic.MaskReplace(amtSplit.Trim()),
                                           Basic.MaskReplace(amt.Trim()));
                        break;

                    case Van.VanType.KSNET:
                        str = Van.KSNET.Reg(kind,
                                            cashKind,
                                            tid,
                                            cardno,
                                            scope,
                                            Basic.MaskReplace(amtSplit.Trim()),
                                            Basic.MaskReplace(amt.Trim()),
                                            1,
                                            SignDataString);


                        break;

                    case Van.VanType.KIS:
                        str = Van.KIS.Reg(kind
                                          , cashKind
                                          , tid
                                          , cardno
                                          , scope
                                          , Basic.MaskReplace(amtSplit.Trim())
                                          , Basic.MaskReplace(amt.Trim())
                                          , strVat
                                          , cashgbn);

                        break;
                    }
                }
                else if (kind == JobKind.CancelCash || kind == JobKind.CancelCard)
                {
                    switch (type)
                    {
                    case Van.VanType.KICC:
                        str = Van.KICC.Cancel(kind,
                                              cashKind,
                                              tid,
                                              cardno,
                                              scope,
                                              Basic.MaskReplace(amtSplit.Trim()),
                                              Basic.MaskReplace(amt.Trim()),
                                              OrgAgreeNo,
                                              OrgAgreeDate
                                              );
                        break;

                    case Van.VanType.KSNET:
                        str = KSNET.Cancel(kind,
                                           cashKind,
                                           tid,
                                           cardno,
                                           scope,
                                           Basic.MaskReplace(amtSplit.Trim()),
                                           Basic.MaskReplace(amt.Trim()),
                                           OrgAgreeNo,
                                           OrgAgreeDate,
                                           1,
                                           "");
                        break;
                    }
                }



                return(str);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #3
0
        public Van.RecivedData GetCashRegNumber(string Project, int amt)
        {
            try
            {
                string svrIP   = "";
                string svrPort = "";
                string tid     = "";

                SignPad pad         = SignPad.NONE;
                string  signcomport = "";

                BizCommon.VanType rtype = BizVan.GetProjectVaninfo(Project, JobKind.None, ref svrIP, ref svrPort, ref tid, ref pad, ref signcomport);

                Van.VanType type = BizVan.ConvertToVanType(rtype);

                if (signcomport == "")
                {
                    throw new Exception("싸인패드 포트가 등록되지 않았습니다.");
                }

                if (pad == SignPad.NONE)
                {
                    throw new Exception("환경설정에 선택한 싸인패드가 없습니다. \n\r식별번호를 수기로 입력하세요");
                }
                else if (pad == SignPad.KSP100S)
                {
                    throw new Exception("선택되어진 싸인패드는 식별번호를 받을 수 없습니다. \n\r식별번호를 수기로 입력하세요");
                }



                /*************************************************************************/
                //싸인패드 식별번호 요청
                /*************************************************************************/



                Van.frmVanLoading fCash = new Van.frmVanLoading("현금영수증 식별번호 요청",
                                                                type,
                                                                frmVanLoading.JobKind.CashRegNumber,
                                                                "BizGetRequest");



                try
                {
                    fCash.Amount    = amt;
                    fCash.SignPort  = int.Parse(signcomport.Replace("COM", ""));
                    fCash.SignSpeed = 57600;
                    fCash.Owner     = this;
                    IsLoop          = true;
                    fCash.ShowDialog();
                }
                catch (Exception ex)
                {
                    throw ex;
                }


                while (IsLoop)
                {
                    Application.DoEvents();
                }

                if (_ReqData.RequestCode == ((int)Van.frmVanLoading.RS232Err.PortError).ToString())
                {
                    throw new Exception("싸인패드 연결실패 입니다.");
                }
                else if (_ReqData.RequestCode == ((int)Van.frmVanLoading.RS232Err.NotData).ToString())
                {
                    throw new Exception("반환된 결과 값이 없습니다.");
                }
                else if (_ReqData.RequestCode == ((int)Van.frmVanLoading.RS232Err.TimeOut).ToString())
                {
                    throw new Exception("제한시간 초과 입니다.");
                }
                else if (_ReqData.RequestCode == ((int)Van.frmVanLoading.RS232Err.Communication).ToString())
                {
                    throw new Exception("싸인패드와 통신할 수 없습니다.");
                }


                if (_ReqData.CashRegNumber.Trim() == "")
                {
                    throw new Exception("식별번호가 없습니다.");
                }


                return(_ReqData);
            }
            catch (Exception ex)
            {
                throw  ex;
            }
        }
Example #4
0
        /// <summary>
        /// 싸인을 받습니다.
        /// </summary>
        /// <param name="tid">터미널아이디</param>
        /// <param name="svrIP">서버아이피</param>
        /// <param name="svrPort">서버포트</param>
        /// <param name="Amt">금액</param>
        /// <param name="ComPort">싸인패드포트</param>
        /// <param name="reqdata">응답데이터</param>
        public bool GetSign(string Project, int Amt, ref Van.RecivedData reqdata, string VanAgreeProtocal)
        {
            try
            {
                string svrIP   = "";
                string svrPort = "";
                string tid     = "";

                SignPad pad         = SignPad.NONE;
                string  signcomport = "";

                BizCommon.VanType rtype = BizVan.GetProjectVaninfo(Project, JobKind.None, ref svrIP, ref svrPort, ref tid, ref pad, ref signcomport);

                Van.VanType type = BizVan.ConvertToVanType(rtype);

                if (signcomport == "")
                {
                    throw new Exception("싸인패드 포트가 등록되지 않았습니다.");
                }

                #region 서명모드
                /******************************************************************************/
                // 싸인패드가 체크 되어 있다면 서명모드 시작
                /******************************************************************************/


                //string str = Van.KICC.Reg(  kind,
                //                            cashKind,
                //                            tid,
                //                            cardno,
                //                            scope,
                //                            Basic.MaskReplace(amtSplit.Trim()),
                //                            Basic.MaskReplace(amt.Trim()));

_lblReTry:



                Van.frmVanLoading fCash = new Van.frmVanLoading("고객싸인요청",
                                                                type,
                                                                frmVanLoading.JobKind.Sign,
                                                                "BizGetRequest");
                try
                {
                    fCash.Amount         = Amt;
                    fCash.SignPort       = int.Parse(signcomport.Replace("COM", ""));
                    fCash.VanServerIP    = svrIP;
                    fCash.VanServerPort  = svrPort.Trim() == "" ? -999 : int.Parse(svrPort);
                    fCash.SignPadReqdata = VanAgreeProtocal;
                    fCash.Tid            = tid;


                    switch (pad)
                    {
                    case SignPad.EP791R:
                        fCash.SignSpeed = 57600;
                        break;

                    case SignPad.KSP100S:
                        fCash.SignSpeed = 34800;
                        break;

                    case SignPad.KISSP30:
                        fCash.SignSpeed = 57600;
                        break;

                    case SignPad.NONE:
                        throw new Exception("서명패드설정이 되어 있지 않습니다.");
                    }
                }
                catch (Exception ex)
                {
                    string strMsg = "싸인패드 설정 오류입니다. \n\r" +
                                    "거래내역은 아직 승인되지 않았습니다. \n\r" +
                                    "오류내용 : \n\r" + ex.Message;

                    throw new Exception(strMsg);
                }

                IsLoop      = true;
                fCash.Owner = this;
                fCash.ShowDialog();
                Application.DoEvents();


                while (IsLoop)
                {
                    Application.DoEvents();
                }
                reqdata = _ReqData;


                if (_ReqData.RequestCode == ((int)Van.frmVanLoading.RS232Err.PortError).ToString())
                {
                    if (MessageBox.Show("싸인패드 연결실패 입니다. - 싸인패드와 통신 상태를 확인하세요 \n\r" +
                                        "거래내역은 아직 승인되지 않았습니다. \n\r" +
                                        "싸인패드와 다시 연결을 시도 하시겠습니까? ", "확인",
                                        MessageBoxButtons.RetryCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
                    {
                        //취소를 누르면 빠져나간다.
                        return(false);
                    }
                    else
                    {
                        //재시도를 누르면 다시 싸인패드를 호출한다.
                        goto _lblReTry;
                    }
                }
                else if (_ReqData.RequestCode == ((int)Van.frmVanLoading.RS232Err.NotImage).ToString())
                {
                    if (MessageBox.Show("싸인이미지가 없습니다. \n\r" +
                                        "거래내역은 아직 승인되지 않았습니다. \n\r" +
                                        "싸인패드와 다시 연결을 시도 하시겠습니까? ", "확인",
                                        MessageBoxButtons.RetryCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
                    {
                        //취소를 누르면 빠져나간다.
                        return(false);
                    }
                    else
                    {
                        //재시도를 누르면 다시 싸인패드를 호출한다.
                        goto _lblReTry;
                    }
                }
                else if (_ReqData.RequestCode == ((int)Van.frmVanLoading.RS232Err.TimeOut).ToString())
                {
                    if (MessageBox.Show("제한시간 초과 입니다. \n\r" +
                                        "거래내역은 아직 승인되지 않았습니다. \n\r" +
                                        "싸인패드와 다시 연결을 시도 하시겠습니까? ", "확인",
                                        MessageBoxButtons.RetryCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
                    {
                        //취소를 누르면 빠져나간다.
                        return(false);
                    }
                    else
                    {
                        //재시도를 누르면 다시 싸인패드를 호출한다.
                        goto _lblReTry;
                    }
                }
                else if (_ReqData.RequestCode == ((int)Van.frmVanLoading.RS232Err.Communication).ToString())
                {
                    if (MessageBox.Show("싸인패드와 통신할 수 없습니다. \n\r" +
                                        "거래내역은 아직 승인되지 않았습니다.\n\r" +
                                        "싸인패드와 다시 연결을 시도 하시겠습니까? ", "확인",
                                        MessageBoxButtons.RetryCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
                    {
                        //취소를 누르면 빠져나간다.
                        return(false);
                    }
                    else
                    {
                        //재시도를 누르면 다시 싸인패드를 호출한다.
                        goto _lblReTry;
                    }
                }
                else if (_ReqData.RequestCode == ((int)Van.frmVanLoading.RS232Err.NotData).ToString())
                {
                    if (MessageBox.Show("리턴된 데이터가 없습니다. \n\r" +
                                        "거래내역은 아직 승인되지 않았습니다. \n\r" +
                                        "싸인패드와 다시 연결을 시도 하시겠습니까? ", "확인",
                                        MessageBoxButtons.RetryCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
                    {
                        //취소를 누르면 빠져나간다.
                        return(false);
                    }
                    else
                    {
                        //재시도를 누르면 다시 싸인패드를 호출한다.
                        goto _lblReTry;
                    }
                }
                //*********************************************************************************

                Image img = mImage.ByteArrayToImage(_ReqData.SignData);

                if (type != Van.VanType.KIS)
                {
                    Van.SignViewer f = new SignViewer(img);
                    f.ShowDialog();
                    Application.DoEvents();
                }



                /******************************************************************************/
                // 서명모드 종료
                /******************************************************************************/

                #endregion

                return(true);
            }
            catch (Exception ex)
            {
                throw  ex;
            }
        }