Subversion Repositories SmartDukaan

Rev

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

Rev 34710 Rev 34729
Line 3630... Line 3630...
3630
 
3630
 
3631
                Address address = addressRepository.selectById(user.getAddressId());
3631
                Address address = addressRepository.selectById(user.getAddressId());
3632
 
3632
 
3633
                String title = "Alert Credit Outstanding!";
3633
                String title = "Alert Credit Outstanding!";
3634
                String url = "http://app.smartdukaan.com/pages/home/credit";
3634
                String url = "http://app.smartdukaan.com/pages/home/credit";
3635
                String message = "Your total pending Loan amount is Rs." + FormattingUtils.formatDecimal(Math.abs(partnerLoanAmountEnrty.getValue())) + ".";
3635
                String message = "Your total outstanding Credit Balance is Rs." + FormattingUtils.formatDecimal(Math.abs(partnerLoanAmountEnrty.getValue())) + ".";
3636
                notificationService.sendNotification(fofoId, title, MessageType.notification, title, message, url);
3636
                notificationService.sendNotification(fofoId, title, MessageType.notification, title, message, url);
3637
 
3637
 
3638
                //notificationService.sendWhatsappMessage(message, title, address.getPhoneNumber());
3638
                //notificationService.sendWhatsappMessage(message, title, address.getPhoneNumber());
3639
 
3639
 
3640
            }
3640
            }
Line 3769... Line 3769...
3769
    }
3769
    }
3770
 
3770
 
3771
    public void notifyDefaultLoans() throws ProfitMandiBusinessException, MessagingException, IOException {
3771
    public void notifyDefaultLoans() throws ProfitMandiBusinessException, MessagingException, IOException {
3772
 
3772
 
3773
        sdCreditService.updateRisk();
3773
        sdCreditService.updateRisk();
3774
        List<Loan> defaultLoans = sdCreditService.getDefaultLoan();
3774
        List<Loan> defaultLoans = sdCreditService.getDefaultLoans();
3775
        if (!defaultLoans.isEmpty()) {
3775
        if (!defaultLoans.isEmpty()) {
3776
            this.sendDefaultLoanAlert(defaultLoans);
3776
            this.sendDefaultLoanAlert(defaultLoans);
3777
        }
3777
        }
3778
 
3778
 
3779
    }
3779
    }
Line 3811... Line 3811...
3811
 
3811
 
3812
            com.spice.profitmandi.dao.entity.user.User user = userUserRepository.selectById(defaultLoan.getFofoId());
3812
            com.spice.profitmandi.dao.entity.user.User user = userUserRepository.selectById(defaultLoan.getFofoId());
3813
 
3813
 
3814
            Address address = addressRepository.selectById(user.getAddressId());
3814
            Address address = addressRepository.selectById(user.getAddressId());
3815
 
3815
 
3816
            String title = "Loan Amount Overdue!";
3816
            String title = "Outstanding Credit Payment Overdue!";
3817
            String url = "http://app.smartdukaan.com/pages/home/credit";
3817
            String url = "http://app.smartdukaan.com/pages/home/credit";
3818
            String message = "Your loan due date " + defaultLoan.getDueDate().toLocalDate().format(DateTimeFormatter.ofPattern("dd-MM-yyyy")) + " has been exceeded. Additional penal interest of " + defaultLoan.getInterestRate().setScale(2, RoundingMode.HALF_UP) + "%  and Rs.100 shall be levied on daily basis." + " Your total pending Loan amount is Rs." + FormattingUtils.formatDecimal(Math.abs(amount)) + ". !!Pay Now!!";
3818
            String message = "Your Outstanding Credit payment due date " + defaultLoan.getDueDate().toLocalDate().format(DateTimeFormatter.ofPattern("dd-MM-yyyy")) + " has been exceeded. Please note "+ ProfitMandiConstants.NEW_DELAYED_INTEREST_RATE +" shall be levied on daily basis." + " Your total pending Loan amount is Rs." + FormattingUtils.formatDecimal(Math.abs(amount)) + ". !!Pay Now!!";
3819
            notificationService.sendNotification(defaultLoan.getFofoId(), title, MessageType.notification, title, message, url);
3819
            notificationService.sendNotification(defaultLoan.getFofoId(), title, MessageType.notification, title, message, url);
