use of com.hyperwallet.clientsdk.model.HyperwalletUser in project java-sdk by hyperwallet.
the class HyperwalletTest method testGetUser_successful.
@Test
public void testGetUser_successful() throws Exception {
HyperwalletUser userResponse = new HyperwalletUser();
Hyperwallet client = new Hyperwallet("test-username", "test-password");
HyperwalletApiClient mockApiClient = createAndInjectHyperwalletApiClientMock(client);
Mockito.when(mockApiClient.get(ArgumentMatchers.anyString(), ArgumentMatchers.any(Class.class))).thenReturn(userResponse);
HyperwalletUser resp = client.getUser("test-user-token");
assertThat(resp, is(equalTo(userResponse)));
Mockito.verify(mockApiClient).get("https://api.sandbox.hyperwallet.com/rest/v4/users/test-user-token", userResponse.getClass());
}
use of com.hyperwallet.clientsdk.model.HyperwalletUser 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.model.HyperwalletUser in project java-sdk by hyperwallet.
the class HyperwalletTest method getUser_withVerificationDocumentAndRejectReasons.
@Test
public void getUser_withVerificationDocumentAndRejectReasons() throws Exception {
Hyperwallet client = new Hyperwallet("test-username", "test-password");
HyperwalletApiClient mockApiClient = createAndInjectHyperwalletApiClientMock(client);
HyperwalletUser hyperwalletUser = getHyperwalletUser();
final String url = "https://api.sandbox.hyperwallet.com/rest/v4/users/" + "test-userToken";
Mockito.when(mockApiClient.get(ArgumentMatchers.eq(url), ArgumentMatchers.eq(HyperwalletUser.class))).thenReturn(hyperwalletUser);
HyperwalletUser user = client.getUser("test-userToken");
Mockito.verify(mockApiClient).get(ArgumentMatchers.eq(url), ArgumentMatchers.eq(HyperwalletUser.class));
assertThat(user.getToken(), is(hyperwalletUser.getToken()));
assertThat(user.getDocuments().size(), is(1));
assertThat(user.getDocuments().get(0).getStatus(), is("INVALID"));
assertThat(user.getDocuments().get(0).getCreatedOn(), is(hyperwalletUser.getDocuments().get(0).getCreatedOn()));
assertThat(user.getDocuments().get(0).getReasons().size(), is(1));
assertThat(user.getDocuments().get(0).getReasons().get(0).getName(), is(RejectReason.DOCUMENT_EXPIRED));
assertThat(user.getDocuments().get(0).getReasons().get(0).getDescription(), is("Document has expired"));
}
use of com.hyperwallet.clientsdk.model.HyperwalletUser in project java-sdk by hyperwallet.
the class HyperwalletTest method testListUsers_withSomeParameters.
@Test
public void testListUsers_withSomeParameters() 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.sortBy("test-sort-by").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?createdBefore=2016-06-29T17:58:26Z&sortBy=test-sort-by"), ArgumentMatchers.any(TypeReference.class));
}
use of com.hyperwallet.clientsdk.model.HyperwalletUser in project mirakl-hyperwallet-connector by paypal.
the class KYCReadyForReviewServiceImplTest method notifyBstkReadyForReview_shouldRunNotifyBusinessStakeholderToHW.
@Test
void notifyBstkReadyForReview_shouldRunNotifyBusinessStakeholderToHW() {
// @formatter:off
final KYCDocumentBusinessStakeHolderInfoModel kycDocumentOne = KYCDocumentBusinessStakeHolderInfoModel.builder().hyperwalletProgram(HYPERWALLET_PROGRAM).userToken(List.of(new MiraklAdditionalFieldValue.MiraklStringAdditionalFieldValue(KYCConstants.HYPERWALLET_USER_TOKEN_FIELD, USER_TOKEN_1))).build();
// @formatter:on
when(hyperwalletApiClientMock.updateUser(Mockito.any(HyperwalletUser.class))).thenReturn(hyperwalletUserMock);
when(hyperwalletUserMock.getClientUserId()).thenReturn(SHOP_ID);
when(hyperwalletSDKServiceMock.getHyperwalletInstance(HYPERWALLET_PROGRAM)).thenReturn(hyperwalletApiClientMock);
testObj.notifyBstkReadyForReview(Map.entry(USER_TOKEN_1, List.of(kycDocumentOne)));
verify(hyperwalletApiClientMock).updateUser(hyperwalletUserCaptor.capture());
final HyperwalletUser hyperwalletUser = hyperwalletUserCaptor.getValue();
assertThat(hyperwalletUser.getToken()).isEqualTo(USER_TOKEN_1);
assertThat(hyperwalletUser.getBusinessStakeholderVerificationStatus()).isEqualTo(HyperwalletUser.BusinessStakeholderVerificationStatus.READY_FOR_REVIEW);
}
Aggregations