示例#1
0
        public eBayResultT InserteBayOrder(eBayOrderT ebayOrderT)
        {
            eBayResultT resultT = null;

            try
            {
                long gepOrderNo = -1;

                // 결제 대기 상품은 GEP_ORDER 에 Insert 하지 않음
                if (ebayOrderT.PaymentStatus == EBayPaymentStatusEnum.Paid)
                {
                    gepOrderNo = InsertOrderInfoToGEP(ebayOrderT);
                }

                eBayOrderInfoT ebayOrderInfoT = GeteBayOrderInfo(ebayOrderT.TransactionId, ebayOrderT.ItemId);

                if (ebayOrderInfoT != null)
                {
                    //같은 주문에 대해 다시 요청 이 온 경우
                    //주문 정보 update
                    resultT = new eBayResultT();
                    resultT.RetCode = RetCodeEnum.True;
                    resultT.RetMessage = "Update : " + ebayOrderT.ToString();

                    IMongoQuery query = Query.And(Query.EQ("Order.TransactionId", ebayOrderT.TransactionId),Query.EQ("Order.ItemId",ebayOrderT.ItemId));
                    IMongoUpdate update = Update.Set("GEPOrderNo", BsonValue.Create(gepOrderNo))
                                                .SetWrapped<eBayOrderT>("Order", ebayOrderT)
                                                .Set("UpdateDt", BsonValue.Create(DateTime.Now))
                                                .SetWrapped<eBayResultT>("ReturnMsg", resultT);

                    new eBayOrderDac().UpdateBayOrderInfo(query, update);
                }
                else
                {
                    // 신규 주문 insert
                    ebayOrderInfoT = new eBayOrderInfoT();
                    ebayOrderInfoT.GEPOrderNo = gepOrderNo;
                    ebayOrderInfoT.Order = ebayOrderT;
                    ebayOrderInfoT.Item = GetOrderdItem(ebayOrderT);
                    ebayOrderInfoT.Status = GepOrderStatus.Conclusion;
                    ebayOrderInfoT.ReturnMsg = new eBayResultT();
                    ebayOrderInfoT.CreateDt  = DateTime.Now;
                    ebayOrderInfoT.ReturnMsg.RetCode = RetCodeEnum.True;
                    ebayOrderInfoT.ReturnMsg.RetMessage = "Insert : " + ebayOrderInfoT.Order.ToString();

                    new eBayOrderDac().InserteBayOrderInfo(ebayOrderInfoT);

                    resultT = ebayOrderInfoT.ReturnMsg;
                }
            }
            catch (Exception ex)
            {
                resultT = new eBayResultT();
                resultT.RetCode = RetCodeEnum.False;
                resultT.RetMessage = "Fail : " + ex.ToString();

                throw ex;
            }
            finally
            {
                eBayHistoryT history = new eBayHistoryT();
                history.ReceiveMsg = ebayOrderT;
                history.ReturnMsg = resultT;
                history.CreateDt = DateTime.Now;

                new eBayOrderDac().InserteBayHistory(history);
            }

            return resultT;
        }
