Subversion Repositories SmartDukaan

Rev

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

Rev 29813 Rev 29834
Line 84... Line 84...
84
		FofoStore fs = fofoStoreRepository.selectByRetailerId(retailerId);
84
		FofoStore fs = fofoStoreRepository.selectByRetailerId(retailerId);
85
		if (gateway != null && gateway.equals(Gateway.MANDII)) {
85
		if (gateway != null && gateway.equals(Gateway.MANDII)) {
86
			try {
86
			try {
87
 
87
 
88
				AccountStatusResponseOut accountStatusResponseOut = mandiiService.getStatus(fs.getPan());
88
				AccountStatusResponseOut accountStatusResponseOut = mandiiService.getStatus(fs.getPan());
-
 
89
 
89
				CreditAccount creditAccount = creditAccountRepository.selectByFofoIdAndGateway(retailerId,
90
				CreditAccount creditAccount = creditAccountRepository.selectByFofoIdAndGateway(retailerId,
90
						Gateway.MANDII);
91
						Gateway.MANDII);
91
 
92
 
92
				if (creditAccount == null) {
93
				if (creditAccount == null) {
93
 
94
 
Line 95... Line 96...
95
 
96
 
96
					creditAccount.setFofoId(retailerId);
97
					creditAccount.setFofoId(retailerId);
97
					creditAccount.setGateway(Gateway.MANDII);
98
					creditAccount.setGateway(Gateway.MANDII);
98
 
99
 
99
				}
100
				}
100
				creditAccount.setSanctionedAmount(accountStatusResponseOut.getSanctionLimit().floatValue());
-
 
101
				creditAccount.setInterestRate(accountStatusResponseOut.getRateOfInterest());
-
 
102
				creditAccount.setAvailableAmount(accountStatusResponseOut.getBalanceAmount().floatValue());
-
 
-
 
101
 
103
				creditAccount.setUpdatedOn(LocalDateTime.now());
102
				if (accountStatusResponseOut == null) {
104
				creditAccount.setDescription(accountStatusResponseOut.getCurrentStage().toString());
-
 
105
				if (accountStatusResponseOut.getStatus().equals(EligibilityStatusEnum.SANCTION_AVAILABLE)) {
-
 
106
					creditAccount.setCreditStatus(CreditStatus.SANCTIONED);
103
					creditAccount.setCreditStatus(CreditStatus.UNKNOWN);
107
				} else if (accountStatusResponseOut.getStatus().equals(EligibilityStatusEnum.IN_ELIGIBLE)) {
-
 
108
					creditAccount.setCreditStatus(CreditStatus.INELIGIBLE);
104
					creditAccount.setDescription("User company not found");
-
 
105
 
109
				} else {
106
				} else {
-
 
107
					creditAccount.setSanctionedAmount(accountStatusResponseOut.getSanctionLimit().floatValue());
-
 
108
					creditAccount.setInterestRate(accountStatusResponseOut.getRateOfInterest());
-
 
109
					creditAccount.setAvailableAmount(accountStatusResponseOut.getBalanceAmount().floatValue());
-
 
110
					creditAccount.setDescription(accountStatusResponseOut.getCurrentStage().toString());
-
 
111
					if (accountStatusResponseOut.getStatus().equals(EligibilityStatusEnum.SANCTION_AVAILABLE)) {
-
 
112
						creditAccount.setCreditStatus(CreditStatus.SANCTIONED);
-
 
113
					} else if (accountStatusResponseOut.getStatus().equals(EligibilityStatusEnum.IN_ELIGIBLE)) {
-
 
114
						creditAccount.setCreditStatus(CreditStatus.INELIGIBLE);
-
 
115
					} else {
110
 
116
 
111
					creditAccount.setCreditStatus(CreditStatus.TO_BE_EVALUATED);
117
						creditAccount.setCreditStatus(CreditStatus.TO_BE_EVALUATED);
-
 
118
					}
112
				}
119
				}
-
 
120
 
-
 
121
				creditAccount.setUpdatedOn(LocalDateTime.now());
-
 
122
 
113
				creditAccountRepository.persist(creditAccount);
123
				creditAccountRepository.persist(creditAccount);
114
				return responseSender.ok(accountStatusResponseOut);
124
				return responseSender.ok(accountStatusResponseOut);
115
			} catch (Exception e) {
125
			} catch (Exception e) {
116
				throw new ProfitMandiBusinessException("Loan Provider", gateway, "Cant fetch details for provider");
126
				throw new ProfitMandiBusinessException("Loan Provider", gateway, "Cant fetch details for provider");
117
			}
127
			}