Subversion Repositories SmartDukaan

Rev

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

Rev 33359 Rev 33364
Line 3... Line 3...
3
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
3
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
4
import com.spice.profitmandi.common.util.Utils;
4
import com.spice.profitmandi.common.util.Utils;
5
import com.spice.profitmandi.dao.entity.transaction.FofoSidbiSanction;
5
import com.spice.profitmandi.dao.entity.transaction.FofoSidbiSanction;
6
import com.spice.profitmandi.dao.repository.dtr.CreditAccountRepository;
6
import com.spice.profitmandi.dao.repository.dtr.CreditAccountRepository;
7
import com.spice.profitmandi.dao.repository.transaction.FofoSidbiSanctionRepository;
7
import com.spice.profitmandi.dao.repository.transaction.FofoSidbiSanctionRepository;
-
 
8
import com.spice.profitmandi.service.transaction.SDCreditService;
8
import com.spice.profitmandi.service.wallet.WalletService;
9
import com.spice.profitmandi.service.wallet.WalletService;
9
import in.shop2020.model.v1.order.WalletReferenceType;
10
import in.shop2020.model.v1.order.WalletReferenceType;
10
import org.apache.logging.log4j.LogManager;
11
import org.apache.logging.log4j.LogManager;
11
import org.springframework.beans.factory.annotation.Autowired;
12
import org.springframework.beans.factory.annotation.Autowired;
12
import org.springframework.stereotype.Component;
13
import org.springframework.stereotype.Component;
Line 129... Line 130...
129
    }
130
    }
130
 
131
 
131
    @Autowired
132
    @Autowired
132
    WalletService walletService;
133
    WalletService walletService;
133
 
134
 
-
 
135
    @Autowired
-
 
136
    SDCreditService sdCreditService;
-
 
137
 
134
    public void issueLimit(FofoSidbiSanction fofoSidbiSanction) throws ProfitMandiBusinessException {
138
    public void issueLimit(FofoSidbiSanction fofoSidbiSanction) throws ProfitMandiBusinessException {
135
        if (fofoSidbiSanction.getIssuedOn() != null) {
139
        if (fofoSidbiSanction.getIssuedOn() != null) {
136
            throw new ProfitMandiBusinessException("Sidbi Sanction Issue",
140
            throw new ProfitMandiBusinessException("Sidbi Sanction Issue",
137
                    "Party - " + fofoSidbiSanction.getFofoId() + " - " + fofoSidbiSanction.getLoanAmount(), "");
141
                    "Party - " + fofoSidbiSanction.getFofoId() + " - " + fofoSidbiSanction.getLoanAmount(), "");
138
        }
142
        }
139
        fofoSidbiSanction.setIssuedOn(fofoSidbiSanction.getCreatedOn().plusDays(2));
143
        fofoSidbiSanction.setIssuedOn(fofoSidbiSanction.getCreatedOn().plusDays(2));
140
        double deductions = this.getProcessingDeductions(fofoSidbiSanction);
144
        double deductions = this.getProcessingDeductions(fofoSidbiSanction);
141
        walletService.consumeAmountFromWallet(fofoSidbiSanction.getFofoId(), fofoSidbiSanction.getId(), WalletReferenceType.ADVANCE_SECURITY, "Deducted to fund advance", (float)deductions, fofoSidbiSanction.getCreatedOn(), true);
145
        walletService.consumeAmountFromWallet(fofoSidbiSanction.getFofoId(), fofoSidbiSanction.getId(), WalletReferenceType.ADVANCE_SECURITY, "Deducted to fund advance", (float) deductions, fofoSidbiSanction.getCreatedOn(), true);
-
 
146
        try {
-
 
147
            sdCreditService.fundWallet(fofoSidbiSanction.getFofoId());
-
 
148
        } catch(Exception e) {
-
 
149
            LOGGER.info("Could not fund wallet for - ", fofoSidbiSanction.getFofoId());
-
 
150
        }
142
    }
151
    }
143
}
152
}