use of com.hyperwallet.clientsdk.util.HyperwalletApiClient in project java-sdk by hyperwallet.
the class HyperwalletTest method testGetVenmoAccount_successful.
@Test
public void testGetVenmoAccount_successful() throws Exception {
HyperwalletVenmoAccount venmoAccount = new HyperwalletVenmoAccount();
Hyperwallet client = new Hyperwallet("test-username", "test-password");
HyperwalletApiClient mockApiClient = createAndInjectHyperwalletApiClientMock(client);
Mockito.when(mockApiClient.get(ArgumentMatchers.anyString(), ArgumentMatchers.any(Class.class))).thenReturn(venmoAccount);
HyperwalletVenmoAccount resp = client.getVenmoAccount("test-user-token", "test-venmo-account-token");
assertThat(resp, is(equalTo(venmoAccount)));
Mockito.verify(mockApiClient).get("https://api.sandbox.hyperwallet.com/rest/v4/users/test-user-token/venmo-accounts/test-venmo-account-token", venmoAccount.getClass());
}
use of com.hyperwallet.clientsdk.util.HyperwalletApiClient in project java-sdk by hyperwallet.
the class HyperwalletTest method testGetBankAccountStatusTransition_successful.
@Test
public void testGetBankAccountStatusTransition_successful() throws Exception {
HyperwalletStatusTransition transitionResponse = new HyperwalletStatusTransition();
Hyperwallet client = new Hyperwallet("test-username", "test-password");
HyperwalletApiClient mockApiClient = createAndInjectHyperwalletApiClientMock(client);
Mockito.when(mockApiClient.get(ArgumentMatchers.anyString(), ArgumentMatchers.any(Class.class))).thenReturn(transitionResponse);
HyperwalletStatusTransition resp = client.getBankAccountStatusTransition("test-user-token", "test-bank-account-token", "test-status-transition-token");
assertThat(resp, is(equalTo(transitionResponse)));
Mockito.verify(mockApiClient).get("https://api.sandbox.hyperwallet.com/rest/v4/users/test-user-token/bank-accounts/test-bank-account-token/status-transitions" + "/test-status-transition-token", transitionResponse.getClass());
}
use of com.hyperwallet.clientsdk.util.HyperwalletApiClient in project java-sdk by hyperwallet.
the class HyperwalletTest method testListUsers_withSomeParameters.
@Test
public void testListUsers_withSomeParameters() throws Exception {
HyperwalletList<HyperwalletUser> response = new HyperwalletList<HyperwalletUser>();
Hyperwallet client = new Hyperwallet("test-username", "test-password");
HyperwalletApiClient mockApiClient = createAndInjectHyperwalletApiClientMock(client);
HyperwalletUsersListPaginationOptions options = new HyperwalletUsersListPaginationOptions();
options.sortBy("test-sort-by").createdBefore(convertStringToDate("2016-06-29T17:58:26Z"));
Mockito.when(mockApiClient.get(ArgumentMatchers.anyString(), ArgumentMatchers.any(TypeReference.class))).thenReturn(response);
HyperwalletList<HyperwalletUser> resp = client.listUsers(options);
assertThat(resp, is(equalTo(response)));
Mockito.verify(mockApiClient).get(ArgumentMatchers.eq("https://api.sandbox.hyperwallet.com/rest/v4/users?createdBefore=2016-06-29T17:58:26Z&sortBy=test-sort-by"), ArgumentMatchers.any(TypeReference.class));
}
use of com.hyperwallet.clientsdk.util.HyperwalletApiClient in project java-sdk by hyperwallet.
the class HyperwalletTest method testListBalancesForPrepaidCard_withParameters.
@Test
public void testListBalancesForPrepaidCard_withParameters() throws Exception {
HyperwalletList<HyperwalletBalance> response = new HyperwalletList<HyperwalletBalance>();
Hyperwallet client = new Hyperwallet("test-username", "test-password");
HyperwalletApiClient mockApiClient = createAndInjectHyperwalletApiClientMock(client);
HyperwalletBalanceListOptions options = new HyperwalletBalanceListOptions();
options.sortBy("test-sort-by").limit(10);
Mockito.when(mockApiClient.get(ArgumentMatchers.anyString(), ArgumentMatchers.any(TypeReference.class))).thenReturn(response);
HyperwalletList<HyperwalletBalance> resp = client.listBalancesForPrepaidCard("test-user-token", "test-prepaid-card-token", options);
assertThat(resp, is(equalTo(response)));
Mockito.verify(mockApiClient).get(ArgumentMatchers.eq("https://api.sandbox.hyperwallet.com/rest/v4/users/test-user-token/prepaid-cards/test-prepaid-card-token/balances" + "?sortBy=test-sort-by&limit=10"), ArgumentMatchers.any(TypeReference.class));
}
use of com.hyperwallet.clientsdk.util.HyperwalletApiClient in project java-sdk by hyperwallet.
the class HyperwalletTest method testCreatePaperCheck_withType.
@Test
public void testCreatePaperCheck_withType() throws Exception {
HyperwalletPaperCheck paperCheck = new HyperwalletPaperCheck();
paperCheck.setUserToken("test-user-token");
paperCheck.setType(HyperwalletPaperCheck.Type.PAPER_CHECK);
paperCheck.setStatus(HyperwalletPaperCheck.Status.ACTIVATED);
paperCheck.setCreatedOn(new Date());
paperCheck.setAddressLine1("test-address-line1");
HyperwalletPaperCheck paperCheckResponse = new HyperwalletPaperCheck();
Hyperwallet client = new Hyperwallet("test-username", "test-password");
HyperwalletApiClient mockApiClient = createAndInjectHyperwalletApiClientMock(client);
Mockito.when(mockApiClient.post(ArgumentMatchers.anyString(), ArgumentMatchers.anyObject(), ArgumentMatchers.any(Class.class))).thenReturn(paperCheckResponse);
HyperwalletPaperCheck resp = client.createPaperCheck(paperCheck);
assertThat(resp, is(equalTo(paperCheckResponse)));
ArgumentCaptor<HyperwalletPaperCheck> argument = ArgumentCaptor.forClass(HyperwalletPaperCheck.class);
Mockito.verify(mockApiClient).post(ArgumentMatchers.eq("https://api.sandbox.hyperwallet.com/rest/v4/users/test-user-token/paper-checks"), argument.capture(), ArgumentMatchers.eq(paperCheck.getClass()));
HyperwalletPaperCheck apiClienPaperCheck = argument.getValue();
assertThat(apiClienPaperCheck, is(notNullValue()));
assertThat(apiClienPaperCheck.getType(), is(equalTo(HyperwalletPaperCheck.Type.PAPER_CHECK)));
assertThat(apiClienPaperCheck.getStatus(), is(nullValue()));
assertThat(apiClienPaperCheck.getCreatedOn(), is(nullValue()));
}
Aggregations