Subversion Repositories SmartDukaan

Rev

Rev 36578 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
30859 tejbeer 1
package com.spice.profitmandi.service.transaction;
2
 
3
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
4
import com.spice.profitmandi.dao.entity.transaction.Loan;
36958 amit 5
import com.spice.profitmandi.dao.entity.transaction.Order;
34288 ranu 6
import com.spice.profitmandi.dao.entity.transaction.LoanSummary;
30936 tejbeer 7
import com.spice.profitmandi.dao.entity.transaction.SDCreditRequirement;
35316 ranu 8
import com.spice.profitmandi.dao.entity.transaction.StateWiseLoanSummary;
30936 tejbeer 9
import com.spice.profitmandi.dao.enumuration.transaction.CreditRisk;
30859 tejbeer 10
import com.spice.profitmandi.dao.enumuration.transaction.LoanReferenceType;
11
import com.spice.profitmandi.dao.model.SDCreditResponseOut;
12
 
35811 amit 13
import com.spice.profitmandi.dao.model.BulkCreditSummary;
14
import com.spice.profitmandi.dao.model.CreditSummary;
15
 
34288 ranu 16
import java.math.BigDecimal;
17
import java.time.LocalDate;
18
import java.time.LocalDateTime;
19
import java.util.List;
20
import java.util.Map;
21
 
35131 amit 22
 
30859 tejbeer 23
public interface SDCreditService {
24
 
33297 amit.gupta 25
	void fundWallet(int fofoId) throws ProfitMandiBusinessException;
26
 
34731 amit.gupta 27
	void fundWallet(int fofoId, double amountToFund, String reasonToFund) throws ProfitMandiBusinessException;
28
 
33339 amit.gupta 29
	//This will create loan irrespective of sanctions and increases the overall ultization
33696 amit.gupta 30
	Loan createLoan(int fofoId, double creditAmountRequired, int freeDays, String creditReason) throws ProfitMandiBusinessException;
33339 amit.gupta 31
 
34661 ranu 32
	BlockLoanIdSanctionId createSDDirectOrder(int userId, double amountRequired, int freeCreditDays)
30859 tejbeer 33
			throws ProfitMandiBusinessException;
34
 
31518 amit.gupta 35
	BigDecimal getAvailableAmount(int fofoId);
30859 tejbeer 36
 
35394 amit 37
	BigDecimal getUtilizationAmount(int fofoId);
30859 tejbeer 38
 
31518 amit.gupta 39
	void createLoanStatement(LoanReferenceType interest, BigDecimal interestAccrued, int fofoId, int loanId,
30859 tejbeer 40
			String description, LocalDateTime businessDate);
41
 
31518 amit.gupta 42
	void addInterest(LocalDate from, LocalDate to, Loan loan, Map<LoanReferenceType, Double> loanStatusAmount);
30859 tejbeer 43
 
34453 amit.gupta 44
	SDCreditResponseOut sdDirectService(int retailerId) throws ProfitMandiBusinessException;
30859 tejbeer 45
 
31518 amit.gupta 46
	CreditRisk getCurrentRisk(SDCreditRequirement sdCreditRequirement, LocalDateTime firstBillingDate);
30936 tejbeer 47
 
31518 amit.gupta 48
	boolean isDefaultPartner(int fofoId);
30936 tejbeer 49
 
31518 amit.gupta 50
	void updateRisk();
30936 tejbeer 51
 
34727 amit.gupta 52
	List<Loan> getDefaultLoans();
30936 tejbeer 53
 
31399 tejbeer 54
	public List<Loan> getDueDateCrossLoan();
55
 
35110 ranu 56
	public List<Loan> getAllActiveLoan();
57
 
30936 tejbeer 58
	public boolean isDefaultLoan(int loanId, LocalDate time);
31020 tejbeer 59
 
32172 jai.hind 60
 
61
		LoanSummary getLoanSummary();
33419 amit.gupta 62
 
35316 ranu 63
	Map<String, StateWiseLoanSummary> getLoanSummaryStateWise() throws ProfitMandiBusinessException;
64
 
33419 amit.gupta 65
    void checkLoans();
33663 amit.gupta 66
 
67
    void createLoanForBilling(int transactionId, double invoiceAmount, String invoiceNumber) throws ProfitMandiBusinessException;
68
 
36958 amit 69
    void createLoanForBilling(int transactionId, double invoiceAmount, String invoiceNumber, List<FlagshipUnit> flagshipUnits) throws ProfitMandiBusinessException;
70
 
71
    /** One flagship credit unit = one physical device (IMEI) and its credit amount. */
72
    List<FlagshipUnit> computeFlagshipUnits(List<Order> billedOrders);
73
 
74
    final class FlagshipUnit {
75
        private final String imei;
76
        private final double amount;
77
 
78
        public FlagshipUnit(String imei, double amount) {
79
            this.imei = imei;
80
            this.amount = amount;
81
        }
82
 
83
        public String getImei() { return imei; }
84
        public double getAmount() { return amount; }
85
    }
86
 
36557 amit 87
    void convertExpiredFlagshipCredits() throws ProfitMandiBusinessException;
88
 
89
    void convertFlagshipCreditToLoan(Loan flagshipLimit, String trigger, String modelName) throws ProfitMandiBusinessException;
90
 
36560 amit 91
    boolean hasActiveFlagshipLimits(int fofoId);
92
 
36562 amit 93
    java.util.Set<Integer> getActiveFlagshipCatalogIds(java.util.List<Integer> catalogIds);
94
 
36578 amit 95
    java.util.Set<Integer> getActiveFlagshipCatalogIds(java.util.List<Integer> catalogIds, java.time.LocalDate asOfDate);
36560 amit 96
 
36958 amit 97
    void convertFlagshipOnSale(int fofoId, java.util.Set<String> soldImeis) throws ProfitMandiBusinessException;
36578 amit 98
 
34731 amit.gupta 99
	void settleBlockedLoan(int transactionId, double amountToRelease) throws ProfitMandiBusinessException;
33663 amit.gupta 100
 
35955 amit 101
	void increaseBlockedLimit(int transactionId, int fofoId, double amount) throws ProfitMandiBusinessException;
102
 
33900 amit.gupta 103
	Loan getLimitFromTransactionId(int transactionId) throws ProfitMandiBusinessException;
104
 
33663 amit.gupta 105
	double settleLoan(Loan loan) throws ProfitMandiBusinessException;
33903 amit.gupta 106
 
35295 amit 107
	void resetHardLimit() throws ProfitMandiBusinessException;
34731 amit.gupta 108
 
35394 amit 109
	void releaseBlockedLimit(Loan blockedLoan, double limitToRelease) throws ProfitMandiBusinessException;
35131 amit 110
 
35811 amit 111
	CreditSummary getCreditSummary(int fofoId);
112
 
113
	CreditSummary getCreditSummaryForOrder(int fofoId, double orderAmount) throws ProfitMandiBusinessException;
114
 
115
	Map<Integer, BulkCreditSummary> getCreditSummaryBulk();
35823 amit 116
 
117
	double getAvailableFreshMoney(int fofoId) throws ProfitMandiBusinessException;
30859 tejbeer 118
}