Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #280: Implement REST client for Digital Onboarding Adapter #287

Merged
merged 10 commits into from
Jul 29, 2022

Conversation

banterCZ
Copy link
Member

No description provided.

@banterCZ banterCZ force-pushed the issues/280-onboarding-adapter-rest-client branch 2 times, most recently from 6f128ef to a60d39b Compare July 25, 2022 12:55
@banterCZ banterCZ force-pushed the issues/280-onboarding-adapter-rest-client branch from 11ce836 to 849a7a6 Compare July 27, 2022 09:23
@@ -29,14 +32,29 @@
*/
@Builder
@Getter
@ToString(exclude = "otpCode")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Covered by a unit test.

private static UserLookupRequestDto convert (final LookupUserRequest source) {
final UserLookupRequestDto target = new UserLookupRequestDto();
target.setIdentification(source.getIdentification());
target.setProcessId(null); // TODO (racansky, 2022-07-19, #299) process is not created yet, get process ID before user lookup
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be done in a separate issue #299 and a dedicated PR.

/**
* Client evaluation is in progress.
*/
CLIENT_EVALUATION,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flow - Enrollment - Identity Verification

@banterCZ banterCZ marked this pull request as ready for review July 27, 2022 10:57
@Test
void testToString() {
final String result = SendOtpCodeRequest.builder()
.otpCode("top secret")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not use any funny values as 666 or 42, the test values should be simple and natural.

I have seen a plethora of similar values in live deployments and e-mails with test failures containing all such bizarre values :-/.

idVerification.setPhase(IdentityVerificationPhase.CLIENT_EVALUATION);
idVerification.setStatus(IdentityVerificationStatus.IN_PROGRESS);
idVerification.setTimestampLastUpdated(ownerId.getTimestamp());
logger.info("Switched to wait for the client evaluation, {}, processId={}", ownerId, idVerification.getProcessId());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait or in progress

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is consistent with logger.info("Switched to wait for the presence check, {}", ownerId);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeps, could be, but that's also not nice text there.

final ParameterizedTypeReference<OtpSendResponseDto> responseType = ParameterizedTypeReference.forType(OtpSendResponseDto.class);
final OtpSendResponseDto response = restClient.post("/otp/send", requestDto, responseType).getBody();
if (response == null) {
throw new OnboardingProviderException("Unable to send otp for " + request);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing a reason of the failure?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would you like to specify? This NPE check is here because underlying Mono#block() is @Nullable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That the response was null, it failed to get one. Debug logging would be enough.

}

private Consumer<EvaluateClientResponse> createSuccessConsumer(final IdentityVerificationEntity identityVerification) {
return response -> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should use a separate service, e.g. new methods in IdentityVerificationStatusService to cover the status changes and rely on a standard transaction aware service method.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean to add a save or update method to IdentityVerificationService or IdentityVerificationStatusService to avoid usage of transactionTemplate?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeps, maybe separate those status changes to own method living in the IdentityVerificationStatusService. Currently those are just small snippets which could be more hard to test or discover.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, let's keep it this way, not to add dependency on another services. May be refactored later, if needed for tests.

@saalistaja saalistaja self-requested a review July 29, 2022 11:21
Copy link
Contributor

@saalistaja saalistaja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great for me. All my small findings resolved and explained.

@banterCZ banterCZ merged commit 81bd3d2 into develop Jul 29, 2022
@banterCZ banterCZ deleted the issues/280-onboarding-adapter-rest-client branch July 29, 2022 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants