private eBayOrderT GetSampleOrderT(string[] sample, int idx) { eBayOrderT ebayOrderT = new eBayOrderT(); ebayOrderT.SiteId = Util.GetSafeInt(sample[0]); ebayOrderT.TransactionId = ((Util.GetSafeLong(sample[1]) > 0) ? Util.GetSafeLong(sample[1]) +idx : 0).ToString(); ebayOrderT.ItemId = sample[3]; ebayOrderT.OrderCnt = Util.GetSafeInt(sample[4]); ebayOrderT.ListingType = (EBayListingTypeEnum)Enum.Parse(typeof(EBayListingTypeEnum), sample[5]); ebayOrderT.OrderPrice = sample[6]; ebayOrderT.Currency = sample[7]; ebayOrderT.DeliveryFee = sample[8]; ebayOrderT.DeliveryFeeCurrency = sample[9]; ebayOrderT.DeliveryCountryCode = sample[10]; ebayOrderT.DeliveryCountryName = sample[11]; ebayOrderT.PaymentStatus = (EBayPaymentStatusEnum)Enum.Parse(typeof(EBayPaymentStatusEnum), sample[12]); ebayOrderT.BuyerId = sample[13]; ebayOrderT.BuyerName = sample[14]; ebayOrderT.BuyerTel = sample[15]; ebayOrderT.BuyerFeedbackScore = int.Parse(sample[16]); ebayOrderT.SellerId = sample[17]; ebayOrderT.TransportWay = sample[18]; ebayOrderT.ReceiverName = sample[19]; ebayOrderT.ReceiverTel = sample[20]; ebayOrderT.ReceiverEmail = sample[21]; ebayOrderT.ReceiverZipCode = sample[22]; ebayOrderT.ReceiverAddress = sample[23]; ebayOrderT.ReceiverState = ""; ebayOrderT.ReceiverCity = ""; ebayOrderT.ReceiverStreet1 = ""; ebayOrderT.ReceiverStreet2 = ""; ebayOrderT.OrderDt = DateTime.Parse(sample[24]); ebayOrderT.ViewItemUrl = sample[26]; if (ebayOrderT.PaymentStatus == EBayPaymentStatusEnum.Paid) { ebayOrderT.OrderId = ((Util.GetSafeLong(sample[2]) > 0) ? Util.GetSafeLong(sample[2]) + idx : 0).ToString(); if (sample[25] == "") { ebayOrderT.PaymentDt = DateTime.Now; } else { ebayOrderT.PaymentDt = DateTime.Parse(sample[25]); } } return ebayOrderT; }
private long InsertOrderInfoToGEP(eBayOrderT ebayOrderT) { GEPOrderInfoT gepOrderInfoT = new GEPOrderBiz().GetGEPOrderInfo(ebayOrderT.TransactionId.ToString(), ebayOrderT.ItemId.ToString()); if (gepOrderInfoT != null) { //같은 주문에 대해 다시 요청 이 온 경우 //주문 정보 update gepOrderInfoT.ExportSiteOrder = ebayOrderT; gepOrderInfoT.GEPOrder = ConvertToGEPOrder(ebayOrderT); gepOrderInfoT.UpdateDt = DateTime.Now; new GEPOrderBiz().UpdateGEPOrderInfo(gepOrderInfoT); } else { //신규 주문 Insert gepOrderInfoT = new GEPOrderInfoT(); gepOrderInfoT.ExportSite = GetExportSiteInfo(); gepOrderInfoT.ExportSiteOrder = ebayOrderT; gepOrderInfoT.ExportSiteTrans = GetExportSiteTrans(ebayOrderT); gepOrderInfoT.Item = GetOrderdItem(ebayOrderT); gepOrderInfoT.GEPOrder = ConvertToGEPOrder(ebayOrderT); gepOrderInfoT.GMKTOrder = GetGMKTOrder(); // TODO: (이태희) "eBay" 하드코딩? gepOrderInfoT.TaId = new CommonBiz().GetTaId(ebayOrderT.SellerId, "eBay"); gepOrderInfoT.CreateDt = DateTime.Now; new GEPOrderBiz().InsertGEPOrderInfo(gepOrderInfoT); } return gepOrderInfoT.GEPOrderNo; }
private OrderedItemT GetOrderdItem(eBayOrderT ebayOrder) { eBayItemsData eBayItem = new eBayItemBiz().GeteBayItem(ebayOrder.ItemId); if (eBayItem == null) { throw new GEPBizException(-1001, string.Format("eBay ItemID : {0} 상품이 없습니다.", ebayOrder.ItemId)); } //주문된 Item 정보 조회 & 셋팅 OrderedItemT item = new OrderedItemT(); item.gep_id = eBayItem.gep_id; item.src_no = eBayItem.gep_info.src_no; item.cln_itemno = eBayItem.cln_itemno; item.ExportItemId = ebayOrder.ItemId; item.ExportItemName = eBayItem.dynamicData.Title; item.src_name = eBayItem.gep_info.src_name; item.GSellerName = eBayItem.gep_info.src_seller.name; item.GSellerTel = eBayItem.gep_info.src_seller.tel; if(ebayOrder.ListingType == EBayListingTypeEnum.FixedPriceItem){ item.ItemPrice = eBayItem.dynamicData.StartPrice.ToString(); } else if(ebayOrder.ListingType == EBayListingTypeEnum.FixedPriceItem){ item.ItemPrice = eBayItem.dynamicData.BuyItNowPrice.ToString(); } item.ExportSiteImgUrl = eBayItem.img; item.gep_img = eBayItem.gep_info.img; item.OptionInfo = new ItemOptionT(); item.OptionInfo.OptNo = eBayItem.cln_selno; item.OptionInfo.OptInfo = eBayItem.gep_info.sel_name; item.DispatchTimeMax = eBayItem.dynamicData.DispatchTimeMax; item.ExportSiteViewItemUrl = ebayOrder.ViewItemUrl; return item; }
private ExportSiteTransInfo GetExportSiteTrans(eBayOrderT ebayOrderT) { ExportSiteTransInfo e = new ExportSiteTransInfo(); e.sender_name = ""; e.sender_zip_code = ""; e.sender_addr = ""; e.sender_tel_no = ""; e.sender_hp_no = ""; e.sender_email = ""; e.sender_iso_country_code = ""; e.sender_country_name = ""; e.sender_country_code = ""; //국가 전화번호 //받는사람 e.receiver_name = ebayOrderT.ReceiverName; e.receiver_zip_code = ebayOrderT.ReceiverZipCode; e.receiver_addr = ebayOrderT.ReceiverAddress; e.receiver_state = ebayOrderT.ReceiverState; e.receiver_city = ebayOrderT.ReceiverCity; e.receiver_street1 = ebayOrderT.ReceiverStreet1; e.receiver_street2 = ebayOrderT.ReceiverStreet2; e.receiver_tel_no = ebayOrderT.ReceiverTel; e.receiver_hp_no = ebayOrderT.ReceiverTel; e.receiver_email = ebayOrderT.ReceiverEmail; e.receiver_iso_country_code = ebayOrderT.DeliveryCountryCode; e.receiver_country_name = ebayOrderT.DeliveryCountryName; e.receiver_country_code = ebayOrderT.DeliveryCountryCode; e.trans_way = ebayOrderT.TransportWay; return e; }
private GEPOrderT ConvertToGEPOrder(eBayOrderT ebayOrderT) { GEPOrderT gepOrderT = new GEPOrderT(); gepOrderT.OrderNo = ebayOrderT.TransactionId.ToString(); gepOrderT.OrderNoSub = ebayOrderT.ItemId.ToString(); gepOrderT.DeliveryFee = ebayOrderT.DeliveryFee; gepOrderT.OrderCnt = ebayOrderT.OrderCnt; gepOrderT.OrderPrice = ebayOrderT.OrderPrice; gepOrderT.Currency = ebayOrderT.Currency; gepOrderT.OrderDt = ebayOrderT.OrderDt; gepOrderT.PaymentDt = ebayOrderT.PaymentDt.Value; gepOrderT.BuyerName = ebayOrderT.BuyerName; gepOrderT.Status = GepOrderStatus.Conclusion; return gepOrderT; }
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; }