| Line 944... |
Line 944... |
| 944 |
model.addAttribute("response1", mvcResponseSender.createResponseString(reference));
|
944 |
model.addAttribute("response1", mvcResponseSender.createResponseString(reference));
|
| 945 |
return "response";
|
945 |
return "response";
|
| 946 |
|
946 |
|
| 947 |
}
|
947 |
}
|
| 948 |
|
948 |
|
| - |
|
949 |
@Autowired
|
| - |
|
950 |
HdfcPaymentRepository hdfcPaymentRepository;
|
| - |
|
951 |
|
| 949 |
@RequestMapping(value = "/addMoney", method = RequestMethod.POST)
|
952 |
@RequestMapping(value = "/addMoney", method = RequestMethod.POST)
|
| 950 |
public String addMoney(HttpServletRequest request, @RequestParam float amount, @RequestParam String transactionReference, @RequestParam LocalDateTime referenceTime, @RequestParam String bankName, @RequestParam int fofoId, Model model) throws Exception {
|
953 |
public String addMoney(HttpServletRequest request, @RequestParam float amount, @RequestParam String transactionReference, @RequestParam LocalDateTime referenceTime, @RequestParam String bankName, @RequestParam int fofoId, Model model) throws Exception {
|
| - |
|
954 |
transactionReference = transactionReference.toUpperCase().trim();
|
| - |
|
955 |
List<AddWalletRequest> addWalletRequests = addWalletRequestRepository.selectByReference(transactionReference);
|
| - |
|
956 |
addWalletRequests = addWalletRequests.stream().filter(x -> Arrays.asList(AddWalletRequestStatus.approved, AddWalletRequestStatus.pending).contains(x.getStatus())).collect(Collectors.toList());
|
| - |
|
957 |
if (addWalletRequests.size() > 0) {
|
| - |
|
958 |
throw new ProfitMandiBusinessException("Transaction Reference (UTR)", transactionReference, "Already added");
|
| - |
|
959 |
}
|
| - |
|
960 |
HdfcPayment hdfcPayment = hdfcPaymentRepository.selectByUtrNo(transactionReference);
|
| - |
|
961 |
if(hdfcPayment != null) {
|
| - |
|
962 |
throw new ProfitMandiBusinessException("Transaction Reference (UTR)", transactionReference, "Already added");
|
| 951 |
|
963 |
}
|
| 952 |
AddWalletRequest addWalletRequest = new AddWalletRequest();
|
964 |
AddWalletRequest addWalletRequest = new AddWalletRequest();
|
| 953 |
addWalletRequest.setRetailerId(fofoId);
|
965 |
addWalletRequest.setRetailerId(fofoId);
|
| 954 |
addWalletRequest.setAmount(amount);
|
966 |
addWalletRequest.setAmount(amount);
|
| 955 |
addWalletRequest.setTransaction_reference(transactionReference);
|
967 |
addWalletRequest.setTransaction_reference(transactionReference.toUpperCase());
|
| 956 |
addWalletRequest.setCreateTimestamp(LocalDateTime.now());
|
968 |
addWalletRequest.setCreateTimestamp(LocalDateTime.now());
|
| 957 |
addWalletRequest.setBank_name(bankName);
|
969 |
addWalletRequest.setBank_name(bankName);
|
| 958 |
addWalletRequest.setReference_date(referenceTime.toLocalDate());
|
970 |
addWalletRequest.setReference_date(referenceTime.toLocalDate());
|
| 959 |
addWalletRequest.setStatus(AddWalletRequestStatus.pending);
|
971 |
addWalletRequest.setStatus(AddWalletRequestStatus.pending);
|
| 960 |
|
972 |
|
| Line 967... |
Line 979... |
| 967 |
|
979 |
|
| 968 |
List<Gateway> directGateways = Arrays.asList(Gateway.SDDIRECT, Gateway.SIDBI);
|
980 |
List<Gateway> directGateways = Arrays.asList(Gateway.SDDIRECT, Gateway.SIDBI);
|
| 969 |
|
981 |
|
| 970 |
@Autowired
|
982 |
@Autowired
|
| 971 |
FofoSidbiSanctionRepository fofoSidbiSanctionRepository;
|
983 |
FofoSidbiSanctionRepository fofoSidbiSanctionRepository;
|
| - |
|
984 |
|
| 972 |
@RequestMapping(value = "/getCreditDetail", method = RequestMethod.GET)
|
985 |
@RequestMapping(value = "/getCreditDetail", method = RequestMethod.GET)
|
| 973 |
public String getCreditDetail(HttpServletRequest request, Model model) throws Exception {
|
986 |
public String getCreditDetail(HttpServletRequest request, Model model) throws Exception {
|
| 974 |
List<CreditAccount> creditAccounts = creditAccountRepository.selectAll().stream().filter(x->directGateways.contains(x.getGateway())).collect(Collectors.toList());
|
987 |
List<CreditAccount> creditAccounts = creditAccountRepository.selectAll().stream().filter(x -> directGateways.contains(x.getGateway())).collect(Collectors.toList());
|
| 975 |
Map<Integer, CustomRetailer> customRetailers = retailerService.getAllFofoRetailers();
|
988 |
Map<Integer, CustomRetailer> customRetailers = retailerService.getAllFofoRetailers();
|
| 976 |
|
989 |
|
| 977 |
//Need to maintain valid upto
|
990 |
//Need to maintain valid upto
|
| 978 |
Map<Integer, FofoSidbiSanction> fofoSidbiPendingSanctionsMap = fofoSidbiSanctionRepository.selectAll(Optional.of(false)).stream().collect(Collectors.toMap(x->x.getFofoId(), x->x));
|
991 |
Map<Integer, FofoSidbiSanction> fofoSidbiPendingSanctionsMap = fofoSidbiSanctionRepository.selectAll(Optional.of(false)).stream().collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
| 979 |
|
992 |
|
| 980 |
|
993 |
|
| 981 |
model.addAttribute("creditAccounts", creditAccounts);
|
994 |
model.addAttribute("creditAccounts", creditAccounts);
|
| 982 |
model.addAttribute("fofoSidbiPendingSanctionsMap", fofoSidbiPendingSanctionsMap);
|
995 |
model.addAttribute("fofoSidbiPendingSanctionsMap", fofoSidbiPendingSanctionsMap);
|
| 983 |
model.addAttribute("directGateways", directGateways);
|
996 |
model.addAttribute("directGateways", directGateways);
|
| Line 985... |
Line 998... |
| 985 |
model.addAttribute("customRetailers", customRetailers);
|
998 |
model.addAttribute("customRetailers", customRetailers);
|
| 986 |
return "partner-credit-detail";
|
999 |
return "partner-credit-detail";
|
| 987 |
}
|
1000 |
}
|
| 988 |
|
1001 |
|
| 989 |
|
1002 |
|
| 990 |
|
- |
|
| 991 |
@RequestMapping(value = "/activateKred", method = RequestMethod.POST)
|
1003 |
@RequestMapping(value = "/activateKred", method = RequestMethod.POST)
|
| 992 |
public String activateKred(HttpServletRequest request, @RequestParam int id, Model model, @RequestParam Gateway gateway) throws Exception {
|
1004 |
public String activateKred(HttpServletRequest request, @RequestParam int id, Model model, @RequestParam Gateway gateway) throws Exception {
|
| 993 |
CreditAccount creditAccount = creditAccountRepository.selectById(id);
|
1005 |
CreditAccount creditAccount = creditAccountRepository.selectById(id);
|
| 994 |
creditAccount.setActive(true);
|
1006 |
creditAccount.setActive(true);
|
| 995 |
creditAccount.setGateway(gateway);
|
1007 |
creditAccount.setGateway(gateway);
|
| 996 |
if(gateway.equals(Gateway.SIDBI)) {
|
1008 |
if (gateway.equals(Gateway.SIDBI)) {
|
| 997 |
FofoSidbiSanction fofoSidbiSanction = fofoSidbiSanctionRepository.selectByFofoId(creditAccount.getFofoId());
|
1009 |
FofoSidbiSanction fofoSidbiSanction = fofoSidbiSanctionRepository.selectByFofoId(creditAccount.getFofoId());
|
| 998 |
creditAccount.setAvailableAmount((float) fofoSidbiSanction.getSanctionAmount());
|
1010 |
creditAccount.setAvailableAmount((float) fofoSidbiSanction.getSanctionAmount());
|
| 999 |
creditAccount.setSanctionedAmount((float) fofoSidbiSanction.getSanctionAmount());
|
1011 |
creditAccount.setSanctionedAmount((float) fofoSidbiSanction.getSanctionAmount());
|
| 1000 |
}
|
1012 |
}
|
| 1001 |
|
1013 |
|