diff --git a/src/main/java/de/financer/controller/RecurringTransactionController.java b/src/main/java/de/financer/controller/RecurringTransactionController.java
index 623d6e1..6c36465 100644
--- a/src/main/java/de/financer/controller/RecurringTransactionController.java
+++ b/src/main/java/de/financer/controller/RecurringTransactionController.java
@@ -57,16 +57,17 @@ public class RecurringTransactionController {
) {
final String decodedFrom = ControllerUtil.urlDecode(fromAccountKey);
final String decodedTo = ControllerUtil.urlDecode(toAccountKey);
+ final String decodedDesc = ControllerUtil.urlDecode(description);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(String
.format("/recurringTransactions/createRecurringTransaction got parameters: %s, %s, %s, %s, %s, " +
- "%s, %s, %s", decodedFrom, decodedTo, amount, description, holidayWeekendType,
+ "%s, %s, %s", decodedFrom, decodedTo, amount, decodedDesc, holidayWeekendType,
intervalType, firstOccurrence, lastOccurrence));
}
final ResponseReason responseReason = this.recurringTransactionService
- .createRecurringTransaction(decodedFrom, decodedTo, amount, description, holidayWeekendType,
+ .createRecurringTransaction(decodedFrom, decodedTo, amount, decodedDesc, holidayWeekendType,
intervalType, firstOccurrence, lastOccurrence);
if (LOGGER.isDebugEnabled()) {
diff --git a/src/main/java/de/financer/controller/TransactionController.java b/src/main/java/de/financer/controller/TransactionController.java
index 61ab109..71de55a 100644
--- a/src/main/java/de/financer/controller/TransactionController.java
+++ b/src/main/java/de/financer/controller/TransactionController.java
@@ -43,15 +43,16 @@ public class TransactionController {
) {
final String decodedFrom = ControllerUtil.urlDecode(fromAccountKey);
final String decodedTo = ControllerUtil.urlDecode(toAccountKey);
+ final String decodedDesc = ControllerUtil.urlDecode(description);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(String
.format("/transactions/createTransaction got parameters: %s, %s, %s, %s, %s",
- decodedFrom, decodedTo, amount, date, description));
+ decodedFrom, decodedTo, amount, date, decodedDesc));
}
final ResponseReason responseReason = this.transactionService
- .createTransaction(decodedFrom, decodedTo, amount, date, description);
+ .createTransaction(decodedFrom, decodedTo, amount, date, decodedDesc);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(String.format("/transactions/createTransaction returns with %s", responseReason.name()));
diff --git a/src/main/java/de/financer/service/RecurringTransactionService.java b/src/main/java/de/financer/service/RecurringTransactionService.java
index 4af4ce9..4c5a7bb 100644
--- a/src/main/java/de/financer/service/RecurringTransactionService.java
+++ b/src/main/java/de/financer/service/RecurringTransactionService.java
@@ -104,6 +104,19 @@ public class RecurringTransactionService {
* @return true if the recurring transaction is due today, false otherwise
*/
private boolean checkRecurringTransactionDueToday(RecurringTransaction recurringTransaction, LocalDate now) {
+ // If a recurring transactions first occurrence is in the future it can never be relevant for this
+ // method. This case will be handled in the checkRecurringTransactionDueFuture method if the recurring
+ // transaction also has HolidayWeekendType#PREVIOUS_WORKDAY.
+ // If this check is not done the datesUntil(...) call will fail as it expects that the callees date is lower
+ // or equal the first parameter which is not the case for the following example:
+ // callee.firstOccurrence = 2019-05-27
+ // now = 2019-05-14
+ // now.plusDays(1) = 2019-05-15
+ // => IllegalArgumentException: 2019-05-15 < 2019-05-27
+ if (recurringTransaction.getFirstOccurrence().isAfter(now)) {
+ return false; // early return
+ }
+
final boolean holiday = this.ruleService.isHoliday(now);
final boolean dueToday = recurringTransaction.getFirstOccurrence()
@@ -150,6 +163,12 @@ public class RecurringTransactionService {
return false; // early return
}
+ // If a recurring transactions first occurrence is in the future it can never be relevant for this
+ // method, as this method handles recurring transactions due in the past.
+ if (recurringTransaction.getFirstOccurrence().isAfter(now)) {
+ return false; // early return
+ }
+
boolean weekend;
boolean holiday;
LocalDate yesterday = now;