Skip to content

Update payday calculation to consider public holidays#54

Merged
jeyongsong merged 2 commits into
mainfrom
consider-public-holidays
May 10, 2026
Merged

Update payday calculation to consider public holidays#54
jeyongsong merged 2 commits into
mainfrom
consider-public-holidays

Conversation

@jeyongsong

Copy link
Copy Markdown
Member

This pull request updates the payday calculation logic to account for public holidays in addition to weekends, ensuring that paydays are moved to the previous business day if they fall on a holiday. The changes also update related services and tests to reflect this new behavior.

Payday calculation logic improvements:

  • The PaydayDay value object now considers both weekends and public holidays when determining the effective payday, moving the payday to the previous business day if necessary. This affects the resolveEffectiveDate, isPayday, and resolvingTo methods, which now accept a set of public holidays and adjust their logic accordingly.
  • The DailyEventType logic is updated to use the new payday calculation, ensuring that payday events are only returned for the correct, adjusted dates.

Service updates:

  • The PublicHolidayService adds a method to retrieve all public holidays for the current and next month, which is used for payday resolution.
  • The WorkdayService and PaydayNotificationBatchService are updated to use the new holiday-aware payday calculation, passing the relevant holidays to payday logic. [1] [2] [3] [4] [5] [6] [7]

Test enhancements:

  • Unit tests for PaydayDay and DailyEventType are expanded to cover cases where paydays fall on public holidays, consecutive weekends and holidays, and the correct identification of payday settings when holidays are present. [1] [2] [3]

Copilot AI review requested due to automatic review settings May 10, 2026 13:54
@github-actions

Copy link
Copy Markdown

Test Results

77 tests   77 ✅  1s ⏱️
10 suites   0 💤
10 files     0 ❌

Results for commit 349f95a.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates payday resolution so that configured paydays falling on weekends or public holidays are shifted to the previous business day, and propagates this holiday-aware logic through event resolution, workday responses, and payday notification batching.

Changes:

  • Extend PaydayDay to resolve effective paydays using weekend + public-holiday adjustment, and update payday detection (isPayday, resolvingTo) accordingly.
  • Add PublicHolidayService.getHolidayDatesForPaydayResolution(...) and update WorkdayService / PaydayNotificationBatchService to supply the needed holiday set.
  • Expand unit tests for PaydayDay and DailyEventType to cover public-holiday payday shifting behavior.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/main/kotlin/com/moa/entity/PaydayDay.kt Adds holiday-aware effective-date resolution and month-boundary-aware payday detection.
src/main/kotlin/com/moa/entity/DailyEventType.kt Uses updated payday detection that accounts for provided public holidays.
src/main/kotlin/com/moa/service/PublicHolidayService.kt Adds helper to fetch holidays needed for payday resolution across current+next month window.
src/main/kotlin/com/moa/service/WorkdayService.kt Switches to payday-resolution holiday set when building workday responses/events.
src/main/kotlin/com/moa/service/notification/PaydayNotificationBatchService.kt Fetches holiday set for correct payday profile resolution.
src/test/kotlin/com/moa/entity/PaydayDayTest.kt Adds tests for holiday shifting and repeated shifting over weekend+holiday sequences.
src/test/kotlin/com/moa/entity/DailyEventTypeTest.kt Adds/updates tests for payday-vs-holiday event behavior after holiday-aware payday shifting.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main/kotlin/com/moa/entity/DailyEventType.kt
Comment thread src/main/kotlin/com/moa/entity/PaydayDay.kt
Comment thread src/main/kotlin/com/moa/entity/PaydayDay.kt
@jeyongsong
jeyongsong merged commit ce3d698 into main May 10, 2026
1 check passed
@jeyongsong
jeyongsong deleted the consider-public-holidays branch May 10, 2026 14:03
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.

2 participants