Example #1
0
 public ActionResult ConsultingCallback(ResponseKMCModel model)
 {
     if (model == null)
     {
         ViewBag.Message = "결과값 비정상";
     }
     return(View(model));
 }
Example #2
0
 public ActionResult Callback(ResponseKMCModel model)
 {
     // 이미 참여했으면 참여한 대상자 처리
     if (model == null)
     {
         ViewBag.Message = "결과값 비정상";
     }
     return(View(model));
 }
Example #3
0
        public ActionResult CompleteKidsNoteKMC(ResponseKMCModel model)
        {
            try {
                if (IsEventClose())
                {
                    throw new KidsNoteServiceException("400", "이벤트가 종료되었습니다.", null);
                }
                var result = kmcService.ResponseKMC(model);

                var entry = new KidsNoteEntry {
                    Name       = string.IsNullOrEmpty(result.Data.M_Name) ? result.Data.Name : result.Data.M_Name,
                    Gender     = string.IsNullOrEmpty(result.Data.M_Gender) ? result.Data.Gender : result.Data.M_Gender,
                    Mobile     = result.Data.PhoneNo,
                    BirthDay   = string.IsNullOrEmpty(result.Data.M_BirthDay) ? result.Data.BirthDay : result.Data.M_BirthDay,
                    Channel    = common.IsMobileDevice ? Domain.Entities.Abstract.ChannelType.Mobile : Domain.Entities.Abstract.ChannelType.PC,
                    IpAddress  = common.IpAddress,
                    CreateDate = common.Now,
                    EventType  = KidsNoteEventType.ThirdEvent   //4차이벤트 시작시 수정해야함
                };
                var resultModel = service.CreateKidsNoteEntry(entry);
                var data        = mapperConfig.CreateMapper().Map <KidsNoteViewModel>(resultModel);

                Session.Add("KidsNoteEntryId", resultModel.Id);

                return(Json(new {
                    Result = result.Result,
                    Message = result.Message,
                    Data = data
                }));
            } catch (KMCServiceException e) {
                logger.Debug(">>>>>>>>>>> Response KMC Service");
                logger.Debug("/////////// message:{0}, data:{1}", e.Message, e.Data);

                return(Json(new {
                    Result = false,
                    Message = string.Format("본인인증 실패되었습니다. [ 본인인증을 다시 해주시길 바랍니다. ({0}) ]", e.Message)
                }));
            } catch (KidsNoteServiceException e) {
                return(Json(new {
                    Result = false,
                    Message = e.Message
                }));
            } catch (Exception e) {
                logger.Error(e);

                return(Json(new {
                    Result = false,
                    Message = "서비스 점검중입니다. 잠시 후 시도해보시거나, 담당자에게 문의하시기 바랍니다."
                }));
            }
        }
Example #4
0
        public ActionResult CompleteMarketingAgreeKMC(ResponseKMCModel model)
        {
            try {
                throw new MarketingAgreeServiceException("400", "이벤트가 종료되었습니다.", null);

                //var result = kmcService.ResponseKMC(model);

                //var entry = new MarketingAgreeEntry {
                //    Name = string.IsNullOrEmpty(result.Data.M_Name) ? result.Data.Name : result.Data.M_Name,
                //    Gender = string.IsNullOrEmpty(result.Data.M_Gender) ? result.Data.Gender : result.Data.M_Gender,
                //    Mobile = result.Data.PhoneNo,
                //    BirthDay = string.IsNullOrEmpty(result.Data.M_BirthDay) ? result.Data.BirthDay : result.Data.M_BirthDay,
                //    Channel = common.IsMobileDevice ? Domain.Entities.Abstract.ChannelType.Mobile : Domain.Entities.Abstract.ChannelType.PC,
                //    IpAddress = common.IpAddress,
                //    CreateDate = common.Now
                //};

                //var resultModel = service.CreateMarketingAgreeEntry(entry);
                //var data = mapperConfig.CreateMapper().Map<MarketingAgreeViewModel>(resultModel);

                //Session.Add("MarketingAgreeEntryId", resultModel.Id);

                //return Json(new {
                //    Result = result.Result,
                //    Message = result.Message,
                //    Data = data
                //});
            }
            catch (KMCServiceException e) {
                logger.Debug(">>>>>>>>>>> Response KMC Service");
                logger.Debug("/////////// message:{0}, data:{1}", e.Message, e.Data);

                return(Json(new {
                    Result = false,
                    Message = string.Format("본인인증 실패되었습니다. [ 본인인증을 다시 해주시길 바랍니다. ({0}) ]", e.Message)
                }));
            } catch (MarketingAgreeServiceException e) {
                return(Json(new {
                    Result = false,
                    Message = e.Message
                }));
            } catch (Exception e) {
                logger.Error(e);

                return(Json(new {
                    Result = false,
                    Message = "서비스 점검중입니다. 잠시 후 시도해보시거나, 담당자에게 문의하시기 바랍니다."
                }));
            }
        }
