Various fixes
Use URLdecode also for the descriptions of (recurring) transactions. Further fix a bug with recurring transactions that have a firstOccurrence date in the future.
This commit is contained in:
@@ -57,16 +57,17 @@ public class RecurringTransactionController {
|
|||||||
) {
|
) {
|
||||||
final String decodedFrom = ControllerUtil.urlDecode(fromAccountKey);
|
final String decodedFrom = ControllerUtil.urlDecode(fromAccountKey);
|
||||||
final String decodedTo = ControllerUtil.urlDecode(toAccountKey);
|
final String decodedTo = ControllerUtil.urlDecode(toAccountKey);
|
||||||
|
final String decodedDesc = ControllerUtil.urlDecode(description);
|
||||||
|
|
||||||
if (LOGGER.isDebugEnabled()) {
|
if (LOGGER.isDebugEnabled()) {
|
||||||
LOGGER.debug(String
|
LOGGER.debug(String
|
||||||
.format("/recurringTransactions/createRecurringTransaction got parameters: %s, %s, %s, %s, %s, " +
|
.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));
|
intervalType, firstOccurrence, lastOccurrence));
|
||||||
}
|
}
|
||||||
|
|
||||||
final ResponseReason responseReason = this.recurringTransactionService
|
final ResponseReason responseReason = this.recurringTransactionService
|
||||||
.createRecurringTransaction(decodedFrom, decodedTo, amount, description, holidayWeekendType,
|
.createRecurringTransaction(decodedFrom, decodedTo, amount, decodedDesc, holidayWeekendType,
|
||||||
intervalType, firstOccurrence, lastOccurrence);
|
intervalType, firstOccurrence, lastOccurrence);
|
||||||
|
|
||||||
if (LOGGER.isDebugEnabled()) {
|
if (LOGGER.isDebugEnabled()) {
|
||||||
|
|||||||
@@ -43,15 +43,16 @@ public class TransactionController {
|
|||||||
) {
|
) {
|
||||||
final String decodedFrom = ControllerUtil.urlDecode(fromAccountKey);
|
final String decodedFrom = ControllerUtil.urlDecode(fromAccountKey);
|
||||||
final String decodedTo = ControllerUtil.urlDecode(toAccountKey);
|
final String decodedTo = ControllerUtil.urlDecode(toAccountKey);
|
||||||
|
final String decodedDesc = ControllerUtil.urlDecode(description);
|
||||||
|
|
||||||
if (LOGGER.isDebugEnabled()) {
|
if (LOGGER.isDebugEnabled()) {
|
||||||
LOGGER.debug(String
|
LOGGER.debug(String
|
||||||
.format("/transactions/createTransaction got parameters: %s, %s, %s, %s, %s",
|
.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
|
final ResponseReason responseReason = this.transactionService
|
||||||
.createTransaction(decodedFrom, decodedTo, amount, date, description);
|
.createTransaction(decodedFrom, decodedTo, amount, date, decodedDesc);
|
||||||
|
|
||||||
if (LOGGER.isDebugEnabled()) {
|
if (LOGGER.isDebugEnabled()) {
|
||||||
LOGGER.debug(String.format("/transactions/createTransaction returns with %s", responseReason.name()));
|
LOGGER.debug(String.format("/transactions/createTransaction returns with %s", responseReason.name()));
|
||||||
|
|||||||
@@ -104,6 +104,19 @@ public class RecurringTransactionService {
|
|||||||
* @return <code>true</code> if the recurring transaction is due today, <code>false</code> otherwise
|
* @return <code>true</code> if the recurring transaction is due today, <code>false</code> otherwise
|
||||||
*/
|
*/
|
||||||
private boolean checkRecurringTransactionDueToday(RecurringTransaction recurringTransaction, LocalDate now) {
|
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 holiday = this.ruleService.isHoliday(now);
|
||||||
|
|
||||||
final boolean dueToday = recurringTransaction.getFirstOccurrence()
|
final boolean dueToday = recurringTransaction.getFirstOccurrence()
|
||||||
@@ -150,6 +163,12 @@ public class RecurringTransactionService {
|
|||||||
return false; // early return
|
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 weekend;
|
||||||
boolean holiday;
|
boolean holiday;
|
||||||
LocalDate yesterday = now;
|
LocalDate yesterday = now;
|
||||||
|
|||||||
Reference in New Issue
Block a user