Esempio n. 1
0
        public ContrDetailValueT MakeContrInfo(ContrBasicInfoT reqContrBasicInfo, ContrDetailValueT contrValue)
        {
            ContrDetailValueT rtnContrDetailValue = new ContrDetailValueT();
            PaypalMoneyT paypalMoney = new PaypalMoneyT();
            rtnContrDetailValue = contrValue;
            string payType = string.Empty;
            string foreignMoney = string.Empty, currency = string.Empty;

            if (reqContrBasicInfo.CashpayWay != "E" && reqContrBasicInfo.AcntWay.ToUpper() != "AD")
            {
                //컬럼명 정의
                if (reqContrBasicInfo.SttlWay == "현금")
                {
                    if (reqContrBasicInfo.CashpayWay == "F" || reqContrBasicInfo.CashpayWay == "P")
                    {
                        if (reqContrBasicInfo.SttlName == "Paypal ExpCheckout")
                        {
                            payType = "paypal";
                        }
                    }
                    else
                    {
                        payType = "cash";
                        if (reqContrBasicInfo.StatInfo == "입금대기" && reqContrBasicInfo.FinalDeposit != string.Empty)
                        {
                            payType = "undepositedCash";
                        }
                    }
                }
                else
                {
                    payType = "card";
                }

                rtnContrDetailValue.PayType = payType;
                //컬럼값
                if (reqContrBasicInfo.SttlWay == "현금")
                {
                    if (reqContrBasicInfo.StatInfo == "입금대기")
                    {
                        if (reqContrBasicInfo.CashpayWay == "F" || reqContrBasicInfo.CashpayWay == "P")
                        {
                            paypalMoney = GetPaypalMoney(reqContrBasicInfo.PackNo);
                            if (paypalMoney != null)
                            {
                                currency = paypalMoney.Currency;

                                if (currency == "USD")
                                {
                                    foreignMoney = paypalMoney.ForeignMoney.ToString("C", CultureInfo.CreateSpecificCulture("en-US"));
                                }
                                else if (currency == "JPY")
                                {
                                    foreignMoney = paypalMoney.ForeignMoney.ToString("C", CultureInfo.CreateSpecificCulture("ja-JP"));
                                }
                                rtnContrDetailValue.DepositNm = reqContrBasicInfo.DepositName;
                                rtnContrDetailValue.ForeignInfo = foreignMoney;
                            }
                        }
                        else
                        {
                            rtnContrDetailValue.SttlName = reqContrBasicInfo.SttlName;
                            rtnContrDetailValue.DepositNm = reqContrBasicInfo.DepositName;
                            rtnContrDetailValue.SttlNo = reqContrBasicInfo.SttlNo;
                            rtnContrDetailValue.FinalDeposit = reqContrBasicInfo.FinalDeposit;
                        }
                    }
                    else
                    {
                        if (reqContrBasicInfo.CashpayWay == "F" || reqContrBasicInfo.CashpayWay == "P")
                        {
                            paypalMoney = GetPaypalMoney(reqContrBasicInfo.PackNo);
                            if (paypalMoney != null)
                            {
                                currency = paypalMoney.Currency;

                                if (currency == "USD")
                                {
                                    foreignMoney = paypalMoney.ForeignMoney.ToString("C", CultureInfo.CreateSpecificCulture("en-US"));
                                }
                                else if (currency == "JPY")
                                {
                                    foreignMoney = paypalMoney.ForeignMoney.ToString("C", CultureInfo.CreateSpecificCulture("ja-JP"));
                                }
                                rtnContrDetailValue.ForeignInfo = foreignMoney;
                            }
                        }
                        rtnContrDetailValue.SttlName = reqContrBasicInfo.SttlName;
                        rtnContrDetailValue.DepositNm = reqContrBasicInfo.DepositName;
                        rtnContrDetailValue.SttlNo = reqContrBasicInfo.SttlNo;
                        if (reqContrBasicInfo.StatInfo == "입금대기" && reqContrBasicInfo.FinalDeposit != string.Empty)
                        {
                            rtnContrDetailValue.FinalDeposit = reqContrBasicInfo.FinalDeposit;
                        }
                    }
                }
                else
                {
                    rtnContrDetailValue.SttlWay = reqContrBasicInfo.SttlWay;
                    rtnContrDetailValue.SttlName = reqContrBasicInfo.SttlName;
                    rtnContrDetailValue.SttlNo = reqContrBasicInfo.SttlNo;
                    rtnContrDetailValue.CardAcptDt = reqContrBasicInfo.CardAcptDt;
                }
            }

            return rtnContrDetailValue;
        }