Example #5
0
        public JsonResult ResponseFinancialConcertMarketingAgreeKMC(ResponseKMCModel model)
        {
            //var result = new JsonResultModel { Result = false, Message = "서비스 점검중입니다. 잠시 후 시도해보시거나, 담당자에게 문의하시기 바랍니다." };
            var result = new JsonResultModel {
                Result = true, Message = "이미 종료된 이벤트입니다."
            };

            /*
             * try {
             *  //response kmc
             *  var responseKmc = kmcService.ResponseKMC(model);
             *
             *  //create entry
             *  var entry = new FinancialConcertMarketingAgreeEntry {
             *      Name = string.IsNullOrEmpty(responseKmc.Data.M_Name) ? responseKmc.Data.Name : responseKmc.Data.M_Name,
             *      Gender = ((string.IsNullOrEmpty(responseKmc.Data.M_Gender) ? responseKmc.Data.Gender : responseKmc.Data.M_Gender) == "0" ? "남" : "여"),
             *      Mobile = responseKmc.Data.PhoneNo,
             *      BirthDay = string.IsNullOrEmpty(responseKmc.Data.M_BirthDay) ? responseKmc.Data.BirthDay : responseKmc.Data.M_BirthDay,
             *      Channel = common.IsMobileDevice ? Domain.Entities.Abstract.ChannelType.Mobile : Domain.Entities.Abstract.ChannelType.PC,
             *      IpAddress = common.IpAddress,
             *      CreateDate = common.Now
             *  };
             *  long entryId = service.Create(entry);
             *
             *  //session save
             *  Session["FINANCIAL_CONCERT_MARKETING_AGREE_ENTRY_ID"] = entryId;
             *
             *  var responseData = mapperConfig.CreateMapper().Map<FinancialConcertMarketingAgreeCertModel>(entry);
             *
             *  result.Result = responseKmc.Result;
             *  result.Message = responseKmc.Message;
             *  result.Data = responseData;
             *
             * } catch (KMCServiceException e) {
             *  logger.Info(">>>>>>>> 재무콘서트 KMC Service Exception");
             *  logger.Debug("/////////// message:{0}, data:{1}", e.Message, e.Data);
             *
             *  result.Message = string.Format("본인인증 실패되었습니다. [본인인증을 다시 해주시길 바랍니다. ({0})]", e.Message);
             * } catch (EventServiceException e) {
             *  result.Message = e.Message;
             * } catch (Exception e) {
             *  logger.Info(">>>>>>>> 재무콘서트 Exception");
             *  logger.Debug("/////////// message:{0}, data:{1}", e.Message, e.Data);
             * }
             */
            return(Json(result));
        }
