@Test public void testAddAmexUser() { Credentials testCredentials = new Credentials("plaid_test", "plaid_good"); TransactionsResponse response = plaidUserClient.addUser(testCredentials, "amex", "*****@*****.**", null); assertEquals("test_amex", response.getAccessToken()); assertTrue(response.getAccounts().size() > 0); assertTrue(response.getTransactions().size() > 0); }
@Test public void testUpdateTransactions() { plaidUserClient.setAccessToken("test_wells"); TransactionsResponse response = plaidUserClient.updateTransactions(); assertEquals("test_wells", response.getAccessToken()); assertTrue(response.getAccounts().size() > 0); assertTrue(response.getTransactions().size() > 0); }
@Test // Not testable with WireMock since HTTP PATCH is unsupported public void testUpdateCredentials() { Credentials testCredentials = new Credentials("plaid_test", "plaid_good"); plaidUserClient.setAccessToken("test_amex"); TransactionsResponse response = plaidUserClient.updateCredentials(testCredentials, "amex"); assertEquals("test_amex", response.getAccessToken()); assertTrue(response.getAccounts().size() > 0); // assertTrue(response.getTransactions().size() > 0); }
@Test public void testAddChaseUserWithMfaStep() { try { Credentials testCredentials = new Credentials("plaid_test", "plaid_good"); ConnectOptions options = new ConnectOptions(); options.setLogin(true); plaidUserClient.addUser(testCredentials, "chase", "*****@*****.**", options); } catch (PlaidMfaException e) { MfaResponse mfaResponse = e.getMfaResponse(); assertNotNull(mfaResponse); assertEquals("test_chase", mfaResponse.getAccessToken()); assertEquals("device", mfaResponse.getType()); assertTrue(mfaResponse instanceof DeviceChoiceMfaResponse); TransactionsResponse response = plaidUserClient.mfaConnectStep("1234", "chase"); assertEquals("test_chase", response.getAccessToken()); assertTrue(response.getAccounts().size() > 0); assertTrue(response.getTransactions().size() > 0); } }