use of com.hyperwallet.clientsdk.util.HyperwalletApiClient in project java-sdk by hyperwallet.
the class HyperwalletTest method testCreateTransferMethod_CompletedUserToken.
@Test
public void testCreateTransferMethod_CompletedUserToken() throws Exception {
HyperwalletTransferMethod transferMethodResponse = new HyperwalletTransferMethod();
Hyperwallet client = new Hyperwallet("test-username", "test-password");
HyperwalletApiClient mockApiClient = createAndInjectHyperwalletApiClientMock(client);
Mockito.when(mockApiClient.post(ArgumentMatchers.anyString(), ArgumentMatchers.anyObject(), ArgumentMatchers.any(Class.class), ArgumentMatchers.any(HashMap.class))).thenReturn(transferMethodResponse);
String jsonCacheToken = "token123-123-123";
String userToken = "test-user-token";
HyperwalletTransferMethod resp = client.createTransferMethod(jsonCacheToken, userToken);
assertThat(resp, is(equalTo(transferMethodResponse)));
ArgumentCaptor<HyperwalletTransferMethod> argument = ArgumentCaptor.forClass(HyperwalletTransferMethod.class);
Mockito.verify(mockApiClient).post(ArgumentMatchers.eq("https://api.sandbox.hyperwallet.com/rest/v4/users/test-user-token/transfer-methods"), argument.capture(), ArgumentMatchers.eq(resp.getClass()), (HashMap<String, String>) ArgumentMatchers.anyMapOf(String.class, String.class));
HyperwalletTransferMethod apiClientTransferMethod = argument.getValue();
assertThat(apiClientTransferMethod, is(notNullValue()));
assertThat(apiClientTransferMethod.getUserToken(), is(notNullValue()));
assertThat(apiClientTransferMethod.getToken(), is(nullValue()));
assertThat(apiClientTransferMethod.getStatus(), is(nullValue()));
assertThat(apiClientTransferMethod.getCreatedOn(), is(nullValue()));
assertThat(apiClientTransferMethod.getCountry(), is(nullValue()));
assertThat(apiClientTransferMethod.getType(), is(nullValue()));
assertThat(apiClientTransferMethod.getTransferMethodCountry(), is(nullValue()));
assertThat(apiClientTransferMethod.getTransferMethodCurrency(), is(nullValue()));
assertThat(apiClientTransferMethod.getBankName(), is(nullValue()));
assertThat(apiClientTransferMethod.getBankId(), is(nullValue()));
assertThat(apiClientTransferMethod.getBranchName(), is(nullValue()));
assertThat(apiClientTransferMethod.getBranchId(), is(nullValue()));
assertThat(apiClientTransferMethod.getBankAccountId(), is(nullValue()));
assertThat(apiClientTransferMethod.getBankAccountPurpose(), is(nullValue()));
assertThat(apiClientTransferMethod.getBranchAddressLine1(), is(nullValue()));
assertThat(apiClientTransferMethod.getBranchAddressLine2(), is(nullValue()));
assertThat(apiClientTransferMethod.getBranchCity(), is(nullValue()));
assertThat(apiClientTransferMethod.getBranchStateProvince(), is(nullValue()));
assertThat(apiClientTransferMethod.getBranchCountry(), is(nullValue()));
assertThat(apiClientTransferMethod.getBranchPostalCode(), is(nullValue()));
assertThat(apiClientTransferMethod.getWireInstructions(), is(nullValue()));
assertThat(apiClientTransferMethod.getIntermediaryBankId(), is(nullValue()));
assertThat(apiClientTransferMethod.getIntermediaryBankName(), is(nullValue()));
assertThat(apiClientTransferMethod.getIntermediaryBankAccountId(), is(nullValue()));
assertThat(apiClientTransferMethod.getIntermediaryBankAddressLine1(), is(nullValue()));
assertThat(apiClientTransferMethod.getIntermediaryBankAddressLine2(), is(nullValue()));
assertThat(apiClientTransferMethod.getIntermediaryBankCity(), is(nullValue()));
assertThat(apiClientTransferMethod.getIntermediaryBankStateProvince(), is(nullValue()));
assertThat(apiClientTransferMethod.getIntermediaryBankCountry(), is(nullValue()));
assertThat(apiClientTransferMethod.getIntermediaryBankPostalCode(), is(nullValue()));
assertThat(apiClientTransferMethod.getCardType(), is(nullValue()));
assertThat(apiClientTransferMethod.getCardPackage(), is(nullValue()));
assertThat(apiClientTransferMethod.getCardNumber(), is(nullValue()));
assertThat(apiClientTransferMethod.getCardBrand(), is(nullValue()));
assertThat(apiClientTransferMethod.getProfileType(), is(nullValue()));
assertThat(apiClientTransferMethod.getBusinessName(), is(nullValue()));
assertThat(apiClientTransferMethod.getBusinessOperatingName(), is(nullValue()));
assertThat(apiClientTransferMethod.getBusinessRegistrationId(), is(nullValue()));
assertThat(apiClientTransferMethod.getBusinessRegistrationStateProvince(), is(nullValue()));
assertThat(apiClientTransferMethod.getBusinessRegistrationCountry(), is(nullValue()));
assertThat(apiClientTransferMethod.getBusinessContactRole(), is(nullValue()));
assertThat(apiClientTransferMethod.getFirstName(), is(nullValue()));
assertThat(apiClientTransferMethod.getMiddleName(), is(nullValue()));
assertThat(apiClientTransferMethod.getLastName(), is(nullValue()));
assertThat(apiClientTransferMethod.getCountryOfBirth(), is(nullValue()));
assertThat(apiClientTransferMethod.getCountryOfNationality(), is(nullValue()));
assertThat(apiClientTransferMethod.getGender(), is(nullValue()));
assertThat(apiClientTransferMethod.getMobileNumber(), is(nullValue()));
assertThat(apiClientTransferMethod.getEmail(), is(nullValue()));
assertThat(apiClientTransferMethod.getGovernmentId(), is(nullValue()));
assertThat(apiClientTransferMethod.getPassportId(), is(nullValue()));
assertThat(apiClientTransferMethod.getDriversLicenseId(), is(nullValue()));
assertThat(apiClientTransferMethod.getAddressLine1(), is(nullValue()));
assertThat(apiClientTransferMethod.getAddressLine2(), is(nullValue()));
assertThat(apiClientTransferMethod.getCity(), is(nullValue()));
assertThat(apiClientTransferMethod.getStateProvince(), is(nullValue()));
assertThat(apiClientTransferMethod.getPostalCode(), is(nullValue()));
assertThat(apiClientTransferMethod.getCountry(), is(nullValue()));
}
use of com.hyperwallet.clientsdk.util.HyperwalletApiClient in project java-sdk by hyperwallet.
the class HyperwalletTest method testGetPaperCheck_successful.
@Test
public void testGetPaperCheck_successful() throws Exception {
HyperwalletPaperCheck paperCheckResponse = new HyperwalletPaperCheck();
Hyperwallet client = new Hyperwallet("test-username", "test-password");
HyperwalletApiClient mockApiClient = createAndInjectHyperwalletApiClientMock(client);
Mockito.when(mockApiClient.get(ArgumentMatchers.anyString(), ArgumentMatchers.any(Class.class))).thenReturn(paperCheckResponse);
HyperwalletPaperCheck resp = client.getPaperCheck("test-user-token", "test-bank-card-token");
assertThat(resp, is(equalTo(paperCheckResponse)));
Mockito.verify(mockApiClient).get("https://api.sandbox.hyperwallet.com/rest/v4/users/test-user-token/paper-checks/test-bank-card-token", paperCheckResponse.getClass());
}
use of com.hyperwallet.clientsdk.util.HyperwalletApiClient in project java-sdk by hyperwallet.
the class HyperwalletTest method testListPayPalAccountStatusTransitions_noParameters.
@Test
public void testListPayPalAccountStatusTransitions_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.listPayPalAccountStatusTransitions("test-user-token", "test-paypal-account-token");
assertThat(resp, is(equalTo(response)));
Mockito.verify(mockApiClient).get(ArgumentMatchers.eq("https://api.sandbox.hyperwallet.com/rest/v4/users/test-user-token/paypal-accounts/test-paypal-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 testListUserStatisTransitions_withParameters.
@Test
public void testListUserStatisTransitions_withParameters() throws Exception {
HyperwalletList<HyperwalletStatusTransition> response = new HyperwalletList<HyperwalletStatusTransition>();
Hyperwallet client = new Hyperwallet("test-username", "test-password");
HyperwalletApiClient mockApiClient = createAndInjectHyperwalletApiClientMock(client);
HyperwalletPaginationOptions options = new HyperwalletPaginationOptions();
options.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.listUserStatusTransitions("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/status-transitions?createdAfter=2016-06-29T17:58:26Z" + "&createdBefore=2016-06-29T17:58:26Z&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 testListBalancesForUser_withParameters.
@Test
public void testListBalancesForUser_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.listBalancesForUser("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/balances?currency=test-currency&sortBy=test-sort-by" + "&limit=10"), ArgumentMatchers.any(TypeReference.class));
}
Aggregations