Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge develop meed #586

Merged
merged 16 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
e2ff28f
feat: Manage Wallet from rewards management page - MEED-7380 - Meeds-…
AzmiTouil Sep 6, 2024
bc43fd8
feat: Suggest to create a rewarding budget - MEED-7379 - Meeds-io/MI…
AzmiTouil Sep 11, 2024
f2c9a1a
feat: List Reward cards per period - MEED-7455 - Meeds-io/MIPs#154 (#…
AzmiTouil Sep 23, 2024
dd1588c
feat: Display Detail of a rewarding for different cases - MEED-7479 -…
AzmiTouil Sep 30, 2024
27e6e95
feat: Detail of a rewarding period when reward sent + UEM - MEED-7478…
AzmiTouil Oct 1, 2024
4e7dabc
feat: Update rewarding admin extensions - MEED-7381 - Meeds-io/MIPs#1…
AzmiTouil Oct 2, 2024
bace2f8
feat: Manage Error when rewards not sent - MEED-7389 - Meeds-io/MIPs#…
AzmiTouil Oct 2, 2024
c3c19ec
feat: Distribution Forecast view when updating the budget conf - MEE…
AzmiTouil Oct 3, 2024
8c146c8
feat: Update status icons in the rewards detail - MEED-7532 - Meeds-i…
AzmiTouil Oct 3, 2024
1505c6b
feat: Update Display of rewards list + reward detail - MEED-7577 - M…
AzmiTouil Oct 3, 2024
18b1171
fix: Adjust Spring Configurations - MEED-7576 - Meeds-io/MIPs#154 (#575)
boubaker Oct 4, 2024
15f43fe
feat: Access transaction history / Transaction hash - MEED-7485 - MEE…
AzmiTouil Oct 7, 2024
cb0ad66
feat: Apply Tertiary Color to placeholder icons - MEED-7467 - Meeds-…
AzmiTouil Oct 7, 2024
d0deeb4
feat: Inform when balance below the budget - MEED-7391 - Meeds-io/MI…
AzmiTouil Oct 7, 2024
774c236
feat: Ensure Update Actual status of rewarding - MEED-7589 - Meeds-io…
AzmiTouil Oct 8, 2024
170a122
feat: Remove Useless database table / Update UT - MEED-7589 - Meeds-i…
AzmiTouil Oct 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<org.exoplatform.wallet.ert-contract.version>1.3.0</org.exoplatform.wallet.ert-contract.version>
<io.meeds.platform-ui.version>7.0.x-meed-SNAPSHOT</io.meeds.platform-ui.version>
<addon.meeds.analytics.version>7.0.x-meed-SNAPSHOT</addon.meeds.analytics.version>
<!-- Sonar properties -->
<addon.meeds.gamification.version>7.0.x-meed-SNAPSHOT</addon.meeds.gamification.version>
<!-- Sonar properties -->
<sonar.organization>meeds-io</sonar.organization>
</properties>
<dependencyManagement>
Expand All @@ -71,7 +72,13 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<type>pom</type>
<scope>import</scope>
</dependency>

