Ejemplo n.º 1
0
        public async Task Connector_ApiKeyLogin()
        {
            //Arrange
            TotalCodeApiService helper = new TotalCodeApiService();

            //Act
            var response = await helper.ApiKeyLoginAsync("api_key_customer_management", "CustomerManagementGuid");

            //Assert
            Assert.IsNotNull(response);
        }
Ejemplo n.º 2
0
        public async Task Connector_VerifyMobileSendSMS()
        {
            //Arrange
            TotalCodeApiService helper = new TotalCodeApiService();
            var authorization          = (ApiKeyLoginResponseContent)await helper.ApiKeyLoginAsync("api_key_customer_management", "CustomerManagementGuid");

            //Act
            var response = await helper.VerifyMobileAsync("B3988460-F283-4D44-8A5E-58EB7C909B39", "http://customer-management-service-api.totalcoding-test1.com", "+441500000000", "PT", authorization.AccessToken);

            //Assert
            Assert.IsNotNull(response);
        }
        public async Task <ApiKeyLoginResponseContent> GetAuthorizationAsync(ApiKeys key)
        {
            DateTime now = DateTime.Now;
            ApiKeyLoginResponseContent response = (ApiKeyLoginResponseContent)HttpContext.Current.Session["authorization"];

            if (response == null || response.Expires <= now)
            {
                response = (ApiKeyLoginResponseContent)await apiService.ApiKeyLoginAsync(key);

                HttpContext.Current.Session["authorization"] = (ApiKeyLoginResponseContent)response;
            }
            return(response);
        }