Example #6
0
        /// <summary>
        /// Response KMC Service
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ResultMessage Post([FromBody] ResponseKMCModel model)
        {
            var result = new ResultMessage {
                Result = false, Message = "본인인증을 다시 해주시길 바랍니다."
            };

            try {
                result = kmcService.ResponseKMC(model);
                //db에 저장
            } catch (KMCServiceException e) {
                logger.Debug(">>>>>>>>>>> Response KMC Service");
                logger.Debug("/////////// message:{0}, data:{1}", e.Message, e.Data);
                result = new ResultMessage {
                    Result  = false,
                    Message = string.Format("본인인증을 다시 해주시길 바랍니다. ({0})", e.Message)
                };
            } catch (Exception e) {
                logger.Error(e);
            }
            return(result);
        }
Example #7
0
        public ActionResult CompleteMarketingAgreeKMC(ResponseKMCModel model)
        {
            try
            {
                if (IsEventClose())
                {
                    throw new OverFortyFiveServiceException("400", "해당 이벤트는 선착순 마감되었습니다.", null);
                }

                var result = kmcService.ResponseKMC(model);

                if (int.Parse(result.Data.BirthDay.ToString().Substring(0, 4)) >= 1980)
                {
                    throw new OverFortyFiveServiceException("400", "40세 이상부터 가능한 이벤트입니다.\r\n[휴대폰 인증 기준, 1979년 이전 출생]\r\n(ex) 79년, 78년, 77년, …", null);
                }

                var entry = new OverFortyFiveDbEntry
                {
                    Name       = string.IsNullOrEmpty(result.Data.M_Name) ? result.Data.Name : result.Data.M_Name,
                    Gender     = string.IsNullOrEmpty(result.Data.M_Gender) ? result.Data.Gender : result.Data.M_Gender,
                    Mobile     = result.Data.PhoneNo,
                    BirthDay   = string.IsNullOrEmpty(result.Data.M_BirthDay) ? result.Data.BirthDay : result.Data.M_BirthDay,
                    Channel    = common.IsMobileDevice ? Domain.Entities.Abstract.ChannelType.Mobile : Domain.Entities.Abstract.ChannelType.PC,
                    IpAddress  = common.IpAddress,
                    CreateDate = common.Now
                };

                var resultModel = service.CreateOverFortyFiveEntry(entry);
                var data        = mapperConfig.CreateMapper().Map <OverFortyFiveDbViewModel>(resultModel);

                Session.Add("OverFortyFiveDbEntryId", resultModel.Id);

                return(Json(new
                {
                    Result = result.Result,
                    Message = result.Message,
                    Data = data
                }));
            }
            catch (KMCServiceException e)
            {
                logger.Debug(">>>>>>>>>>> Response KMC Service");
                logger.Debug("/////////// message:{0}, data:{1}", e.Message, e.Data);

                return(Json(new
                {
                    Result = false,
                    Message = string.Format("본인인증 실패되었습니다. [ 본인인증을 다시 해주시길 바랍니다. ({0}) ]", e.Message)
                }));
            }
            catch (OverFortyFiveServiceException e)
            {
                return(Json(new
                {
                    Result = false,
                    Message = e.Message
                }));
            }
            catch (Exception e)
            {
                logger.Error(e);

                return(Json(new
                {
                    Result = false,
                    Message = "서비스 점검중입니다. 잠시 후 시도해보시거나, 담당자에게 문의하시기 바랍니다."
                }));
            }
        }
