Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
boubaker authored Sep 19, 2023
2 parents 94997c3 + 8085727 commit ed1d928
Show file tree
Hide file tree
Showing 23 changed files with 523 additions and 276 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ public static final String formatNumber(Object amount, String lang) {
lang = Locale.getDefault().getLanguage();
}
NumberFormat numberFormat = NumberFormat.getNumberInstance(new Locale(lang));
numberFormat.setMaximumFractionDigits(3);
numberFormat.setMaximumFractionDigits(2);
return numberFormat.format(Double.parseDouble(amount.toString()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import org.apache.commons.codec.binary.StringUtils;

import org.exoplatform.commons.api.notification.NotificationContext;
import org.exoplatform.commons.api.notification.NotificationMessageUtils;
import org.exoplatform.commons.api.notification.channel.template.AbstractTemplateBuilder;
import org.exoplatform.commons.api.notification.model.*;
import org.exoplatform.commons.api.notification.service.template.TemplateContext;
Expand Down Expand Up @@ -86,9 +85,6 @@ protected MessageInfo makeMessage(NotificationContext ctx) {
String rewardEndPeriodDate = (String) templateContext.get(REWARD_END_PERIOD_DATE);
templateContext.put(REWARD_END_PERIOD_DATE_FORMATTED, formatTime(Long.parseLong(rewardEndPeriodDate) - 1, zoneId, language));

String notificationRead = notification.getValueOwnerParameter(NotificationMessageUtils.READ_PORPERTY.getKey());
templateContext.put("READ", Boolean.parseBoolean(notificationRead) ? "read" : "unread");

setLastModifiedDate(notification, language, templateContext);
SocialNotificationUtils.addFooterAndFirstName(notification.getTo(), templateContext);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ public class RewardSuccessTemplateProvider extends TemplateProvider {

private RewardSuccessTemplateBuilder builder = null;

private String webTemplatePath = null;

private String pushTemplatePath = null;

private String mailTemplatePath = null;
Expand All @@ -48,7 +46,6 @@ public RewardSuccessTemplateProvider(PortalContainer container, RewardSettingsSe

this.templateBuilders.put(PLUGIN_KEY, builder);

setWebTemplatePath("war:/conf/wallet/templates/notification/web/RewardSuccessWebPlugin.gtmpl");
setMailTemplatePath("war:/conf/wallet/templates/notification/mail/RewardSuccessMailPlugin.gtmpl");
setPushTemplatePath("war:/conf/wallet/templates/notification/push/RewardSuccessPushPlugin.gtmpl");
}
Expand All @@ -60,20 +57,10 @@ public Map<PluginKey, String> getTemplateFilePathConfigs() {
return Collections.singletonMap(PLUGIN_KEY, mailTemplatePath);
} else if (StringUtils.equals(channelKey.getId(), "PUSH_CHANNEL")) {
return Collections.singletonMap(PLUGIN_KEY, pushTemplatePath);
} else if (StringUtils.equals(channelKey.getId(), "WEB_CHANNEL")) {
return Collections.singletonMap(PLUGIN_KEY, webTemplatePath);
}
return Collections.emptyMap();
}

public String getWebTemplatePath() {
return webTemplatePath;
}

public void setWebTemplatePath(String webTemplatePath) {
this.webTemplatePath = webTemplatePath;
}

public String getPushTemplatePath() {
return pushTemplatePath;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void testBuildMessage() {
new RewardSuccessTemplateProvider(container,
getService(WalletRewardSettingsService.class),
params);
templateProvider.setWebTemplatePath("jar:/template/RewardSuccessReward.gtmpl");
templateProvider.setMailTemplatePath("jar:/template/RewardSuccessReward.gtmpl");

NotificationContext ctx = NotificationContextImpl.cloneInstance();

Expand Down Expand Up @@ -99,7 +99,7 @@ private InitParams getParams() {

ValueParam valueParam = new ValueParam();
valueParam.setName("channel-id");
valueParam.setValue("WEB_CHANNEL");
valueParam.setValue("MAIL_CHANNEL");
initParams.addParam(valueParam);
return initParams;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ public void testGetTemplate() {

provider = new RewardSuccessTemplateProvider(container,
getService(WalletRewardSettingsService.class),
getParams("WEB_CHANNEL"));
getParams("MAIL_CHANNEL"));
templateFilePathConfigs = provider.getTemplateFilePathConfigs();
assertNotNull(templateFilePathConfigs);
assertEquals(1, templateFilePathConfigs.size());
template = templateFilePathConfigs.values().iterator().next();
assertEquals(provider.getWebTemplatePath(), template);
assertEquals(provider.getMailTemplatePath(), template);

provider = new RewardSuccessTemplateProvider(container,
getService(WalletRewardSettingsService.class),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import java.util.Locale;

import org.exoplatform.commons.api.notification.NotificationContext;
import org.exoplatform.commons.api.notification.NotificationMessageUtils;
import org.exoplatform.commons.api.notification.channel.template.AbstractTemplateBuilder;
import org.exoplatform.commons.api.notification.channel.template.TemplateProvider;
import org.exoplatform.commons.api.notification.model.MessageInfo;
Expand Down Expand Up @@ -82,7 +81,6 @@ protected MessageInfo makeMessage(NotificationContext ctx) {
String userUrl = notification.getValueOwnerParameter(USER_URL);
String symbol = notification.getValueOwnerParameter(SYMBOL);
String message = notification.getValueOwnerParameter(MESSAGE);
String notificationRead = notification.getValueOwnerParameter(NotificationMessageUtils.READ_PORPERTY.getKey());
String fundRequestSent = notification.getValueOwnerParameter(FUNDS_REQUEST_SENT);

RequestLifeCycle.begin(container);
Expand All @@ -100,7 +98,6 @@ protected MessageInfo makeMessage(NotificationContext ctx) {
templateContext.put("MESSAGE", message);
templateContext.put("AVATAR", avatar != null ? avatar : LinkProvider.PROFILE_DEFAULT_AVATAR_URL);
templateContext.put("NOTIFICATION_ID", notification.getId());
templateContext.put("READ", Boolean.parseBoolean(notificationRead) ? "read" : "unread");
templateContext.put("FUNDS_REQUEST_SENT", Boolean.valueOf(fundRequestSent));
setLastModifiedDate(notification, language, templateContext);
SocialNotificationUtils.addFooterAndFirstName(notification.getTo(), templateContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.apache.commons.lang3.StringUtils;

import org.exoplatform.commons.api.notification.NotificationContext;
import org.exoplatform.commons.api.notification.NotificationMessageUtils;
import org.exoplatform.commons.api.notification.channel.template.AbstractTemplateBuilder;
import org.exoplatform.commons.api.notification.channel.template.TemplateProvider;
import org.exoplatform.commons.api.notification.model.MessageInfo;
Expand Down Expand Up @@ -83,7 +82,6 @@ protected MessageInfo makeMessage(NotificationContext ctx) {
String symbol = notification.getValueOwnerParameter(SYMBOL);
String message = notification.getValueOwnerParameter(MESSAGE);
String hash = notification.getValueOwnerParameter(HASH);
String notificationRead = notification.getValueOwnerParameter(NotificationMessageUtils.READ_PORPERTY.getKey());

RequestLifeCycle.begin(container);
try {
Expand All @@ -97,7 +95,6 @@ protected MessageInfo makeMessage(NotificationContext ctx) {
templateContext.put("SYMBOL", symbol);
templateContext.put("CONTRACT_ADDRESS", contractAddress == null ? "" : contractAddress);
templateContext.put("NOTIFICATION_ID", notification.getId());
templateContext.put("READ", Boolean.parseBoolean(notificationRead) ? "read" : "unread");
templateContext.put("MESSAGE", message);
templateContext.put("HASH", hash);

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#
UINotification.label.group.Wallet=Wallet

Notification.label.types.wallet=Wallet

UINotification.title.EtherSenderNotificationPlugin=Funds sent
UINotification.label.EtherSenderNotificationPlugin=Sending funds notification
Notification.subject.EtherSenderNotificationPlugin=You have sent funds
Expand All @@ -32,6 +34,18 @@ Notification.message.AdminFundReceiverNotificationPlugin=Congratulations! The co
Notification.subject.SpaceEtherReceiverNotificationPlugin=Space Wallet has received funds
Notification.message.SpaceEtherReceiverNotificationPlugin={0} has received {1} {3} from {2}

Notification.message.FundsSpaceReceiverNotificationPlugin=Space {0} has received {1} {2}
Notification.message.FundsReceiverNotificationPlugin=You have received {0} {1}

Notification.message.FundsSpaceSentToSpaceNotificationPlugin=Space {0} has sent {1} {2} to Space {3}
Notification.message.FundsSpaceSentNotificationPlugin=Space {0} has sent {1} {2} to {3}
Notification.message.FundsSentToSpaceNotificationPlugin=You have sent {0} {1} to Space {2}
Notification.message.FundsSentNotificationPlugin=You have sent {0} {1} to {2}

Notification.message.FundsRequestNotificationPlugin={0} has requested {1} {2}
Notification.message.RewardsSentNotificationPlugin=Rewards for period {0} to {1} successfully sent
Notification.subtitle.RewardsSentNotificationPlugin=Total amount of {0} {1} for {2} members

UINotification.title.FundsRequestNotificationPlugin=Funds request received
UINotification.label.FundsRequestNotificationPlugin=Receiving funds request
Notification.subject.FundsRequestNotificationPlugin=Funds request received
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,17 +199,6 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

<external-component-plugins>
<target-component>org.exoplatform.commons.api.notification.channel.ChannelManager</target-component>
<component-plugin>
<name>web.channel.wallet.template</name>
<set-method>registerTemplateProvider</set-method>
<type>org.exoplatform.wallet.notification.provider.WebTemplateProvider</type>
<init-params>
<value-param>
<name>channel-id</name>
<value>WEB_CHANNEL</value>
</value-param>
</init-params>
</component-plugin>
<component-plugin>
<name>mail.channel.wallet.template</name>
<set-method>registerTemplateProvider</set-method>
Expand All @@ -232,17 +221,6 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
</value-param>
</init-params>
</component-plugin>
<component-plugin>
<name>web.channel.wallet.reward.template</name>
<set-method>registerTemplateProvider</set-method>
<type>org.exoplatform.wallet.reward.notification.RewardSuccessTemplateProvider</type>
<init-params>
<value-param>
<name>channel-id</name>
<value>WEB_CHANNEL</value>
</value-param>
</init-params>
</component-plugin>
<component-plugin>
<name>mail.channel.wallet.reward.template</name>
<set-method>registerTemplateProvider</set-method>
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit ed1d928

Please sign in to comment.