Subversion Repositories SmartDukaan

Rev

Rev 34752 | Rev 35828 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 34752 Rev 34966
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;
-
 
4
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
3
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
5
import com.spice.profitmandi.common.model.CustomRetailer;
4
import com.spice.profitmandi.common.model.CustomRetailer;
6
import com.spice.profitmandi.common.model.ProfitMandiConstants;
5
import com.spice.profitmandi.common.model.ProfitMandiConstants;
7
import com.spice.profitmandi.common.util.FileUtil;
6
import com.spice.profitmandi.common.util.FileUtil;
8
import com.spice.profitmandi.common.util.FormattingUtils;
-
 
9
import com.spice.profitmandi.dao.entity.dtr.UserAccount;
7
import com.spice.profitmandi.dao.entity.dtr.UserAccount;
10
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
8
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
11
import com.spice.profitmandi.dao.entity.transaction.AddWalletRequest;
9
import com.spice.profitmandi.dao.entity.transaction.AddWalletRequest;
12
import com.spice.profitmandi.dao.entity.transaction.ManualPaymentType;
10
import com.spice.profitmandi.dao.entity.transaction.ManualPaymentType;
13
import com.spice.profitmandi.dao.entity.transaction.UserWallet;
11
import com.spice.profitmandi.dao.entity.transaction.UserWallet;
Line 90... Line 88...
90
        if (Math.round(amount) == 0)
88
        if (Math.round(amount) == 0)
91
            return;
89
            return;
92
        UserWallet userWallet = userWalletRepository.selectByRetailerId(retailerId);
90
        UserWallet userWallet = userWalletRepository.selectByRetailerId(retailerId);
93
        int walletAmount = this.getWalletAmount(retailerId);
91
        int walletAmount = this.getWalletAmount(retailerId);
94
        userWallet.setAmount(walletAmount + Math.round(amount));
92
        userWallet.setAmount(walletAmount + Math.round(amount));
95
        if (amount > 0) {
-
 
96
            notificationService.sendNotification(retailerId, "walletcredit", MessageType.wallet, "Rs." + FormattingUtils.formatDecimal(amount) + " credited in SD Wallet", description);
-
 
97
        }
-
 
98
        this.createUserWalletHistory(Math.round(amount), userWallet.getId(), referenceId, referenceType, description, businessTime);
93
        this.createUserWalletHistory(Math.round(amount), userWallet.getId(), referenceId, referenceType, description, businessTime);
99
    }
94
    }
100
 
95
 
101
    @Override
96
    @Override
102
    public void consumeAmountFromWallet(int retailerId, int referenceId, WalletReferenceType referenceType,
97
    public void consumeAmountFromWallet(int retailerId, int referenceId, WalletReferenceType referenceType,