Skip to content

Commit

Permalink
LC-224 - Identity listener improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Maros Silady committed Sep 29, 2023
1 parent bc3634c commit 8116ab2
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,24 @@ public interface IIdentityListener {
* see {@link IExtensionContext#findIdentityVerificationApplicant(String)}
* and {@link IdentityApplicant#getIdentity()}
*/
default void onVerificationResult(String rawPayload, ApplicantCheckResult result) {
default void onIdentityVerificationResult(String rawPayload, ApplicantCheckResult result) {
}

/**
* Called when a new identity is created by the master or admin service.
*
* @param publicIdentityId Public ID of the newly created identity.
*/
default void onIdentityCreated(String publicIdentityId) {
}

/**
* Called whenever the admin or master service changes the state of an identity.
*
* @param publicIdentityId Public ID of the identity whose state has changed.
* @param stateFrom The previous state of the identity before the change.
* @param stateTo The new state of the identity after the change.
*/
default void onIdentityStateChanged(String publicIdentityId, int stateFrom, int stateTo) {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class ExampleIdentityListener implements IIdentityListener {
Logger log = LoggerFactory.getLogger(ExampleIdentityListener.class);

@Override
public void onVerificationResult(String rawPayload, ApplicantCheckResult result) {
public void onIdentityVerificationResult(String rawPayload, ApplicantCheckResult result) {
WebhookData data = parsePayload(rawPayload);
IExtensionContext ctx = IdentityExampleExtension.getExtensionContext();
IdentityApplicant applicant = ctx.findIdentityVerificationApplicant(result.getIdentityApplicantId());
Expand Down Expand Up @@ -86,6 +86,16 @@ public void onVerificationResult(String rawPayload, ApplicantCheckResult result)
new ChoiceCustomFieldValue(element.getId())));
}

@Override
public void onIdentityCreated(String publicIdentityId) {
log.info("Identity with public ID {} has been created", publicIdentityId);
}

@Override
public void onIdentityStateChanged(String publicIdentityId, int stateFrom, int stateTo) {
log.info("Identity with public ID {} changed from state {} to state {}", publicIdentityId, stateFrom, stateTo);
}

private CustomFieldDefinition findCustomFieldDefinition(Collection<CustomFieldDefinition> customFieldDefinitions,
String name,
CustomFieldDefinitionType type) {
Expand Down

0 comments on commit 8116ab2

Please sign in to comment.