private void BtnAccountSettings_Click(object sender, EventArgs e) { ApiAccount form = new ApiAccount(); form.apiContext = apiContext; if (form.ShowDialog() == DialogResult.OK) apiContext = form.apiContext; }
public static ApiContext GetGenericApiContext(string site) { ApiContext apiContext = new ApiContext(); apiContext.Version = System.Configuration.ConfigurationManager.AppSettings.Get(VERSION); apiContext.Timeout = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings.Get(TIME_OUT)); apiContext.SoapApiServerUrl = System.Configuration.ConfigurationManager.AppSettings.Get(API_SERVER_URL); apiContext.EPSServerUrl = System.Configuration.ConfigurationManager.AppSettings.Get(EPS_SERVER_URL); apiContext.SignInUrl = System.Configuration.ConfigurationManager.AppSettings.Get(SIGNIN_URL); ApiAccount apiAccount = new ApiAccount(); apiAccount.Developer = System.Configuration.ConfigurationManager.AppSettings["Environment.DevId"]; apiAccount.Application = System.Configuration.ConfigurationManager.AppSettings["Environment.AppId"]; apiAccount.Certificate = System.Configuration.ConfigurationManager.AppSettings["Environment.CertId"]; ApiCredential apiCredential = new ApiCredential(); apiCredential.ApiAccount = apiAccount; apiContext.ApiCredential = apiCredential; apiContext.EnableMetrics = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings.Get(ENABLE_METRICS)); if (!string.IsNullOrEmpty(site)) { apiContext.Site = (SiteCodeType)Enum.Parse(typeof(SiteCodeType), site, true); } apiContext.RuleName = System.Configuration.ConfigurationManager.AppSettings["RuName"]; // EBayPriceChanges.Config.RuName; apiContext.RuName = System.Configuration.ConfigurationManager.AppSettings["RuName"]; // EBayPriceChanges.Config.RuName; return(apiContext); }
public static String getAuthenticateUrl(out String sessionId) { sessionId = ""; ApiAccount apiAccount = new ApiAccount(); apiAccount.Application = EbayAppId; apiAccount.Certificate = EbayCertId; apiAccount.Developer = EbayDevId; ApiContext localContext = new ApiContext(); localContext.ApiCredential = new eBay.Service.Core.Sdk.ApiCredential(); localContext.ApiCredential.ApiAccount = apiAccount; localContext.RuName = EbayRuName; localContext.SoapApiServerUrl = System.Configuration.ConfigurationManager.AppSettings.Get(AppSettingHelper.API_SERVER_URL); localContext.SignInUrl = System.Configuration.ConfigurationManager.AppSettings.Get(AppSettingHelper.SIGNIN_URL); GetSessionIDCall apiCall = new GetSessionIDCall(localContext); apiCall.RuName = EbayRuName; apiCall.Execute(); sessionId = apiCall.SessionID; String authUrl = String.Format("{0}&RuName={1}&SessID={2}", localContext.SignInUrl, EbayRuName, sessionId); return(authUrl); }
//20180803更新超时秘钥 public void resetetcode(string username, string eticket) { this._1context(); DateTime dts = DateTime.UtcNow; try { bool isNew = false; ApiAccount ApiAccountMS = isNew ? new ApiAccount() { } : _context.Set <ApiAccount>().SingleOrDefault(b => b.ApiAccountUserName == username); ApiAccountMS.ApiAccountRealPassWord = eticket; ApiAccountMS.ExpTime = Convert.ToDateTime(pbc.DecryptPassWord(eticket)); ApiAccountMS.LoginTime = Convert.ToDateTime(pbc.DecryptPassWord(eticket)); isNew = false; if (isNew) { _context.Add(ApiAccountMS); } _context.SaveChanges(); } catch (Exception ex) { throw ex; //string exst = ex.ToString(); } finally { } }
public string Apiuserni(string apiusername, string userredt) { this._1context(); string rest = ""; ApiAccount ApiAccountMS = _context.Set <ApiAccount>().SingleOrDefault(c => c.ApiAccountUserName.Contains(apiusername)); switch (userredt) { case "LoginTime": rest = ApiAccountMS.LoginTime.ToString(); break; case "ApiAccountRealPassWord": rest = ApiAccountMS.ApiAccountRealPassWord; break; case "ApiAccountId": rest = ApiAccountMS.ApiAccountId.ToString(); break; case "ApiAccountCode": rest = ApiAccountMS.ApiAccountCode; break; } return(rest); }
/// <summary> /// /// </summary> /// <returns> API Context without user crendials /// </returns> private static ApiContext GetGenericApiContext() { ApiContext apiContext = new ApiContext(); apiContext.Version = System.Configuration.ConfigurationManager.AppSettings.Get(VERSION); apiContext.Timeout = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings.Get(TIME_OUT)); apiContext.SoapApiServerUrl = System.Configuration.ConfigurationManager.AppSettings.Get(API_SERVER_URL); apiContext.EPSServerUrl = System.Configuration.ConfigurationManager.AppSettings.Get(EPS_SERVER_URL); apiContext.SignInUrl = System.Configuration.ConfigurationManager.AppSettings.Get(SIGNIN_URL); ApiAccount apiAccount = new ApiAccount(); apiAccount.Developer = System.Configuration.ConfigurationManager.AppSettings.Get(DEV_ID); apiAccount.Application = System.Configuration.ConfigurationManager.AppSettings.Get(APP_ID); apiAccount.Certificate = System.Configuration.ConfigurationManager.AppSettings.Get(CERT_ID); ApiCredential apiCredential = new ApiCredential(); apiCredential.ApiAccount = apiAccount; apiContext.ApiCredential = apiCredential; apiContext.EnableMetrics = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings.Get(ENABLE_METRICS)); string site = System.Configuration.ConfigurationManager.AppSettings.Get(EBAY_USER_SITE_ID); if (site != null) { apiContext.Site = (SiteCodeType)Enum.Parse(typeof(SiteCodeType), site, false); } apiContext.RuleName = System.Configuration.ConfigurationManager.AppSettings.Get(RULE_NAME); return(apiContext); }
public Boolean userticketchkex(string apiusername) { this._1context(); string tm2st = ""; ApiAccount ApiAccountMS = _context.Set <ApiAccount>().SingleOrDefault(c => c.ApiAccountUserName.Contains(apiusername)); if (ApiAccountMS != null) { tm2st = ApiAccountMS.ExpTime.ToString(); } if (tm2st == null || tm2st == "") { tm2st = "1900-01-01 00:00:00"; } DateTime tm1 = Convert.ToDateTime(DateTime.Now.ToString()); DateTime tm2 = Convert.ToDateTime(tm2st); TimeSpan tm3 = tm1 - tm2; if (tm3.Days > 2) { return(false); } else { return(true); } }
public async Task GetAccountTest() { string userId = Guid.NewGuid().ToString(); string lowellRef = "12345678"; string uri = $"{_portalSettings.GatewayEndpoint}api/MyAccounts/GetMyAccountsDetail"; ApiAccount apiModel = new ApiAccount() { AccountReference = "12345678" }; Account serviceModel = new Account() { AccountReference = "12345678" }; Account expected = new Account() { AccountReference = "12345678" }; _restClient.Setup(x => x.PostAsync <AccountDetailApiRequest, ApiAccount>(uri, It.Is <AccountDetailApiRequest>(m => m.UserId == userId && m.LowellReference == lowellRef))).Returns(Task.FromResult(apiModel)); _mapper.Setup(x => x.Map <ApiAccount, Account>(apiModel)).Returns(serviceModel); Account result = await _service.GetAccount(userId, lowellRef); string expectedStr = JsonConvert.SerializeObject(expected); string resultStr = JsonConvert.SerializeObject(result); Assert.AreEqual(expectedStr, resultStr); }
private void GenerateApiContext() { this._apiContext = new ApiContext(); this._apiContext.Version = API_VERSION; this._apiContext.Timeout = 6000; ApiAccount apiAccount = new ApiAccount(); apiAccount.Developer = ACCOUNT_DEVELOPER; apiAccount.Application = ACCOUNT_APPLICATION; apiAccount.Certificate = ACCOUNT_CERTIFICATE; ApiCredential apiCredential = new ApiCredential(); apiCredential.ApiAccount = apiAccount; apiCredential.eBayToken = this.EbayToken; this._apiContext.ApiCredential = apiCredential; this._apiContext.EnableMetrics = false; SiteCodeType siteCodeType; if (!Enum.TryParse <SiteCodeType>(this.SiteCode, out siteCodeType)) { siteCodeType = SiteCodeType.Australia; } this._apiContext.Site = siteCodeType; this._apiContext.RuleName = ""; }
public virtual ApiAccount GenerateNewApiKey(ApiAccount account) { if (account.ApiAccountType != ApiAccountType.Hmac) { throw new InvalidOperationException(SecurityAccountExceptions.NonHmacKeyGenerationException); } account = _apiAccountProvider.GenerateApiKey(account.ToDataModel()).ToCoreModel(); return(account); }
public static ApiAccount ToCoreModel(this ApiAccountEntity entity) { var result = new ApiAccount(); result = Mapper.Map <ApiAccountEntity, ApiAccount>(entity); result.ApiAccountType = entity.ApiAccountType; result.IsActive = entity.IsActive; return(result); }
public IHttpActionResult GenerateNewApiKey(ApiAccount account) { if (account.ApiAccountType != ApiAccountType.Hmac) { return(BadRequest(SecurityResources.NonHmacKeyGenerationException)); } var retVal = _securityService.GenerateNewApiKey(account); return(Ok(retVal)); }
public static ApiAccount ToCoreModel(this dataModel.ApiAccountEntity entity) { var result = new ApiAccount(); result.InjectFrom(entity); result.ApiAccountType = entity.ApiAccountType; result.IsActive = entity.IsActive; return(result); }
private MhwAccount AuthenticateAccount() { ApiAccount apiAccount = Sdk.Account.Get(); return(new MhwAccount { Name = apiAccount.DisplayName, AccountId = apiAccount.AccountId, PictureFileId = apiAccount.PictureFileId, IsPersonalAccount = true }); }
private bool validateApiAccount(ApiContext apiContext) { ApiAccount acc = apiContext.ApiCredential.ApiAccount; if (acc == null || acc.Application.Length == 0 || acc.Certificate.Length == 0 || acc.Developer.Length == 0) { return(false); } else { return(true); } }
public static String FetchUserToken(String sessionId, out String userId) { userId = ""; if (sessionId == "") { return(""); } String token = ""; ApiAccount apiAccount = new ApiAccount(); apiAccount.Application = EbayAppId; apiAccount.Certificate = EbayCertId; apiAccount.Developer = EbayDevId; ApiContext localContext = new ApiContext(); localContext.ApiCredential = new eBay.Service.Core.Sdk.ApiCredential(); localContext.ApiCredential.ApiAccount = apiAccount; localContext.RuName = EbayRuName; localContext.SoapApiServerUrl = System.Configuration.ConfigurationManager.AppSettings.Get(AppSettingHelper.API_SERVER_URL); localContext.SignInUrl = System.Configuration.ConfigurationManager.AppSettings.Get(AppSettingHelper.SIGNIN_URL); ConfirmIdentityCall apiCall = new ConfirmIdentityCall(localContext); apiCall.SessionID = sessionId; try { apiCall.ConfirmIdentity(sessionId); userId = apiCall.UserID; } catch (System.Exception) { } FetchTokenCall fetchTokenApiCall = new FetchTokenCall(localContext); apiCall.SessionID = sessionId; try { fetchTokenApiCall.FetchToken(sessionId); token = fetchTokenApiCall.eBayToken; } catch (System.Exception) { } return(token); }
public async Task <Account> GetAccount(string userId, string lowellRef) { AccountDetailApiRequest request = new AccountDetailApiRequest() { UserId = userId, LowellReference = lowellRef }; string url = $"{_settings.GatewayEndpoint}api/MyAccounts/GetMyAccountsDetail"; ApiAccount apiAccount = await _restClient.PostAsync <AccountDetailApiRequest, ApiAccount>(url, request); Account serviceAccount = _mapper.Map <ApiAccount, Account>(apiAccount); return(serviceAccount); }
public static ApiAccountEntity ToDataModel(this ApiAccount model) { var result = new ApiAccountEntity(); result = Mapper.Map <ApiAccount, ApiAccountEntity>(model); result.Id = model.Id; if (model.IsActive != null) { result.IsActive = model.IsActive.Value; } result.ApiAccountType = model.ApiAccountType; return(result); }
public static dataModel.ApiAccountEntity ToDataModel(this ApiAccount model) { var result = new dataModel.ApiAccountEntity(); result.InjectFrom(model); if (model.Id != null) { result.Id = model.Id; } if (model.IsActive != null) { result.IsActive = model.IsActive.Value; } result.ApiAccountType = model.ApiAccountType; return(result); }
private static ApiAccount CreateAccount() { string emailAddress = GenerateEmailAddress(); string password = GeneratePassword(); ApiAccount account = new ApiAccount { Properties = new ApiAccountProperty[] { //These fields are mandatory new ApiAccountProperty { Name = "EMAIL", Value = emailAddress, }, new ApiAccountProperty { Name = "FIRSTNAME", Value = "firstname", }, new ApiAccountProperty { Name = "LASTNAME", Value = "lastname", }, new ApiAccountProperty { Name = "PASSWORD", Value = password, }, new ApiAccountProperty { Name = "USERIPADDRESS", //should reflect the IP address that the account holder is likely to log in from. Value = "127.0.0.1" }, //The following fields are optional new ApiAccountProperty { Name = "COMPANY", Value = "a-company", }, new ApiAccountProperty { Name = "PHONE", Value = "02080001000", }, new ApiAccountProperty { //you can find a list of locale ids @ http://msdn.microsoft.com/en-us/library/ms912047(v=winembedded.10).aspx Name = "CULTUREID", Value = "2057", //en-GB }, new ApiAccountProperty { Name = "TIMEZONEID", //you can find a list of timezone ids @ http://msdn.microsoft.com/en-us/library/gg154758.aspx Value = "GMT Standard Time", }, new ApiAccountProperty { Name = "onlinepaymentsenabled", Value = "false" } } }; ApiAccount createdAccount = _client.CreateAccount(account); Console.WriteLine("Account '{0}' has been created with the password '{1}' and assigned the ID '{2}'", emailAddress, password, createdAccount.Id); return createdAccount; }
private static void UpdateTheme(ApiAccount forAccount) { //example colours taken from: http://paletton.com/#uid=7280u0kllllaFw0g0qFqFg0w0aF ApiTheme theme = new ApiTheme { ButtonColor = "#71266e", HyperlinkColor = "#993350", PrimaryColor = "#90a437", SecondaryColor = "#5e9732" }; _client.UpdateTheme(forAccount.Id, theme); Console.WriteLine("Theme succesfully updated for account"); }
private static void CreateManagedUser(ApiAccount forAccount) { string password = GeneratePassword(); ApiManagedUser managedUser = new ApiManagedUser { Email = GenerateEmailAddress(), FirstName = "Firstname", LastName = "Lastname", MobileNumber = "07511111111", Password = password, //The list of permissions you want to assign to a managed user. Permissions = new ApiPermissionTypes[] { ApiPermissionTypes.ContactExporter, ApiPermissionTypes.Contacts, ApiPermissionTypes.EditCampaigns, ApiPermissionTypes.Programs, ApiPermissionTypes.ReportDrillDown, ApiPermissionTypes.Reporter, ApiPermissionTypes.Sender, ApiPermissionTypes.TemplateAdmin, ApiPermissionTypes.ViewAccountInvoices } }; ApiManagedUser createdManagedUser = _client.CreateManagedUser(forAccount.Id, managedUser); Console.WriteLine("Managed user '{0}' has been created with password '{1}'", createdManagedUser.Email, password); }
private static void CreateApiUser(ApiAccount forAccount) { string password = GeneratePassword(); ApiUser apiUser = new ApiUser { Email = GenerateEmailAddress(), Password = password, }; ApiUser createdApiUser = _client.CreateApiUser(forAccount.Id, apiUser); Console.WriteLine("API user '{0}' has been created with the password '{1}'", createdApiUser.Email, password); }
/// <summary> /// Install plugin /// </summary> public override void Install() { _context.Install(); var settings = new ConfigurationModel { AppID = "PhuocPha-worldbuy-PRD-28e35c535-94b2bb4b", DevID = "4343ce44-efa1-4c33-a431-18daed74c054", Token = "v^1.1#i^1#p^1#r^0#I^3#f^0#t^H4sIAAAAAAAAAOVXa2wUVRTu9oVIizESwYK4nRZjkJm98+ruDt2FpS20aWkXtiBQCZnHHXZgdmYzc5ftxjTWGpr4gB/+MPFFahRJE8WKSg3aRCQEoeAfNfEBPzQQrMQYeQQjwXhndinbSngWIXH/bObcM+ee7zvfOXcu6C6dPLe3sfd8uWdSYV836C70eOgpYHJpyeNTiworSgpAnoOnr7u6u7in6JdaW0zoSWE5tJOmYUNvZ0I3bME1hoiUZQimaGu2YIgJaAtIFmKRpS0CQwEhaZnIlE2d8DbVhwiOlRiFkThallRIcwq2GpditpshgpFYKShyNTDA8KzEAbxu2ynYZNhINBBeB7SfBEGS5tqBX+BogaapGkCvIbwroWVrpoFdKECE3XQF910rL9erpyraNrQQDkKEmyKLY22RpvqG1vZaX16scI6HGBJRyh77VGcq0LtS1FPw6tvYrrcQS8kytG3CF87uMDaoELmUzE2k71JNK5CtYZSAn1UkhhbhhFC52LQSIrp6Ho5FU0jVdRWggTSUuRajmA1pA5RR7qkVh2iq9zp/y1KirqkatEJEw6LI6kg0SoSj8ZQpR+MimTYtXZFSGTK6vJ5kApDlZZ7lySAnMZLESbmNstFyNI/bqc40FM0hzfa2mmgRxFnD8dywedxgpzajzYqoyMko3y+Y45APsmucomarmEJxw6krTGAivO7jtSsw+jZClialEByNMH7BpShEiMmkphDjF10t5uTTaYeIOEJJwedLp9NUmqVMa72PAYD2rVraEpPjMCES2Nfp9ay/du0XSM2FImNtYX8BZZI4l06sVZyAsZ4I4x7284Ec72PTCo+3/suQh9k3tiMmqkNkMSjjGRNgFBb4eV6eiA4J50Tqc/KAkpghE6K1EaKkLsqQlLHOUgloaYrA8irDBlRIKjVBleSCqkpKvFJD0iqEAEJJkoOB/1OjXK/UY7KZhFFT1+TMhAh+wsTOWkpUtFAmBnUdG65X9VcEaTsgbzs8p9dvCKITw8ZBxKRGOdqmZDPhM0U81BzTOjfrW8Kt4fPwrioqBphFqinZg4xy4VL2JpmyoG2mLHyGU23OXG83N0IDdwmyTF2H1kr6lpiYuIl+h6b5FVHJuoZpXHe3IbvBMXmT2hbRHURd3OPpuAJymge4qlzAf2tqrXPr2p75D4bWDRW20bQRVG7DB4hv7HUoXOD+6B7Px6DH8wG+UQEfmENXgcrSohXFRWUVtoYgpYkqZWvrDfyVb0FqI8wkRc0qLPV0zBroX5d3AetbC2aMXsEmF9FT8u5jYNbllRL6vunltB8EaQ74OZqm14Cqy6vF9IPF08oemfVoWlnV/9zfp56Jb7t/2+9/8IOgfNTJ4ykpwMooONbwUs3M6a38yMDJtx+rq5SmlZ3Z17ug5bfBc7v3jJxhv18y79Ck9+a9cbbs8EDz8Fr9+TeHRuYfr336kyWf9aiVW6u/014c3v1rsLfw1Fx+YeHhrpnw02DVO5tbd/55Ysve+tiiZct2WcZbJU/81HXvA+rPof3NM/oeenjf4Ef97efC2/U9+0bK2YXxAx21p4deLZ2XPliVOHvh/Q3qzl3bza9+/Lx6xwWmujTR8eyOv3zD06xNXUdjP+zS7zm4YviF9JeNRQfOD84+8uHeoddnt758RGrZ8u6TA8e/qGCPvbL/4tRDFd7j2+K1g1+f/Hbh/Dmd/emnXlt7cfPWqmYVrN4xMrRgdd2JrsrTR6lvsuX7B4CTuGQaDwAA", CertID = "PRD-8e35c5356f0f-1449-425a-a638-6322" }; _settingService.SaveSetting(settings); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.Affiliate.Ebay.AppID", "App ID"); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.Affiliate.Ebay.CertID", "Cert ID"); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.Affiliate.Ebay.Token", "Token"); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.Affiliate.Ebay.DevID", "Dev ID"); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.Affiliate.Ebay.CategoryId", "Category Worldbuy"); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.Affiliate.Ebay.CategoryEbayId", "Category Ebay"); this.AddOrUpdatePluginLocaleResource("Plugins.AffiliateEbay.MapCategory.Error", "Danh mục đã được map"); this.AddOrUpdatePluginLocaleResource("Plugins.AffiliateEbay.MapCategory.Added", "Map danh mục thành công"); this.AddOrUpdatePluginLocaleResource("Plugins.AffiliateEbay.CallApi.Error", "Map danh mục trước khi lấy sản phẩm"); this.AddOrUpdatePluginLocaleResource("Admin.Catalog.Products.Added", "Lấy sản phẩm thành công"); this.AddOrUpdatePluginLocaleResource("Plugin.Configuration.Settings.Ebay", "Lấy sản phẩm thành công"); this.AddOrUpdatePluginLocaleResource("Nop.Plugin.Affiliate.Ebay.Mapping", "Mapping Category"); this.AddOrUpdatePluginLocaleResource("Nop.Plugin.Affiliate.Ebay.Product", "Get Product"); this.AddOrUpdatePluginLocaleResource("Nop.Plugin.Affiliate.Ebay.Setting", "Config Plugin"); this.AddOrUpdatePluginLocaleResource("Nop.Plugin.Affiliate.Ebay", "Plugin Ebay"); this.AddOrUpdatePluginLocaleResource("Plugin.Configuration.Settings.Ebay", "Configure Ebay"); this.AddOrUpdatePluginLocaleResource("Plugin.Ebay.Configuration.Settings.CallApi", "Get Product Ebay"); this.AddOrUpdatePluginLocaleResource("Plugin.Ebay.Configuration.Settings.MappingCategory", "Mapping Category"); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.Affiliate.Ebay.KeyWord", "Keyword"); //Insert CategoryEbay // set devId, appId, certId in ApiAccount ApiAccount account = new ApiAccount(); account.Developer = "4343ce44-efa1-4c33-a431-18daed74c054"; account.Application = "PhuocPha-worldbuy-PRD-28e35c535-94b2bb4b"; account.Certificate = "PRD-8e35c5356f0f-1449-425a-a638-6322"; // set ApiAccount and token in ApiCredential ApiCredential credential = new ApiCredential(); credential.ApiAccount = account; credential.eBayToken = "AgAAAA**AQAAAA**aAAAAA**JYLgWQ**nY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6ACl4CiC5KHowqdj6x9nY+seQ**Pt8DAA**AAMAAA**XEESS+BUaGiTZWWj64HwUby9/+ABWbn3NBturqmQgtWJzIW3f/FNc8Wm/EtypFpT5NU6yfvf9lBvyp7kUifGyih/PIQTmDWVrDJjXU+PxJX6QEGFzw4noZK/E1n01EFm6heicUJ5XVj8KY0GA7WVatXy3k2AVDc6psRDoscGAya5mZVDhHgqdyiTHTs/G/5y6G01HBS9ehbkui4eRbggCX6eyee9nCz/UmLOn19C9WJmCpLng8PxcifyEu4Ca8UInQJsaAqYKKGVflBofV0D+6jd4URuEaKl3J2lZbUrjPIBgmCZtYHv8LOKw5OgCRQKCl014DBz91PgOKpUfZCvh7suXazzNOdjh2t4qitzPCi7uMTmzXUzN7WjN5pbFx+3n90FOe+uKjZN1ZhrFx7295qtt5eFh7xxV0ZqdwbBQUILUKm9tE5/KYlpKS+3wjMFpTw66hYuw0s2CIv7axomq+NV2d+rEY2FXAKD3v8OWVnbIFjzQJY+cV8bpMxxDkHsTN9G7lOhbCGxGlRkV1xy5JYeGmqzGYhuDRZ9glfERySkCXJflU94H/bOls8GgEVDrV6iDvcBgPYVhf8YgLN4MUCY3U/osTZbAXh+bV5RPgvtZLNQ4ZB1WhP/qtCsufdkJKnnpxYy1Zswl8QBRZK4+TVkf7/CEqfNSsJGEllxzmznD+Ox4KL+A1n8nzk/NYPMceXFZPS3l4047juy6lTQ6BSBzP+N0CMjezHAoA4tE0vdlJKTRFPyt1sSCjj03MVX"; // add ApiCredential to ApiContext ApiContext context = new ApiContext(); context.ApiCredential = credential; // set eBay server URL to call context.SoapApiServerUrl = "https://api.ebay.com/wsapi"; // set timeout in milliseconds - 3 minutes context.Timeout = 180000; // set wsdl version number context.Version = "1027"; // create ApiCall object - we'll use it to make the call GetCategoriesCall apicall = new GetCategoriesCall(context); apicall.LevelLimit = 3; apicall.DetailLevelList.Add(DetailLevelCodeType.ReturnAll); CategoryTypeCollection cats = apicall.GetCategories(); foreach (CategoryType category in cats) { var cate = new CategoryEbay(); var ebayId = Convert.ToInt32(category.CategoryParentID.ItemAt(0)); var getCate = _affiliateEbayService.GetByEbayId(ebayId); if (getCate != null) { cate.ParentCategoryId = getCate.Id; } else { cate.ParentCategoryId = 0; } cate.EbayId = Convert.ToInt32(category.CategoryID); cate.Name = category.CategoryName; cate.Level = category.CategoryLevel; cate.Published = true; cate.Deleted = false; _affiliateEbayService.InsertCategoryEbay(cate); } base.Install(); }