Ejemplo n.º 1
0
        public async Task AuthUserSelection()
        {
            IHttpClientWrapper httpClient = this.GetMockHttpClient("AuthUserCiti.json", HttpStatusCode.OK, HttpMethod.Post, "connect/step");
            IPlaidClient       testClient = this.GetPlaidClient(httpClient);
            AddUserResult      result     = await testClient.AuthenticateUserAsync(new AccessToken("test_citi"), false, ApiType.Connect, "tomato", "ketchup");

            Assert.IsNotNull(result);
            Assert.IsFalse(result.IsError);
            Assert.IsFalse(result.IsMfaRequired);
            Assert.IsNull(result.AuthPrompt);
        }
Ejemplo n.º 2
0
        public async Task AuthUserSingleQuestion()
        {
            IHttpClientWrapper httpClient = this.GetMockHttpClient("AuthUserUsBank.json", HttpStatusCode.OK, HttpMethod.Post, "connect/step");
            IPlaidClient       testClient = this.GetPlaidClient(httpClient);
            AccessToken        token      = new AccessToken("test_us");
            AddUserResult      result     = await testClient.AuthenticateUserAsync(token, false, ApiType.Connect, "tomato");

            Assert.IsNotNull(result);
            Assert.IsFalse(result.IsError);
            Assert.IsFalse(result.IsMfaRequired);
            Assert.IsNotNull(result.AccessToken);
        }
Ejemplo n.º 3
0
        public async Task AuthUserCodeDeviceType()
        {
            IHttpClientWrapper httpClient = this.GetMockHttpClient("DeviceCodeMfa.json", HttpStatusCode.Created, HttpMethod.Post, "connect/step");
            IPlaidClient       testClient = this.GetPlaidClient(httpClient);
            AddUserResult      result     = await testClient.AuthenticateUserAsync(new AccessToken("test_chase"), DeliveryType.Phone);

            Assert.IsNotNull(result);
            Assert.IsFalse(result.IsError);
            Assert.IsTrue(result.IsMfaRequired);

            Assert.AreEqual(AuthType.Device, result.AuthPrompt.AuthType);
            Assert.IsNull(result.AuthPrompt.CodeDeliveryOptions);
            Assert.IsFalse(string.IsNullOrWhiteSpace(result.AuthPrompt.DeviceMessage));
        }
Ejemplo n.º 4
0
        public async Task AuthUserMultipleQuestions()
        {
            IHttpClientWrapper httpClient = this.GetMockHttpClient("QuestionMfa.json", HttpStatusCode.Created, HttpMethod.Post, "connect/step");
            IPlaidClient       testClient = this.GetPlaidClient(httpClient); testClient = this.GetPlaidClient(httpClient);
            AccessToken        token      = new AccessToken("test_us");
            AddUserResult      result     = await testClient.AuthenticateUserAsync(token, false, ApiType.Connect, "again");

            Assert.IsNotNull(result);
            Assert.IsFalse(result.IsError);
            Assert.IsTrue(result.IsMfaRequired);
            Assert.IsNotNull(result.AuthPrompt);
            Assert.IsNotNull(result.AuthPrompt.Questions);
            Assert.IsNotNull(result.AccessToken);

            httpClient = this.GetMockHttpClient("AuthUserUsBank.json", HttpStatusCode.OK, HttpMethod.Post, "connect/step");
            testClient = this.GetPlaidClient(httpClient);
            result     = await testClient.AuthenticateUserAsync(token, false, mfaValues : "tomato");

            Assert.IsNotNull(result);
            Assert.IsFalse(result.IsError);
            Assert.IsFalse(result.IsMfaRequired);
            Assert.IsNotNull(result.AccessToken);
        }
Ejemplo n.º 5
0
        public async Task AuthUserInvalidAnswer()
        {
            IHttpClientWrapper httpClient = this.GetMockHttpClient("InvalidMfa.json", HttpStatusCode.PaymentRequired, HttpMethod.Post, "connect/step");
            IPlaidClient       testClient = this.GetPlaidClient(httpClient);
            AddUserResult      result     = await testClient.AuthenticateUserAsync(new AccessToken("test_citi"), false, ApiType.Connect, "tomato");

            Assert.IsNotNull(result);
            Assert.IsTrue(result.IsError);
            Assert.IsFalse(result.IsMfaRequired);

            Assert.IsNotNull(result.Exception);
            Assert.AreEqual(ErrorCode.InvalidMfa, result.Exception.ErrorCode);
            Assert.IsFalse(string.IsNullOrWhiteSpace(result.Exception.Message));
            Assert.IsFalse(string.IsNullOrWhiteSpace(result.Exception.Resolution));
        }
Ejemplo n.º 6
0
        public async Task UpdateUserAuth()
        {
            IHttpClientWrapper httpClient = this.GetMockHttpClient("QuestionMfa.json", HttpStatusCode.Created, new HttpMethod("PATCH"));
            IPlaidClient       testClient = this.GetPlaidClient(httpClient);
            AddUserResult      result     = await testClient.UpdateUserAsync(new AccessToken("test_usaa"), BaseTestClass.TestUsername, BaseTestClass.TestPassword, "1234");

            Assert.IsNotNull(result);
            Assert.IsFalse(result.IsError);
            Assert.IsTrue(result.IsMfaRequired);
            Assert.IsNotNull(result.AuthPrompt);
            Assert.IsNotNull(result.AuthPrompt.Questions);

            httpClient = this.GetMockHttpClient("AddUserSuccess.json", HttpStatusCode.OK, new HttpMethod("PATCH"), "connect/step");
            testClient = this.GetPlaidClient(httpClient);

            result = await testClient.AuthenticateUserAsync(new AccessToken("test_usaa"), true, ApiType.Connect, "tomato");

            Assert.IsNotNull(result);
            Assert.IsFalse(result.IsError);
            Assert.IsFalse(result.IsMfaRequired);
        }