From 0309f1d07e9c13316f5895ae9383c325a03ca8e7 Mon Sep 17 00:00:00 2001 From: vikrantbipin <118338417+vikrantbipin@users.noreply.github.com> Date: Thu, 1 Feb 2024 15:18:26 +0530 Subject: [PATCH] Added two parameters in course enrolment email notification (#129) * Added two parameters in course enrolment email notification --- .../coursebatch/CourseBatchNotificationActor.java | 13 +++++++++++++ .../org/sunbird/common/models/util/JsonKey.java | 7 +++++++ .../src/main/resources/externalresource.properties | 3 +++ 3 files changed, 23 insertions(+) diff --git a/course-mw/course-actors/src/main/java/org/sunbird/learner/actors/coursebatch/CourseBatchNotificationActor.java b/course-mw/course-actors/src/main/java/org/sunbird/learner/actors/coursebatch/CourseBatchNotificationActor.java index 0e0b5b742..2fe0b2fb1 100644 --- a/course-mw/course-actors/src/main/java/org/sunbird/learner/actors/coursebatch/CourseBatchNotificationActor.java +++ b/course-mw/course-actors/src/main/java/org/sunbird/learner/actors/coursebatch/CourseBatchNotificationActor.java @@ -37,6 +37,9 @@ public class CourseBatchNotificationActor extends BaseActor { .getProperty(JsonKey.SUNBIRD_COURSE_BATCH_NOTIFICATION_SIGNATURE); private static String baseUrl = PropertiesCache.getInstance().getProperty(JsonKey.SUNBIRD_WEB_URL); + private static String contentBucket = PropertiesCache.getInstance().getProperty(JsonKey.CONTENT_BUCKET); + private static String staticHostUrl = PropertiesCache.getInstance().getProperty(JsonKey.STATIC_HOST_URL); + private static String profileUpdateUrl = PropertiesCache.getInstance().getProperty(JsonKey.PROFILE_UPDATE_URL); private static String courseBatchPath = PropertiesCache.getInstance().getProperty(JsonKey.COURSE_BATCH_PATH); private UserOrgService userOrgService = UserOrgServiceImpl.getInstance(); @@ -165,6 +168,16 @@ private Map createEmailRequest( requestMap.put(JsonKey.BODY, "Notification mail Body"); requestMap.put(JsonKey.ORG_NAME, courseBatchObject.get(JsonKey.ORG_NAME)); requestMap.put(JsonKey.COURSE_LOGO_URL, contentDetails.get(JsonKey.APP_ICON)); + if (contentDetails.containsKey(JsonKey.POSTER_IMAGE)) { + String posterImageUrl = (String) contentDetails.get(JsonKey.POSTER_IMAGE); + if (posterImageUrl.contains(staticHostUrl)) { + String[] posterImageUrlArr = posterImageUrl.split("/content/"); + posterImageUrl = baseUrl + contentBucket + "/" + posterImageUrlArr[1]; + } + requestMap.put(JsonKey.COURSE_POSTER_IMAGE, posterImageUrl); + } + requestMap.put(JsonKey.PROVIDER_NAME, contentDetails.get(JsonKey.SOURCE)); + requestMap.put(JsonKey.PROFILE_UPDATE_LINK, baseUrl + profileUpdateUrl); requestMap.put(JsonKey.START_DATE, courseBatchObject.get(JsonKey.START_DATE)); requestMap.put(JsonKey.END_DATE, courseBatchObject.get(JsonKey.END_DATE)); requestMap.put(JsonKey.COURSE_ID, courseBatchObject.get(JsonKey.COURSE_ID)); diff --git a/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/java/org/sunbird/common/models/util/JsonKey.java b/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/java/org/sunbird/common/models/util/JsonKey.java index d3477d66c..449a27c5b 100644 --- a/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/java/org/sunbird/common/models/util/JsonKey.java +++ b/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/java/org/sunbird/common/models/util/JsonKey.java @@ -122,6 +122,9 @@ public final class JsonKey { public static final String CONTACT_DETAILS = "contactDetail"; public static final String CONTAINER = "container"; public static final String CONTENT = "content"; + public static final String CONTENT_BUCKET = "content_bucket"; + public static final String STATIC_HOST_URL = "static_host_url"; + public static final String PROFILE_UPDATE_URL = "profile_update_url"; public static final String CONTENT_CREATOR = "CONTENT_CREATOR"; public static final String CONTENT_ID = "contentId"; public static final String CONTENT_IDS = "contentIds"; @@ -153,6 +156,10 @@ public final class JsonKey { public static final String COURSE_IDS = "courseIds"; public static final String COURSE_LIST = "courseList"; public static final String COURSE_LOGO_URL = "courseLogoUrl"; + public static final String COURSE_POSTER_IMAGE ="coursePosterImage"; + public static final String POSTER_IMAGE ="posterImage"; + public static final String PROVIDER_NAME ="providerName"; + public static final String PROFILE_UPDATE_LINK = "profileUpdateLink"; public static final String COURSE_MANAGEMENT_DB = "courseManagement_db"; public static final String COURSE_NAME = "courseName"; public static final String COURSE_PROGRESS = "progress"; diff --git a/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/resources/externalresource.properties b/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/resources/externalresource.properties index ac96a0d20..55a4e1e10 100644 --- a/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/resources/externalresource.properties +++ b/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/resources/externalresource.properties @@ -220,3 +220,6 @@ content_hierarchy_store_key_space_name=dev_hierarchy_store kafka_cert_pre_processor_topic=dev.issue.program.certificate.request admin_program_enroll_allowed_primary_category=Program kafka_user_enrolment_event_topic=dev.user.enrolment.event +content_bucket=/content-store/content +static_host_url=https://static.karmayogiprod.nic.in +profile_update_url=/app/user-profile/details