<dependency>
<groupId>io.meeds.gamification</groupId>
<artifactId>gamification</artifactId>
<version>${addon.meeds.gamification.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>io.meeds.analytics</groupId>
<artifactId>analytics-parent</artifactId>
Expand Down
45 changes: 13 additions & 32 deletions wallet-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<artifactId>wallet-api</artifactId>
<name>Meeds:: Add-on:: Wallet - API</name>
<properties>
<rest.api.doc.title>Wallet Rest Api</rest.api.doc.title>
<rest.api.doc.version>1.0</rest.api.doc.version>
<rest.api.doc.description>Wallet addon rest endpoints</rest.api.doc.description>

<exo.test.coverage.ratio>0.12</exo.test.coverage.ratio>
<exo.test.coverage.ratio>0.21</exo.test.coverage.ratio>
</properties>
<dependencies>
<dependency>
Expand All @@ -42,32 +38,17 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<artifactId>analytics-api</artifactId>
<scope>provided</scope>
</dependency>
<!-- Test dependencies -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>com.vaadin.external.google</groupId>
<artifactId>android-json</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<finalName>wallet-api</finalName>
<plugins>
<plugin>
<groupId>io.openapitools.swagger</groupId>
<artifactId>swagger-maven-plugin</artifactId>
<configuration>
<useResourcePackagesChildren>true</useResourcePackagesChildren>
<resourcePackages>
<locations>org.exoplatform.wallet.rest</locations>
<locations>org.exoplatform.wallet.reward.rest</locations>
</resourcePackages>
<swaggerConfig>
<info>
<title>${rest.api.doc.title}</title>
<version>${rest.api.doc.version}</version>
<description>${rest.api.doc.description}</description>
<license>
<url>https://www.gnu.org/licenses/lgpl-3.0.en.html</url>
<name>LGPL</name>
</license>
</info>
</swaggerConfig>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package org.exoplatform.wallet.model;
package io.meeds.wallet.model;

public class AddressAlreadyInUseException extends RuntimeException {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package org.exoplatform.wallet.model;
package io.meeds.wallet.model;

import java.io.Serializable;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package org.exoplatform.wallet.model;
package io.meeds.wallet.model;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* This file is part of the Meeds project (https://meeds.io/).
*
* Copyright (C) 2020 - 2024 Meeds Lab contact@meedslab.com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package io.meeds.wallet.model;

import lombok.Data;

@Data
public class DistributionForecast {

private int participantsCount;

private int eligibleContributorsCount;

private double acceptedContributions;

private double budget;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package org.exoplatform.wallet.model.transaction;
package io.meeds.wallet.model;

import java.io.Serializable;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package org.exoplatform.wallet.model.settings;
package io.meeds.wallet.model;

import java.io.Serializable;

import org.apache.commons.beanutils.BeanUtils;

import org.exoplatform.wallet.model.ContractDetail;

import lombok.*;
import lombok.EqualsAndHashCode.Exclude;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package org.exoplatform.wallet.model.settings;
package io.meeds.wallet.model;

import java.io.Serializable;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package org.exoplatform.wallet.model.settings;
package io.meeds.wallet.model;

import java.io.Serializable;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package org.exoplatform.wallet.model.reward;
package io.meeds.wallet.model;

public enum RewardBudgetType {
COMPUTED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package org.exoplatform.wallet.model.reward;
package io.meeds.wallet.model;

import static org.exoplatform.wallet.utils.RewardUtils.formatTime;
import static io.meeds.wallet.utils.RewardUtils.formatTime;

import java.io.Serializable;
import java.time.Instant;
Expand Down Expand Up @@ -62,7 +62,7 @@ public static RewardPeriod getCurrentPeriod(RewardSettings rewardSettings) {

public static RewardPeriod getPeriodOfTime(RewardSettings rewardSettings, LocalDate date) {
ZoneId zoneId = rewardSettings == null ? ZoneId.systemDefault() : rewardSettings.zoneId();
RewardPeriodType rewardPeriodType = null;
RewardPeriodType rewardPeriodType;
if (rewardSettings == null || rewardSettings.getPeriodType() == null) {
rewardPeriodType = RewardPeriodType.DEFAULT;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,20 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package org.exoplatform.wallet.model.reward;
package io.meeds.wallet.model;

import static org.exoplatform.wallet.utils.RewardUtils.timeToSecondsAtDayStart;
import static io.meeds.wallet.utils.RewardUtils.timeToSecondsAtDayStart;

import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.Year;
import java.time.YearMonth;
import java.time.ZoneId;
import java.time.ZonedDateTime;

public enum RewardPeriodType {
WEEK, MONTH, QUARTER, SEMESTER, YEAR;
WEEK, MONTH, QUARTER;

public static final RewardPeriodType DEFAULT = MONTH;
public static final RewardPeriodType DEFAULT = WEEK;

public RewardPeriod getPeriodOfTime(LocalDate date, ZoneId zoneId) {
ZonedDateTime zonedDateTime = date.atStartOfDay(zoneId);
Expand All @@ -49,9 +48,8 @@ public RewardPeriod getPeriodOfTime(ZonedDateTime zonedDateTime) {
rewardPeriod.setEndDateInSeconds(timeToSecondsAtDayStart(firstDayOfNextWeek.toLocalDate(), zoneId));
break;
case MONTH:
YearMonth currentMonth = yearMonth;
YearMonth nextMonth = currentMonth.plusMonths(1);
rewardPeriod.setStartDateInSeconds(timeToSecondsAtDayStart(currentMonth.atDay(1), zoneId));
YearMonth nextMonth = yearMonth.plusMonths(1);
rewardPeriod.setStartDateInSeconds(timeToSecondsAtDayStart(yearMonth.atDay(1), zoneId));
rewardPeriod.setEndDateInSeconds(timeToSecondsAtDayStart(nextMonth.atDay(1), zoneId));
break;
case QUARTER:
Expand All @@ -62,18 +60,6 @@ public RewardPeriod getPeriodOfTime(ZonedDateTime zonedDateTime) {
rewardPeriod.setStartDateInSeconds(timeToSecondsAtDayStart(startQuarterMonth.atDay(1), zoneId));
rewardPeriod.setEndDateInSeconds(timeToSecondsAtDayStart(endQuarterMonth.atDay(1), zoneId));
break;
case SEMESTER:
int monthSemesterIndex = ((yearMonth.getMonthValue() - 1) / 6) * 6 + 1;

YearMonth startSemesterMonth = YearMonth.of(yearMonth.getYear(), monthSemesterIndex);
YearMonth endSemesterMonth = startSemesterMonth.plusMonths(6);
rewardPeriod.setStartDateInSeconds(timeToSecondsAtDayStart(startSemesterMonth.atDay(1), zoneId));
rewardPeriod.setEndDateInSeconds(timeToSecondsAtDayStart(endSemesterMonth.atDay(1), zoneId));
break;
case YEAR:
rewardPeriod.setStartDateInSeconds(timeToSecondsAtDayStart(Year.from(zonedDateTime).atDay(1), zoneId));
rewardPeriod.setEndDateInSeconds(timeToSecondsAtDayStart(Year.from(zonedDateTime).plusYears(1).atDay(1), zoneId));
break;
}
return rewardPeriod;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,19 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package org.exoplatform.wallet.model.reward;
package io.meeds.wallet.model;

import java.time.Instant;
import java.time.ZoneId;
import java.time.ZonedDateTime;

import org.exoplatform.wallet.utils.RewardUtils;
import io.meeds.wallet.utils.RewardUtils;

import lombok.EqualsAndHashCode;
import lombok.EqualsAndHashCode.Exclude;
import lombok.Getter;

@Getter
@EqualsAndHashCode(callSuper = true)
public class RewardPeriodWithFullDate extends RewardPeriod {

Expand All @@ -45,11 +46,9 @@ public RewardPeriodWithFullDate(RewardPeriod rewardPeriod) {
this.setTimeZone(rewardPeriod.getTimeZone());
}

@Getter
@Exclude
private String startDate;

@Getter
@Exclude
private String endDate;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package org.exoplatform.wallet.model.reward;
package io.meeds.wallet.model;

import java.io.Serializable;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package org.exoplatform.wallet.model.reward;
package io.meeds.wallet.model;

import static org.exoplatform.wallet.utils.RewardUtils.*;
import static io.meeds.wallet.utils.RewardUtils.*;

import java.util.HashSet;
import java.util.Set;
Expand All @@ -32,6 +32,8 @@ public class RewardReport {

private Set<WalletReward> rewards = new HashSet<>();

private int participationsCount;

public long getPendingTransactionCount() {
return rewards.stream()
.filter(rewardItem -> StringUtils.equals(rewardItem.getStatus(),
Expand Down Expand Up @@ -61,25 +63,25 @@ public long getTransactionsCount() {

public Set<WalletReward> getValidRewards() {
return rewards.stream()
.filter(rewardItem -> rewardItem.getTokensToSend() > 0)
.filter(rewardItem -> rewardItem.getAmount() > 0 || rewardItem.getTokensSent() > 0)
.collect(Collectors.toSet());
}

public double getRemainingTokensToSend() {
return rewards.stream()
.mapToDouble(rewardItem -> rewardItem.getTokensSent() == 0 ? rewardItem.getTokensToSend() : 0)
.mapToDouble(rewardItem -> rewardItem.getTokensSent() == 0 ? rewardItem.getAmount() : 0)
.sum();
}

public long getValidRewardCount() {
return rewards.stream()
.filter(rewardItem -> rewardItem.getTokensToSend() > 0)
.filter(rewardItem -> rewardItem.getAmount() > 0 || rewardItem.getTokensSent() > 0)
.count();
}

public double getTokensToSend() {
return rewards.stream()
.mapToDouble(WalletReward::getTokensToSend)
.mapToDouble(WalletReward::getAmount)
.sum();
}

Expand Down
Loading
Loading