Пример #1
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;
            }
        }