use of com.hyperwallet.clientsdk.util.HyperwalletApiClient in project java-sdk by hyperwallet.
the class HyperwalletTest method testListBankAccounts_withParameters.
@Test
public void testListBankAccounts_withParameters() throws Exception {
HyperwalletList<HyperwalletBankAccount> response = new HyperwalletList<HyperwalletBankAccount>();
Hyperwallet client = new Hyperwallet("test-username", "test-password");
HyperwalletApiClient mockApiClient = createAndInjectHyperwalletApiClientMock(client);
Mockito.when(mockApiClient.get(ArgumentMatchers.anyString(), ArgumentMatchers.any(TypeReference.class))).thenReturn(response);
HyperwalletBankAccountsListPaginationOptions options = new HyperwalletBankAccountsListPaginationOptions();
options.type(HyperwalletBankAccount.Type.BANK_ACCOUNT).status(HyperwalletBankAccount.Status.ACTIVATED).sortBy("test-sort-by").limit(10).createdAfter(convertStringToDate("2016-06-29T17:58:26Z")).createdBefore(convertStringToDate("2019-06-29T17:58:26Z"));
HyperwalletList<HyperwalletBankAccount> resp = client.listBankAccounts("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-accounts?createdAfter=2016-06-29T17:58:26Z" + "&createdBefore=2019-06-29T17:58:26Z&sortBy=test-sort-by&limit=10&type=BANK_ACCOUNT&status=ACTIVATED"), ArgumentMatchers.any(TypeReference.class));
}
use of com.hyperwallet.clientsdk.util.HyperwalletApiClient in project java-sdk by hyperwallet.
the class HyperwalletTest method testListBankAccountStatusTransitions_noParameters.
@Test
public void testListBankAccountStatusTransitions_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.listBankAccountStatusTransitions("test-user-token", "test-bank-account-token");
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"), ArgumentMatchers.any(TypeReference.class));
}
use of com.hyperwallet.clientsdk.util.HyperwalletApiClient in project java-sdk by hyperwallet.
the class HyperwalletTest method testListBusinessStakeholders_withUserTokenNoOptions.
@Test
public void testListBusinessStakeholders_withUserTokenNoOptions() throws Exception {
String token = "test-token";
HyperwalletList<HyperwalletBusinessStakeholder> response = new HyperwalletList<HyperwalletBusinessStakeholder>();
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<HyperwalletBusinessStakeholder> resp = client.listBusinessStakeholders(token);
assertThat(resp, is(equalTo(response)));
Mockito.verify(mockApiClient).get(ArgumentMatchers.eq("https://api.sandbox.hyperwallet.com/rest/v4/users/" + token + "/business-stakeholders"), ArgumentMatchers.any(TypeReference.class));
}
use of com.hyperwallet.clientsdk.util.HyperwalletApiClient in project java-sdk by hyperwallet.
the class HyperwalletTest method testCreatePayPalAccount_withType.
@Test
public void testCreatePayPalAccount_withType() throws Exception {
HyperwalletPayPalAccount payPalAccount = new HyperwalletPayPalAccount();
payPalAccount.setUserToken("test-user-token");
payPalAccount.setTransferMethodCountry("test-transfer-method-country");
payPalAccount.setTransferMethodCurrency("test-transfer-method-currency");
payPalAccount.setStatus(HyperwalletPayPalAccount.Status.ACTIVATED);
payPalAccount.setType(HyperwalletPayPalAccount.Type.PAYPAL_ACCOUNT);
payPalAccount.setEmail("test-email");
payPalAccount.setCreatedOn(new Date());
HyperwalletPayPalAccount payPalAccountResponse = new HyperwalletPayPalAccount();
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(payPalAccountResponse);
HyperwalletPayPalAccount resp = client.createPayPalAccount(payPalAccount);
assertThat(resp, is(equalTo(payPalAccountResponse)));
ArgumentCaptor<HyperwalletPayPalAccount> argument = ArgumentCaptor.forClass(HyperwalletPayPalAccount.class);
Mockito.verify(mockApiClient).post(ArgumentMatchers.eq("https://api.sandbox.hyperwallet.com/rest/v4/users/test-user-token/paypal-accounts"), argument.capture(), ArgumentMatchers.eq(payPalAccount.getClass()));
HyperwalletPayPalAccount apiPayPalAccount = argument.getValue();
assertThat(apiPayPalAccount, is(notNullValue()));
assertThat(apiPayPalAccount.getUserToken(), is(equalTo("test-user-token")));
assertThat(apiPayPalAccount.getTransferMethodCountry(), is(equalTo("test-transfer-method-country")));
assertThat(apiPayPalAccount.getTransferMethodCurrency(), is(equalTo("test-transfer-method-currency")));
assertThat(apiPayPalAccount.getStatus(), is(nullValue()));
assertThat(apiPayPalAccount.getCreatedOn(), is(nullValue()));
assertThat(apiPayPalAccount.getType(), is(HyperwalletPayPalAccount.Type.PAYPAL_ACCOUNT));
}
use of com.hyperwallet.clientsdk.util.HyperwalletApiClient in project java-sdk by hyperwallet.
the class HyperwalletTest method testListReceiptsForPrepaidCard_noParameters.
@Test
public void testListReceiptsForPrepaidCard_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.listReceiptsForPrepaidCard("test-user-token", "test-prepaid-card-token");
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" + "/receipts"), ArgumentMatchers.any(TypeReference.class));
}
Aggregations