Minimum threshold for token topup added
This commit is contained in:
@@ -80,8 +80,8 @@ public class WalletController {
|
|||||||
BigDecimal amount = new BigDecimal(request.get("amount").toString());
|
BigDecimal amount = new BigDecimal(request.get("amount").toString());
|
||||||
|
|
||||||
// ── FIX: validate amount BEFORE touching the database ──
|
// ── FIX: validate amount BEFORE touching the database ──
|
||||||
if (amount.compareTo(BigDecimal.ZERO) <= 0) {
|
if (amount.compareTo(new BigDecimal("50")) < 0) {
|
||||||
return ResponseEntity.badRequest().body(Map.of("error", "Amount must be positive"));
|
return ResponseEntity.badRequest().body(Map.of("error", "Minimum top up amount is 50 tokens"));
|
||||||
}
|
}
|
||||||
if (amount.compareTo(MAX_TOPUP) > 0) {
|
if (amount.compareTo(MAX_TOPUP) > 0) {
|
||||||
return ResponseEntity.badRequest().body(
|
return ResponseEntity.badRequest().body(
|
||||||
|
|||||||
Reference in New Issue
Block a user