// http://developer.ebay.com/devzone/xml/docs/reference/ebay/getuser.html public UserType GetUser(string userid = null) { GetUserCall apicall = new GetUserCall(api); apicall.UserID = userid; return(apicall.GetUser()); }
/// <summary> /// Gets the user data. /// </summary> /// <param name="token">The token.</param> /// <returns></returns> public Task <UserType> GetUserData(string token) { var getUserCall = new GetUserCall(GetContext(token)); var getUserRequestType = new GetUserRequestType(); getUserRequestType.IncludeExpressRequirements = true; getUserRequestType.IncludeExpressRequirementsSpecified = true; getUserRequestType.IncludeFeatureEligibility = true; getUserRequestType.IncludeFeatureEligibilitySpecified = true; getUserCall.ApiRequest = getUserRequestType; return(Task.Run(() => getUserCall.GetUser())); }
public void GetUser() { GetUserCall api = new GetUserCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); UserType user = api.GetUser(); Assert.IsNotNull(user.Email); Assert.IsNotNull(user.EIASToken); userType = user; }
private void BtnGetUser_Click(object sender, System.EventArgs e) { try { TxtUserIdRet.Text = ""; TxtEmail.Text = ""; TxtFeedBackScore.Text = ""; TxtRegDate.Text = ""; TxtSellerLevel.Text = ""; TxtSite.Text = ""; TxtStar.Text = ""; TxtStoreUrl.Text = ""; TxtNew.Text = ""; TxtVerified.Text = ""; TxtChanged.Text = ""; GetUserCall apicall = new GetUserCall(Context); if (TxtUserId.Text != String.Empty) { apicall.UserID = TxtUserId.Text; } if (TxtItemId.Text != String.Empty) { apicall.ItemID = TxtItemId.Text; } UserType user = apicall.GetUser(); TxtUserIdRet.Text = user.UserID; TxtEmail.Text = user.Email; TxtFeedBackScore.Text = user.FeedbackScore.ToString(); TxtRegDate.Text = user.RegistrationDate.ToString(); TxtSellerLevel.Text = user.SellerInfo.SellerLevel.ToString(); TxtSite.Text = user.Site.ToString(); TxtStar.Text = user.FeedbackRatingStar.ToString(); TxtStoreUrl.Text = user.SellerInfo.StoreURL; TxtNew.Text = user.NewUser.ToString(); TxtVerified.Text = user.IDVerified.ToString(); TxtChanged.Text = user.UserIDLastChanged.ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void GetMessagePreferences() { GetUserCall userApi = new GetUserCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; userApi.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); UserType user = userApi.GetUser(); Assert.IsNotNull(user.Email); Assert.IsNotNull(user.EIASToken); GetMessagePreferencesCall api = new GetMessagePreferencesCall(this.apiContext); api.Site = SiteCodeType.US; // ASQPreferencesType resp = api.GetMessagePreferences(user.UserID, true); Assert.IsNotNull(resp); Console.WriteLine("T_100_GetMessagesPreferencesLibrary: " + resp.ToString()); }
public static List <EbayTransactionType> GetAllOrders(AccountType account, TimeFilter timeFilter, StringCollection orderIds) { List <EbayTransactionType> transList = new List <EbayTransactionType>(); GetOrdersCall getOrdersApiCall = new GetOrdersCall(account.SellerApiContext); getOrdersApiCall.IncludeFinalValueFee = true; DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; getOrdersApiCall.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); if (orderIds != null) { getOrdersApiCall.OrderIDList = orderIds; } try { OrderTypeCollection orders = getOrdersApiCall.GetOrders(timeFilter, TradingRoleCodeType.Seller, OrderStatusCodeType.All); foreach (OrderType order in orders) { AddressType addressType = order.ShippingAddress; String shippingAddress = GetShippingAddressString(addressType); String shippingAddressCompact = GetShippingAddressCompactString(addressType); bool completed = order.OrderStatus == OrderStatusCodeType.Completed; foreach (TransactionType trans in order.TransactionArray) { #region Process each ebay transaction // Check if this transaction has already be recorded in system. String transId = trans.TransactionID; if (transId == null || transId == "") { Logger.WriteSystemLog("GetAllOrders: Invalid transaction id, skip and continue."); continue; } EbayTransactionType ebayTrans = new EbayTransactionType(); ebayTrans.SellerName = account.ebayAccount; ebayTrans.OrderId = order.OrderID; ebayTrans.OrderLineItemId = trans.OrderLineItemID; ebayTrans.EbayTransactionId = trans.TransactionID; ebayTrans.EbayRecordId = order.ShippingDetails.SellingManagerSalesRecordNumberSpecified ? order.ShippingDetails.SellingManagerSalesRecordNumber : -1; ebayTrans.BuyerId = order.BuyerUserID; GetUserCall getUserApiCall = new GetUserCall(account.SellerApiContext); getUserApiCall.UserID = order.BuyerUserID; UserType user = getUserApiCall.GetUser(); // BuyerRating if (user.FeedbackScoreSpecified) { ebayTrans.BuyerRating = user.FeedbackScore; } else { ebayTrans.BuyerRating = -1; } // BuyerCountryEbayCode ebayTrans.BuyerCountryEbayCode = addressType.Country.ToString(); // BuyerCountry4PXCode ebayTrans.BuyerCountry4PXCode = ""; // BuyerCountry ebayTrans.BuyerCountry = addressType.CountryName; // BuyerCompanyName ebayTrans.BuyerCompanyName = StringUtil.GetSafeString(addressType.CompanyName); // BuyerName ebayTrans.BuyerName = addressType.Name; // BuyerStateOrProvince ebayTrans.BuyerStateOrProvince = addressType.StateOrProvince; // BuyerCity ebayTrans.BuyerCity = addressType.CityName; // BuyerTel ebayTrans.BuyerTel = addressType.Phone; // BuyerMail ebayTrans.BuyerMail = trans.Buyer.Email; // BuyerPostalCode ebayTrans.BuyerPostalCode = addressType.PostalCode; // BuyerAddress ebayTrans.BuyerAddress = shippingAddress; // BuyerAddressCompact ebayTrans.BuyerAddressCompact = shippingAddressCompact; // BuyerAddressLine1 ebayTrans.BuyerAddressLine1 = addressType.Street1; // BuyerAddressLine2 ebayTrans.BuyerAddressLine2 = addressType.Street2; // BuyerPayPal ebayTrans.BuyerPayPal = trans.Buyer.Email; // ItemId ebayTrans.ItemId = trans.Item.ItemID; // What is the valid way to determine if there is a variation. if (trans.Variation != null && trans.Variation.VariationTitle != null && trans.Variation.VariationTitle.Trim() != "") { // ItemTitle ebayTrans.ItemTitle = trans.Variation.VariationTitle; // ItemSKU ebayTrans.ItemSKU = trans.Variation.SKU; } else { // ItemTitle ebayTrans.ItemTitle = trans.Item.Title; // ItemSKU ebayTrans.ItemSKU = trans.Item.SKU; } // ItemPrice if (trans.TransactionPrice != null) { ebayTrans.ItemPrice = trans.TransactionPrice.Value; } // SaleQuantity ebayTrans.SaleQuantity = trans.QuantityPurchased; if (trans.TransactionPrice != null) { // SalePrice ebayTrans.SalePrice = trans.TransactionPrice.Value * trans.QuantityPurchased; // TotalPrice ebayTrans.TotalPrice = trans.TransactionPrice.Value * trans.QuantityPurchased; } // TODO: there may be multiple transactions in one order. if (order.Total != null) { ebayTrans.TotalPrice = order.Total.Value; ebayTrans.CurrencyId = order.Total.currencyID.ToString(); } else { // Set a default value. ebayTrans.TotalPrice = 0.0; ebayTrans.CurrencyId = ""; } // SaleDate ebayTrans.SaleDate = order.CreatedTime; // SaleDateCN ebayTrans.SaleDateCN = order.CreatedTime.ToLocalTime(); // IsPaid ebayTrans.IsPaid = order.PaidTimeSpecified; // order.AmountPaid // order.CheckoutStatus // ebayPaymentStatus // Status // orderStatus if (ebayTrans.IsPaid == false) { // Some payment is paid using credit card, and while PayPal is processing the payment, // the transaction is marked as unpaid. we should view it as paid. if (order.OrderStatusSpecified && order.OrderStatus == OrderStatusCodeType.Completed) { ebayTrans.IsPaid = true; } } if (ebayTrans.IsPaid == false) { if (order.CheckoutStatus.StatusSpecified && order.CheckoutStatus.Status == CompleteStatusCodeType.Complete) { ebayTrans.IsPaid = true; } } // PaidDate ebayTrans.PaidDate = StringUtil.GetSafeDateTime(order.PaidTime); // IsShipped ebayTrans.IsShipped = order.ShippedTimeSpecified; if (order.ShippedTimeSpecified) { ebayTrans.ShippedDate = StringUtil.GetSafeDateTime(order.ShippedTime); } else { ebayTrans.ShippedDate = DateTime.Now.AddYears(-10); } // Store the shippedDate as the local date time. ebayTrans.ShippedDate = ebayTrans.ShippedDate.ToLocalTime(); // ShippingServiceCode ebayTrans.ShippingServiceCode = ""; // ShippingService ebayTrans.ShippingService = ""; // ShippingTrackingNo ebayTrans.ShippingTrackingNo = ""; // ShippingCost ebayTrans.ShippingCost = 0.0; // FinalValueFee if (trans.FinalValueFee != null) { ebayTrans.FinalValueFee = trans.FinalValueFee.Value; } else { ebayTrans.FinalValueFee = 0.0; } // PayPalFee ebayTrans.PayPalFee = 0.034 * ebayTrans.TotalPrice + 0.3; // IsReceived ebayTrans.IsReceived = false; ebayTrans.IsBuyerLeftFeedback = false; ebayTrans.IsSellerLeftFeedback = false; ebayTrans.IsNeedAttention = false; ebayTrans.MessageStatus = TransactionMessageStatus.NoMessage; ebayTrans.IsContactedBuyer = false; ebayTrans.LastContactedBuyerDate = DateTime.Now.AddYears(-10); ebayTrans.IsResendReplacement = false; ebayTrans.UserComment = ""; GetFeedbackCall getFeedbackApiCall = new GetFeedbackCall(account.SellerApiContext); //DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; getFeedbackApiCall.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); getFeedbackApiCall.OrderLineItemID = trans.OrderLineItemID; FeedbackDetailTypeCollection feedbacks = getFeedbackApiCall.GetFeedback(); foreach (FeedbackDetailType feedback in feedbacks) { if (feedback.CommentingUser == account.ebayAccount) { ebayTrans.IsSellerLeftFeedback = true; } if (feedback.CommentingUser == ebayTrans.BuyerId) { ebayTrans.IsBuyerLeftFeedback = true; } } if (trans.ShippingDetails != null) { if (trans.ShippingDetails.ShipmentTrackingDetails.Count == 1) { ShipmentTrackingDetailsType shipmentDetails = trans.ShippingDetails.ShipmentTrackingDetails[0]; ebayTrans.ShippingTrackingNo = shipmentDetails.ShipmentTrackingNumber; } } transList.Add(ebayTrans); #endregion } } } catch (Exception ex) { Logger.WriteSystemLog(string.Format("Unexpected expection : {0}", ex.Message)); } return(transList); } // GetAllOrders