Subversion Repositories SmartDukaan

Rev

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

Rev 32727 Rev 33045
Line 963... Line 963...
963
        addWalletRequestRepository.persist(addWalletRequest);
963
        addWalletRequestRepository.persist(addWalletRequest);
964
        model.addAttribute("response1", mvcResponseSender.createResponseString(true));
964
        model.addAttribute("response1", mvcResponseSender.createResponseString(true));
965
        return "response";
965
        return "response";
966
    }
966
    }
967
 
967
 
-
 
968
    List<Gateway> directGateways = Arrays.asList(Gateway.SDDIRECT, Gateway.SIDBI);
-
 
969
 
-
 
970
    @Autowired
-
 
971
    FofoSidbiSanctionRepository fofoSidbiSanctionRepository;
968
    @RequestMapping(value = "/getCreditDetail", method = RequestMethod.GET)
972
    @RequestMapping(value = "/getCreditDetail", method = RequestMethod.GET)
969
    public String getCreditDetail(HttpServletRequest request, Model model) throws Exception {
973
    public String getCreditDetail(HttpServletRequest request, Model model) throws Exception {
970
        List<CreditAccount> creditAccounts = creditAccountRepository.selectAll().stream().filter(x->x.getGateway().equals(Gateway.SDDIRECT)).collect(Collectors.toList());
974
        List<CreditAccount> creditAccounts = creditAccountRepository.selectAll().stream().filter(x->directGateways.contains(x.getGateway())).collect(Collectors.toList());
971
        Map<Integer, CustomRetailer> customRetailers = retailerService.getAllFofoRetailers();
975
        Map<Integer, CustomRetailer> customRetailers = retailerService.getAllFofoRetailers();
972
 
976
 
-
 
977
        //Need to maintain valid upto
973
        Map<Integer, FofoStore> fofoStoreMap = fofoStoreRepository.selectByRetailerIds(new ArrayList<>(customRetailers.keySet())).stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
978
        Map<Integer, FofoSidbiSanction> fofoSidbiPendingSanctionsMap = fofoSidbiSanctionRepository.selectAll(Optional.of(false)).stream().collect(Collectors.toMap(x->x.getFofoId(), x->x));
-
 
979
 
974
 
980
 
975
        model.addAttribute("creditAccounts", creditAccounts);
981
        model.addAttribute("creditAccounts", creditAccounts);
-
 
982
        model.addAttribute("fofoSidbiPendingSanctionsMap", fofoSidbiPendingSanctionsMap);
976
        model.addAttribute("fofoStoreMap", fofoStoreMap);
983
        model.addAttribute("directGateways", directGateways);
-
 
984
 
977
        model.addAttribute("customRetailers", customRetailers);
985
        model.addAttribute("customRetailers", customRetailers);
978
        return "partner-credit-detail";
986
        return "partner-credit-detail";
979
    }
987
    }
980
 
988
 
-
 
989
 
-
 
990
 
981
    @RequestMapping(value = "/activateKred", method = RequestMethod.POST)
991
    @RequestMapping(value = "/activateKred", method = RequestMethod.POST)
982
    public String activateKred(HttpServletRequest request, @RequestParam int id, Model model) throws Exception {
992
    public String activateKred(HttpServletRequest request, @RequestParam int id, Model model, @RequestParam Gateway gateway) throws Exception {
983
        CreditAccount creditAccount = creditAccountRepository.selectById(id);
993
        CreditAccount creditAccount = creditAccountRepository.selectById(id);
984
 
-
 
985
        creditAccount.setActive(true);
994
        creditAccount.setActive(true);
-
 
995
        creditAccount.setGateway(gateway);
-
 
996
        if(gateway.equals(Gateway.SIDBI)) {
-
 
997
            FofoSidbiSanction fofoSidbiSanction = fofoSidbiSanctionRepository.selectByFofoId(creditAccount.getFofoId());
-
 
998
            creditAccount.setAvailableAmount((float) fofoSidbiSanction.getSanctionAmount());
-
 
999
            creditAccount.setSanctionedAmount((float) fofoSidbiSanction.getSanctionAmount());
-
 
1000
        }
986
 
1001
 
987
        Map<Integer, CustomRetailer> customRetailers = retailerService.getAllFofoRetailers();
1002
        Map<Integer, CustomRetailer> customRetailers = retailerService.getAllFofoRetailers();
988
 
1003
 
989
        String title = "Loan Approved";
1004
        String title = "Loan Approved";
990
        String url = "http://app.smartdukaan.com/pages/home/credit";
1005
        String url = "http://app.smartdukaan.com/pages/home/credit";