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

Use the updated mobile number to send otp in verify mobile number on update scenario #222

Merged
merged 1 commit into from
Feb 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ public class DefaultNotificationHandler extends AbstractEventHandler {
private static final String STREAM_DEFINITION_ID = "stream" ;
private static final String NOTIFICATION_TEMPLATE_TYPE = "notification_template" ;
private static final String DEFAULT_STREAM_ID = "id_gov_notify_stream:1.0.0";
private static final String NOTIFICATION_TYPE_VERIFY_MOBILE_ON_UPDATE = "verifyMobileOnUpdate";
private static final String SEND_TO = "send-to";
private static final String MOBILE = "mobile";

@Override
public void handleEvent(Event event) throws IdentityEventException {
Expand Down Expand Up @@ -185,6 +188,14 @@ protected Map<String, String> buildNotificationData(Event event) throws Identity
}
Map<String, String> arbitraryDataFromProperties = getArbitraryDataFromProperties(event);
arbitraryDataMap.putAll(arbitraryDataFromProperties);

/* During the verify mobile number on update scenario, the otp needs to send to the 'send-to' number.
(new mobile number). So use the 'send-to' attribute value as 'mobile' number. */
if (StringUtils.equalsIgnoreCase(NOTIFICATION_TYPE_VERIFY_MOBILE_ON_UPDATE, notificationTemplateName)) {
if (arbitraryDataMap.containsKey(SEND_TO) && StringUtils.isNotBlank(arbitraryDataMap.get(SEND_TO))) {
arbitraryDataMap.put(MOBILE, arbitraryDataMap.get(SEND_TO));
}
}
return arbitraryDataMap ;
}

Expand Down
Loading