| Line 80... |
Line 80... |
| 80 |
if (amount == 0)
|
80 |
if (amount == 0)
|
| 81 |
return;
|
81 |
return;
|
| 82 |
UserWallet userWallet = userWalletRepository.selectByRetailerId(retailerId);
|
82 |
UserWallet userWallet = userWalletRepository.selectByRetailerId(retailerId);
|
| 83 |
int walletAmount = walletService.getWalletAmount(retailerId);
|
83 |
int walletAmount = walletService.getWalletAmount(retailerId);
|
| 84 |
// userWallet = userWalletRepository.selectByIdForUpdate(userWallet.getId());
|
84 |
// userWallet = userWalletRepository.selectByIdForUpdate(userWallet.getId());
|
| 85 |
if (!WalletReferenceType.DAMAGE_PROTECTION.equals(referenceType) && amount > 2 && amount > walletAmount) {
|
85 |
if (!WalletReferenceType.DAMAGE_PROTECTION.equals(referenceType) && amount > 2 && Math.floor(amount) > walletAmount) {
|
| 86 |
LOGGER.error("Wallet Balance is insufficient!");
|
86 |
LOGGER.error("Wallet Balance is insufficient!");
|
| 87 |
throw new ProfitMandiBusinessException("balance", walletAmount, "WLT_1000");
|
87 |
throw new ProfitMandiBusinessException("balance", walletAmount, "WLT_1000");
|
| 88 |
}
|
88 |
}
|
| 89 |
userWallet.setAmount(walletAmount - Math.round(amount));
|
89 |
userWallet.setAmount(walletAmount - Math.round(amount));
|
| 90 |
userWalletRepository.persist(userWallet);
|
90 |
userWalletRepository.persist(userWallet);
|