| Line 71... |
Line 71... |
| 71 |
if (amount == 0)
|
71 |
if (amount == 0)
|
| 72 |
return;
|
72 |
return;
|
| 73 |
UserWallet userWallet = userWalletRepository.selectByRetailerId(retailerId);
|
73 |
UserWallet userWallet = userWalletRepository.selectByRetailerId(retailerId);
|
| 74 |
int walletAmount = walletService.getWalletAmount(retailerId);
|
74 |
int walletAmount = walletService.getWalletAmount(retailerId);
|
| 75 |
// userWallet = userWalletRepository.selectByIdForUpdate(userWallet.getId());
|
75 |
// userWallet = userWalletRepository.selectByIdForUpdate(userWallet.getId());
|
| 76 |
if (amount > walletAmount) {
|
76 |
if (amount > 2 && amount > walletAmount) {
|
| 77 |
LOGGER.error("Wallet Balance is insufficient!");
|
77 |
LOGGER.error("Wallet Balance is insufficient!");
|
| 78 |
throw new ProfitMandiBusinessException("balance", walletAmount, "WLT_1000");
|
78 |
throw new ProfitMandiBusinessException("balance", walletAmount, "WLT_1000");
|
| 79 |
}
|
79 |
}
|
| 80 |
userWallet.setAmount(walletAmount - Math.round(amount));
|
80 |
userWallet.setAmount(walletAmount - Math.round(amount));
|
| 81 |
userWalletRepository.persist(userWallet);
|
81 |
userWalletRepository.persist(userWallet);
|