use of com.hyperwallet.clientsdk.util.HyperwalletApiClient in project java-sdk by hyperwallet.
the class HyperwalletTest method testCreateBankCard_noType.
@Test
public void testCreateBankCard_noType() throws Exception {
HyperwalletBankCard bankCard = new HyperwalletBankCard();
bankCard.setUserToken("test-user-token");
bankCard.setStatus(HyperwalletBankCard.Status.ACTIVATED);
bankCard.setCreatedOn(new Date());
bankCard.setCardType(HyperwalletBankCard.CardType.DEBIT);
bankCard.setTransferMethodCountry("test-transfer-method-country");
bankCard.setTransferMethodCurrency("test-transfer-method-currency");
bankCard.setCardNumber("test-card-number");
bankCard.setCardBrand(HyperwalletBankCard.Brand.VISA);
bankCard.setDateOfExpiry(new Date());
bankCard.setCvv("cvv");
HyperwalletBankCard bankCardResponse = new HyperwalletBankCard();
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(bankCardResponse);
HyperwalletBankCard resp = client.createBankCard(bankCard);
assertThat(resp, is(equalTo(bankCardResponse)));
ArgumentCaptor<HyperwalletBankCard> argument = ArgumentCaptor.forClass(HyperwalletBankCard.class);
Mockito.verify(mockApiClient).post(ArgumentMatchers.eq("https://api.sandbox.hyperwallet.com/rest/v4/users/test-user-token/bank-cards"), argument.capture(), ArgumentMatchers.eq(bankCard.getClass()));
HyperwalletBankCard apiClientBankCard = argument.getValue();
assertThat(apiClientBankCard, is(notNullValue()));
assertThat(apiClientBankCard.getType(), is(equalTo(HyperwalletBankCard.Type.BANK_CARD)));
assertThat(apiClientBankCard.getStatus(), is(nullValue()));
assertThat(apiClientBankCard.getCreatedOn(), is(nullValue()));
assertThat(apiClientBankCard.getCardType(), is(nullValue()));
assertThat(apiClientBankCard.getCardBrand(), is(nullValue()));
}
use of com.hyperwallet.clientsdk.util.HyperwalletApiClient in project java-sdk by hyperwallet.
the class HyperwalletTest method testListVenmoAccountStatusTransitions_withSomeParameters.
@Test
public void testListVenmoAccountStatusTransitions_withSomeParameters() 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.sortBy("test-sort-by").createdBefore(convertStringToDate("2020-08-20T23:20:26Z"));
Mockito.when(mockApiClient.get(ArgumentMatchers.anyString(), ArgumentMatchers.any(TypeReference.class))).thenReturn(response);
HyperwalletList<HyperwalletStatusTransition> resp = client.listVenmoAccountStatusTransitions("test-user-token", "test-venmo-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/venmo-accounts/test-venmo-account-token/status" + "-transitions?createdBefore=2020-08-20T23:20: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 testListReceiptsForPrepaidCard_withParameters.
@Test
public void testListReceiptsForPrepaidCard_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.listReceiptsForPrepaidCard("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/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));
}
use of com.hyperwallet.clientsdk.util.HyperwalletApiClient in project java-sdk by hyperwallet.
the class HyperwalletTest method testListBalancesForProgramAccount_withParameters.
@Test
public void testListBalancesForProgramAccount_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).currency("test-currency");
Mockito.when(mockApiClient.get(ArgumentMatchers.anyString(), ArgumentMatchers.any(TypeReference.class))).thenReturn(response);
HyperwalletList<HyperwalletBalance> resp = client.listBalancesForAccount("test-prg-token", "test-acct-token", options);
assertThat(resp, is(equalTo(response)));
Mockito.verify(mockApiClient).get(ArgumentMatchers.eq("https://api.sandbox.hyperwallet.com/rest/v4/programs/test-prg-token/accounts/test-acct-token/balances?currency=test" + "-currency&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 testGetTransfer_successful.
@Test
public void testGetTransfer_successful() throws Exception {
HyperwalletTransfer transfer = new HyperwalletTransfer();
Hyperwallet client = new Hyperwallet("test-username", "test-password");
HyperwalletApiClient mockApiClient = createAndInjectHyperwalletApiClientMock(client);
Mockito.when(mockApiClient.get(ArgumentMatchers.anyString(), ArgumentMatchers.any(Class.class))).thenReturn(transfer);
HyperwalletTransfer resp = client.getTransfer("test-transfer-token");
assertThat(resp, is(equalTo(transfer)));
Mockito.verify(mockApiClient).get("https://api.sandbox.hyperwallet.com/rest/v4/transfers/test-transfer-token", transfer.getClass());
}
Aggregations