예제 #1
0
파일: CartTest.cs 프로젝트: tomochandv/Test
        public void BasketOriginVerificationTest(BasketInputParamT reqBasketInputParam)
        {
            CartBiz biz = new CartBiz();
            ValidCheckResultT originValidCheckResult = new ValidCheckResultT();
            originValidCheckResult.Result = new GEPBaseResultT();
            BasketParamT basket = new BasketParamT();
            basket.Pbid = "1AF6EDB9-DD31-4B64-BEAE-3AF9D28BC89A";
            basket.OrderIdxs = "1100066150|1100066152|1100066159|1100066161";

            originValidCheckResult = biz.OriginVerification(basket);
            Console.WriteLine("주문 Verification 결과 : " + originValidCheckResult.Result.RetCode);
            for (int i = 0, cnt = originValidCheckResult.ValidCheckList.Count; i < cnt; i++)
            {
                Console.WriteLine(originValidCheckResult.ValidCheckList[i].OrderIdx + "::" + originValidCheckResult.ValidCheckList[i].RetCode);
            }
        }
예제 #2
0
        public ActionResult BasketTest()
        {
            /*
            OriginCheckResult result = new OriginCheckResult();

            result.Result.RetCode = 0;
            result.Result.RetMessage = "성공";

            string orderIdx = Request.QueryString["orderIdx"];
            string[] orderIdxList = orderIdx.Split(new char[] { ',' });

            foreach (string idx in orderIdxList)
            {
                result.CheckResult.Add(new BasketValidCheck { OrderIdx = Convert.ToInt32(idx), RetCode = 0, RetMessage = "성공" });
            }
            */

            CartBiz biz = new CartBiz();
            ValidCheckResultT result = new ValidCheckResultT();
            result.Result = new GEPBaseResultT();
            BasketParamT basket = new BasketParamT();

            string orderIdx = Request.QueryString["orderIdx"];
            string pid = Request.QueryString["pId"];
            string cloneIds = Request.QueryString["cloneIds"];

            basket.Pbid = pid;
            basket.OrderIdxs = orderIdx;
            basket.GoodsCodes = cloneIds;

            result = biz.OriginVerification(basket);
            JsonpResult jsonResult = new JsonpResult
            {
                Data = new { Result = result.Result, Data = result.ValidCheckList },
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            };

            jsonResult.ContentEncoding = Encoding.GetEncoding("euc-kr");

            return jsonResult;
        }
예제 #3
0
파일: CartBiz.cs 프로젝트: tomochandv/Test
        //장바구니에 넣기 전 Verification
        public GEPBaseResultT BasketVerification(BasketParamT reqBasketParam)
        {
            GEPBaseResultT basketVerificationResult = new GEPBaseResultT();
            basketVerificationResult.RetCode = 0;

            //배송체크
            if (DeliveryVerification(reqBasketParam) != 0)
            {
                basketVerificationResult.RetCode = 202;
                basketVerificationResult.RetMessage = "다음 상품은 배송비 설정이 잘못 되었습니다.";
                return basketVerificationResult;
            }

            //재고체크
            InventoryCheckResultT inventoryVerificationResult = new InventoryCheckResultT();
            inventoryVerificationResult = InventoryVerification(reqBasketParam);
            if (inventoryVerificationResult.RetCode != 0)
            {
                basketVerificationResult.RetCode = 203;
                basketVerificationResult.RetMessage = "다음 상품은 "+ inventoryVerificationResult.RetMsg +" 상품입니다.";
                return basketVerificationResult;
            }

            //옵션체크
            SelectOptionInfoResultT selOptResult = new SelectOptionInfoResultT();
            selOptResult.Result = new GEPBaseResultT();
            selOptResult = OptionVerification(reqBasketParam);
            if (reqBasketParam.OptSelYn == "Y" || reqBasketParam.OptAddYn == "Y") //옵션이 있을 때
            {
                if (selOptResult.Result.RetCode != 0)
                {
                    basketVerificationResult.RetCode = 204;
                    basketVerificationResult.RetMessage = "다음 상품은 장바구니에 담을 수 없습니다." + selOptResult.Result.RetMessage;
                    return basketVerificationResult;
                }
            }

            if (reqBasketParam.InputWay == "C")
            {
                //Mother상품비교변경사항체크
                ValidCheckResultT oriCheckResult = new ValidCheckResultT();
                oriCheckResult.Result = new GEPBaseResultT();
                oriCheckResult = OriginVerification(reqBasketParam);
                if (oriCheckResult.Result.RetCode != 0)
                {
                    basketVerificationResult.RetCode = 204;
                    basketVerificationResult.RetMessage = "상품 정보가 변경되었습니다.";
                    return basketVerificationResult;
                }
            }

            if(basketVerificationResult.RetCode == 0){
                basketVerificationResult.RetMessage = "Verification Success!";
            }

            return basketVerificationResult;
        }