示例#2
0
        public eBayResultT insertCancel(eBayCancelT ebayCancelT)
        {
            eBayResultT resultT = null;

            try
            {
                eBayOrderInfoT ebayOrderInfoT = GeteBayOrderInfo(ebayCancelT.Order.TransactionId, ebayCancelT.Order.ItemId);

                if (ebayOrderInfoT == null)
                {
                    throw new GEPBizException(-1002, string.Format("eBay TransactionID : {0} , ItemID : {1} 주문이 없습니다.", ebayCancelT.Order.TransactionId, ebayCancelT.Order.ItemId));
                }

                eBayCancelT existCancleT = GeteBayCancelInfo(ebayCancelT.Order.TransactionId, ebayCancelT.Order.ItemId);

                if (existCancleT != null)
                {
                    // 취소/반품 진행 상태 변경
                    resultT = new eBayResultT();
                    resultT.RetCode = RetCodeEnum.True;
                    resultT.RetMessage = "Update : " + ebayCancelT.ToString();

                    IMongoQuery query = Query.And(Query.EQ("Order.TransactionId", ebayCancelT.Order.TransactionId), Query.EQ("Order.ItemId", ebayCancelT.Order.ItemId));
                    IMongoUpdate update = Update.Set("Status", BsonValue.Create(EnumHelper.GetDBCode(ebayCancelT.Status).ToString()))
                                                .Set("DisputeModifiedTime", BsonValue.Create(ebayCancelT.DisputeModifiedTime))
                                                .Set("UpdateDt", BsonValue.Create(DateTime.Now))
                                                .SetWrapped<eBayResultT>("ReturnMsg", resultT);

                    new eBayOrderDac().UpdateeBayCancel(query, update);

                    if (ebayOrderInfoT.Order.PaymentStatus == EBayPaymentStatusEnum.Paid)
                    {
                        // gep_cancle_list 취소/반품 진행 상태 변경
                        new GEPOrderBiz().UpdateGEPCancelStatus(ebayCancelT.Order.TransactionId.ToString(), ebayCancelT.Order.ItemId.ToString(), ebayCancelT.Status, ebayCancelT.DisputeModifiedTime.Value);
                    }
                }
                else
                {
                    // 취소/반품 최초 등록
                    ebayCancelT.Order = ebayOrderInfoT.Order;
                    ebayCancelT.Item = ebayOrderInfoT.Item;
                    ebayCancelT.CreateDt = DateTime.Now;

                    ebayCancelT.ReturnMsg = new eBayResultT();
                    ebayCancelT.ReturnMsg.RetCode = RetCodeEnum.True;
                    ebayCancelT.ReturnMsg.RetMessage = "Update : " + ebayCancelT.ToString();

                    resultT = ebayCancelT.ReturnMsg;

                    new eBayOrderDac().InserteBayCancel(ebayCancelT);

                    //eBay_order_list 에 취소/반품 상태 변경
                    IMongoQuery query = Query.And(Query.EQ("Order.TransactionId", ebayCancelT.Order.TransactionId), Query.EQ("Order.ItemId", ebayCancelT.Order.ItemId));
                    IMongoUpdate update = Update.Set("Status", BsonValue.Create(EnumHelper.GetDBCode(GepOrderStatus.Cancel).ToString()))
                                                .Set("UpdateDt", BsonValue.Create(DateTime.Now));

                    new eBayOrderDac().UpdateBayOrderInfo(query, update);

                    if (ebayOrderInfoT.Order.PaymentStatus == EBayPaymentStatusEnum.Paid)
                    {
                        // 결제 완료 상태일 경우
                        // GEP_ORDER에 취소/반품 상태 변경
                        new GEPOrderBiz().UpdateGEPOrderStatus(ebayCancelT.Order.TransactionId.ToString(), ebayCancelT.Order.ItemId.ToString(), GepOrderStatus.Cancel);

                        // GEP_CANCEL에 취소/반품 추가
                        GEPOrderInfoT gepOrderInfoT = new GEPOrderBiz().GetGEPOrderInfo(ebayCancelT.Order.TransactionId.ToString(), ebayCancelT.Order.ItemId.ToString());
                        GEPCancelInfoT gepCancelInfoT = new GEPCancelInfoT();
                        gepCancelInfoT.ExportSite = GetExportSiteInfo();
                        gepCancelInfoT.ExportSiteCancel = ebayCancelT;
                        gepCancelInfoT.GEPCancel = ConvertToGEPCancel(ebayCancelT);
                        gepCancelInfoT.GEPOrder = gepOrderInfoT.GEPOrder;
                        gepCancelInfoT.GEPOrderNo = gepOrderInfoT.GEPOrderNo;
                        gepCancelInfoT.GMKTOrder = gepOrderInfoT.GMKTOrder;
                        gepCancelInfoT.Item = gepOrderInfoT.Item;
                        gepCancelInfoT.TaId = gepOrderInfoT.TaId;
                        gepCancelInfoT.CreateDt = DateTime.Now;

                        new GEPOrderBiz().InsertGEPCancel(gepCancelInfoT);
                    }
                }
            }
            catch (Exception ex)
            {
                resultT = new eBayResultT();
                resultT.RetCode = RetCodeEnum.False;
                resultT.RetMessage = "Fail : " + ex.ToString();

                throw ex;
            }
            finally
            {
                eBayHistoryT history = new eBayHistoryT();
                history.ReceiveMsg = ebayCancelT;
                history.ReturnMsg = resultT;
                history.CreateDt = DateTime.Now;

                new eBayOrderDac().InserteBayHistory(history);
            }

            return resultT;
        }