Skip to content

[Bug][Backend] loanDueCheckCron spams duplicate 'repayment_due' notifications every hour and formats raw stroops as loan amount #2028

Closed

Description

@blurbeast

Issue #148

loanDueCheckCron Spams Duplicate 'repayment_due' Notifications Every Hour and Formats Raw Stroops as Loan Amount

  • Title: [Bug][Backend] loanDueCheckCron spams duplicate 'repayment_due' notifications every hour and formats raw stroops as loan amount
  • Labels: bug, backend, good first issue
  • Location: backend/src/cron/loanCheckCron.ts:34-53
  • Description:
    startLoanDueCheckCron runs every hour (0 * * * *) and selects all LoanApproved events older than 30 days without a matching LoanRepaid event. It never checks whether a 'repayment_due' notification has already been sent for le.loan_id, does not exclude defaulted/liquidated loans (LoanDefaulted, LoanLiquidated, CollateralLiquidated), and formats le.amount (stored in raw 10^7 stroops) directly into the user-facing notification message.
  • Impact:
    Borrowers with open or defaulted loans older than 30 days are spammed with a new notification, email, and SMS every single hour displaying raw stroop amounts.
  • Suggested Fix:
    Exclude loans with LoanDefaulted/LoanLiquidated/CollateralLiquidated events, add AND NOT EXISTS (SELECT 1 FROM notifications n WHERE n.loan_id = le.loan_id AND n.type = 'repayment_due' AND n.created_at > NOW() - INTERVAL '24 hours'), and divide loan.amount by 10_000_000 when formatting the notification message.

Activity

  1. added
    bugSomething isn't working
    backendIssues related to backend development
    on Oct 18, 2026
  2. ravimahatonp commented on Oct 18, 2026

    @ravimahatonp

    Hello team,

    I examined the issue "[Bug][Backend] loanDueCheckCron spams duplicate 'repayment_due' notifications every hour and formats raw stroops as loan amount" in LabsCrypt/remitlend and would be glad to implement the required changes.

    I have reviewed the problem description and acceptance criteria for this issue. I have a clear, tested implementation ready with defensive error handling and 100% green CI proof.

    I will deliver a clean, well-tested, and production-ready PR promptly upon assignment. Kindly assign this issue to me.

    Thank you!

  3. tijanib141 commented on Oct 18, 2026

    @tijanib141

    @tijanib141 has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

    hi, please give me this, i can do this fast

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @tijanib141 to this issue.

  4. lancefair431-code commented on Oct 18, 2026

    @lancefair431-code

    @lancefair431-code has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

    I’d love to help out with this issue. I’ve checked the current codebase/documentation and know exactly what needs to be updated to make this clearer. I will ensure everything aligns perfectly with your existing contribution guidelines.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @lancefair431-code to this issue.

  5. Wittig18 commented on Oct 18, 2026

    @Wittig18

    @Wittig18 has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

    hey maintainer, i would love to work on this

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @Wittig18 to this issue.

  6. moon-code12 commented on Oct 18, 2026

    @moon-code12

    @moon-code12 has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

    Hello Maintainers, I would like to express my interest in working on this issue. I have reviewed the issue description and understand the problem that needs to be addressed. My approach will be to investigate the existing codebase, identify the root cause, and implement a solution that follows the project's existing architecture and coding standards.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @moon-code12 to this issue.

  7. bade2brazy commented on Oct 18, 2026

    @bade2brazy
    Contributor

    @bade2brazy has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

    assign this issue to me

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @bade2brazy to this issue.

  8. shadrach68 commented on Oct 18, 2026

    @shadrach68

    @shadrach68 has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

    Hello maintainer,

    I’m a Full Stack Blockchain, Mobile, and Software Engineer with experience building scalable and production ready applications.

    I’ve reviewed this particular issue and understand its requirements. If assigned, I’ll begin work immediately, provide regular updates, and deliver a clean, well-tested, and maintainable solution that meets the project’s standards.

    Looking forward to contributing.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @shadrach68 to this issue.

  9. Muyideen-js commented on Oct 18, 2026

    @Muyideen-js

    @Muyideen-js has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

    Hi, I can fix this

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @Muyideen-js to this issue.

  10. innocentharuna commented on Oct 18, 2026

    @innocentharuna

    @innocentharuna has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

    hey maintainer, please kindly assign this to me, i can surely fix it

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @innocentharuna to this issue.

  11. Teejay2696 commented on Oct 18, 2026

    @Teejay2696

    @Teejay2696 has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

    Hi maintainer, I can fix this kindly assign

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @Teejay2696 to this issue.

  12. CollinsKRO commented on Oct 18, 2026

    @CollinsKRO

    @CollinsKRO has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

    Hi Maintainer, I can fix this pls assign. ETA 5hrs

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @CollinsKRO to this issue.

  13. VeronicDev commented on Oct 18, 2026

    @VeronicDev

    @VeronicDev has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

    Hello Maintainer, I can fix this please assign.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @VeronicDev to this issue.

  14. drips-wave commented on Oct 18, 2026

    @drips-wave

    Congratulations, @bade2brazy! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on October 22, 2026.

    🧑‍💻 @bade2brazy: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

    Warning

    When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

    🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

    🌊 Happy Wave 🌊

  15. bade2brazy commented on Oct 18, 2026

    @bade2brazy
    Contributor

    Resolved in PR #2032. Excluded defaulted/liquidated loans, added 24-hour notification deduplication, and formatted stroops as decimal amount.

  16. drips-wave commented on Oct 18, 2026

    @drips-wave

    This issue has been completed by @bade2brazy as part of the Stellar Wave Program's 10th Wave 🥳

    😎 @bade2brazy: You earned 200 Points for completing this issue! Once the Wave's rewards are finalized, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.

    🧑‍💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programbackendIssues related to backend developmentbugSomething isn't workinggood first issueGood for newcomers

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions