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