From 14807796d82b1f68f06161c54508c1ab7378cdce Mon Sep 17 00:00:00 2001 From: Azmi TOUIL <42934070+AzmiTouil@users.noreply.github.com> Date: Wed, 4 Sep 2024 14:28:50 +0200 Subject: [PATCH] feat: Split Rewards and Gamification navigation items - MEED-7377 - Meeds-io/MIPs#154 (#20) Update reward admin url Ensure registration of Bouncy Castle provider. --- .../wallet/RewardSucceededPwaNotificationPlugin.java | 12 ++++++------ .../meeds/pwa/service/PushServiceConfiguration.java | 5 +++++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/pwa-plugin/src/main/java/io/meeds/pwa/plugin/wallet/RewardSucceededPwaNotificationPlugin.java b/pwa-plugin/src/main/java/io/meeds/pwa/plugin/wallet/RewardSucceededPwaNotificationPlugin.java index d725f12..fcbd2ac 100644 --- a/pwa-plugin/src/main/java/io/meeds/pwa/plugin/wallet/RewardSucceededPwaNotificationPlugin.java +++ b/pwa-plugin/src/main/java/io/meeds/pwa/plugin/wallet/RewardSucceededPwaNotificationPlugin.java @@ -39,14 +39,14 @@ @Profile("wallet") @Component public class RewardSucceededPwaNotificationPlugin implements PwaNotificationPlugin { - private static final String REWAR_ADMINISTRATION_URL = "/portal/administration/home/recognition/reward"; - private static final String TITLE_LABEL_KEY = "pwa.notification.RewardSuccessNotificationPlugin.title"; + private static final String REWARD_ADMINISTRATION_URL = "/portal/administration/home/rewards/reward"; - private static final String BODY_LABEL_KEY = "pwa.notification.RewardSuccessNotificationPlugin.body"; + private static final String TITLE_LABEL_KEY = "pwa.notification.RewardSuccessNotificationPlugin.title"; - private static final DateTimeFormatter DATE_FORMATTER = - DateTimeFormatter.ofPattern("d MMM uuuu"); + private static final String BODY_LABEL_KEY = "pwa.notification.RewardSuccessNotificationPlugin.body"; + + private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("d MMM uuuu"); @Autowired private ResourceBundleService resourceBundleService; @@ -64,7 +64,7 @@ public PwaNotificationMessage process(NotificationInfo notification, LocaleConfi notificationMessage.setBody(resourceBundleService.getSharedString(BODY_LABEL_KEY, locale) .replace("{0}", getDateLabel(notification, "rewardStartPeriodDate", locale)) .replace("{1}", getDateLabel(notification, "rewardEndPeriodDate", locale))); - notificationMessage.setUrl(REWAR_ADMINISTRATION_URL); + notificationMessage.setUrl(REWARD_ADMINISTRATION_URL); return notificationMessage; } diff --git a/pwa-service/src/main/java/io/meeds/pwa/service/PushServiceConfiguration.java b/pwa-service/src/main/java/io/meeds/pwa/service/PushServiceConfiguration.java index 1aa1a55..85a30a1 100644 --- a/pwa-service/src/main/java/io/meeds/pwa/service/PushServiceConfiguration.java +++ b/pwa-service/src/main/java/io/meeds/pwa/service/PushServiceConfiguration.java @@ -19,8 +19,10 @@ package io.meeds.pwa.service; import java.security.KeyPair; +import java.security.Security; import org.apache.commons.lang3.StringUtils; +import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -39,6 +41,9 @@ public class PushServiceConfiguration { @Bean public PushService getPushService(PwaNotificationStorage pwaNotificationStorage) throws Exception { // NOSONAR + if (Security.getProvider(BouncyCastleProvider.PROVIDER_NAME) == null) { + Security.addProvider(new BouncyCastleProvider()); + } PushService pushService = new PushService(new KeyPair(pwaNotificationStorage.getVapidPublicKey(), pwaNotificationStorage.getVapidPrivateKey())); pushService.setSubject("mailto:" + getContactEmail());