예제 #4
0
파일: CartBiz.cs 프로젝트: tomochandv/Test
        //장바구니에 넣은 후 - 주문하기 전 Verification
        public GEPBaseResultT PaymentVerification(BasketParamT reqBasketParam)
        {
            GEPBaseResultT PaymentVerificationResult = new GEPBaseResultT();
            PaymentVerificationResult.RetCode = 0;
            /* asp 페이지에서 함
            //재고체크
            InventoryCheckResultT inventoryVerificationResult = new InventoryCheckResultT();
            inventoryVerificationResult = InventoryVerification(reqBasketParam);
            if (inventoryVerificationResult.RetCode > 0)
            {
                basketVerificationResult.RetCode = 301;
                basketVerificationResult.RetMessage = "다음 상품은 " + inventoryVerificationResult.RetMsg + " 상품입니다.";
                return basketVerificationResult;
            }

            //옵션체크
            OptionValidCheckTResultT selOptResult = new OptionValidCheckTResultT();
            selOptResult.Result = new GEPBaseResultT();
            selOptResult = PaymentOptionVerification(reqBasketParam);
            if (reqBasketParam.OptSelYn == "Y" || reqBasketParam.OptAddYn == "Y") //옵션이 있을 때
            {
                if (selOptResult.Result.RetCode > 0)
                {
                    basketVerificationResult.RetCode = 302;
                    basketVerificationResult.RetMessage = "다음 상품은 장바구니에 담을 수 없습니다." + selOptResult.Result.RetMessage;
                    return basketVerificationResult;
                }
            }
            */
            //Mother상품비교변경사항체크
            if (reqBasketParam.InputWay == "C")
            {
                ValidCheckResultT oriCheckResult = new ValidCheckResultT();
                oriCheckResult.Result = new GEPBaseResultT();
                oriCheckResult = OriginVerification(reqBasketParam);
                if (oriCheckResult.Result.RetCode > 0)
                {
                    PaymentVerificationResult.RetCode = 301;
                    PaymentVerificationResult.RetMessage = "상품 정보가 변경되었습니다.";
                    return PaymentVerificationResult;
                }
            }

            return PaymentVerificationResult;
        }
