use of com.hyperwallet.clientsdk.util.HyperwalletApiClient in project java-sdk by hyperwallet.
the class HyperwalletTest method testCreateBankCardStatusTransition_successful.
@Test
public void testCreateBankCardStatusTransition_successful() throws Exception {
HyperwalletStatusTransition transition = new HyperwalletStatusTransition();
transition.setFromStatus(HyperwalletStatusTransition.Status.ACTIVATED);
transition.setToStatus(HyperwalletStatusTransition.Status.DE_ACTIVATED);
transition.setCreatedOn(new Date());
transition.setTransition(HyperwalletStatusTransition.Status.DE_ACTIVATED);
HyperwalletStatusTransition transitionResponse = 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(transitionResponse);
HyperwalletStatusTransition resp = client.createBankCardStatusTransition("test-user-token", "test-bank-card-token", transition);
assertThat(resp, is(equalTo(transitionResponse)));
ArgumentCaptor<HyperwalletStatusTransition> argument = ArgumentCaptor.forClass(HyperwalletStatusTransition.class);
Mockito.verify(mockApiClient).post(ArgumentMatchers.eq("https://api.sandbox.hyperwallet.com/rest/v4/users/test-user-token/bank-cards/test-bank-card-token/status-transitions"), argument.capture(), ArgumentMatchers.eq(transition.getClass()));
HyperwalletStatusTransition apiClientTransition = argument.getValue();
assertThat(apiClientTransition, is(notNullValue()));
assertThat(apiClientTransition.getTransition(), is(equalTo(HyperwalletStatusTransition.Status.DE_ACTIVATED)));
assertThat(apiClientTransition.getFromStatus(), is(nullValue()));
assertThat(apiClientTransition.getToStatus(), is(nullValue()));
assertThat(apiClientTransition.getCreatedOn(), is(nullValue()));
}
use of com.hyperwallet.clientsdk.util.HyperwalletApiClient in project java-sdk by hyperwallet.
the class HyperwalletTest method testListBankAccountStatisTransitions_withParameters.
@Test
public void testListBankAccountStatisTransitions_withParameters() throws Exception {
HyperwalletList<HyperwalletStatusTransition> response = new HyperwalletList<HyperwalletStatusTransition>();
Hyperwallet client = new Hyperwallet("test-username", "test-password");
HyperwalletApiClient mockApiClient = createAndInjectHyperwalletApiClientMock(client);
HyperwalletStatusTransitionListPaginationOptions options = new HyperwalletStatusTransitionListPaginationOptions();
options.transition(Status.DE_ACTIVATED).sortBy("test-sort-by").limit(10).createdAfter(convertStringToDate("2016-06-29T17:58:26Z")).createdBefore(convertStringToDate("2016-06-29T17:58:26Z"));
Mockito.when(mockApiClient.get(ArgumentMatchers.anyString(), ArgumentMatchers.any(TypeReference.class))).thenReturn(response);
HyperwalletList<HyperwalletStatusTransition> resp = client.listBankAccountStatusTransitions("test-user-token", "test-bank-account-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-accounts/test-bank-account-token/status" + "-transitions?createdAfter=2016-06-29T17:58:26Z&createdBefore=2016-06-29T17:58:26Z&sortBy=test-sort-by&limit=10" + "&transition=DE_ACTIVATED"), ArgumentMatchers.any(TypeReference.class));
}
use of com.hyperwallet.clientsdk.util.HyperwalletApiClient in project java-sdk by hyperwallet.
the class HyperwalletTest method testListBankCards_withSomeParameters.
@Test
public void testListBankCards_withSomeParameters() 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.sortBy("test-sort-by").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?createdBefore=2019-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 testListTransferMethodConfigurations_noParameters_successful.
@Test
public void testListTransferMethodConfigurations_noParameters_successful() throws Exception {
HyperwalletList<HyperwalletTransferMethodConfiguration> response = new HyperwalletList<HyperwalletTransferMethodConfiguration>();
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<HyperwalletTransferMethodConfiguration> resp = client.listTransferMethodConfigurations("test-user-token");
assertThat(resp, is(equalTo(response)));
Mockito.verify(mockApiClient).get(ArgumentMatchers.eq("https://api.sandbox.hyperwallet.com/rest/v4/transfer-method-configurations?userToken=test-user-token"), ArgumentMatchers.any(TypeReference.class));
}
use of com.hyperwallet.clientsdk.util.HyperwalletApiClient in project java-sdk by hyperwallet.
the class HyperwalletTest method testListReceiptsForProgramAccount_withParameters.
@Test
public void testListReceiptsForProgramAccount_withParameters() throws Exception {
HyperwalletList<HyperwalletReceipt> response = new HyperwalletList<HyperwalletReceipt>();
Hyperwallet client = new Hyperwallet("test-username", "test-password");
HyperwalletApiClient mockApiClient = createAndInjectHyperwalletApiClientMock(client);
HyperwalletReceiptPaginationOptions options = new HyperwalletReceiptPaginationOptions();
options.type(HyperwalletReceipt.Type.ANNUAL_FEE).sortBy("test-sort-by").limit(10).createdAfter(convertStringToDate("2016-06-29T17:58:26Z")).createdBefore(convertStringToDate("2016-06-29T17:58:26Z"));
Mockito.when(mockApiClient.get(ArgumentMatchers.anyString(), ArgumentMatchers.any(TypeReference.class))).thenReturn(response);
HyperwalletList<HyperwalletReceipt> resp = client.listReceiptsForProgramAccount("test-program-token", "test-account-token", options);
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" + "?createdAfter=2016-06-29T17:58:26Z&createdBefore=2016-06-29T17:58:26Z&sortBy=test-sort-by&limit=10&type=ANNUAL_FEE"), ArgumentMatchers.any(TypeReference.class));
}
Aggregations