Example #8
0
        public ActionResult CompleteFcSharingKMC(ResponseKMCModel model)
        {
            if (IsEventClose())
            {
                throw new EventServiceException("400", "이벤트가 종료되었습니다.", null);
            }
            try
            {
                var result = kmcService.ResponseKMC(model);
                var entry  = new FinancialConsultantSharingKMCResultModel
                {
                    Name   = string.IsNullOrEmpty(result.Data.M_Name) ? result.Data.Name : result.Data.M_Name,
                    Gender = string.IsNullOrEmpty(result.Data.M_Gender) ? result.Data.Gender : result.Data.M_Gender,
                    Mobile = string.IsNullOrEmpty(result.Data.PhoneNo) ? result.Data.PhoneNo : result.Data.PhoneNo,
                    Birth  = string.IsNullOrEmpty(result.Data.BirthDay) ? result.Data.BirthDay : result.Data.BirthDay,
                };

                //요청을 어떤 uri로 주었냐에 따라 구분
                if (result.Data.PlusInfo == "origin")
                {
                    //중복 참여 확인 - true
                    if (!financialConsultantSharingService.depulicateOriginCustomer(entry.Mobile))
                    {
                        throw new EventServiceException("400", "이미 참여하셨습니다.", entry.Mobile);
                    }
                    ;

                    //신규 가입여부 확인
                    if (financialConsultantSharingService.existNewCustomer(entry.Mobile) != null)
                    {
                        throw new EventServiceException("400", "신규가입고객은 참여를 하실 수 없습니다.", null);
                    }

                    Session.Add("FcOriginCustomerInfo", entry.Name + "^" + entry.Mobile + "^" + entry.Gender + "^" + entry.Birth);
                }
                else if (result.Data.PlusInfo == "new")
                {
                    //중복 참여 확인 - true
                    if (!financialConsultantSharingService.depulicateNewCustomer(entry.Mobile))
                    {
                        throw new EventServiceException("400", "이미 참여하셨습니다.", entry.Mobile);
                    }
                    ;

                    //기존 가입여부 확인
                    if (!financialConsultantSharingService.depulicateOriginCustomer(entry.Mobile))
                    {
                        throw new EventServiceException("400", "기존 가입고객은 신규가입을 하실 수 없습니다.", entry.Mobile);
                    }

                    Session.Add("FcNewCustomerInfo", entry.Name + "^" + entry.Mobile + "^" + entry.Gender + "^" + entry.Birth);
                }

                return(Json(new
                {
                    Result = "200",
                    Message = "본인인증이 완료되었습니다.",
                    Data = entry
                }));
            }
            catch (KMCServiceException e)
            {
                logger.Debug(">>>>>>>>>>> Response KMC Service");
                logger.Debug("/////////// message:{0}, data:{1}", e.Message, e.Data);
                return(Json(new
                {
                    Result = false,
                    Message = string.Format("본인인증 실패되었습니다. [ 본인인증을 다시 해주시길 바랍니다. ({0}) ]", e.Message)
                }));
            }
            catch (EventServiceException e)
            {
                return(Json(new
                {
                    Result = false,
                    Message = e.Message
                }));
            }
            catch (Exception e)
            {
                logger.Error(e);
                return(Json(new
                {
                    Result = false,
                    Message = "서비스 점검중입니다. 잠시 후 시도해보시거나, 담당자에게 문의하시기 바랍니다."
                }));
            }
        }
