Subversion Repositories SmartDukaan

Rev

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