3820
 
3820
 
3821
            // notificationService.sendWhatsappMessage(message, title,
3821
            // notificationService.sendWhatsappMessage(message, title,
3822
            // address.getPhoneNumber());
3822
            // address.getPhoneNumber());
3823
 
3823
 
Line 3986... Line 3986...
3986
                double amount = loanStatements.stream().map(x -> x.getAmount()).collect(Collectors.summingDouble(x -> x.doubleValue()));
3986
                double amount = loanStatements.stream().map(x -> x.getAmount()).collect(Collectors.summingDouble(x -> x.doubleValue()));
3987
 
3987
 
3988
                String url = "http://app.smartdukaan.com/pages/home/credit";
3988
                String url = "http://app.smartdukaan.com/pages/home/credit";
3989
 
3989
 
3990
                String title = "Alert!";
3990
                String title = "Alert!";
3991
                String message = "Your loan due date " + loan.getDueDate().toLocalDate().format(DateTimeFormatter.ofPattern("dd-MM-yyyy")) + " has been exceeded. Additional penal interest of " + loan.getInterestRate().setScale(2, RoundingMode.HALF_UP) + "% shall be levied on daily basis. Your total pending loan amount is Rs." + FormattingUtils.formatDecimal(Math.abs(amount)) + ". !!Pay Now!!";
3991
                String message = "Your Outstanding Credit Payment due date " + loan.getDueDate().toLocalDate().format(DateTimeFormatter.ofPattern("dd-MM-yyyy")) + " has been exceeded. Additional penal interest of " + loan.getInterestRate().setScale(2, RoundingMode.HALF_UP) + "% shall be levied on daily basis. Your total pending loan amount is Rs." + FormattingUtils.formatDecimal(Math.abs(amount)) + ". !!Pay Now!!";
3992
 
3992
 
3993
                notificationService.sendNotification(loan.getFofoId(), title, MessageType.notification, title, message, url);
3993
                notificationService.sendNotification(loan.getFofoId(), title, MessageType.notification, title, message, url);
3994
 
3994
 
3995
                //notificationService.sendWhatsappMessage(message, title, address.getPhoneNumber());
3995
                //notificationService.sendWhatsappMessage(message, title, address.getPhoneNumber());
3996
 
3996
 
Line 4021... Line 4021...
4021
                    String title = "Alert!";
4021
                    String title = "Alert!";
4022
                    String url = "http://app.smartdukaan.com/pages/home/credit";
4022
                    String url = "http://app.smartdukaan.com/pages/home/credit";
4023
                    String message = null;
4023
                    String message = null;
4024
                    if (noOfdaysBetween == 0) {
4024
                    if (noOfdaysBetween == 0) {
4025
 
4025
 
4026
                        message = "Your total pending Loan amount is Rs." + FormattingUtils.formatDecimal(Math.abs(amount)) + " is due for Today, Pay Now!!";
4026
                        message = "Your total outstanding Credit amount is Rs." + FormattingUtils.formatDecimal(Math.abs(amount)) + " is due for Today, Pay Now!!";
4027
 
4027
 
4028
                    } else {
4028
                    } else {
4029
 
4029
 
4030
                        message = "Your total pending Loan amount is Rs." + FormattingUtils.formatDecimal(Math.abs(amount)) + " is due by " + loan.getDueDate().toLocalDate().format(DateTimeFormatter.ofPattern("dd-MM-yyyy")) + " , Pay Now!!";
4030
                        message = "Your total outstanding Credit amount is Rs." + FormattingUtils.formatDecimal(Math.abs(amount)) + " is due by " + loan.getDueDate().toLocalDate().format(DateTimeFormatter.ofPattern("dd-MM-yyyy")) + " , Pay Now!!";
4031
 
4031
 
4032
                    }
4032
                    }
4033
                    notificationService.sendNotification(loan.getFofoId(), title, MessageType.notification, title, message, url);
4033
                    notificationService.sendNotification(loan.getFofoId(), title, MessageType.notification, title, message, url);
4034
                    //notificationService.sendWhatsappMessage(message, title, address.getPhoneNumber());
4034
                    //notificationService.sendWhatsappMessage(message, title, address.getPhoneNumber());
4035
 
4035
 
