use of com.hyperwallet.clientsdk.util.HyperwalletApiClient in project java-sdk by hyperwallet.
the class HyperwalletTest method testListUsers_withParameters.
@Test
public void testListUsers_withParameters() throws Exception {
HyperwalletList<HyperwalletUser> response = new HyperwalletList<HyperwalletUser>();
Hyperwallet client = new Hyperwallet("test-username", "test-password");
HyperwalletApiClient mockApiClient = createAndInjectHyperwalletApiClientMock(client);
HyperwalletUsersListPaginationOptions options = new HyperwalletUsersListPaginationOptions();
options.clientUserId("CSLAJQt7bD").email("john@company.com").programToken("prg-83836cdf-2ce2-4696-8bc5-f1b86077238c").status(HyperwalletUser.Status.ACTIVATED).verificationStatus(HyperwalletUser.VerificationStatus.NOT_REQUIRED).taxVerificationStatus(TaxVerificationStatus.REQUIRED).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<HyperwalletUser> resp = client.listUsers(options);
assertThat(resp, is(equalTo(response)));
Mockito.verify(mockApiClient).get(ArgumentMatchers.eq("https://api.sandbox.hyperwallet.com/rest/v4/users?createdAfter=2016-06-29T17:58:26Z&createdBefore=2016-06-29T17:58:26Z" + "&sortBy=test-sort-by&limit=10&clientUserId=CSLAJQt7bD&email=john@company" + ".com&programToken=prg-83836cdf-2ce2-4696-8bc5-f1b86077238c&status=ACTIVATED&verificationStatus=NOT_REQUIRED" + "&taxVerificationStatus=REQUIRED"), ArgumentMatchers.any(TypeReference.class));
}
use of com.hyperwallet.clientsdk.util.HyperwalletApiClient in project java-sdk by hyperwallet.
the class HyperwalletTest method testGetTransferMethodConfiguration_successful.
@Test
public void testGetTransferMethodConfiguration_successful() throws Exception {
HyperwalletTransferMethodConfiguration configResponse = new HyperwalletTransferMethodConfiguration();
Hyperwallet client = new Hyperwallet("test-username", "test-password");
HyperwalletApiClient mockApiClient = createAndInjectHyperwalletApiClientMock(client);
Mockito.when(mockApiClient.get(ArgumentMatchers.anyString(), ArgumentMatchers.any(Class.class))).thenReturn(configResponse);
HyperwalletTransferMethodConfiguration resp = client.getTransferMethodConfiguration("test-user-token", "test-country", "test-currency", HyperwalletTransferMethod.Type.BANK_ACCOUNT, HyperwalletUser.ProfileType.INDIVIDUAL);
assertThat(resp, is(equalTo(configResponse)));
Mockito.verify(mockApiClient).get("https://api.sandbox.hyperwallet.com/rest/v4/transfer-method-configurations?userToken=test-user-token&country=test-country" + "¤cy=test-currency&type=BANK_ACCOUNT&profileType=INDIVIDUAL", configResponse.getClass());
}
use of com.hyperwallet.clientsdk.util.HyperwalletApiClient in project java-sdk by hyperwallet.
the class HyperwalletTest method testListBankCards_noParameters.
@Test
public void testListBankCards_noParameters() throws Exception {
HyperwalletList<HyperwalletBankCard> response = new HyperwalletList<HyperwalletBankCard>();
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<HyperwalletBankCard> resp = client.listBankCards("test-user-token");
assertThat(resp, is(equalTo(response)));
Mockito.verify(mockApiClient).get(ArgumentMatchers.eq("https://api.sandbox.hyperwallet.com/rest/v4/users/test-user-token/bank-cards"), ArgumentMatchers.any(TypeReference.class));
}
use of com.hyperwallet.clientsdk.util.HyperwalletApiClient in project java-sdk by hyperwallet.
the class HyperwalletTest method testCreateTransferMethod_Completed.
@Test
public void testCreateTransferMethod_Completed() throws Exception {
HyperwalletTransferMethod transferMethod = createPrePopulatedTransferMethod();
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";
HyperwalletTransferMethod resp = client.createTransferMethod(jsonCacheToken, transferMethod);
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(transferMethod.getClass()), (HashMap<String, String>) ArgumentMatchers.anyMapOf(String.class, String.class));
HyperwalletTransferMethod apiClientTransferMethod = argument.getValue();
assertThat(apiClientTransferMethod, is(notNullValue()));
assertThat(apiClientTransferMethod.getToken(), is(nullValue()));
assertThat(apiClientTransferMethod.getStatus(), is(nullValue()));
assertThat(apiClientTransferMethod.getCreatedOn(), is(nullValue()));
assertThat(apiClientTransferMethod.getCountry(), is(equalTo("test-country")));
assertThat(apiClientTransferMethod.getType(), is(equalTo(HyperwalletTransferMethod.Type.BANK_ACCOUNT)));
assertThat(apiClientTransferMethod.getTransferMethodCountry(), is(equalTo("test-transfer-method-country")));
assertThat(apiClientTransferMethod.getTransferMethodCurrency(), is(equalTo("test-transfer-method-currency")));
assertThat(apiClientTransferMethod.getBankName(), is(equalTo("test-bank-name")));
assertThat(apiClientTransferMethod.getBankId(), is(equalTo("test-bank-id")));
assertThat(apiClientTransferMethod.getBranchName(), is(equalTo("test-branch-name")));
assertThat(apiClientTransferMethod.getBranchId(), is(equalTo("test-branch-id")));
assertThat(apiClientTransferMethod.getBankAccountId(), is(equalTo("test-bank-account-id")));
assertThat(apiClientTransferMethod.getBankAccountPurpose(), is(equalTo("test-bank-account-purpose")));
assertThat(apiClientTransferMethod.getBranchAddressLine1(), is(equalTo("test-branch-address-line1")));
assertThat(apiClientTransferMethod.getBranchAddressLine2(), is(equalTo("test-branch-address-line2")));
assertThat(apiClientTransferMethod.getBranchCity(), is(equalTo("test-branch-city")));
assertThat(apiClientTransferMethod.getBranchStateProvince(), is(equalTo("test-branch-state-province")));
assertThat(apiClientTransferMethod.getBranchCountry(), is(equalTo("test-branch-country")));
assertThat(apiClientTransferMethod.getBranchPostalCode(), is(equalTo("test-branch-postal-code")));
assertThat(apiClientTransferMethod.getWireInstructions(), is(equalTo("test-wire-instructions")));
assertThat(apiClientTransferMethod.getIntermediaryBankId(), is(equalTo("test-intermediary-bank-id")));
assertThat(apiClientTransferMethod.getIntermediaryBankName(), is(equalTo("test-intermediary-bank-name")));
assertThat(apiClientTransferMethod.getIntermediaryBankAccountId(), is(equalTo("test-intermediary-bank-account-id")));
assertThat(apiClientTransferMethod.getIntermediaryBankAddressLine1(), is(equalTo("test-intermediary-bank-address-line1")));
assertThat(apiClientTransferMethod.getIntermediaryBankAddressLine2(), is(equalTo("test-intermediary-bank-address-line2")));
assertThat(apiClientTransferMethod.getIntermediaryBankCity(), is(equalTo("test-intermediary-bank-city")));
assertThat(apiClientTransferMethod.getIntermediaryBankStateProvince(), is(equalTo("test-intermediary-bank-state-province")));
assertThat(apiClientTransferMethod.getIntermediaryBankCountry(), is(equalTo("test-intermediary-bank-country")));
assertThat(apiClientTransferMethod.getIntermediaryBankPostalCode(), is(equalTo("test-intermediary-bank-postal-code")));
assertThat(apiClientTransferMethod.getCardType(), is(equalTo(HyperwalletTransferMethod.CardType.VIRTUAL)));
assertThat(apiClientTransferMethod.getCardPackage(), is(equalTo("test-card-package")));
assertThat(apiClientTransferMethod.getCardNumber(), is(equalTo("test-card-number")));
assertThat(apiClientTransferMethod.getCardBrand(), is(equalTo(HyperwalletPrepaidCard.Brand.VISA)));
assertThat(apiClientTransferMethod.getUserToken(), is(equalTo("test-user-token")));
assertThat(apiClientTransferMethod.getProfileType(), is(equalTo(HyperwalletUser.ProfileType.INDIVIDUAL)));
assertThat(apiClientTransferMethod.getBusinessName(), is(equalTo("test-business-name")));
assertThat(apiClientTransferMethod.getBusinessOperatingName(), is(equalTo("test-business-operating-name")));
assertThat(apiClientTransferMethod.getBusinessRegistrationId(), is(equalTo("test-business-registration-id")));
assertThat(apiClientTransferMethod.getBusinessRegistrationStateProvince(), is(equalTo("test-business-registration-state-province")));
assertThat(apiClientTransferMethod.getBusinessRegistrationCountry(), is(equalTo("test-business-registration-country")));
assertThat(apiClientTransferMethod.getBusinessContactRole(), is(equalTo(HyperwalletUser.BusinessContactRole.OWNER)));
assertThat(apiClientTransferMethod.getFirstName(), is(equalTo("test-first-name")));
assertThat(apiClientTransferMethod.getMiddleName(), is(equalTo("test-middle-name")));
assertThat(apiClientTransferMethod.getLastName(), is(equalTo("test-last-name")));
assertThat(apiClientTransferMethod.getCountryOfBirth(), is(equalTo("test-country-of-birth")));
assertThat(apiClientTransferMethod.getCountryOfNationality(), is(equalTo("test-country-of-nationality")));
assertThat(apiClientTransferMethod.getGender(), is(equalTo(HyperwalletUser.Gender.MALE)));
assertThat(apiClientTransferMethod.getMobileNumber(), is(equalTo("test-mobile-number")));
assertThat(apiClientTransferMethod.getEmail(), is(equalTo("test-email")));
assertThat(apiClientTransferMethod.getGovernmentId(), is(equalTo("test-government-id")));
assertThat(apiClientTransferMethod.getPassportId(), is(equalTo("test-passport-id")));
assertThat(apiClientTransferMethod.getDriversLicenseId(), is(equalTo("test-drivers-license-id")));
assertThat(apiClientTransferMethod.getAddressLine1(), is(equalTo("test-address-line1")));
assertThat(apiClientTransferMethod.getAddressLine2(), is(equalTo("test-address-line2")));
assertThat(apiClientTransferMethod.getCity(), is(equalTo("test-city")));
assertThat(apiClientTransferMethod.getStateProvince(), is(equalTo("test-state-province")));
assertThat(apiClientTransferMethod.getPostalCode(), is(equalTo("test-postal-code")));
assertThat(apiClientTransferMethod.getCountry(), is(equalTo("test-country")));
}
use of com.hyperwallet.clientsdk.util.HyperwalletApiClient in project java-sdk by hyperwallet.
the class HyperwalletTest method testCreateBankAccountStatusTransition_successful.
@Test
public void testCreateBankAccountStatusTransition_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.createBankAccountStatusTransition("test-user-token", "test-bank-account-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-accounts/test-bank-account-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()));
}
Aggregations