Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
        private static ApiContext GetApiContext()
        {
            if (apiContext != null)
            {
                return(apiContext);
            }
            else
            {
                apiContext = new ApiContext();
                apiContext.SoapApiServerUrl = ConfigurationManager.AppSettings["environment.ApiServerUrl"];
                ApiCredential apiCredential = new ApiCredential();
                apiCredential.eBayToken  = ConfigurationManager.AppSettings["userAccount.ApiToken"];
                apiContext.ApiCredential = apiCredential;
                apiContext.Site          = SiteCodeType.US;
                bool result;
                if (bool.TryParse(ConfigurationManager.AppSettings["enableLogging"], out result) && result)
                {
                    apiContext.ApiLogManager = new ApiLogManager();
                    string logFullFileName = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "log.txt");
                    apiContext.ApiLogManager.ApiLoggerList.Add(new FileLogger(logFullFileName, true, true, true));
                    apiContext.ApiLogManager.EnableLogging = true;
                }

                return(apiContext);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Populate eBay SDK ApiContext object with data from application configuration file
        /// </summary>
        /// <returns>ApiContext</returns>
        static ApiContext GetApiContext()
        {
            //apiContext is a singleton,
            //to avoid duplicate configuration reading
            if (apiContext != null)
            {
                return(apiContext);
            }
            else
            {
                apiContext = new ApiContext();

                //set Api Server Url
                //apiContext.SoapApiServerUrl = "https://api.sandbox.ebay.com/wsapi"; // "https://api.ebay.com/wsapi";
                apiContext.SoapApiServerUrl = "https://api.ebay.com/wsapi";
                //set Api Token to access eBay Api Server
                ApiCredential apiCredential = new ApiCredential();
                apiCredential.eBayToken  = "XXXXXXX";
                apiContext.ApiCredential = apiCredential;
                //set eBay Site target to US
                apiContext.Site = SiteCodeType.US;

                return(apiContext);
            }
        }
Ejemplo n.º 4
0
        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 ApiContext GetApiContext()
    {
        //ApiContext is a singleton,
        if (apiContext != null)
        {
            return(apiContext);
        }

        else
        {
            apiContext = new ApiContext();

            //supply Api Server Url
            apiContext.SoapApiServerUrl = ConfigurationManager.AppSettings["Environment.ApiServerUrl"];

            //Supply user token
            ApiCredential apiCredential = new ApiCredential();

            apiCredential.eBayToken  = ConfigurationManager.AppSettings["UserAccount.ApiToken"];
            apiContext.ApiCredential = apiCredential;

            //Specify site: here we use US site
            apiContext.Site = eBay.Service.Core.Soap.SiteCodeType.US;

            return(apiContext);
        } // else
    }     //GetApiContext
Ejemplo n.º 6
0
        //get parameters from config file and create
        //ApiContext object
        static ApiContext GetApiContext()
        {
            ApiContext cxt = new ApiContext();

            // set api server address
            cxt.SoapApiServerUrl = ConfigurationManager.AppSettings[KEY_API_URL];


            // set token
            ApiCredential ac    = new ApiCredential();
            string        token = ConfigurationManager.AppSettings[KEY_APITOKEN];

            ac.eBayToken      = token;
            cxt.ApiCredential = ac;

            // initialize log.
            ApiLogManager logManager = null;
            string        logPath    = ConfigurationManager.AppSettings[KEY_LOGFILE];

            if (logPath.Length > 0)
            {
                logManager = new ApiLogManager();

                logManager.EnableLogging = true;

                logManager.ApiLoggerList = new ApiLoggerCollection();
                ApiLogger log = new FileLogger(logPath, true, true, true);
                logManager.ApiLoggerList.Add(log);
            }
            cxt.ApiLogManager = logManager;

            return(cxt);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Populate eBay SDK ApiContext object with data from application configuration file
        /// </summary>
        /// <returns>ApiContext object</returns>
        private ApiContext GetApiContext()
        {
            //apiContext is a singleton,
            //to avoid duplicate configuration reading
            if (apiContext != null)
            {
                return(apiContext);
            }
            else
            {
                apiContext         = new ApiContext();
                apiContext.Version = "673";
                //set Api Server Url
                apiContext.SoapApiServerUrl =
                    ConfigurationManager.AppSettings["Environment.ApiServerUrl"];
                //set Api Token to access eBay Api Server
                ApiCredential apiCredential = new ApiCredential();
                apiCredential.eBayToken =
                    ConfigurationManager.AppSettings["UserAccount.ApiToken"];
                apiContext.ApiCredential = apiCredential;
                //set eBay Site target to AU
                apiContext.Site = SiteCodeType.Australia;

                //set Api logging
                apiContext.ApiLogManager = new ApiLogManager();
                apiContext.ApiLogManager.ApiLoggerList.Add(new FileLogger("listing_log.txt", true, true, true));

                apiContext.ApiLogManager.EnableLogging = true;


                return(apiContext);
            }
        }
Ejemplo n.º 8
0
        public static ApiContext GetApiContext()
        {
            //apiContext is a singleton,
            //to avoid duplicate configuration reading
            if (apiContext != null)
            {
                return(apiContext);
            }
            else
            {
                apiContext = new ApiContext();

                //set Api Server Url
                apiContext.SoapApiServerUrl =
                    ConfigurationManager.AppSettings["Environment.ApiServerUrl"];
                //set Api Token to access eBay Api Server
                ApiCredential apiCredential = new ApiCredential();
                apiCredential.eBayToken =
                    ConfigurationManager.AppSettings["UserAccount.ApiToken"];
                apiContext.ApiCredential = apiCredential;
                apiContext.ApiCredential.ApiAccount.Application =
                    ConfigurationManager.AppSettings["Application"];
                apiContext.ApiCredential.ApiAccount.Certificate =
                    ConfigurationManager.AppSettings["Certificate"];
                apiContext.ApiCredential.ApiAccount.Developer =
                    ConfigurationManager.AppSettings["Developer"];
                //set eBay Site target to US
                apiContext.Site = SiteCodeType.US;

                return(apiContext);
            }
        }
Ejemplo n.º 9
0
        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 = "";
        }
        /// <summary>
        /// Instantiating and setting ApiContext
        /// </summary>
        /// <param name="commerceContext"></param>
        /// <returns></returns>
        public async Task <ApiContext> GetEbayContext(CommerceContext commerceContext)
        {
            //apiContext is a singleton,
            if (apiContext != null)
            {
                return(apiContext);
            }
            else
            {
                apiContext = new ApiContext();
                var ebayConfig = await this._commerceCommander.GetEntity <EbayConfigEntity>(commerceContext, "Entity-EbayConfigEntity-Global", true).ConfigureAwait(false);

                if (ebayConfig.HasComponent <EbayBusinessUserComponent>())
                {
                    var ebayConfigComponent = ebayConfig.GetComponent <EbayBusinessUserComponent>();

                    //Supply user token
                    ApiCredential apiCredential = new ApiCredential();
                    apiContext.ApiCredential = apiCredential;

                    if (!string.IsNullOrEmpty(ebayConfigComponent.EbayToken))
                    {
                        apiCredential.eBayToken = ebayConfigComponent.EbayToken;
                    }
                }

                //supply Api Server Url
                apiContext.SoapApiServerUrl = "https://api.sandbox.ebay.com/wsapi";

                //Specify site: here we use US site
                apiContext.Site = SiteCodeType.US;

                return(apiContext);
            }
        }
Ejemplo n.º 11
0
        public static ApiContext GetApiContext(string Token)
        {
            //apiContext is a singleton,
            //to avoid duplicate configuration reading
            if (apiContext != null)
            {
                return(apiContext);
            }
            else
            {
                apiContext = new ApiContext();

                //set Api Server Url
                apiContext.SoapApiServerUrl =
                    ConfigurationManager.AppSettings["Environment.ApiServerUrl"];
                //set Api Token to access eBay Api Server
                ApiCredential apiCredential = new ApiCredential();
                apiCredential.eBayToken  = Token;
                apiContext.ApiCredential = apiCredential;
                //set eBay Site target to US
                apiContext.Site = SiteCodeType.US;

                //set Api logging
                apiContext.ApiLogManager = new ApiLogManager();
                apiContext.ApiLogManager.ApiLoggerList.Add(
                    new FileLogger("listing_log.txt", true, true, true)
                    );
                apiContext.ApiLogManager.EnableLogging = true;


                return(apiContext);
            }
        }
Ejemplo n.º 12
0
        public void ToStringTest(string key, string expected)
        {
            var sut = new ApiCredential {
                Key = key
            };

            Assert.AreEqual(expected, sut.ToString());
        }
Ejemplo n.º 13
0
 public async Task DeleteApiCredentialAsync(ApiCredential apiCreds)
 {
     if (apiCreds == null)
     {
         throw new ArgumentNullException(nameof(apiCreds));
     }
     context.ApiCredentials.Remove(apiCreds);
     await context.SaveChangesAsync();
 }
Ejemplo n.º 14
0
        /// <summary>
        ///
        /// </summary>
        /// <returns> the API context for the second user </returns>
        public static ApiContext GetUser2ApiContext()
        {
            ApiContext apiContext = GetGenericApiContext();

            ApiCredential apiCredential = apiContext.ApiCredential;

            apiCredential.eBayToken = System.Configuration.ConfigurationManager.AppSettings.Get(API_TOKEN2);

            return(apiContext);
        }
Ejemplo n.º 15
0
        /// <summary>
        ///
        /// </summary>
        /// <returns> the API context for the default user </returns>
        public static ApiContext GetApiContext(string apiToken)
        {
            ApiContext apiContext = GetGenericApiContext();

            ApiCredential apiCredential = apiContext.ApiCredential;

            apiCredential.eBayToken = apiToken;

            return(apiContext);
        }
Ejemplo n.º 16
0
 public static void SetCredentials(eBayCredentialDto credential)
 {
     _apiCredential            = new ApiCredential();
     _apiCredential.ApiAccount = new ApiAccount
     {
         Application = credential.ApplicationId,
         Developer   = credential.DeveloperId,
         Certificate = credential.CertificationId
     };
     _apiCredential.eBayToken = credential.UserToken;
     _payPalEmailAddress      = credential.PayPalEmailAddress;
     _mode = credential.Mode;
 }
        public ApiCredential ApiCredentialsGet(string provider)
        {
            ApiCredential apic = null;

            for (int i = 0; i < _apiCredentials.Count && apic == null; i++)
            {
                if (_apiCredentials[i].Provider == provider)
                {
                    apic = _apiCredentials[i];
                }
            }

            return(apic);
        }
Ejemplo n.º 18
0
        private ApiContext GetAPIContextByConfig(eBayAPIContextConfig config)
        {
            var apiContext    = new ApiContext();
            var apiCredential = new ApiCredential();

            apiCredential.eBayToken            = config.eBayToken;
            apiCredential.eBayAccount.UserName = config.SellerID;
            apiContext.SoapApiServerUrl        = config.ServiceURL;


            apiContext.ApiCredential = apiCredential;
            apiContext.Site          = (SiteCodeType)Enum.Parse(typeof(SiteCodeType), config.eBaySiteID);
            return(apiContext);
        }
Ejemplo n.º 19
0
        private static void GetApiContext()
        {
            if (_apiContext == null)
            {
                _apiContext = new ApiContext();

                _apiContext.SoapApiServerUrl = "https://api.ebay.com/wsapi";
                ApiCredential apiCredential = new ApiCredential();
                apiCredential.eBayToken =
                    "AgAAAA**AQAAAA**aAAAAA**QfmvWw**nY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6ADkoehCJKBqAidj6x9nY+seQ**CbUEAA**AAMAAA**g72igHsAWb44hhUnierXvX8o4YyDEuaXgtczBFz1Rh5R6AC0t9QZhukhCiupG1xD8VE3Ae20Zy2qSo61+GyJuRZjZLZ58zGt0b8RSPsvOHuIWjnNuPUq+6g16N8QQexnG2AMwiGx26GH9BO/AbPEjMWt8bZ3GCocnr8ZZeA5kWPFaGpah/3k8kDc3bC4X4FhQ73x8NJp42UsN/fTfOtPJzpHK9qj7r4344svvO1IjPuDktKE/zPb3lSG+5cPJ3rCKkNPmpwxwRE4hS7gUTHp/AvofiYtyx5GTzs0T4X1DMlloSdIA2vFjOBXIKdAGWfl5oku9yeQICg62io7Mvp+jyMWxvhpNwRRPXVyr0n84R9q9G3gNVcLo8gAeCyjNX26/+Jc980h5vbUz5eUoCn9evVMyXbW/GUu09pIEm/WLk5s5NwQlLhOHaLAqhit7lRPW1LE21nNmno+XY5vdOak4HjOBmq7PaUDjzvYuaZKU0Vn0WI/34TxUzTGRZIRzP1OTs2iwEu5CAVSEOBrpgU47yayY1ClhfUhTPVCVtMh95yQY/qvS3k4LjVfKV6PFfIJF6RFU/+gqHfLZlbie5q7Vu0hTO3xe9pcR+IvCAfoZDX+YhIYcwMn3MXzFBzVs++O2yQ8BBQuOZd+LwjEudtWgDIyWUbMrKvu0idVEmJt9PHHZB/oybJjWc7g5OaKbnm1eG2mATa53VA87pdsoIV8lsNDcRZrUmC2o5kj9MURdhzxSOOwo91yY4pt5oc3+rA7";

                _apiContext.ApiCredential = apiCredential;
                _apiContext.Site          = SiteCodeType.US;
            }
        }
Ejemplo n.º 20
0
        public ApiConfig Get()
        {
            var creds = new ApiCredential
            {
                Key      = ConfigurationManager.AppSettings["apiKey"]
                , Secret = ConfigurationManager.AppSettings["apiSecret"]
            };

            var config = new ApiConfig
            {
                BaseUrl      = ConfigurationManager.AppSettings["apiUrl"]
                , Credential = creds
            };

            return(config);
        }
Ejemplo n.º 21
0
        public async Task <NewApiKeyViewModel> CreateApiKey()
        {
            var userId    = principal.GetUserId();
            var newApiKey = await encryptionService.GenerateApiKey();

            var newCredential = new ApiCredential()
            {
                UserId     = userId,
                UserSecret = newApiKey.HashedKeySecret,
                Username   = newApiKey.KeyName
            };
            await apiKeyRepository.AddAsync(newCredential);

            newApiKey.HashedKeySecret = null;
            return(newApiKey);
        }
Ejemplo n.º 22
0
        public string DoUserRegistrationQuickBlox(string name, string email, string password)
        {
            try
            {
                //register user

                //  ResponseObjectInfo objResponseObjectInfo = new ResponseObjectInfo();

                string application_id = "49511";
                string auth_key       = "YVfFMVjZryr3HC5";
                string timestamp      = Timestamp();
                string nonce          = new Random().Next().ToString();
                string auth_secret    = "ktmQ32QKqHEMEHh";
                //string setAccountKey = "ckY9GmG3pkzKZr76RKh1";


                string result           = null;
                var    apiCredentials   = new ApiCredential(application_id, auth_key, auth_secret);
                var    adminCredentials = new UserCredential()
                {
                    UserLogin = "******", Password = "******"
                };
                QuickbloxRestApi client    = new QuickbloxRestApi(apiCredentials, adminCredentials);
                UserParameters   UserParam = new UserParameters();


                UserParam.Email    = email;
                UserParam.Password = password;
                UserParam.FullName = name;
                UserParam.Login    = email;


                var users = client.RegisterAsync(UserParam);

                //objResponseObjectInfo.Status = 1;
                //objResponseObjectInfo.Message = "Success";
                //objResponseObjectInfo.dt_ReturnedTables = new dynamic[1];
                //objResponseObjectInfo.dt_ReturnedTables[0] = users;

                return(users);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
        public eBayProductCategoryRequestor(string applicationId, string developerId, string certificateId, string userToken)
        {
            _logger = new LoggerRepository();

            var apiCredential = new ApiCredential();

            apiCredential.ApiAccount = new ApiAccount
            {
                Application = applicationId,
                Developer   = developerId,
                Certificate = certificateId
            };
            apiCredential.eBayToken = userToken;

            _context = new ApiContext();
            _context.ApiCredential    = apiCredential;
            _context.SoapApiServerUrl = "https://api.ebay.com/wsapi";
        }
Ejemplo n.º 24
0
        private ApiContext GetAPIContextByConfig(eBayAPIContextConfig config)
        {
            var apiContext    = new ApiContext();
            var apiCredential = new ApiCredential();

            apiCredential.eBayToken              = config.eBayToken;
            apiCredential.eBayAccount.UserName   = config.SellerID;
            apiCredential.ApiAccount.Application = config.AppID;
            apiCredential.ApiAccount.Developer   = config.DevID;
            apiCredential.ApiAccount.Certificate = config.CertID;

            apiContext.SoapApiServerUrl = config.ServiceURL;
            //apiContext.Site = (SiteCodeType)Enum.Parse(typeof(SiteCodeType), config.eBaySiteID);
            apiContext.Site = SiteCodeType.Australia;

            apiContext.ApiCredential = apiCredential;

            return(apiContext);
        }
Ejemplo n.º 25
0
        public override void ApiCredentialsSet(string provider, string apiCredentials1, string apiCredentials2, string apiCredentials3, string apiCredentials4, OperationComplete apiCredentialsSetComplete)
        {
            ApiCredential apic = new ApiCredential();

            apic.Provider        = provider;
            apic.ApiCredentials1 = Obany.Cryptography.SecureEncryption.EncryptData(apiCredentials1);
            apic.ApiCredentials2 = Obany.Cryptography.SecureEncryption.EncryptData(apiCredentials2);
            apic.ApiCredentials3 = Obany.Cryptography.SecureEncryption.EncryptData(apiCredentials3);
            apic.ApiCredentials4 = Obany.Cryptography.SecureEncryption.EncryptData(apiCredentials4);

            base.ApiCredentialsAdd(apic);

            ConfigurationSave();

            if (apiCredentialsSetComplete != null)
            {
                apiCredentialsSetComplete(true);
            }
        }
Ejemplo n.º 26
0
        //Methods
        #region GetApiContext
        /// <summary>
        /// Populate eBay SDK ApiContext object with data from application configuration file
        /// </summary>
        /// <returns>ApiContext object</returns>
        /// <remarks>
        /// apiContext is a singleton to avoid duplicate configuration reading
        /// </remarks>
        public static ApiContext GetApiContext()
        {
            if (EbayController.apiContext == null)
            {
                EbayController.apiContext = new ApiContext();

                EbayController.apiContext.SoapApiServerUrl = ShopperConfiguration.Default.Ebay.ApiServerUrl;
                ApiCredential apiCredential = new ApiCredential();
                apiCredential.eBayToken = ShopperConfiguration.Default.Ebay.ApiToken;
                EbayController.apiContext.ApiCredential = apiCredential;
                EbayController.apiContext.Site          = SiteCodeType.Germany;

                //set Api logging
                //apiContext.ApiLogManager = new ApiLogManager();
                //apiContext.ApiLogManager.ApiLoggerList.Add(new FileLogger("listing_log.txt", true, true, true));
                //apiContext.ApiLogManager.EnableLogging = true;
            }

            return(EbayController.apiContext);
        }
Ejemplo n.º 27
0
    public static void Main(String[] args)
    {
        var apiCredential = new ApiCredential(API_USER_NAME, API_PASSWORD, API_KEY);
        var clientKeys = new ClientKeys(@"c:\work\abenity\private.pem", @"c:\work\abenity\public.pem");

        var abenityApi = new AbenityApi(apiCredential, clientKeys);
        abenityApi.PostSsoMember(new SsoMemberPayload()
        {
            Address = "67 Bianco",
            City = "Irvine",
            ClientUserId = "7",
            Country = "US",
            Email = "*****@*****.**",
            FirstName = "Ryan",
            LastName = "Meyer",
            SendWelcomeEmail = true,
            State = "CA",
            Zip = "92618"
        });
    }
Ejemplo n.º 28
0
    public static void Main(String[] args)
    {
        var apiCredential = new ApiCredential(API_USER_NAME, API_PASSWORD, API_KEY);
        var clientKeys = new ClientKeys(@"path-to-client-private-key.pem", @"path-to-abenity-public-key.pem");

        var abenityApi = new AbenityApi(apiCredential, clientKeys);
        abenityApi.PostSsoMember(new SsoMemberPayload()
        {
            Address = "1 Main St.",
            City = "Nashville",
            ClientUserId = "1",
            Country = "US",
            Email = "*****@*****.**",
            FirstName = "Jane",
            LastName = "Doe",
            SendWelcomeEmail = true,
            State = "TN",
            Zip = "37201"
        });
    }
Ejemplo n.º 29
0
        public ApiContext GetApiContext()
        {
            if (_apiContext == null)
            {
                ApiContext apiContext = new ApiContext();
                apiContext.SoapApiServerUrl = @"https://api.ebay.com/wsapi";

                ApiCredential apiCredential = new ApiCredential();
                apiCredential.eBayToken  = this.Token;
                apiContext.ApiCredential = apiCredential;
                apiContext.Site          = SiteCodeType.US;
                apiContext.ApiLogManager = new ApiLogManager();
                apiContext.ApiLogManager.ApiLoggerList.Add(new FileLogger("listing_log.txt", true, true, true));
                apiContext.ApiLogManager.EnableLogging = false;

                _apiContext = apiContext;
            }

            return(_apiContext);
        }
Ejemplo n.º 30
0
        private void InitializeContext()
        {
            Context = new ApiContext();
            Context.SoapApiServerUrl = ConfigurationManager.AppSettings["Environment.ApiServerUrl"];
            ApiCredential apiCredential = new ApiCredential();

            apiCredential.eBayToken =
                ConfigurationManager.AppSettings["UserAccount.ApiToken"];
            apiCredential.ApiAccount             = new ApiAccount();
            apiCredential.ApiAccount.Application = ConfigurationManager.AppSettings["Environment.AppId"];
            apiCredential.ApiAccount.Certificate = ConfigurationManager.AppSettings["Environment.CertId"];
            apiCredential.ApiAccount.Developer   = ConfigurationManager.AppSettings["Environment.DevId"];
            Context.ApiCredential = apiCredential;
            Context.Site          = SiteCodeType.Germany;

            Context.ApiLogManager = new ApiLogManager();
            Context.ApiLogManager.ApiLoggerList.Add(new FileLogger(
                                                        ConfigurationManager.AppSettings["Ebay.Logfile"], false,
                                                        false, true));
            Context.ApiLogManager.EnableLogging = true;
        }
Ejemplo n.º 31
0
        public ApiCredential Find(ApplicationUser user, LoginModel loginModel, string NomeComplet)
        {
            ApiCredential credential = new ApiCredential();

            var result = _signInManager.CheckPasswordSignInAsync(user, loginModel.Password, lockoutOnFailure: false);

            if (result.Result == SignInResult.Success)
            {
                //#if !debug
                //  var utilisateur = UtilisateurDepot.Search(new Dictionary<string, object> { { "Nom", "MATEUS ELOY EVANGELISTA CAETANO" } }).DefaultIfEmpty(null).FirstOrDefault();

                //#else
                var utilisateur = UtilisateurDepot.Search(new Dictionary <string, object> {
                    { "AdresseCourriel", loginModel.Email }
                }).DefaultIfEmpty(null).FirstOrDefault();
                if (utilisateur == null)
                {
                    utilisateur = UtilisateurDepot.Search(new Dictionary <string, object> {
                        { "Nom", NomeComplet.ToUpper() }
                    }).DefaultIfEmpty(null).FirstOrDefault();

                    if (utilisateur == null)
                    {
                        throw new Exception("Utilisateur not found");
                    }

                    utilisateur.AdresseCourriel = loginModel.Email;
                    UtilisateurDepot.Update(utilisateur);
                }
                //#endif

                credential.authenticated = true;
                credential.message       = "Ok";
                credential.utilisateurId = utilisateur.GraphKey;
            }
            return(credential);
        }
Ejemplo n.º 32
0
        public static ApiContext GetContext(SellerOrBuyer Who)
        {
            ApiContext apiContext = new ApiContext();

            apiContext.SoapApiServerUrl =
                ConfigurationManager.AppSettings["Environment.ApiServerUrl"];
            ApiCredential apiCredential = new ApiCredential();

            apiCredential.eBayToken =
                ConfigurationManager.AppSettings[
                    Who == SellerOrBuyer.typeSELLER ? "UserAccount.ApiToken_Seller" : "UserAccount.ApiToken_Buyer"];
            apiCredential.ApiAccount.Application = ConfigurationManager.AppSettings["AppID"];
            apiCredential.ApiAccount.Developer   = ConfigurationManager.AppSettings["DevID"];
            apiCredential.ApiAccount.Certificate = ConfigurationManager.AppSettings["CertID"];
            apiCredential.eBayAccount.UserName   = "";
            apiCredential.eBayAccount.Password   = "";

            apiContext.ApiCredential = apiCredential;

            apiContext.Site = global::eBay.Service.Core.Soap.SiteCodeType.US;

            Metrics = new CallMetricsTable();
            apiContext.EnableMetrics    = true;
            apiContext.CallMetricsTable = Metrics;

            LogManager = new ApiLogManager();
            LogManager.EnableLogging = true;

            LogManager.ApiLoggerList.Add(logger);
            LogManager.ApiLoggerList[0].LogApiMessages  = true;
            LogManager.ApiLoggerList[0].LogExceptions   = true;
            LogManager.ApiLoggerList[0].LogInformations = true;
            apiContext.ApiLogManager = LogManager;

            return(apiContext);
        }
Ejemplo n.º 33
0
        public override void ApiCredentialsSet(string provider, string apiCredentials1, string apiCredentials2, string apiCredentials3, string apiCredentials4, OperationComplete apiCredentialsSetComplete)
        {
            ApiCredential apic = new ApiCredential();

            apic.Provider = provider;
            apic.ApiCredentials1 = Obany.Cryptography.SecureEncryption.EncryptData(apiCredentials1);
            apic.ApiCredentials2 = Obany.Cryptography.SecureEncryption.EncryptData(apiCredentials2);
            apic.ApiCredentials3 = Obany.Cryptography.SecureEncryption.EncryptData(apiCredentials3);
            apic.ApiCredentials4 = Obany.Cryptography.SecureEncryption.EncryptData(apiCredentials4);

            base.ApiCredentialsAdd(apic);

            ConfigurationSave();

            if (apiCredentialsSetComplete != null)
            {
                apiCredentialsSetComplete(true);
            }
        }
Ejemplo n.º 34
0
 /// <summary>
 /// Construct a new AbenityApi object to interact with the Abenity Api.
 /// </summary>
 /// <param name="apiCredential">Your Abenity credentials</param>
 /// <param name="clientKeys">Your public and private keys</param>
 /// <param name="useProduction">(optional) Point Api calls at Abenity's production environment?</param>
 public AbenityApi(ApiCredential apiCredential, ClientKeys clientKeys, bool useProduction = false)
 {
     _apiCredential = apiCredential;
     _clientKeys = clientKeys;
     _apiUrl = (useProduction) ? "https://api.abenity.com/v1/client/sso_member.json" : "https://sandbox.abenity.com/v1/client/sso_member.json";
 }