Skip to content

Commit 8ffdd8f

Browse files
committed
Solve issue #27: reserving money for saving goal deserialization issue
1 parent 36add7e commit 8ffdd8f

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

fintrack-api/src/main/java/com/jongsoft/finance/rest/account/AccountEditResource.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import com.jongsoft.finance.providers.AccountProvider;
77
import com.jongsoft.finance.rest.ApiDefaults;
88
import com.jongsoft.finance.rest.model.AccountResponse;
9-
import com.jongsoft.finance.security.CurrentUserProvider;
109
import io.micronaut.http.annotation.*;
1110
import io.micronaut.security.annotation.Secured;
1211
import io.micronaut.security.rules.SecurityRule;
@@ -199,13 +198,13 @@ AccountResponse adjustSavingGoal(
199198
AccountResponse reservationForSavingGoal(
200199
@PathVariable long accountId,
201200
@PathVariable long savingId,
202-
@Valid @QueryValue @Positive BigDecimal amount) {
201+
@Valid @QueryValue @Positive double amount) {
203202
accountProvider.lookup(accountId)
204203
.ifPresent(account ->
205204
account.getSavingGoals()
206205
.filter(goal -> goal.getId() == savingId)
207206
.head()
208-
.registerPayment(amount))
207+
.registerPayment(BigDecimal.valueOf(amount)))
209208
.elseThrow(() -> StatusException.notFound("No account found for id " + accountId));
210209

211210
return accountProvider.lookup(accountId)

0 commit comments

Comments
 (0)