| Line 53... |
Line 53... |
| 53 |
LOGGER.error("Wallet Balance is insufficient!");
|
53 |
LOGGER.error("Wallet Balance is insufficient!");
|
| 54 |
throw new ProfitMandiBusinessException("balance", userWallet.getAmount(), "WLT_1000");
|
54 |
throw new ProfitMandiBusinessException("balance", userWallet.getAmount(), "WLT_1000");
|
| 55 |
}
|
55 |
}
|
| 56 |
userWallet.setAmount(userWallet.getAmount() - Float.valueOf(amount).intValue());
|
56 |
userWallet.setAmount(userWallet.getAmount() - Float.valueOf(amount).intValue());
|
| 57 |
userWalletRepository.persist(userWallet);
|
57 |
userWalletRepository.persist(userWallet);
|
| 58 |
this.createUserWalletHistory(amount, userWallet.getId(), referenceId, referenceType, description);
|
58 |
this.createUserWalletHistory(-amount, userWallet.getId(), referenceId, referenceType, description);
|
| 59 |
}
|
59 |
}
|
| 60 |
|
60 |
|
| 61 |
private void createUserWalletHistory(float amount, int walletId, int referenceId, WalletReferenceType referenceType, String description){
|
61 |
private void createUserWalletHistory(float amount, int walletId, int referenceId, WalletReferenceType referenceType, String description){
|
| 62 |
UserWalletHistory userWalletHistory = new UserWalletHistory();
|
62 |
UserWalletHistory userWalletHistory = new UserWalletHistory();
|
| 63 |
userWalletHistory.setWalletId(walletId);
|
63 |
userWalletHistory.setWalletId(walletId);
|