예제 #1
0
        public ActionResult PaymentProcess(FormCollection collection)
        {
            PaymentProcessBiz biz = new PaymentProcessBiz();
            PaymentValuesModel model = new PaymentValuesModel();

            // 주문 파라메터 set
            Dictionary<string, string> paramCollection = collection.AllKeys.ToDictionary(k => k, v => collection[v]);

            model.PaymentRequestInfo = biz.ConvertRequestInfo(paramCollection);

            model.PaymentRequestInfo.RemoteAddress = Request.UserHostAddress;
            model.PaymentRequestInfo.ServerIPAddress = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName()).AddressList[0].ToString();

            // 주문
            PaymentResultT result;
            try
            {
                result = biz.Payment(model.PaymentRequestInfo);
            }
            catch (PaymentProcessBizException pEx)
            {
                result = new PaymentResultT();
                result.Result = new GEPBaseResultT { RetCode = pEx.ErrorCode, RetMessage = pEx.Message };
            }
            catch (Exception ex)
            {
                result = new PaymentResultT();
                result.Result = new GEPBaseResultT { RetCode = -9900, RetMessage = ex.Message };
            }

            // 결과는?
            if (result.Result.RetCode != 0)
            {
                return RedirectToAction("PaymentFail",
                    new
                    {
                        Code = result.Result.RetCode
                    }
                );
            }

            ViewBag.Result = result.Result;
            ViewBag.OrderResultList = result.OrderResultList;

            ViewBag.ParamCollection = paramCollection;

            PaymentContractInfoSummaryT summary = biz.GetContractInfoSummary(result.OrderResultList[0].PackNo, result.PaymentRequestInfo.ItemCount
                                , result.OrderParam.AcntType, paramCollection["TotalPrice"], paramCollection["TotalDeliveryFee"], paramCollection["TotalCostPrice"]);

            return RedirectToAction("PaymentComplete", summary);
        }
예제 #2
0
        /// <summary>
        /// GEP 주문
        /// </summary>
        /// <param name="paymentRequestInfo"></param>
        /// <returns></returns>
        public PaymentResultT Payment(PaymentRequestInfoT paymentRequestInfo)
        {
            #region 내부 변수

            PaymentRequestInfoT requestInfo = paymentRequestInfo;
            PaymentRequestInfoT orgRequestInfo = paymentRequestInfo;

            PaymentBiz paymentBiz = new PaymentBiz();

            PaymentResultT paymentResult = new PaymentResultT();
            paymentResult.Result = new GEPBaseResultT();

            //string oType = "N";
            int packNo = 0;

            #endregion

            #region 주문 파라메터 체크

            try
            {
                ValidateRequestInfo(paymentRequestInfo);
            }
            catch
            {
                throw new PaymentProcessBizException(-1101, "주문 정보가 올바르지 않습니다. 확인후 다시 주문해 주시기 바랍니다.");
            }

            #endregion

            #region 파라메터 초기화

            try
            {
                requestInfo = InitPaymentRequestInfo(requestInfo);
            }
            catch (PaymentProcessBizException pEx)
            {
                new PaymentErrorWriter().SendPaymentError(paymentRequestInfo, PaymentConstant.CONST_GMKT_FRONT_ORDER_ORDER_ERROR_TXT, pEx.ErrorCode, pEx.Message, "NT");
                throw pEx;
            }
            catch (Exception ex)
            {
                throw new PaymentProcessBizException(-1170, ex.Message);
                //throw new PaymentProcessBizException(-1170, "접수중에 문제가 발생하여 결제가 이루어지지 않았습니다. 확인후 다시 주문해 주시기 바랍니다.");
            }

            #endregion

            #region Policy 입력

            try
            {
                PaymentOrderItemT paymentOrderItem = new PaymentPolicyInfo().SetPaymentOrderItem(orgRequestInfo, requestInfo);

                requestInfo.OrderNo = paymentOrderItem.OrderNo;
                packNo = paymentOrderItem.PolicyInfoList[0].PackNo;
            }
            catch (PaymentProcessBizException pEx)
            {
                new PaymentErrorWriter().SendPaymentError(paymentRequestInfo, PaymentConstant.CONST_GMKT_FRONT_ORDER_ORDER_ERROR_TXT, pEx.ErrorCode, pEx.Message, "NT");
                throw pEx;
            }
            catch
            {
                throw new PaymentProcessBizException(-1171, "접수중에 문제가 발생하여 결제가 이루어지지 않았습니다. 확인후 다시 주문해 주시기 바랍니다");
            }

            #endregion

            #region 주문!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

            PaymentGEPPaymentProcessResultT paymentProcessResult = new PaymentGEPPaymentProcessResultT();
            try
            {
                PaymentOrderMultiParamT orderParam = PaymentProcessHelper.ConvertRequestInfo2OrderParam(requestInfo);

                // 추가 내용
                orderParam.PackNo = packNo;

                paymentProcessResult = new PaymentProcessQuery().GEPOrderDomesticMulti(orderParam);

                paymentResult.OrderParam = orderParam;

                // convert : 여기까지가 line 2194

                if (paymentProcessResult.Result.RetCode != 0)
                {
                    paymentResult.Result = paymentProcessResult.Result;

                    return paymentResult;
                }

                // fix : 아래는 임시임
                paymentResult.OrderResultList.AddRange(paymentProcessResult.OrderResultList);
                // 임시 끝
            }
            catch (PaymentProcessBizException pEx)
            {
                new PaymentErrorWriter().SendPaymentError(paymentRequestInfo, PaymentConstant.CONST_GMKT_FRONT_ORDER_ORDER_ERROR_TXT, pEx.ErrorCode, pEx.Message, "NT");
                throw pEx;
            }
            catch
            {
                throw new PaymentProcessBizException(-1172, "접수중에 문제가 발생하여 결제가 이루어지지 않았습니다. 확인후 다시 주문해 주시기 바랍니다");
            }
            #endregion

            #region 주문 후 뒷처리

            // fix : [skip] 프로모션 상품 처리
            // convert : 여기까지가 line 2273

            try
            {
                PaymentProcessFollowUp(paymentProcessResult, requestInfo);
            }
            catch (PaymentProcessBizException pEx)
            {
                new PaymentErrorWriter().SendPaymentError(paymentRequestInfo, PaymentConstant.CONST_GMKT_FRONT_ORDER_ORDER_ERROR_TXT, pEx.ErrorCode, pEx.Message, "NT");
                throw pEx;
            }
            catch (Exception ex)
            {
                throw new PaymentProcessBizException(-1173, ex.Message);
                //throw new PaymentProcessBizException(-1173, "접수중에 문제가 발생하여 결제가 이루어지지 않았습니다. 확인후 다시 주문해 주시기 바랍니다");
            }

            #endregion

            //////////////////////////////
            paymentResult.PaymentRequestInfo = requestInfo;

            return paymentResult;
        }