diff --git a/src/main/java/com/application/munera/facades/PersonFacade.java b/src/main/java/com/application/munera/facades/PersonFacade.java index f7dd58d..3f3248c 100644 --- a/src/main/java/com/application/munera/facades/PersonFacade.java +++ b/src/main/java/com/application/munera/facades/PersonFacade.java @@ -134,7 +134,7 @@ public class PersonFacade { */ public void setCreditPaid(Person person, TreeGrid grid, Long userId) { try { - List expenses = expenseService.findExpensesWhereBeneficiary(person).stream().toList(); + List expenses = (List) expenseService.findExpensesWhereBeneficiary(person); for (Expense expense : expenses) { expense.setIsPaid(true); expenseService.update(expense, userId); diff --git a/src/main/java/com/application/munera/services/ExpenseService.java b/src/main/java/com/application/munera/services/ExpenseService.java index e98cf88..24a4503 100644 --- a/src/main/java/com/application/munera/services/ExpenseService.java +++ b/src/main/java/com/application/munera/services/ExpenseService.java @@ -216,15 +216,8 @@ public class ExpenseService { Person beneficiary = expense.getBeneficiary(); // Determine the expense type - if (payer.equals(loggedInPerson) && !beneficiary.equals(loggedInPerson)) { - // Logged-in user is the payer, and the beneficiary is someone else - expense.setExpenseType(ExpenseType.CREDIT); - } else if (!payer.equals(loggedInPerson) && beneficiary.equals(loggedInPerson)) { - // Logged-in user is the beneficiary, and the payer is someone else - expense.setExpenseType(ExpenseType.DEBIT); - } else if (payer.equals(loggedInPerson) && beneficiary.equals(loggedInPerson)) { - // Both payer and beneficiary are the logged-in user - expense.setExpenseType(ExpenseType.NONE); - } + if (payer.equals(loggedInPerson) && !beneficiary.equals(loggedInPerson)) expense.setExpenseType(ExpenseType.CREDIT); // Logged-in user is the payer, and the beneficiary is someone else + else if (!payer.equals(loggedInPerson) && beneficiary.equals(loggedInPerson)) expense.setExpenseType(ExpenseType.DEBIT); // Logged-in user is the beneficiary, and the payer is someone else + else if (payer.equals(loggedInPerson)) expense.setExpenseType(ExpenseType.NONE); // Both payer and beneficiary are the logged-in user } } \ No newline at end of file