-
Notifications
You must be signed in to change notification settings - Fork 2
HDPI-3769 Regular expenses #1610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
libanAbdirahman1
wants to merge
11
commits into
master
Choose a base branch
from
HDPI-3769-BE-Regular-expenses
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
b13a787
HDPI-3769:WIP
libanAbdirahman1 79761a2
HDPI-3769:Fixing checkstyle issue
libanAbdirahman1 45fe990
HDPI-3769:Adding test coverage
libanAbdirahman1 8e00520
HDPI-3769:Renaming frequency enum
libanAbdirahman1 bbd98b0
Merge remote-tracking branch 'origin' into HDPI-3769-BE-Regular-expenses
libanAbdirahman1 98fde95
HDPI-3769:Dropping old columns
libanAbdirahman1 520f25d
Merge remote-tracking branch 'origin' into HDPI-3769-BE-Regular-expenses
libanAbdirahman1 e2683f8
HDPI-3769:Added new domain class for repeated related fields
libanAbdirahman1 e1a2a0f
HDPI-3769:Minor refactoring of service
libanAbdirahman1 b451dbf
Merge remote-tracking branch 'origin' into HDPI-3769-BE-Regular-expenses
libanAbdirahman1 1f2f447
HDPI-3769:Updating migration script numbers post merge
libanAbdirahman1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
29 changes: 29 additions & 0 deletions
29
.../java/uk/gov/hmcts/reform/pcs/ccd/domain/respondpossessionclaim/IncomeExpenseDetails.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| package uk.gov.hmcts.reform.pcs.ccd.domain.respondpossessionclaim; | ||
|
|
||
| import lombok.AllArgsConstructor; | ||
| import lombok.Builder; | ||
| import lombok.Data; | ||
| import lombok.NoArgsConstructor; | ||
| import uk.gov.hmcts.ccd.sdk.api.CCD; | ||
| import uk.gov.hmcts.ccd.sdk.type.FieldType; | ||
| import uk.gov.hmcts.ccd.sdk.type.YesOrNo; | ||
| import uk.gov.hmcts.reform.pcs.ccd.annotation.JacksonMoneyGBP; | ||
|
|
||
| import java.math.BigDecimal; | ||
|
|
||
| @Builder | ||
| @Data | ||
| @NoArgsConstructor | ||
| @AllArgsConstructor | ||
| public class IncomeExpenseDetails { | ||
|
|
||
| @CCD | ||
| private YesOrNo applies; | ||
|
|
||
| @CCD(typeOverride = FieldType.MoneyGBP) | ||
| @JacksonMoneyGBP | ||
| private BigDecimal amount; | ||
|
|
||
| @CCD | ||
| private RecurrenceFrequency frequency; | ||
| } |
18 changes: 18 additions & 0 deletions
18
...n/java/uk/gov/hmcts/reform/pcs/ccd/domain/respondpossessionclaim/RecurrenceFrequency.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| package uk.gov.hmcts.reform.pcs.ccd.domain.respondpossessionclaim; | ||
|
|
||
| import lombok.AllArgsConstructor; | ||
| import lombok.Getter; | ||
| import uk.gov.hmcts.ccd.sdk.api.HasLabel; | ||
|
|
||
| /** | ||
| * Enum representing the recurrence frequency of income, benefits, and expenses. | ||
| */ | ||
| @AllArgsConstructor | ||
| @Getter | ||
| public enum RecurrenceFrequency implements HasLabel { | ||
| WEEKLY("Weekly"), | ||
| MONTHLY("Monthly"); | ||
|
|
||
| private final String label; | ||
|
|
||
| } | ||
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
53 changes: 47 additions & 6 deletions
53
...ov/hmcts/reform/pcs/ccd/service/respondpossessionclaim/HouseholdCircumstancesService.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,63 @@ | ||
| package uk.gov.hmcts.reform.pcs.ccd.service.respondpossessionclaim; | ||
|
|
||
| import org.springframework.stereotype.Service; | ||
| import uk.gov.hmcts.ccd.sdk.type.YesOrNo; | ||
| import uk.gov.hmcts.reform.pcs.ccd.domain.respondpossessionclaim.HouseholdCircumstances; | ||
| import uk.gov.hmcts.reform.pcs.ccd.domain.respondpossessionclaim.IncomeExpenseDetails; | ||
| import uk.gov.hmcts.reform.pcs.ccd.domain.respondpossessionclaim.RecurrenceFrequency; | ||
| import uk.gov.hmcts.reform.pcs.ccd.entity.respondpossessionclaim.HouseholdCircumstancesEntity; | ||
|
|
||
| import java.math.BigDecimal; | ||
|
|
||
| @Service | ||
| public class HouseholdCircumstancesService { | ||
|
|
||
| public HouseholdCircumstancesEntity createHouseholdCircumstancesEntity(HouseholdCircumstances circumstances) { | ||
| public HouseholdCircumstancesEntity createHouseholdCircumstancesEntity(HouseholdCircumstances hc) { | ||
|
|
||
| if (circumstances == null) { | ||
| if (hc == null) { | ||
| return null; | ||
| } | ||
|
|
||
| HouseholdCircumstancesEntity householdCircumstancesEntity = HouseholdCircumstancesEntity.builder() | ||
| .dependantChildren(circumstances.getDependantChildren()) | ||
| return HouseholdCircumstancesEntity.builder() | ||
| .dependantChildren(hc.getDependantChildren()) | ||
| .householdBills(getApplies(hc.getHouseholdBills())) | ||
| .householdBillsAmount(getAmountIfYes(hc.getHouseholdBills())) | ||
| .householdBillsFrequency(getFrequencyIfYes(hc.getHouseholdBills())) | ||
| .loanPayments(getApplies(hc.getLoanPayments())) | ||
| .loanPaymentsAmount(getAmountIfYes(hc.getLoanPayments())) | ||
| .loanPaymentsFrequency(getFrequencyIfYes(hc.getLoanPayments())) | ||
| .childSpousalMaintenance(getApplies(hc.getChildSpousalMaintenance())) | ||
| .childSpousalMaintenanceAmount(getAmountIfYes(hc.getChildSpousalMaintenance())) | ||
| .childSpousalMaintenanceFrequency(getFrequencyIfYes(hc.getChildSpousalMaintenance())) | ||
| .mobilePhone(getApplies(hc.getMobilePhone())) | ||
| .mobilePhoneAmount(getAmountIfYes(hc.getMobilePhone())) | ||
| .mobilePhoneFrequency(getFrequencyIfYes(hc.getMobilePhone())) | ||
| .groceryShopping(getApplies(hc.getGroceryShopping())) | ||
| .groceryShoppingAmount(getAmountIfYes(hc.getGroceryShopping())) | ||
| .groceryShoppingFrequency(getFrequencyIfYes(hc.getGroceryShopping())) | ||
| .fuelParkingTransport(getApplies(hc.getFuelParkingTransport())) | ||
| .fuelParkingTransportAmount(getAmountIfYes(hc.getFuelParkingTransport())) | ||
| .fuelParkingTransportFrequency(getFrequencyIfYes(hc.getFuelParkingTransport())) | ||
| .schoolCosts(getApplies(hc.getSchoolCosts())) | ||
| .schoolCostsAmount(getAmountIfYes(hc.getSchoolCosts())) | ||
| .schoolCostsFrequency(getFrequencyIfYes(hc.getSchoolCosts())) | ||
| .clothing(getApplies(hc.getClothing())) | ||
| .clothingAmount(getAmountIfYes(hc.getClothing())) | ||
| .clothingFrequency(getFrequencyIfYes(hc.getClothing())) | ||
| .otherExpenses(getApplies(hc.getOtherExpenses())) | ||
| .otherExpensesAmount(getAmountIfYes(hc.getOtherExpenses())) | ||
| .otherExpensesFrequency(getFrequencyIfYes(hc.getOtherExpenses())) | ||
| .build(); | ||
| } | ||
|
|
||
| private YesOrNo getApplies(IncomeExpenseDetails details) { | ||
| return details != null ? details.getApplies() : null; | ||
| } | ||
|
|
||
| private BigDecimal getAmountIfYes(IncomeExpenseDetails details) { | ||
| return details != null && YesOrNo.YES.equals(details.getApplies()) ? details.getAmount() : null; | ||
| } | ||
|
|
||
| return householdCircumstancesEntity; | ||
| private RecurrenceFrequency getFrequencyIfYes(IncomeExpenseDetails details) { | ||
| return details != null && YesOrNo.YES.equals(details.getApplies()) ? details.getFrequency() : null; | ||
| } | ||
| } |
File renamed without changes.
41 changes: 41 additions & 0 deletions
41
src/main/resources/db/migration/V076__add_regular_expenses_columns.sql
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| ALTER TABLE household_circumstances | ||
| ADD COLUMN household_bills YES_NO, | ||
| ADD COLUMN household_bills_amount DECIMAL(18,2), | ||
| ADD COLUMN household_bills_frequency VARCHAR(10), | ||
|
|
||
| ADD COLUMN loan_payments YES_NO, | ||
| ADD COLUMN loan_payments_amount DECIMAL(18,2), | ||
| ADD COLUMN loan_payments_frequency VARCHAR(10), | ||
|
|
||
| ADD COLUMN child_spousal_maintenance YES_NO, | ||
| ADD COLUMN child_spousal_maintenance_amount DECIMAL(18,2), | ||
| ADD COLUMN child_spousal_maintenance_frequency VARCHAR(10), | ||
|
|
||
| ADD COLUMN mobile_phone YES_NO, | ||
| ADD COLUMN mobile_phone_amount DECIMAL(18,2), | ||
| ADD COLUMN mobile_phone_frequency VARCHAR(10), | ||
|
|
||
| ADD COLUMN grocery_shopping YES_NO, | ||
| ADD COLUMN grocery_shopping_amount DECIMAL(18,2), | ||
| ADD COLUMN grocery_shopping_frequency VARCHAR(10), | ||
|
|
||
| ADD COLUMN fuel_parking_transport YES_NO, | ||
| ADD COLUMN fuel_parking_transport_amount DECIMAL(18,2), | ||
| ADD COLUMN fuel_parking_transport_frequency VARCHAR(10), | ||
|
|
||
| ADD COLUMN school_costs YES_NO, | ||
| ADD COLUMN school_costs_amount DECIMAL(18,2), | ||
| ADD COLUMN school_costs_frequency VARCHAR(10), | ||
|
|
||
| ADD COLUMN clothing YES_NO, | ||
| ADD COLUMN clothing_amount DECIMAL(18,2), | ||
| ADD COLUMN clothing_frequency VARCHAR(10), | ||
|
|
||
| ADD COLUMN other_expenses YES_NO, | ||
| ADD COLUMN other_expenses_amount DECIMAL(18,2), | ||
| ADD COLUMN other_expenses_frequency VARCHAR(10), | ||
|
|
||
| DROP COLUMN regular_expenses, | ||
| DROP COLUMN expense_amount, | ||
| DROP COLUMN expense_frequency; | ||
|
|
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.