Merge pull request 'refactor: subtract betamount on blank status' (!166) from slots-fix-blank-result into main
All checks were successful
Release / Release (push) Successful in 1m7s
Release / Build Frontend Image (push) Successful in 28s
Release / Build Backend Image (push) Successful in 33s

Reviewed-on: #166
Reviewed-by: Jan K9f <jan@kjan.email>
This commit is contained in:
Phan Huy Tran 2025-05-07 12:50:19 +00:00
commit bb1134abd3
No known key found for this signature in database
GPG key ID: 944223E4D46B7412

View file

@ -52,25 +52,15 @@ public class SlotService {
private SpinResult processResult(BigDecimal betAmount, UserEntity user, Status status, Symbol winSymbol) {
SpinResult spinResult = new SpinResult();
spinResult.setStatus(status.name().toLowerCase());
switch (status) {
case WIN:
if (status == Status.WIN) {
BigDecimal winAmount = betAmount.multiply(winSymbol.getPayoutMultiplier());
this.balanceService.addFunds(user, winAmount);
spinResult.setAmount(winAmount);
spinResult.setStatus(Status.WIN.name().toLowerCase());
break;
case BLANK:
spinResult.setAmount(BigDecimal.ZERO);
spinResult.setStatus(Status.BLANK.name().toLowerCase());
break;
case LOSE:
} else {
this.balanceService.subtractFunds(user, betAmount);
spinResult.setAmount(betAmount);
spinResult.setStatus(Status.LOSE.name().toLowerCase());
break;
}
return spinResult;