Example #9
0
        /// <summary>
        /// KMC 본인인증서비스 Response
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ResultMessage ResponseKMC(ResponseKMCModel model)
        {
            //parameter 수신
            var iv = model.CertNum;  // certNum값을 복호화키에 세팅

            //01. 1차 복호화
            ICERTSECURITYLib.SEED dec = new ICERTSECURITYLib.SEED();
            var rec_cert = dec.IcertSeedDecript(model.Rec_Cert, iv);

            //02. 복호화 데이터 Split (rec_cert 1차암호화데이터 / 위변조 검증값 / 암복화확장변수)
            var decStr_Split = rec_cert.Split('/');
            var encPara      = decStr_Split[0]; // rec_cert 1차 암호화데이터
            var encMsg       = decStr_Split[1]; // 위변조검증값

            //03.위변조 검증값 생성
            ICERTSECURITYLib.AES hash = new ICERTSECURITYLib.AES();
            var hashStr = hash.IcertHMacEncript(encPara);
            var msgChk  = "";

            //04. 위변조 검증
            if (hashStr == encMsg)
            {
                msgChk = "T";
            }
            var result = new ResultKMCModel();

            if (msgChk == "T")   // 위변조가 정상일때 2차 복호화
            {
                rec_cert     = dec.IcertSeedDecript(encPara, iv);
                decStr_Split = rec_cert.Split('/');
                result       = new ResultKMCModel {
                    CertNum    = decStr_Split[0],
                    Date       = decStr_Split[1],
                    CI         = decStr_Split[2],
                    PhoneNo    = decStr_Split[3],
                    PhoneCorp  = decStr_Split[4],
                    BirthDay   = decStr_Split[5],
                    Gender     = decStr_Split[6],
                    Nation     = decStr_Split[7],
                    Name       = decStr_Split[8],
                    Result     = decStr_Split[9],
                    CertMet    = decStr_Split[10],
                    Ip         = decStr_Split[11],
                    M_Name     = decStr_Split[12],
                    M_BirthDay = decStr_Split[13],
                    M_Gender   = decStr_Split[14],
                    M_Nation   = decStr_Split[15],
                    PlusInfo   = decStr_Split[16],
                    DI         = decStr_Split[17]
                };
            }

            // 파라미터 형식 검증 -------------------------------------------------------
            if (result.CertNum.Length == 0 || result.CertNum.Length > 40)
            {
                throw new KMCServiceException("400", "요청번호 비정상", result.CertNum);
            }
            if (result.Date.Length == 0 || !new Regex("^[0-9]*$").IsMatch(result.Date))
            {
                throw new KMCServiceException("400", "요청일시 비정상", result.Date);
            }

            if (result.CertMet.Length == 0 || !new Regex("^[A-Z]*$").IsMatch(result.CertMet))
            {
                throw new KMCServiceException("400", "본인인증방법 비정상", result.CertMet);
            }

            if (result.Name.Length == 60 || !new Regex("^[\\s가-힣a-zA-Z-,.]*$").IsMatch(result.Name))
            {
                throw new KMCServiceException("400", "성명정보 비정상", result.Name);
            }

            if (result.PhoneNo.Length == 0 || !new Regex("^[0-9]*$").IsMatch(result.PhoneNo))
            {
                throw new KMCServiceException("400", "휴대폰번호 비정상", result.PhoneNo);
            }

            if (result.PhoneCorp.Length == 0 || !new Regex("^[A-Z]*$").IsMatch(result.PhoneCorp))
            {
                throw new KMCServiceException("400", "이동통신사 비정상", result.PhoneCorp);
            }

            if (result.BirthDay.Length == 0 || !new Regex("^[0-9]*$").IsMatch(result.BirthDay))
            {
                throw new KMCServiceException("400", "생년월일 비정상", result.BirthDay);
            }

            if (result.Gender.Length == 0 || !new Regex("^[0-9]*$").IsMatch(result.Gender))
            {
                throw new KMCServiceException("400", "성별 비정상", result.Gender);
            }

            if (result.Nation.Length == 0 || !new Regex("^[0-9]*$").IsMatch(result.Nation))
            {
                throw new KMCServiceException("400", "내외국인 비정상", result.Nation);
            }

            if (result.Result.Length == 0 || !new Regex("^[A-Z]*$").IsMatch(result.Result))
            {
                throw new KMCServiceException("400", "결과 비정상", result.Result);
            }

            if (!string.IsNullOrEmpty(result.M_Name) && (result.M_Name.Length == 60 || !new Regex("^[\\s가-힣a-zA-Z-,.]*$").IsMatch(result.M_Name)))
            {
                throw new KMCServiceException("400", "미성년자 성명정보 비정상", result.M_Name);
            }

            if (!string.IsNullOrEmpty(result.M_BirthDay) && (result.M_BirthDay.Length == 0 || !new Regex("^[0-9]*$").IsMatch(result.M_BirthDay)))
            {
                throw new KMCServiceException("400", "미성년자 생년월일 비정상", result.M_BirthDay);
            }

            if (!string.IsNullOrEmpty(result.M_Gender) && (result.M_Gender.Length == 0 || !new Regex("^[0-9]*$").IsMatch(result.M_Gender)))
            {
                throw new KMCServiceException("400", "미성년자 성별 비정상", result.M_Gender);
            }

            if (!string.IsNullOrEmpty(result.M_Nation) && (result.M_Nation.Length == 0 || !new Regex("^[0-9]*$").IsMatch(result.M_Nation)))
            {
                throw new KMCServiceException("400", "미성년자 내외국인 비정상", result.M_Nation);
            }
            // End - 파라미터 형식 검증 -------------------------------------------------------

            //05. CI, DI 복호화
            if (string.IsNullOrEmpty(result.CI) || string.IsNullOrEmpty(result.DI))
            {
                throw new KMCServiceException("400", "복호화 실패", result);
            }
            result.DescriptCI = dec.IcertSeedDecript(result.CI, iv);
            result.DescriptDI = dec.IcertSeedDecript(result.DI, iv);
            return(new ResultMessage {
                Result = true,
                Message = "본인인증 완료되었습니다.",
                Data = result
            });
        }