Esempio n. 2
0
        public OrderDetailT MakeOrderDetailList(int packNo, string custNo)
        {
            List<OrderDetailInfoT> orderDetailList = new List<OrderDetailInfoT>();
            OrderDetailT orderDetail = new OrderDetailT();
            ContrDetailValueT contrDetailValue = new ContrDetailValueT();
            ContrBasicInfoT contrBasicInfo = new ContrBasicInfoT();
            List<GepOrderNoT> gepOrderNoList = new List<GepOrderNoT>();
            Dictionary<long, long> GepOrderNos = new Dictionary<long, long>();
            long gepOrderNo;

            decimal totalPayMoney = 0, totalOriginPayMoney = 0, totalItemPrice = 0, totalDeliveryFee = 0;
            int orderCnt = 0;
            DateTime finalDepositDt;
            string tmpContrDt = string.Empty;
            string orderNos = string.Empty;

            orderDetailList = GetGmarketOrderDetailInfo(packNo, custNo);

            for (int j = 0, orderNosCnt = orderDetailList.Count; j < orderNosCnt; j++)
            {
                if (j == 0)
                {
                    orderNos = orderDetailList[j].BuyOrderNo.ToString();
                }
                else
                {
                    orderNos = orderNos + "," + orderDetailList[j].BuyOrderNo.ToString();
                }
            }

            gepOrderNoList = GetGepOrderNo(orderNos);
            for (int k = 0, gepOrderNoListCnt = gepOrderNoList.Count; k < gepOrderNoListCnt; k++)
            {
                GepOrderNos.Add((int)gepOrderNoList[k].OrderNo, gepOrderNoList[k].GepOrderNo);
            }

            for (int i = 0, orderDetailListCnt = orderDetailList.Count; i < orderDetailListCnt; i++)
            {
                OrderDetailValueT detailValue = new OrderDetailValueT();
                GEPOrderInfoT gepOrderInfo = new GEPOrderInfoT();
                DomesticDeliveryStatusParamT domDelStatusParam = new DomesticDeliveryStatusParamT();
                DomesticDeliveryStatusT rtnDelStatus = new DomesticDeliveryStatusT();
                SellerInfoT sellerInfo = new SellerInfoT();
                GepOrderNoT resultGepOrderNo = new GepOrderNoT();

                TransportCommonBiz transBiz = new TransportCommonBiz();
                DeliveryTracking overseaDeliveryTracking = new DeliveryTracking();

                sellerInfo = GetSellerInfo(orderDetailList[i].ChgSellCustNo, "y");
                if (GepOrderNos.TryGetValue(orderDetailList[i].BuyOrderNo, out gepOrderNo))
                {
                    //몽고디비에서 GEP Order 정보 가져오는 부분
                    gepOrderInfo = GetGEPOrderInfo(gepOrderNo);
                }
                else
                {
                    gepOrderInfo = null;
                }

                //해외배송 정보 가져오는 부분
                overseaDeliveryTracking = transBiz.GetDeliveryTracking(orderDetailList[i].ContrNo);

                if (orderDetailList != null)
                {
                    detailValue.ListNo = i;
                    detailValue.ContrNo = orderDetailList[i].ContrNo;
                    detailValue.CloneItemNo = orderDetailList[i].ItemNo;
                    detailValue.CloneItemName = orderDetailList[i].ItemName;
                    detailValue.ContrAmt = orderDetailList[i].ContrAmt;
                    detailValue.ItemPrice = orderDetailList[i].ContrPrice;
                    detailValue.TotalPrice = orderDetailList[i].ContrPrice * orderDetailList[i].ContrAmt + orderDetailList[i].TotSelItemPrice;
                    detailValue.DeliveryFee = orderDetailList[i].DeliveryFee;
                    detailValue.CustKey = CustNoEncode(orderDetailList[i].ChgSellCustNo);
                    detailValue.SellerId = sellerInfo.Nickname;
                    detailValue.SellerPhone = sellerInfo.HelpdeskTelNo;
                    detailValue.SellerEmail = sellerInfo.EMail;

                    detailValue.SelOptInfo = MakeOrderSelOptInfo(orderDetailList[i].ItemNo, orderDetailList[i].OrderNo);

                    domDelStatusParam.StatInfo = orderDetailList[i].StatInfo;
                    domDelStatusParam.IsDeliveryGoodsYn = orderDetailList[i].IsDeliveryGoodsYn;
                    domDelStatusParam.TranscNm = orderDetailList[i].TakbaeName;
                    domDelStatusParam.InvoiceNo = orderDetailList[i].NoSongjang;
                    domDelStatusParam.GdShopkind = orderDetailList[i].GdShopkind;
                    domDelStatusParam.GdShopkind2 = orderDetailList[i].GdShopkind2;
                    domDelStatusParam.GdShopkind3 = orderDetailList[i].GdShopkind3;
                    domDelStatusParam.DelivLtpExtendDt = orderDetailList[i].DelivLtpExtendDt;
                    domDelStatusParam.DelivLtpStat = orderDetailList[i].DelivLtpStat;
                    domDelStatusParam.TransDate = orderDetailList[i].TransDt;
                    domDelStatusParam.SendPlanDt = orderDetailList[i].SendPlanDt.ToString();
                    domDelStatusParam.SendPlanRec = orderDetailList[i].SendPlanRec;
                    domDelStatusParam.ItemName = orderDetailList[i].ItemName;

                    rtnDelStatus = MakeDomesticDeliveryStatus(domDelStatusParam);
                    //detailValue.DomesticDeliveryStatus = rtnDelStatus.DeliveryStat;

                    if(orderDetailList[i].AcntStat != "SC" && orderDetailList[i].AcntStat != "SX" && orderDetailList[i].AcntStat != "SQ")
                    {
                        totalPayMoney = totalPayMoney + detailValue.TotalPrice + detailValue.DeliveryFee - orderDetailList[i].CostPrice;
                    }
                    totalOriginPayMoney = totalOriginPayMoney + detailValue.TotalPrice + detailValue.DeliveryFee - orderDetailList[i].CostPrice;
                    orderCnt = orderCnt + 1;
                    totalItemPrice = totalItemPrice + detailValue.ItemPrice;
                    totalDeliveryFee = totalDeliveryFee + detailValue.DeliveryFee;

                    if (gepOrderInfo != null)
                    {
                        detailValue.MotherItemNo = gepOrderInfo.Item.src_no;
                        detailValue.ExportSiteItemNo = gepOrderInfo.Item.ExportItemId;
                        detailValue.ExportSiteItemName = gepOrderInfo.Item.ExportItemName;
                        detailValue.ExportSiteName = gepOrderInfo.ExportSite.Name;
                        detailValue.OverseaDeliveryState = overseaDeliveryTracking.DeliveryState;
                        if (overseaDeliveryTracking.DeliveryWay == "PS")
                        {
                            detailValue.OverseaDeliveryWay = overseaDeliveryTracking.DeliveryWayKor;
                        }
                        else
                        {
                            detailValue.OverseaDeliveryWay = overseaDeliveryTracking.DeliveryWay;
                        }
                        detailValue.OverseaInvoiceNo = overseaDeliveryTracking.InvoiceNo;
                        detailValue.OverseaTrackingURL = overseaDeliveryTracking.TrackingURL;
                        if (gepOrderInfo.GEPOrder.OrderNo == "0")
                        {
                            detailValue.ExportSiteOrderNo = gepOrderInfo.GEPOrder.OrderNoSub;
                        }
                        else
                        {
                            detailValue.ExportSiteOrderNo = gepOrderInfo.GEPOrder.OrderNo;
                        }

                        detailValue.OverseaAddress = gepOrderInfo.ExportSiteTrans.receiver_addr;
                        detailValue.OverseaRcvNm = gepOrderInfo.ExportSiteTrans.receiver_name;
                        detailValue.OverseaPhone = gepOrderInfo.ExportSiteTrans.receiver_tel_no;
                        detailValue.OverseaEmail = gepOrderInfo.ExportSiteTrans.receiver_email;
                        detailValue.ViewItemURL = gepOrderInfo.Item.ExportSiteViewItemUrl;
                    }
                    orderDetail.DomesticDeliveryStatusList.Add(rtnDelStatus);
                    orderDetail.OrderDetailValueList.Add(detailValue);
                }
                else
                {
                    //아무 디비도 안 나옴
                }
            }
            //결제 정보
            contrDetailValue.ItemCnt = orderCnt;
            contrDetailValue.TotItemPrice = totalItemPrice;
            contrDetailValue.TotDeliveryFee = totalDeliveryFee;
            contrDetailValue.PackTotPayMoney = totalPayMoney;
            contrDetailValue.PackOriginTotPayMoney = totalOriginPayMoney;
            contrDetailValue.PackCancelTotPayMoney = totalOriginPayMoney - totalPayMoney;

            contrBasicInfo.AcntWay = orderDetailList[0].AcntWay;
            contrBasicInfo.CashpayWay = orderDetailList[0].CashpayWay;
            contrBasicInfo.StatInfo = orderDetailList[0].StatInfo;
            tmpContrDt = orderDetailList[0].ContrDt.Substring(0, 4) + "-" + orderDetailList[0].ContrDt.Substring(4, 2) + "-" + orderDetailList[0].ContrDt.Substring(6, 2);
            finalDepositDt = DateTime.Parse(tmpContrDt);
            contrBasicInfo.FinalDeposit = finalDepositDt.AddDays(7).ToString("yyyy-MM-dd");
            contrBasicInfo.PackNo = orderDetailList[0].PackNo;

            if (orderDetailList[0].AcntWay == "A2" || orderDetailList[0].AcntWay == "A7")
            {
                int sttlNoLenth = 0;
                int halbuMonth = orderDetailList[0].Halbumonth;
                contrBasicInfo.SttlName = orderDetailList[0].SttlkindNm;
                if (orderDetailList[0].CardNo != string.Empty)
                {
                    sttlNoLenth = orderDetailList[0].CardNo.Length;
                    contrBasicInfo.SttlNo = orderDetailList[0].CardNo.Substring(0, 8) + "****************";
                    contrBasicInfo.SttlNo = contrBasicInfo.SttlNo.Substring(0, sttlNoLenth);
                    contrBasicInfo.CardAcptDt = orderDetailList[0].AcptDt;
                }

                if (halbuMonth >= 60)
                {
                    halbuMonth = halbuMonth - 60;
                }
                else if (halbuMonth >= 40 && halbuMonth < 60 && halbuMonth != 41)
                {
                    halbuMonth = halbuMonth - 40;
                }

                if (halbuMonth == 0 || halbuMonth == 41)
                {
                    contrBasicInfo.SttlWay = "일시불";
                }
                else
                {
                    if (orderDetailList[0].HalbuType == "C" || orderDetailList[0].HalbuType == "F")
                    {
                        contrBasicInfo.SttlWay = halbuMonth + " 개월 무이자 할부";
                    }
                    else
                    {
                        contrBasicInfo.SttlWay = halbuMonth + " 개월 할부";
                    }
                }
            }
            else
            {
                contrBasicInfo.SttlName = orderDetailList[0].BankNm;
                contrBasicInfo.SttlNo = ShowVAccount(orderDetailList[0].BankAcntNo, orderDetailList[0].GbankNo);
                contrBasicInfo.DepositName = orderDetailList[0].DepositNm;
                contrBasicInfo.SttlWay = "현금";
            }

            contrDetailValue = MakeContrInfo(contrBasicInfo, contrDetailValue);

            orderDetail.ContrValue = contrDetailValue;

            return orderDetail;
        }