Ejemplo n.º 1
0
        /*☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★*/

        private void GetSignImage(ref string SignDataString, ref Image SignImage)
        {
            try
            {
                //싸인이미지를 받는다.
                Van.frmVanLoading f = new Van.frmVanLoading("서명을 받습니다.", Van.VanType.KSNET, Van.frmVanLoading.JobKind.Sign, "GetRequest");
                f.SignPort    = int.Parse(this.txtSignPadPort.Text.Trim());
                f.SignSpeed   = int.Parse(this.txtSignPadSpeed.Text.Trim());
                f.WaitTimeOut = 10000;
                f.Owner       = this;
                f.ShowDialog();

                Image img = _ReqData.SignData == null ? null : mImage.ByteArrayToImage(_ReqData.SignData);


                if (_ReqData.SignData != null)
                {
                    Van.SignViewer fSign = new SignViewer(img);
                    fSign.Owner = this;
                    fSign.ShowDialog();
                }

                SignDataString = _ReqData.SignStringData;
                SignImage      = _ReqData.SignData == null ? null : mImage.ByteArrayToImage(_ReqData.SignData);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 2
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;
            }
        }
Ejemplo n.º 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;
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 실제적인 승인처리 현금영수 - 카드 승인/취소 공통이다.
        /// </summary>
        /// <param name="tid">터미널아이디</param>
        /// <param name="svrIP">서버아이피.</param>
        /// <param name="svrPort">서버포트</param>
        /// <param name="str">전송전문</param>
        /// <param name="kind">종류 /  카드승인/카드취소/현금승인/현금취소등</param>
        /// <param name="SignDataString">싸인데이터 </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>
        /// <returns></returns>
        private Van.RecivedData MySendData(
            BizCommon.VanType rtype,
            string svrIP,
            string svrPort,
            Van.JobKind kind,
            CashKind cashKind,
            string tid,
            string cardno,
            string scope,
            string amtSplit,
            string amt,
            string vanSeq,
            string SignDataString,
            string OrgAgreeNo,
            string OrgAgreeDate
            , CashGbn cashgbn)
        {
            try
            {
                Van.VanType type = BizVan.ConvertToVanType(rtype);

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

                if (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;

                    case Van.VanType.STAR_CAT:
                        str = Van.STAR_CAT.Reg(kind
                                               , cashKind
                                               , 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;

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

                    case Van.VanType.STAR_CAT:
                        str = STAR_CAT.Cancel(kind,
                                              cashKind,
                                              Basic.MaskReplace(amtSplit.Trim()),
                                              Basic.MaskReplace(amt.Trim()),
                                              OrgAgreeNo,
                                              OrgAgreeDate
                                              );
                        break;
                    }
                }



                Van.frmVanLoading f = new Van.frmVanLoading("승인요청 중 입니다.",
                                                            type,
                                                            frmVanLoading.JobKind.Communication,
                                                            svrIP,
                                                            svrPort == "" ? -99 : int.Parse(svrPort),
                                                            str,
                                                            "BizGetRequest");

                f.CardApprovalType = SignDataString == "" ? CARD_APPROVAL_TYPE.DDC : CARD_APPROVAL_TYPE.DSC;
                f.ArgJobKinds      = kind;
                f.SignDataString   = SignDataString;
                f.Tid   = tid;
                f.Owner = this;
                IsLoop  = true;
                f.ShowDialog();

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


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