public bool GetMarketplaceUserPreference() { // create and init the API Context var context = new ApiContext(); context.ApiCredential = RequestHelper.ApiCredential; context.SoapApiServerUrl = RequestHelper.ServiceUrl; try { // create the preference feed var preferenceType = new GetUserPreferencesRequestType { ShowOutOfStockControlPreference = true, ShowSellerPaymentPreferences = true, }; var apiCall = new GetUserPreferencesCall(context); var response = apiCall.ExecuteRequest(preferenceType); if (response.Ack == AckCodeType.Success) { return(true); } // log the error _logger.LogError(LogEntryType.eBayProductProvider, string.Format("{0} - Error in getting user preference - Message: {1}", ChannelName, response.Errors[0].LongMessage), string.Join(",", response.Errors[0].ErrorParameters)); return(false); } catch (Exception ex) { _logger.LogError(LogEntryType.eBayProductProvider, string.Format("Unexpected error in getting user preference\". Err Message: {0}", EisHelper.GetExceptionMessage(ex)), ex.StackTrace); return(false); } }
public void GetUserPreferences() { GetUserPreferencesCall api = new GetUserPreferencesCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); api.ShowBidderNoticePreferences = true; api.ShowCombinedPaymentPreferences = true; api.ShowCrossPromotionPreferences = true; api.ShowEndOfAuctionEmailPreferences = true; api.ShowSellerFavoriteItemPreferences = true; api.ShowSellerPaymentPreferences = true; // Make API call. api.Execute(); Assert.IsNotNull(api.ApiResponse.BidderNoticePreferences); Assert.IsNotNull(api.ApiResponse.CombinedPaymentPreferences); Assert.IsNotNull(api.ApiResponse.CrossPromotionPreferences); Assert.IsNotNull(api.ApiResponse.EndOfAuctionEmailPreferences); Assert.IsNotNull(api.ApiResponse.SellerPaymentPreferences); Assert.IsNotNull(api.ApiResponse.SellerPaymentPreferences); TestData.UserPreferencesResponse = (GetUserPreferencesResponseType)api.ApiResponse; }