예제 #1
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 = "서비스 점검중입니다. 잠시 후 시도해보시거나, 담당자에게 문의하시기 바랍니다."
                }));
            }
        }
예제 #2
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);
        }
예제 #3
0
        public ActionResult CompleteRebrandingKMC(RebrandingResponseKMCModel model)
        {
            try {
                if (common.Now >= new DateTime(2018, 10, 22))
                {
                    throw new RebrandingEventServiceException("400", "이벤트가 종료되었습니다.", null);
                }
                var result = kmcService.ResponseKMC(model.ResponseKMCModel);
                var data   = new RebrandingViewModel {
                };
                if (model.RebrandingEventType == RebrandingEventType.MarketingAgree)
                {
                    if (service.IsRebrandingMarketingEntryLimit(2590))
                    {
                        throw new RebrandingEventServiceException("400", "선착순이 마감되었습니다.", null);
                    }
                    var entry = new RebrandingMarketingAgreeEntry {
                        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.CreateRebrandingMarketingAgreeEntry(entry);
                    data = mapperConfig.CreateMapper().Map <RebrandingViewModel>(resultModel);

                    Session.Add("RebrandingMarketingAgreeEntryId", resultModel.Id);
                }
                else if (model.RebrandingEventType == RebrandingEventType.ConsultingAgree)
                {
                    if (service.IsRebrandingConsultingEntryLimit(300))
                    {
                        throw new RebrandingEventServiceException("400", "선착순이 마감되었습니다.", null);
                    }
                    var entry = new RebrandingConsultingAgreeEntry {
                        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.CreateRebrandingConsultingAgreeEntry(entry);
                    data = mapperConfig.CreateMapper().Map <RebrandingViewModel>(resultModel);

                    Session.Add("RebrandingConsultingAgreeEntryId", 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 (RebrandingEventServiceException e) {
                return(Json(new {
                    Result = false,
                    Message = e.Message
                }));
            } catch (Exception e) {
                logger.Error(e);

                return(Json(new {
                    Result = false,
                    Message = "서비스 점검중입니다. 잠시 후 시도해보시거나, 담당자에게 문의하시기 바랍니다."
                }));
            }
        }
예제 #4
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 = "서비스 점검중입니다. 잠시 후 시도해보시거나, 담당자에게 문의하시기 바랍니다."
                }));
            }
        }
예제 #5
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 = "서비스 점검중입니다. 잠시 후 시도해보시거나, 담당자에게 문의하시기 바랍니다."
                }));
            }
        }
예제 #6
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 = "서비스 점검중입니다. 잠시 후 시도해보시거나, 담당자에게 문의하시기 바랍니다."
                }));
            }
        }