Esempio n. 1
0
        public JsonResult CreateFcNewEntry(FinancialConsultantSharingNewModels model)
        {
            if (IsEventClose())
            {
                throw new EventServiceException("400", "이벤트가 종료되었습니다.", null);
            }

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

            try
            {
                //신규회원 2000명 제한 추가
                if (!financialConsultantSharingService.limitNewCustomer())
                {
                    throw new EventServiceException("400", "준비된 경품이 모두 소진되었습니다.", null);
                }

                var entry = mapperConfig.CreateMapper().Map <FinancialConsultantNewCustomerEntry>(model.FinancialConsultantSharingNewCreateModel);

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

                //중복 참여 확인 - true
                if (!financialConsultantSharingService.depulicateNewCustomer(entry.Mobile))
                {
                    throw new EventServiceException("400", "이미 참여하셨습니다.", entry.Mobile);
                }
                ;

                //fc 코드 다시 확인
                financialConsultantSharingService.isExistFC(model.FinancialConsultantSharingNewCreateModel.FcCode);


                //본인인증 결과 확인
                var authSession         = Session["FcNewCustomerInfo"] as string;
                var authOriginEntryInfo = string.IsNullOrEmpty(authSession);
                if (authOriginEntryInfo || !authSession.Contains("^"))
                {
                    throw new EventServiceException("400", "본인 인증을 다시 받아주세요.[1]", null);
                }
                else
                {
                    string[] autoInfo = authSession.Split('^');
                    if (autoInfo[0] != model.FinancialConsultantSharingNewCreateModel.Name ||
                        autoInfo[1] != model.FinancialConsultantSharingNewCreateModel.Mobile ||
                        autoInfo[3] != model.FinancialConsultantSharingNewCreateModel.BirthDay)
                    {
                        throw new EventServiceException("400", "본인 인증을 다시 받아주세요.[2]", null);
                    }
                }


                entry.Channel    = common.IsMobileDevice ? Domain.Entities.Abstract.ChannelType.Mobile : Domain.Entities.Abstract.ChannelType.PC;
                entry.IpAddress  = common.IpAddress;
                entry.CreateDate = common.Now;
                var authInfo = Session["AuthInfo"] as string;
                var randFlag = string.IsNullOrEmpty(authInfo);
                if (!randFlag || authInfo.Contains("^"))
                {
                    string[] infos = authInfo.Split('^');
                    entry.OriginCustomerRandomNum = infos[0];
                    entry.ProposerName            = infos[1];
                }
                else
                {
                    throw new EventServiceException("400", "공유 URL 인증 시간이 만료되었습니다.\r\n다시 공유받은 링크로 접속바랍니다.", null);
                }


                //데이터 저장
                entry = financialConsultantSharingService.saveNewEntry(entry);

                //문자발송
                var message = string.Format("안녕하세요, 고객님 {0}년 {1}월 {2}일에 \r\n오렌지라이프생명보험㈜ 에\r\n‘상품의 소개 등을 위한 개인(신용)정보 처리 동의‘(마케팅 동의)가 정상 반영되어 안내 드립니다.\r\n준법감시인심의필 제\r\n2016-0444호(2016.10.13)", common.Now.Year, common.Now.Month, common.Now.Day);
                if (kmcState.Equals("local"))
                {
                    // 로컬, 테스트서버 제외
                    entry.IsMessage = true;
                }
                else
                {
                    if (smsService.SendMMS("", entry.Mobile, "0222008606", message, "L"))
                    {
                        //문자완료 플레그 업데이트
                        entry.IsMessage = true;
                    }
                    else
                    {
                        //실패시 플레그 실패 업데이트
                        entry.IsMessage = false;
                        //프로세스는 계속 진행
                    };
                }

                //메세지 flag update
                financialConsultantSharingService.updateNewEntry(entry);

                //본인인증 세션 지우기
                Session.Remove("FcNewCustomerInfo");
                Session.Remove("AuthInfo");

                result.Result  = true;
                result.Message = "이벤트 응모가 완료되었습니다.";
            }
            catch (EventServiceException e)
            {
                result.Result  = false;
                result.Message = e.Message;
            }
            catch (Exception e)
            {
                logger.Info(">>>>>>>> FC SHARING EVENT ENTRY SAVE (call FinancialConsultantOriginalCustomerEntry) Exception");
                logger.Debug("/////////// message:{0}, data:{1}", e.Message, e.Data);
            }
            return(Json(result));
        }
Esempio n. 2
0
        // GET: fc
        public ActionResult NewCustomerIndex(FCNewAuthModel fCNewAuthModel)
        {
            if (IsEventClose())
            {
                ViewBag.IsClose = true;
                ViewBag.Message = "이벤트가 종료되었습니다.";
                return(View(new FinancialConsultantSharingNewModels
                {
                    RequestKMCModel = new RequestKMCModel()
                }));
            }

            var urlCode = "";
            var trUrl   = "";
            var domain  = "";

            switch (kmcState)
            {
            case "local":
            default:
                urlCode = "004012";
                domain  = "http://test.www.orange-event.kr";
                trUrl   = "http://dev.www.orange-event.kr/fc-sharing-new/callback";
                break;

            case "debug":
                urlCode = "003018";
                domain  = "http://test.www.orange-event.kr";
                //본인인증 모듈 로드시에 익스플로러 안열리는 현상이 있음.
                trUrl = "http://test.www.orange-event.kr/fc-sharing-new/callback";
                break;

            //TODO: 실서버 적용시 urlCode,trUrl 실서버용으로 변경
            case "release":
                urlCode = "002010";
                domain  = "https://www.orange-event.kr";
                trUrl   = "https://www.orange-event.kr/fc-sharing-new/callback";
                break;
            }

            ViewBag.url   = domain + "/fc-sharing-new";
            ViewBag.image = domain + "/Content/images/FcEvent/sns/kakao.jpg";

            var model = new FinancialConsultantSharingNewModels();

            //존재하는 기존고객인지 확인
            var originCustomer = financialConsultantSharingService.existOriginCustomer(new FinancialConsultantOriginalCustomerEntry()
            {
                FcCode            = fCNewAuthModel.fc,
                CustomerRandomNum = fCNewAuthModel.rid
            });

            //기존고객이 존재하면
            if (originCustomer != null)
            {
                var date     = common.Now.ToString("yyyyMMddHHmmss");
                var kmcModel = kmcService.RequestKMC(date, urlCode, trUrl);
                kmcModel.PlusInfo = "new";
                model             = new FinancialConsultantSharingNewModels
                {
                    RequestKMCModel = kmcModel
                };

                ViewBag.IsClose = false;
                ViewBag.FCCode  = fCNewAuthModel.fc;
                ViewBag.RId     = maskingName(originCustomer.Name);
                if (!financialConsultantSharingService.limitNewCustomer())
                {
                    ViewBag.IsClose = true;
                    ViewBag.Message = "준비된 경품이 모두 소진되었습니다.";
                }
                Session.Add("AuthInfo", fCNewAuthModel.rid + "^" + originCustomer.Name);
                return(View(model));
            }
            else
            {
                ViewBag.IsClose = true;
                ViewBag.Message = "카카오톡 공유 메세지로 접속해주세요.";
                return(View());
            }
        }