Skip to content

Commit

Permalink
Issue #LR-676 fix: Support email (#1238)
Browse files Browse the repository at this point in the history
  • Loading branch information
AmiableAnil authored Jan 18, 2024
1 parent a90364a commit 77a8d26
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,8 @@ public final class JsonKey {
public static final String EDIT = "edit";
public static final String DEFAULT_FRAMEWORK = "defaultFramework";
public static final String EXTERNAL_ID_PROVIDER = "externalIdProvider";
public static final String SUNBIRD_INSTALLATION_DISPLAY_NAME =
"sunbird_installation_display_name_for_sms";
public static final String SUNBIRD_INSTALLATION_DISPLAY_NAME = "sunbird_installation_display_name_for_sms";
public static final String SUNBIRD_SUPPORT_EMAIL = "sunbird_support_email";
public static final String USR_EXT_IDNT_TABLE = "usr_external_identity";
public static final String RESPONSE_CODE = "responseCode";
public static final String OK = "ok";
Expand Down Expand Up @@ -406,6 +406,7 @@ public final class JsonKey {
public static final String RATE_LIMIT_UNIT = "unit";
public static final String RATE = "rate";
public static final String INSTALLATION_NAME = "installationName";
public static final String SUPPORT_EMAIL = "supportEmail";
public static final String LOCATION_CODES = "locationCodes";
public static final String USER_LOCATIONS = "userLocations";
public static final String USER_ID_TYPE = "userIdType";
Expand Down
2 changes: 1 addition & 1 deletion helm/learner/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ data:
telemetry_pdata_pid: {{ .Values.telemetry_pdata_pid }}
telemetry_queue_threshold_value: {{ .Values.telemetry_queue_threshold_value | quote }}
user_index_alias: {{ .Values.user_index_alias }}

sunbird_support_email: {{ .Values.sunbird_support_email }}
---
apiVersion: v1
kind: ConfigMap
Expand Down
1 change: 1 addition & 0 deletions helm/learner/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ telemetry_pdata_id: learner
telemetry_pdata_pid: learner-service
telemetry_queue_threshold_value: 100
user_index_alias: user_alias
sunbird_support_email: support@sunbird.org


## Variables that can be deprecated
Expand Down
10 changes: 5 additions & 5 deletions service/src/main/java/org/sunbird/util/otp/OTPUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,9 @@ public static boolean sendOTPViaSMS(Map<String, Object> otpMap, RequestContext c
Map<String, String> smsTemplate = new HashMap<>();
String templateId = (String) otpMap.get(JsonKey.TEMPLATE_ID);
smsTemplate.put(JsonKey.OTP, (String) otpMap.get(JsonKey.OTP));
smsTemplate.put(
JsonKey.OTP_EXPIRATION_IN_MINUTES, (String) otpMap.get(JsonKey.OTP_EXPIRATION_IN_MINUTES));
smsTemplate.put(
JsonKey.INSTALLATION_NAME,
ProjectUtil.getConfigValue(JsonKey.SUNBIRD_INSTALLATION_DISPLAY_NAME));
smsTemplate.put(JsonKey.OTP_EXPIRATION_IN_MINUTES, (String) otpMap.get(JsonKey.OTP_EXPIRATION_IN_MINUTES));
smsTemplate.put(JsonKey.INSTALLATION_NAME, ProjectUtil.getConfigValue(JsonKey.SUNBIRD_INSTALLATION_DISPLAY_NAME));
smsTemplate.put(JsonKey.SUPPORT_EMAIL, ProjectUtil.getConfigValue(JsonKey.SUNBIRD_SUPPORT_EMAIL));
String sms = "";
if (StringUtils.isBlank(templateId)) {
sms = otpService.getSmsBody(JsonKey.VERIFY_PHONE_OTP_TEMPLATE, smsTemplate, context);
Expand Down Expand Up @@ -138,6 +136,7 @@ public static Request getRequestToSendOTPViaEmail(
}
String templateId = (String) emailTemplateMap.get(JsonKey.TEMPLATE_ID);
String envName = ProjectUtil.getConfigValue(JsonKey.SUNBIRD_INSTALLATION_DISPLAY_NAME);
String supportEmail = ProjectUtil.getConfigValue(JsonKey.SUNBIRD_SUPPORT_EMAIL);
List<String> reciptientsMail = new ArrayList<>();
reciptientsMail.add((String) emailTemplateMap.get(JsonKey.EMAIL));
emailTemplateMap.put(JsonKey.RECIPIENT_EMAILS, reciptientsMail);
Expand All @@ -160,6 +159,7 @@ public static Request getRequestToSendOTPViaEmail(
emailTemplateMap.put(JsonKey.SUBJECT, JsonKey.DELETE_USER_VERIFICATION_SUBJECT);
}
emailTemplateMap.put(JsonKey.INSTALLATION_NAME, envName);
emailTemplateMap.put(JsonKey.SUPPORT_EMAIL, supportEmail);
request = new Request();
request.setOperation(ActorOperations.EMAIL_SERVICE.getValue());
request.put(JsonKey.EMAIL_REQUEST, emailTemplateMap);
Expand Down

0 comments on commit 77a8d26

Please sign in to comment.