예제 #5
0
파일: CartBiz.cs 프로젝트: tomochandv/Test
        //옵션체크(클론옵션과장바구니옵션비교)
        public ValidCheckResultT PaymentOptionVerification(BasketParamT reqBasketParam)
        {
            ValidCheckResultT paymentOptionVerificationResult = new ValidCheckResultT();
            paymentOptionVerificationResult.Result = new GEPBaseResultT();

            List<SelectOptionInfoT> lstSelOptInfo = new List<SelectOptionInfoT>();
            BasketGoodsBasicInfoT basketGoodsBasicInfo = new BasketGoodsBasicInfoT();
            List<GEPBasketOptionInfoT> lstGEPBasketOptionInfo = new List<GEPBasketOptionInfoT>();
            SelectOptionStatusT selectOptionStatus = new SelectOptionStatusT();
            string strOptionValidCheckResult = "OK";
            string strOrderIdxs = string.Empty;
            string[] arrGdNo, arrGdSelNo;
            string strXML = string.Empty;
            int err_count = 0;
            strOrderIdxs = reqBasketParam.OrderIdxs;
            if (strOrderIdxs.Substring(strOrderIdxs.Length - 1) != "|")
            {
                strOrderIdxs = strOrderIdxs + "|";
            }
            strOrderIdxs = strOrderIdxs.Replace("|", ",");
            //장바구니 내 정보 가져오기(덩어리)
            basketGoodsBasicInfo = GetBasketGoodsBasicInfo(reqBasketParam.Pbid, "N", strOrderIdxs);

            //장바구니 옵션 테이블에서 정보 가져와서 lstGEPBasketOptionInfo에 넣기
            if (strOrderIdxs.Length > 0)
            {
                arrGdNo = basketGoodsBasicInfo.ItemNo.Split(PaymentConstant.CommaSeperator);
                arrGdSelNo = basketGoodsBasicInfo.GdSelNo.Split(PaymentConstant.CommaSeperator);

                strXML = "<Data>";
                for (int i = 0, arrGdNoLenth = arrGdNo.Length; i < arrGdNoLenth; i++)
                {
                    if (arrGdNo[i] != string.Empty && arrGdSelNo[i] != string.Empty)
                    {
                        strXML = strXML + "<rows>";
                        strXML = strXML + "<iid>" + i + "</iid>";
                        strXML = strXML + "<gd_no>" + arrGdNo[i] + "</gd_no>";
                        strXML = strXML + "<gd_sel_no>" + arrGdSelNo[i] + "</gd_sel_no>";
                        strXML = strXML + "</rows>";
                    }
                }
                strXML = strXML + "</Data>";

                lstGEPBasketOptionInfo = GetGEPCartOptionInfo("B", reqBasketParam.Pbid, "N", "", "", strXML);

                string strOptValidationChk = string.Empty;
                for (int bIdx = 0, lstGEPBasketOptionInfoCnt = lstGEPBasketOptionInfo.Count; bIdx < lstGEPBasketOptionInfoCnt; bIdx++)
                {
                    if (!Validate.IsNull(lstGEPBasketOptionInfo[bIdx].OptNo))
                    {
                        selectOptionStatus = GetSelectOptionStatus(lstGEPBasketOptionInfo[bIdx].GdNo);
                        lstSelOptInfo = GetSelectOptionInfo(lstGEPBasketOptionInfo[bIdx].GdNo, "S");
                        for (int optIdx = 0, lstSelOptInfoCnt = lstSelOptInfo.Count; optIdx < lstSelOptInfoCnt; optIdx++)
                        {
                            strOptValidationChk = "N";
                            if (lstGEPBasketOptionInfo[bIdx].OptNo == lstSelOptInfo[optIdx].OptNo)
                            {
                                if (lstSelOptInfo[optIdx].OptStat == "N")
                                {
                                    strOptValidationChk = "O"; //품절
                                    continue;
                                }

                                if (lstSelOptInfo[optIdx].InfoType == "Y")
                                {
                                    if (lstGEPBasketOptionInfo[bIdx].OptOrderCnt > lstSelOptInfo[optIdx].InventoryCnt)
                                    {
                                        strOptValidationChk = "I"; //재고부족
                                        continue;
                                    }
                                }

                                if (lstGEPBasketOptionInfo[bIdx].VersionChgDt != lstSelOptInfo[optIdx].VersionChgDt)
                                {
                                    strOptValidationChk = "Y"; //정보변경
                                    continue;
                                }
                                strOptValidationChk = "F";

                                if (strOptValidationChk == "I" || strOptValidationChk == "O" || selectOptionStatus.SellingStat == 1)
                                {
                                    strOptionValidCheckResult = "IV";
                                }
                                else if (strOptValidationChk == "Y")
                                {
                                    if (lstGEPBasketOptionInfo[bIdx].SelName != lstSelOptInfo[optIdx].OptNm)
                                    {
                                        strOptionValidCheckResult = "NM";
                                    }
                                    else if (lstGEPBasketOptionInfo[bIdx].SelValue != lstSelOptInfo[optIdx].OptValue)
                                    {
                                        strOptionValidCheckResult = "VL";
                                    }
                                    else if (lstGEPBasketOptionInfo[bIdx].SelPrice != lstSelOptInfo[optIdx].OptPrice)
                                    {
                                        strOptionValidCheckResult = "PR";
                                    }
                                    else
                                    {
                                        strOptionValidCheckResult = "ET";
                                    }
                                }

                                if (strOptValidationChk != "N" && strOptValidationChk != "F")
                                {
                                    err_count = err_count + 1;
                                }
                                else
                                {
                                    strOptionValidCheckResult = "PS";
                                }
                                ValidCheckT optionVaildCheck = new ValidCheckT();
                                optionVaildCheck.OrderIdx = lstGEPBasketOptionInfo[bIdx].OrderIdx.ToString();
                                optionVaildCheck.RetCode = strOptionValidCheckResult;

                                paymentOptionVerificationResult.ValidCheckList.Add(optionVaildCheck);
                            }
                        }
                    }
                }
            }
            if (err_count > 0)
            {
                paymentOptionVerificationResult.Result.RetCode = -1;
            }
            else
            {
                paymentOptionVerificationResult.Result.RetCode = 0;
            }

            return paymentOptionVerificationResult;
        }
