| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.service.wallet;
|
1 |
package com.spice.profitmandi.service.wallet;
|
| 2 |
|
2 |
|
| - |
|
3 |
import com.spice.profitmandi.common.enumuration.MessageType;
|
| 3 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
4 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 4 |
import com.spice.profitmandi.common.util.FormattingUtils;
|
5 |
import com.spice.profitmandi.common.util.FormattingUtils;
|
| 5 |
import com.spice.profitmandi.dao.entity.dtr.UserAccount;
|
6 |
import com.spice.profitmandi.dao.entity.dtr.UserAccount;
|
| 6 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
7 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 7 |
import com.spice.profitmandi.dao.entity.transaction.UserWallet;
|
8 |
import com.spice.profitmandi.dao.entity.transaction.UserWallet;
|
| Line 56... |
Line 57... |
| 56 |
return;
|
57 |
return;
|
| 57 |
UserWallet userWallet = userWalletRepository.selectByRetailerId(retailerId);
|
58 |
UserWallet userWallet = userWalletRepository.selectByRetailerId(retailerId);
|
| 58 |
int walletAmount = walletService.getWalletAmount(retailerId);
|
59 |
int walletAmount = walletService.getWalletAmount(retailerId);
|
| 59 |
// userWallet = userWalletRepository.selectByIdForUpdate(userWallet.getId());
|
60 |
// userWallet = userWalletRepository.selectByIdForUpdate(userWallet.getId());
|
| 60 |
userWallet.setAmount(walletAmount + Math.round(amount));
|
61 |
userWallet.setAmount(walletAmount + Math.round(amount));
|
| 61 |
notificationService.sendNotification(retailerId, "walletcredit", "Rs. " + FormattingUtils.formatDecimal(amount) + " credited in SD Wallet", description);
|
62 |
notificationService.sendNotification(retailerId, "walletcredit", MessageType.wallet, "Rs." + FormattingUtils.formatDecimal(amount) + " credited in SD Wallet", description);
|
| 62 |
this.createUserWalletHistory(Math.round(amount), userWallet.getId(), referenceId, referenceType, description, businessTime);
|
63 |
this.createUserWalletHistory(Math.round(amount), userWallet.getId(), referenceId, referenceType, description, businessTime);
|
| 63 |
}
|
64 |
}
|
| 64 |
|
65 |
|
| 65 |
@Override
|
66 |
@Override
|
| 66 |
public void consumeAmountFromWallet(int retailerId, int referenceId, WalletReferenceType referenceType,
|
67 |
public void consumeAmountFromWallet(int retailerId, int referenceId, WalletReferenceType referenceType,
|