Example #10
0
        public ActionResult ResponseTumblerEventAgreeKMC(ResponseKMCModel model)
        {
            try
            {
                //response kmc
                var responseKmc = kmcService.ResponseKMC(model);
                if (tumblerService.CheckEntry(responseKmc.Data.Name.Trim().ToLower(), responseKmc.Data.PhoneNo.Trim(), responseKmc.Data.Gender, responseKmc.Data.BirthDay) != null)
                {
                    throw new EventServiceException("400", "이미 참여하셨습니다.", null);
                }
                var tumblerEntry = new TumblerEventEntry();
                tumblerEntry = new TumblerEventEntry
                {
                    Name     = string.IsNullOrEmpty(responseKmc.Data.M_Name) ? responseKmc.Data.Name : responseKmc.Data.M_Name,
                    Gender   = string.IsNullOrEmpty(responseKmc.Data.M_Gender) ? responseKmc.Data.Gender : responseKmc.Data.M_Gender,
                    Mobile   = responseKmc.Data.PhoneNo,
                    BirthDay = string.IsNullOrEmpty(responseKmc.Data.M_BirthDay) ? responseKmc.Data.BirthDay : responseKmc.Data.M_BirthDay,
                };

                Session["MARKETING_AGREE_NAME"]     = tumblerEntry.Name;
                Session["MARKETING_AGREE_GENDER"]   = tumblerEntry.Gender;
                Session["MARKETING_AGREE_MOBILE"]   = tumblerEntry.Mobile;
                Session["MARKETING_AGREE_BRITHDAY"] = tumblerEntry.BirthDay;

                var responseData = mapperConfig.CreateMapper().Map <TumblerCreateModel>(tumblerEntry);

                return(Json(new
                {
                    Result = responseKmc.Result,
                    Message = responseKmc.Message,
                    EventType = responseKmc.Data.PlusInfo,
                    Data = responseData
                }));
            }
            catch (KMCServiceException e)
            {
                logger.Info(">>>>>>>> 텀블러이벤트 KMC Service Exception");
                logger.Debug("/////////// message:{0}, data:{1}", e.Message, e.Data);

                return(Json(new
                {
                    Result = false,
                    Message = string.Format("본인인증 실패되었습니다. [ 본인인증을 다시 해주시길 바랍니다. ({0}) ]", e.Message)
                }));
            }
            catch (EventServiceException e)
            {
                return(Json(new
                {
                    Result = false,
                    Message = e.Message
                }));
            }
            catch (Exception e)
            {
                logger.Info(">>>>>>>> 텀블러이벤트 Exception");
                logger.Debug("/////////// message:{0}, data:{1}", e.Message, e.Data);

                return(Json(new
                {
                    Result = false,
                    Message = "서비스 점검중입니다. 잠시 후 시도해보시거나, 담당자에게 문의하시기 바랍니다."
                }));
            }
        }