예제 #6
0
파일: CartBiz.cs 프로젝트: tomochandv/Test
        //Mother상품비교변경사항체크
        public ValidCheckResultT OriginVerification(BasketParamT reqBasketParam)
        {
            CommonBiz commonBiz = new CommonBiz();
            ValidCheckResultT originValidCheckResult = new ValidCheckResultT();
            GmarketVerifyDataClone gmktVerifyDataResult = new GmarketVerifyDataClone();
            originValidCheckResult.Result = new GEPBaseResultT();
            originValidCheckResult.Result.RetCode = 0;
            int errcnt = 0;

            string[] arrOrderIdx, arrCloneId;
            string strOrderIdxs = string.Empty;
            strOrderIdxs = reqBasketParam.OrderIdxs;
            string strCloneIds = reqBasketParam.GoodsCodes;
            if (strOrderIdxs != null)
            {
                if (strOrderIdxs.Substring(strOrderIdxs.Length - 1) != "|")
                {
                    strOrderIdxs = strOrderIdxs + "|";
                }
                strOrderIdxs = strOrderIdxs.Replace("|", ",");
                arrOrderIdx = strOrderIdxs.Split(PaymentConstant.CommaSeperator);

                arrCloneId = strCloneIds.Split(new char[] { ';' });

                //이 상태는 몽고 디비에 데이터가 없다는 거.
                //테스트를 위해 무조건 유효성검사성공임
                for (int i = 0, arrOrderIdxLenth = arrOrderIdx.Length; i < arrOrderIdxLenth; i++)
                {
                    if (arrOrderIdx[i] != string.Empty)
                    {
                        ValidCheckT originValidCheck = new ValidCheckT();
                        originValidCheck.OrderIdx = arrOrderIdx[i];

                        originValidCheck.RetCode = "S";
                        originValidCheck.RetMessage = "유효성검사성공";

                        originValidCheckResult.ValidCheckList.Add(originValidCheck);
                    }
                }

                /*
                for (int i = 0, arrOrderIdxLenth = arrOrderIdx.Length; i < arrOrderIdxLenth; i++)
                {
                    if (arrOrderIdx[i] != string.Empty && arrCloneId[i] != string.Empty)
                    {
                        ValidCheckT originValidCheck = new ValidCheckT();
                        originValidCheck.OrderIdx = arrOrderIdx[i];

                        gmktVerifyDataResult = commonBiz.GmarketVerifyCloneId(arrCloneId[i]);

                        if (gmktVerifyDataResult.Result == true)
                        {
                            originValidCheck.RetCode = "S";
                            originValidCheck.RetMessage = "유효성검사성공";
                        }
                        else
                        {
                            originValidCheck.RetCode = "F";
                            originValidCheck.RetMessage = "유효성검사실패";
                            errcnt = errcnt + 1;
                        }
                        originValidCheckResult.ValidCheckList.Add(originValidCheck);
                    }
                }
                */

                if (errcnt > 0)
                {
                    originValidCheckResult.Result.RetCode = -1;
                    originValidCheckResult.Result.RetMessage = "원상품유효성검사실패";
                }
                else
                {
                    originValidCheckResult.Result.RetCode = 0;
                    originValidCheckResult.Result.RetMessage = "원상품유효성검사성공";
                }
            }

            return originValidCheckResult;
        }