| Line 38... |
Line 38... |
| 38 |
|
38 |
|
| 39 |
@Override
|
39 |
@Override
|
| 40 |
public void addAmountToWallet(int retailerId, int referenceId, WalletReferenceType referenceType, String description,
|
40 |
public void addAmountToWallet(int retailerId, int referenceId, WalletReferenceType referenceType, String description,
|
| 41 |
float amount) throws ProfitMandiBusinessException{
|
41 |
float amount) throws ProfitMandiBusinessException{
|
| 42 |
UserWallet userWallet = userWalletRepository.selectByRetailerId(retailerId);
|
42 |
UserWallet userWallet = userWalletRepository.selectByRetailerId(retailerId);
|
| 43 |
userWallet.setAmount(userWallet.getAmount() + Float.valueOf(amount).intValue());
|
43 |
userWallet.setAmount(userWallet.getAmount() + Math.round(retailerId));
|
| 44 |
userWalletRepository.persist(userWallet);
|
44 |
userWalletRepository.persist(userWallet);
|
| 45 |
this.createUserWalletHistory(amount, userWallet.getId(), referenceId, referenceType, description);
|
45 |
this.createUserWalletHistory(amount, userWallet.getId(), referenceId, referenceType, description);
|
| 46 |
}
|
46 |
}
|
| 47 |
|
47 |
|
| 48 |
@Override
|
48 |
@Override
|
| Line 59... |
Line 59... |
| 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);
|
| 64 |
userWalletHistory.setAmount(Float.valueOf(amount).intValue());
|
64 |
userWalletHistory.setAmount(Math.round(amount));
|
| 65 |
userWalletHistory.setReference(referenceId);
|
65 |
userWalletHistory.setReference(referenceId);
|
| 66 |
userWalletHistory.setReferenceType(referenceType);
|
66 |
userWalletHistory.setReferenceType(referenceType);
|
| 67 |
userWalletHistory.setTimestamp(LocalDateTime.now());
|
67 |
userWalletHistory.setTimestamp(LocalDateTime.now());
|
| 68 |
userWalletHistory.setDescription(description);
|
68 |
userWalletHistory.setDescription(description);
|
| 69 |
userWalletHistoryRepository.persit(userWalletHistory);
|
69 |
userWalletHistoryRepository.persit(userWalletHistory);
|