Esempio n. 1
0
        public void Ctor_CanConstruct_ResultNotNull()
        {
            // Arrange + act
            var result = new AuthorizedRequestsHandler(Mock.Of <ITikkieConfiguration>());

            // Assert
            Assert.IsNotNull(result);
        }
        /// <summary>
        /// Initializes a new instance of the Tikkie API Client.
        /// </summary>
        /// <param name="apiKey">The API key that allows the usage of the Tikkie API.</param>
        /// <param name="privateKeyPath">The directory path where the RSA private key PEM file can be found.</param>
        /// <param name="useTestEnvironment">True if the connexion is made to the development/sandbox Tikkie API environment, false if it uses the production environment. False by default.</param>
        /// <exception cref="ArgumentException">If the API Key is null or empty.</exception>
        /// <exception cref="FileNotFoundException">If the private key pem file doesn't exist in the specified location.</exception>
        /// <exception cref="InvalidDataException">If the RSA private key PEM file cannot be read.</exception>
        public TikkieClient(
            string apiKey,
            string privateKeyPath,
            bool useTestEnvironment = false)
        {
            Configuration = new TikkieConfiguration(apiKey, privateKeyPath, useTestEnvironment);
            var authorizedRequestsHandler = new AuthorizedRequestsHandler(Configuration);

            AuthorizationTokenInfo   = authorizedRequestsHandler.AuthorizationTokenInfo;
            _platformRequestsHandler = new PlatformRequestsHandler(authorizedRequestsHandler);
            _userRequestsHandler     = new UserRequestsHandler(authorizedRequestsHandler);
            _paymentRequestsHandler  = new PaymentRequestsHandler(authorizedRequestsHandler);
        }