Update payday calculation to consider public holidays#54
Merged
Conversation
Test Results77 tests 77 ✅ 1s ⏱️ Results for commit 349f95a. |
Contributor
There was a problem hiding this comment.
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
PaydayDayto resolve effective paydays using weekend + public-holiday adjustment, and update payday detection (isPayday,resolvingTo) accordingly. - Add
PublicHolidayService.getHolidayDatesForPaydayResolution(...)and updateWorkdayService/PaydayNotificationBatchServiceto supply the needed holiday set. - Expand unit tests for
PaydayDayandDailyEventTypeto 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
PaydayDayvalue 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 theresolveEffectiveDate,isPayday, andresolvingTomethods, which now accept a set of public holidays and adjust their logic accordingly.DailyEventTypelogic is updated to use the new payday calculation, ensuring that payday events are only returned for the correct, adjusted dates.Service updates:
PublicHolidayServiceadds a method to retrieve all public holidays for the current and next month, which is used for payday resolution.WorkdayServiceandPaydayNotificationBatchServiceare 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:
PaydayDayandDailyEventTypeare 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]