예제 #1
0
        public void PaymentProcess()
        {
            PaymentRequestInfoT paymentParam = GetpaymentParam();

            PaymentProcessBiz biz = new PaymentProcessBiz();

            PaymentResultT result = biz.Payment(paymentParam);

            Trace.DumpBusinessEntity(result);
        }
예제 #2
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);
        }