use of com.hyperwallet.clientsdk.util.HyperwalletApiClient in project java-sdk by hyperwallet.
the class HyperwalletTest method testListBankCards_withParameters.
@Test
public void testListBankCards_withParameters() throws Exception {
HyperwalletList<HyperwalletBankCard> response = new HyperwalletList<HyperwalletBankCard>();
Hyperwallet client = new Hyperwallet("test-username", "test-password");
HyperwalletApiClient mockApiClient = createAndInjectHyperwalletApiClientMock(client);
HyperwalletBankCardListPaginationOptions options = new HyperwalletBankCardListPaginationOptions();
options.status(HyperwalletBankCard.Status.ACTIVATED).sortBy("test-sort-by").limit(10).createdAfter(convertStringToDate("2016-06-29T17:58:26Z")).createdBefore(convertStringToDate("2019-06-29T17:58:26Z"));
Mockito.when(mockApiClient.get(ArgumentMatchers.anyString(), ArgumentMatchers.any(TypeReference.class))).thenReturn(response);
HyperwalletList<HyperwalletBankCard> resp = client.listBankCards("test-user-token", options);
assertThat(resp, is(equalTo(response)));
Mockito.verify(mockApiClient).get(ArgumentMatchers.eq("https://api.sandbox.hyperwallet.com/rest/v4/users/test-user-token/bank-cards?createdAfter=2016-06-29T17:58:26Z" + "&createdBefore=2019-06-29T17:58:26Z&sortBy=test-sort-by&limit=10&status=ACTIVATED"), ArgumentMatchers.any(TypeReference.class));
}
use of com.hyperwallet.clientsdk.util.HyperwalletApiClient in project java-sdk by hyperwallet.
the class HyperwalletTest method testDeactivateBusinessStakeholderStatusTransition_successful.
@Test
public void testDeactivateBusinessStakeholderStatusTransition_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.deactivateBusinessStakeholder("test-user-token", "test-stk-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/business-stakeholders/test-stk-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 testGetWebhookEvent_Successful.
@Test
public void testGetWebhookEvent_Successful() throws Exception {
HyperwalletWebhookNotification event = new HyperwalletWebhookNotification();
Hyperwallet client = new Hyperwallet("test-username", "test-password");
HyperwalletApiClient mockApiClient = createAndInjectHyperwalletApiClientMock(client);
Mockito.when(mockApiClient.get(ArgumentMatchers.anyString(), ArgumentMatchers.any(Class.class))).thenReturn(event);
HyperwalletWebhookNotification resp = client.getWebhookEvent("test-webhook-token");
assertThat(resp, is(equalTo(event)));
Mockito.verify(mockApiClient).get("https://api.sandbox.hyperwallet.com/rest/v4/webhook-notifications/test-webhook-token", event.getClass());
}
use of com.hyperwallet.clientsdk.util.HyperwalletApiClient in project java-sdk by hyperwallet.
the class HyperwalletTest method testListReceiptsForProgramAccount_noParameters.
@Test
public void testListReceiptsForProgramAccount_noParameters() throws Exception {
HyperwalletList<HyperwalletReceipt> response = new HyperwalletList<HyperwalletReceipt>();
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<HyperwalletReceipt> resp = client.listReceiptsForProgramAccount("test-program-token", "test-account-token");
assertThat(resp, is(equalTo(response)));
Mockito.verify(mockApiClient).get(ArgumentMatchers.eq("https://api.sandbox.hyperwallet.com/rest/v4/programs/test-program-token/accounts/test-account-token/receipts"), ArgumentMatchers.any(TypeReference.class));
}
use of com.hyperwallet.clientsdk.util.HyperwalletApiClient in project java-sdk by hyperwallet.
the class HyperwalletTest method testListVenmoAccountStatusTransitions_noParameters.
@Test
public void testListVenmoAccountStatusTransitions_noParameters() throws Exception {
HyperwalletList<HyperwalletStatusTransition> response = new HyperwalletList<HyperwalletStatusTransition>();
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<HyperwalletStatusTransition> resp = client.listVenmoAccountStatusTransitions("test-user-token", "test-venmo-account-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/test-venmo-account-token/status" + "-transitions"), ArgumentMatchers.any(TypeReference.class));
}
Aggregations