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