use of com.hyperwallet.clientsdk.util.HyperwalletApiClient in project java-sdk by hyperwallet.
the class HyperwalletTest method testListVenmoAccount_noListOptions.
@Test
public void testListVenmoAccount_noListOptions() throws Exception {
HyperwalletList<HyperwalletVenmoAccount> response = new HyperwalletList<>();
Hyperwallet client = new Hyperwallet("test-username", "test-password");
HyperwalletApiClient mockApiClient = createAndInjectHyperwalletApiClientMock(client);
Mockito.when(mockApiClient.get(ArgumentMatchers.anyString(), ArgumentMatchers.any(TypeReference.class))).thenReturn(response);
HyperwalletList<HyperwalletVenmoAccount> resp = client.listVenmoAccounts("test-user-token");
assertThat(resp, is(equalTo(response)));
Mockito.verify(mockApiClient).get(ArgumentMatchers.eq("https://api.sandbox.hyperwallet.com/rest/v4/users/test-user-token/venmo-accounts"), ArgumentMatchers.any(TypeReference.class));
}
use of com.hyperwallet.clientsdk.util.HyperwalletApiClient in project java-sdk by hyperwallet.
the class HyperwalletTest method testGetPrepaidCardStatusTransition_successful.
@Test
public void testGetPrepaidCardStatusTransition_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.getPrepaidCardStatusTransition("test-user-token", "test-prepaid-card-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/prepaid-cards/test-prepaid-card-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 testUpdateBankAccount_successful.
@Test
public void testUpdateBankAccount_successful() throws Exception {
HyperwalletBankAccount bankAccount = new HyperwalletBankAccount();
bankAccount.setToken("test-bank-account-token");
bankAccount.setUserToken("test-user-token");
bankAccount.setFirstName("test-first-name");
bankAccount.setBusinessOperatingName("test-business-operating-name");
HyperwalletBankAccount bankAccountResponse = new HyperwalletBankAccount();
Hyperwallet client = new Hyperwallet("test-username", "test-password");
HyperwalletApiClient mockApiClient = createAndInjectHyperwalletApiClientMock(client);
Mockito.when(mockApiClient.put(ArgumentMatchers.anyString(), ArgumentMatchers.anyObject(), ArgumentMatchers.any(Class.class))).thenReturn(bankAccountResponse);
HyperwalletBankAccount resp = client.updateBankAccount(bankAccount);
assertThat(resp, is(equalTo(bankAccountResponse)));
ArgumentCaptor<HyperwalletBankAccount> argument = ArgumentCaptor.forClass(HyperwalletBankAccount.class);
Mockito.verify(mockApiClient).put(ArgumentMatchers.eq("https://api.sandbox.hyperwallet.com/rest/v4/users/test-user-token/bank-accounts/test-bank-account-token"), argument.capture(), ArgumentMatchers.eq(bankAccount.getClass()));
HyperwalletBankAccount apiClientBankAccount = argument.getValue();
assertThat(apiClientBankAccount, is(notNullValue()));
assertThat(apiClientBankAccount.getFirstName(), is(equalTo("test-first-name")));
assertThat(apiClientBankAccount.getBusinessOperatingName(), is(equalTo("test-business-operating-name")));
}
use of com.hyperwallet.clientsdk.util.HyperwalletApiClient in project java-sdk by hyperwallet.
the class HyperwalletTest method testDeactivateUserStatusTransition_successful.
@Test
public void testDeactivateUserStatusTransition_successful() throws Exception {
HyperwalletStatusTransition statusTransitionResponse = new HyperwalletStatusTransition();
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(statusTransitionResponse);
HyperwalletStatusTransition resp = client.deactivateUser("test-user-token");
assertThat(resp, is(equalTo(statusTransitionResponse)));
ArgumentCaptor<HyperwalletStatusTransition> argument = ArgumentCaptor.forClass(HyperwalletStatusTransition.class);
Mockito.verify(mockApiClient).post(ArgumentMatchers.eq("https://api.sandbox.hyperwallet.com/rest/v4/users/test-user-token/status-transitions"), argument.capture(), ArgumentMatchers.eq(statusTransitionResponse.getClass()));
HyperwalletStatusTransition apiClientStatusTransition = argument.getValue();
assertThat(apiClientStatusTransition, is(notNullValue()));
assertThat(apiClientStatusTransition.getTransition(), is(equalTo(HyperwalletStatusTransition.Status.DE_ACTIVATED)));
}
use of com.hyperwallet.clientsdk.util.HyperwalletApiClient in project java-sdk by hyperwallet.
the class HyperwalletTest method testListBusinessStakeholders_withUserTokenAndSomeOptions.
@Test
public void testListBusinessStakeholders_withUserTokenAndSomeOptions() throws Exception {
String token = "test-token";
HyperwalletList<HyperwalletBusinessStakeholder> response = new HyperwalletList<HyperwalletBusinessStakeholder>();
Hyperwallet client = new Hyperwallet("test-username", "test-password");
HyperwalletApiClient mockApiClient = createAndInjectHyperwalletApiClientMock(client);
HyperwalletPaginationOptions options = new HyperwalletPaginationOptions();
options.limit(10).createdBefore(convertStringToDate("2016-06-29T17:58:26Z"));
Mockito.when(mockApiClient.get(ArgumentMatchers.anyString(), ArgumentMatchers.any(TypeReference.class))).thenReturn(response);
HyperwalletList<HyperwalletBusinessStakeholder> resp = client.listBusinessStakeholders(token, options);
assertThat(resp, is(equalTo(response)));
Mockito.verify(mockApiClient).get(ArgumentMatchers.eq("https://api.sandbox.hyperwallet.com/rest/v4/users/" + token + "/business-stakeholders?createdBefore=2016-06-29T17:58:26Z&limit=10"), ArgumentMatchers.any(TypeReference.class));
}
Aggregations