Skip to content

feat: harden premium payment date progression logic#415

Open
Mosas2000 wants to merge 1 commit intoRemitwise-Org:mainfrom
Mosas2000:feature/insurance-premium-date-drift-hardening
Open

feat: harden premium payment date progression logic#415
Mosas2000 wants to merge 1 commit intoRemitwise-Org:mainfrom
Mosas2000:feature/insurance-premium-date-drift-hardening

Conversation

@Mosas2000
Copy link
Copy Markdown
Contributor

Implement deterministic next_payment_date updates to prevent schedule drift:

  • Add PREMIUM_INTERVAL_SECONDS constant (30 days) for consistent interval usage
  • Modify pay_premium to advance from previous due date, not current timestamp
  • Handle late payments by advancing until next_due is in the future
  • Prevent schedule manipulation through early or late payment timing

The new logic ensures:

  • Early payments don't shift the schedule forward
  • Late payments don't double-cover periods
  • Payment schedules remain predictable regardless of payment timing

Test coverage includes:

  • Early payment scenarios (5-15 days early)
  • On-time payment boundary cases
  • Late payment single/multiple period scenarios
  • Mixed early/late payment sequences over 12 months
  • Boundary condition at exactly next_due timestamp

Resolves: premium payment date drift issue

Closes #278

Implement deterministic next_payment_date updates to prevent schedule drift:

- Add PREMIUM_INTERVAL_SECONDS constant (30 days) for consistent interval usage
- Modify pay_premium to advance from previous due date, not current timestamp
- Handle late payments by advancing until next_due is in the future
- Prevent schedule manipulation through early or late payment timing

The new logic ensures:
- Early payments don't shift the schedule forward
- Late payments don't double-cover periods
- Payment schedules remain predictable regardless of payment timing

Test coverage includes:
- Early payment scenarios (5-15 days early)
- On-time payment boundary cases
- Late payment single/multiple period scenarios
- Mixed early/late payment sequences over 12 months
- Boundary condition at exactly next_due timestamp

Resolves: premium payment date drift issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Harden premium payment date progression against drift

1 participant