Skip to content

Commit

Permalink
Merge pull request #222 from UdeshAthukorala/mobile-verification
Browse files Browse the repository at this point in the history
Use the updated mobile number to send otp in verify mobile number on update scenario
  • Loading branch information
DMHP authored Feb 21, 2024
2 parents 3731e13 + 08fd12c commit 248f56e
Showing 1 changed file with 11 additions and 0 deletions.
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

0 comments on commit 248f56e

Please sign in to comment.