Line 4677... Line 4677...
4677
 
4677
 
4678
    }
4678
    }
4679
 
4679
 
4680
    public void sendMailWhatsAppAfterLoanDueDate() throws Exception {
4680
    public void sendMailWhatsAppAfterLoanDueDate() throws Exception {
4681
        sdCreditService.updateRisk();
4681
        sdCreditService.updateRisk();
4682
        List<Loan> defaultLoans = sdCreditService.getLoanALert();
4682
        List<Loan> defaultLoans = sdCreditService.getDefaultLoans();
4683
        if (!defaultLoans.isEmpty()) {
4683
        if (!defaultLoans.isEmpty()) {
4684
            this.sendLoanAlert(defaultLoans);
4684
            this.sendLoanAlert(defaultLoans);
4685
        }
4685
        }
4686
 
4686
 
4687
 
4687
 
Line 4778... Line 4778...
4778
            // After Due Date – Alternate days
4778
            // After Due Date – Alternate days
4779
            if ((noOfdaysBetween % 2 == 0) && (noOfdaysBetween > 5)) {
4779
            if ((noOfdaysBetween % 2 == 0) && (noOfdaysBetween > 5)) {
4780
                sb.append("<html><body><p><b>Loan Repayment Alert !</b></p></br><p>Dear " + name + "</p>");
4780
                sb.append("<html><body><p><b>Loan Repayment Alert !</b></p></br><p>Dear " + name + "</p>");
4781
                sb.append("<p>We would like to remind you that your payment for the outstanding balance on your account is now overdue. " +
4781
                sb.append("<p>We would like to remind you that your payment for the outstanding balance on your account is now overdue. " +
4782
                        "As per our terms and conditions, a higher interest rate will be levied on the overdue amount Rs. " + formattedAmount + ".</p>");
4782
                        "As per our terms and conditions, a higher interest rate will be levied on the overdue amount Rs. " + formattedAmount + ".</p>");
4783
                sb.append("<p>To avoid further charges and any negative impact on your CIBIL score, we kindly request that you settle the " +
4783
                sb.append("<p>To avoid further charges and any negative impact on your Credit score, we kindly request that you settle the " +
4784
                        "outstanding balance as soon as possible.</p>");
4784
                        "outstanding balance as soon as possible.</p>");
4785
                sb.append("<p>Thank you for your attention to this matter.</p></br><p> Smart Dukaan Team !!</p>");
4785
                sb.append("<p>Thank you for your attention to this matter.</p></br><p> Smart Dukaan Team !!</p>");
4786
            }
4786
            }
4787
            // 5 Days before default - daily
4787
            // 5 Days before default - daily
4788
            if (noOfdaysBetween <= 5) {
4788
            if (noOfdaysBetween <= 5) {
4789
                sb.append("<html><body><p><b>Loan Repayment Alert !</b></p></br>");
4789
                sb.append("<html><body><p><b>Loan Repayment Alert !</b></p></br>");
4790
                sb.append("<p>Attention: High Alert</p>");
4790
                sb.append("<p>Attention: High Alert</p>");
4791
                sb.append("<p>Dear " + name + "</p>");
4791
                sb.append("<p>Dear " + name + "</p>");
4792
                sb.append("<p>This is to inform you that the due date for your payment of Rs. " + formattedAmount + " has been crossed, " +
4792
                sb.append("<p>This is to inform you that the due date for your payment of Rs. " + formattedAmount + " has been crossed, " +
4793
                        "and you are approaching the default date on " + defaultDate.format(DateTimeFormatter.ofPattern("dd-MM-yyyy")) + ". " +
4793
                        "and you are approaching the default date on " + defaultDate.format(DateTimeFormatter.ofPattern("dd-MM-yyyy")) + ". " +
4794
                        "Please be aware that this will have a significant impact on your CIBIL score and may result in substantial penalties as well.</p>");
4794
                        "Please be aware that this will have a significant impact on your Credit score and may result in substantial penalties as well.</p>");
4795
                sb.append("<p>To rectify this situation, it is imperative that you take immediate action. " +
4795
                sb.append("<p>To rectify this situation, it is imperative that you take immediate action. " +
4796
                        "Please make the necessary payment immediately to avoid further consequences.</p>");
4796
                        "Please make the necessary payment immediately to avoid further consequences.</p>");
4797
                sb.append("<p>Thank you for your attention to this matter.</p></br><p> Smart Dukaan Team !!</p>");
4797
                sb.append("<p>Thank you for your attention to this matter.</p></br><p> Smart Dukaan Team !!</p>");
4798
            }
4798
            }
4799
        } else {
4799
        } else {
4800
            // Post Default - Daily
4800
            // Post Default - Daily
4801
            sb.append("<html><body><p><b>Loan Repayment Alert !</b></p></br><p>Dear " + name + "</p>");
4801
            sb.append("<html><body><p><b>Loan Repayment Alert !</b></p></br><p>Dear " + name + "</p>");
4802
            sb.append("<p>We regret to inform you that you are currently in loan default. As a result, " +
4802
            sb.append("<p>We regret to inform you that you are currently in loan default. As a result, " +
4803
                    "higher penalties are being charged, which is also negatively impacting your CIBIL score. " +
4803
                    "higher penalties are being charged, which is also negatively impacting your Credit score. " +
4804
                    "It is imperative that you make an immediate payment to rectify this situation.</p>");
4804
                    "It is imperative that you make an immediate payment to rectify this situation.</p>");
4805
            sb.append("<p>Please note that failing to make the payment promptly will result in further consequences, " +
4805
            sb.append("<p>Please note that failing to make the payment promptly will result in further consequences, " +
4806
                    "including potential legal action and additional financial penalties. " +
4806
                    "including potential legal action and additional financial penalties. " +
4807
                    "We strongly urge you to take this matter seriously and settle the outstanding amount as soon as possible.</p>");
4807
                    "We strongly urge you to take this matter seriously and settle the outstanding amount as soon as possible.</p>");
4808
            sb.append("<p>To make the payment, please add Rs. " + formattedAmount + " to your wallet. We are here to help you resolve this issue and get back on track.</p>");
4808
            sb.append("<p>To make the payment, please add Rs. " + formattedAmount + " to your wallet. We are here to help you resolve this issue and get back on track.</p>");
Line 4835... Line 4835...
4835
            long noOfdaysBetween = ChronoUnit.DAYS.between(LocalDate.now(), defaultLoan.getDueDate().toLocalDate());
4835
            long noOfdaysBetween = ChronoUnit.DAYS.between(LocalDate.now(), defaultLoan.getDueDate().toLocalDate());
4836
            String payDate = defaultLoan.getDueDate().toLocalDate().format(DateTimeFormatter.ofPattern("dd-MM-yyyy"));
4836
            String payDate = defaultLoan.getDueDate().toLocalDate().format(DateTimeFormatter.ofPattern("dd-MM-yyyy"));
4837
            // 5 Days Before Due Date - daily
4837
            // 5 Days Before Due Date - daily
4838
            if (noOfdaysBetween <= 5) {
4838
            if (noOfdaysBetween <= 5) {
4839
 
4839
 
4840
                message = "Dear %s, This is a friendly reminder that your loan payment is due in %d days, on %s.\n" +
4840
                message = "Dear %s, This is a friendly reminder that your outstanding credit payment is due in %d days, on %s.\n" +
4841
                        "\n" +
4841
                        "\n" +
4842
                        "Please ensure that the payment is made on time to avoid any late fees or penalties.As per the terms of your loan agreement, the total amount due is Rs. %s. You can make the payment by adding money to wallet.\n" +
4842
                        "Please ensure that the payment is made on time to avoid any late fees or penalties.As per the terms of your loan agreement, the total amount due is Rs. %s. You can make the payment by adding money to wallet.\n" +
4843
                        "\n" +
4843
                        "\n" +
4844
                        "If you have any questions or need assistance, our customer service team is available to help you.\n" +
4844
                        "If you have any questions or need assistance, our customer service team is available to help you.\n" +
4845
                        "Thank you for your cooperation and prompt attention to this matter.\n" +
4845
                        "Thank you for your cooperation and prompt attention to this matter.\n" +
Line 4851... Line 4851...
4851
            long noOfdaysBetween = ChronoUnit.DAYS.between(defaultDate, LocalDate.now());
4851
            long noOfdaysBetween = ChronoUnit.DAYS.between(defaultDate, LocalDate.now());
4852
            // After Due Date – Alternate days
4852
            // After Due Date – Alternate days
4853
            if ((noOfdaysBetween % 2 == 0) && (noOfdaysBetween > 5)) {
4853
            if ((noOfdaysBetween % 2 == 0) && (noOfdaysBetween > 5)) {
4854
                message = "Dear %s, We would like to remind you that your payment for the outstanding balance on your account is now overdue. \n" +
4854
                message = "Dear %s, We would like to remind you that your payment for the outstanding balance on your account is now overdue. \n" +
4855
                        "As per our terms and conditions, a higher interest rate will be levied on the overdue amount Rs.%s.\n" +
4855
                        "As per our terms and conditions, a higher interest rate will be levied on the overdue amount Rs.%s.\n" +
4856
                        "To avoid further charges and any negative impact on your CIBIL score, we kindly request that you settle the outstanding balance as soon as possible.\n" +
4856
                        "To avoid further charges and any negative impact on your Credit ratings, we kindly request that you settle the outstanding balance as soon as possible.\n" +
4857
                        "Thank you for your attention to this matter. \n" +
4857
                        "Thank you for your attention to this matter. \n" +
4858
                        "\n" +
4858
                        "\n" +
4859
                        "Team SmartDukaan";
4859
                        "Team SmartDukaan";
4860
                message = String.format(message, name, formattedAmount);
4860
                message = String.format(message, name, formattedAmount);
4861
            }
4861
            }
Line 4863... Line 4863...
4863
            if (noOfdaysBetween <= 5) {
4863
            if (noOfdaysBetween <= 5) {
4864
                String defaultPayDate = defaultDate.format(DateTimeFormatter.ofPattern("dd-MM-yyyy"));
4864
                String defaultPayDate = defaultDate.format(DateTimeFormatter.ofPattern("dd-MM-yyyy"));
4865
                message = "Attention: High Alert!! Dear %s, \n" +
4865
                message = "Attention: High Alert!! Dear %s, \n" +
4866
                        "\n" +
4866
                        "\n" +
4867
                        "This is to inform you that the due date for your payment of Rs. %s has been crossed, and as a result, you are now about to reach default date %s.\n" +
4867
                        "This is to inform you that the due date for your payment of Rs. %s has been crossed, and as a result, you are now about to reach default date %s.\n" +
4868
                        "Please be aware that this will have a significant impact on your CIBIL score and may result in substantial penalties as well. To rectify this situation, it is imperative that you take immediate action.\n" +
4868
                        "Please be aware that this will have a significant impact on your Credit score and may result in substantial penalties as well. To rectify this situation, it is imperative that you take immediate action.\n" +
4869
                        "\n" +
4869
                        "\n" +
4870
                        "Please make the necessary payment immediately to avoid further consequences. Thank you for your attention to this matter.\n" +
4870
                        "Please make the necessary payment immediately to avoid further consequences. Thank you for your attention to this matter.\n" +
4871
                        "\n" +
4871
                        "\n" +
4872
                        "Team SmartDukaan";
4872
                        "Team SmartDukaan";
4873
                message = String.format(message, name, formattedAmount, defaultPayDate);
4873
                message = String.format(message, name, formattedAmount, defaultPayDate);
4874
            }
4874
            }
4875
        } else {
4875
        } else {
4876
            // Post Default - Daily
4876
            // Post Default - Daily
4877
            message = "Dear %s, We regret to inform you that you are currently in loan default. As a result, higher penalties are being charged, which is also negatively impacting your CIBIL score. \n" +
4877
            message = "Dear %s, We regret to inform you that you are currently in Credit default. As a result, higher penalties are being charged, which is also negatively impacting your Credit score. \n" +
4878
                    "\n" +
4878
                    "\n" +
4879
                    "It is imperative that you make an immediate payment to rectify this situation. \n" +
4879
                    "It is imperative that you make an immediate payment to rectify this situation. \n" +
4880
                    "\n" +
4880
                    "\n" +
4881
                    "Please note that failing to make the payment promptly will result in further consequences, including potential legal action and additional financial penalties. \n" +
4881
                    "Please note that failing to make the payment promptly will result in further consequences, including potential legal action and additional financial penalties. \n" +
4882
                    "\n" +
4882
                    "\n" +