generated from hmcts/spring-boot-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
855 additions
and
230 deletions.
There are no files selected for viewing
This file contains 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
20 changes: 20 additions & 0 deletions
20
src/main/java/uk/gov/hmcts/opal/dto/legacy/AccountActivitiesDto.java
This file contains 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,20 @@ | ||
package uk.gov.hmcts.opal.dto.legacy; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
@Builder | ||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class AccountActivitiesDto { | ||
|
||
@JsonProperty(value = "account_activity") | ||
private List<AccountActivityDto> accountActivity; | ||
|
||
} |
37 changes: 37 additions & 0 deletions
37
src/main/java/uk/gov/hmcts/opal/dto/legacy/AccountActivityDto.java
This file contains 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,37 @@ | ||
package uk.gov.hmcts.opal.dto.legacy; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.annotation.JsonRootName; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Builder | ||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@JsonRootName(value = "account_activity") | ||
public class AccountActivityDto { | ||
|
||
@JsonProperty("activity_id") | ||
private Integer activityId; | ||
|
||
@JsonProperty("activity_type") | ||
private String activityType; | ||
|
||
@JsonProperty("activity_type_code") | ||
private String activityTypeCode; | ||
|
||
@JsonProperty("activity_text") | ||
private String activityText; | ||
|
||
@JsonProperty("posted_date") | ||
private String postedDate; | ||
|
||
@JsonProperty("posted_by") | ||
private String postedBy; | ||
|
||
@JsonProperty("amount") | ||
private Double amount; | ||
} |
77 changes: 77 additions & 0 deletions
77
src/main/java/uk/gov/hmcts/opal/dto/legacy/DefendantAccountDto.java
This file contains 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,77 @@ | ||
package uk.gov.hmcts.opal.dto.legacy; | ||
|
||
import com.fasterxml.jackson.annotation.JsonFormat; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.math.BigDecimal; | ||
import java.time.LocalDate; | ||
|
||
@Builder | ||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class DefendantAccountDto { | ||
|
||
@JsonProperty("defendant_account_id") | ||
private Long defendantAccountId; | ||
@JsonProperty("account_number") | ||
private String accountNumber; | ||
@JsonProperty("amount_imposed") | ||
private BigDecimal amountImposed; | ||
@JsonProperty("amount_paid") | ||
private BigDecimal amountPaid; | ||
@JsonProperty("account_balance") | ||
private BigDecimal accountBalance; | ||
@JsonProperty("business_unit_id") | ||
private int businessUnitId; | ||
@JsonProperty("business_unit_name") | ||
private String businessUnitName; | ||
@JsonProperty("account_status") | ||
private String accountStatus; | ||
@JsonProperty("originator_name") | ||
private String originatorName; | ||
@JsonProperty("imposed_hearing_date") | ||
@JsonFormat(pattern = "yyyy-MM-dd") | ||
private LocalDate imposedHearingDate; | ||
@JsonProperty("imposing_court_code") | ||
private int imposingCourtCode; | ||
@JsonProperty("last_hearing_date") | ||
private String lastHearingDate; | ||
@JsonProperty("last_hearing_court_code") | ||
private int lastHearingCourtCode; | ||
@JsonProperty("last_changed_date") | ||
@JsonFormat(pattern = "yyyy-MM-dd") | ||
private LocalDate lastChangedDate; | ||
@JsonProperty("last_movement_date") | ||
@JsonFormat(pattern = "yyyy-MM-dd") | ||
private LocalDate lastMovementDate; | ||
@JsonProperty("collection_order") | ||
private boolean collectionOrder; | ||
@JsonProperty("enforcing_court_code") | ||
private int enforcingCourtCode; | ||
@JsonProperty("last_enforcement") | ||
private String lastEnforcement; | ||
@JsonProperty("enf_override_result_id") | ||
private String enfOverrideResultId; | ||
@JsonProperty("enf_override_enforcer_code") | ||
private Short enfOverrideEnforcerCode; | ||
@JsonProperty("enf_override_tfo_lja_code") | ||
private int enfOverrideTfoLjaCode; | ||
@JsonProperty("prosecutor_case_reference") | ||
private String prosecutorCaseReference; | ||
@JsonProperty("account_comments") | ||
private String accountComments; | ||
@JsonProperty("payment_terms") | ||
private PaymentTermsDto paymentTerms; | ||
@JsonProperty("parties") | ||
private PartiesDto parties; | ||
@JsonProperty("impositions") | ||
private ImpositionsDto impositions; | ||
@JsonProperty("account_activities") | ||
private AccountActivitiesDto accountActivities; | ||
|
||
} |
46 changes: 46 additions & 0 deletions
46
src/main/java/uk/gov/hmcts/opal/dto/legacy/ImpositionDto.java
This file contains 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,46 @@ | ||
package uk.gov.hmcts.opal.dto.legacy; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.annotation.JsonRootName; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Builder | ||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@JsonRootName(value = "imposition") | ||
public class ImpositionDto { | ||
@JsonProperty("imposition_id") | ||
private Integer impositionId; | ||
|
||
@JsonProperty("posted_date") | ||
private String postedDate; | ||
|
||
@JsonProperty("result_id") | ||
private String resultId; | ||
|
||
@JsonProperty("imposed_date") | ||
private String imposedDate; | ||
|
||
@JsonProperty("imposing_court_code") | ||
private Integer imposingCourtCode; | ||
|
||
@JsonProperty("imposed_amount") | ||
private Double imposedAmount; | ||
|
||
@JsonProperty("paid_amount") | ||
private Double paidAmount; | ||
|
||
@JsonProperty("offence_title") | ||
private String offenceTitle; | ||
|
||
@JsonProperty("creditor_account_number") | ||
private String creditorAccountNumber; | ||
|
||
@JsonProperty("creditor_name") | ||
private String creditorName; | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/uk/gov/hmcts/opal/dto/legacy/ImpositionsDto.java
This file contains 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,20 @@ | ||
package uk.gov.hmcts.opal.dto.legacy; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
@Builder | ||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class ImpositionsDto { | ||
|
||
@JsonProperty(value = "imposition") | ||
private List<ImpositionDto> imposition; | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/uk/gov/hmcts/opal/dto/legacy/LegacyAccountDetailsRequestDto.java
This file contains 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,22 @@ | ||
package uk.gov.hmcts.opal.dto.legacy; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import lombok.extern.jackson.Jacksonized; | ||
import uk.gov.hmcts.opal.dto.ToJsonString; | ||
|
||
@Data | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Jacksonized | ||
public class LegacyAccountDetailsRequestDto implements ToJsonString { | ||
|
||
//defendant_accounts.defendant_account_id | ||
@JsonProperty("defendant_account_id") | ||
private Long defendantAccountId; | ||
|
||
} |
76 changes: 76 additions & 0 deletions
76
src/main/java/uk/gov/hmcts/opal/dto/legacy/LegacyAccountDetailsResponseDto.java
This file contains 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,76 @@ | ||
package uk.gov.hmcts.opal.dto.legacy; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import lombok.extern.jackson.Jacksonized; | ||
import uk.gov.hmcts.opal.dto.AccountDetailsDto; | ||
import uk.gov.hmcts.opal.dto.ToJsonString; | ||
import uk.gov.hmcts.opal.service.DefendantAccountService; | ||
|
||
import java.util.List; | ||
|
||
@Data | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Jacksonized | ||
public class LegacyAccountDetailsResponseDto implements ToJsonString { | ||
|
||
@JsonProperty("defendant_account") | ||
private DefendantAccountDto defendantAccount; | ||
|
||
|
||
public static AccountDetailsDto toAccountDetailsDto(LegacyAccountDetailsResponseDto legacy) { | ||
|
||
DefendantAccountDto defendantAccountDto = legacy.getDefendantAccount(); | ||
PartyDto partyDto = defendantAccountDto.getParties().getParty().get(0); | ||
PaymentTermsDto paymentTermsDto = defendantAccountDto.getPaymentTerms(); | ||
|
||
return AccountDetailsDto.builder() | ||
.defendantAccountId(defendantAccountDto.getDefendantAccountId()) | ||
.accountNumber(defendantAccountDto.getAccountNumber()) | ||
.fullName(partyDto.getOrganisation() | ||
? partyDto.getOrganisationName() | ||
: partyDto.getFullName()) | ||
.accountCT(defendantAccountDto.getBusinessUnitName()) | ||
.address(DefendantAccountService.buildFullAddress( | ||
partyDto.getAddressLine1(), | ||
partyDto.getAddressLine2(), | ||
partyDto.getAddressLine3(), | ||
partyDto.getAddressLine4(), | ||
partyDto.getAddressLine5() | ||
)) | ||
.postCode(partyDto.getPostcode()) | ||
.dob(partyDto.getBirthDate()) | ||
.detailsChanged(defendantAccountDto.getLastChangedDate()) | ||
.lastCourtAppAndCourtCode(defendantAccountDto.getLastHearingDate() | ||
+ " " + defendantAccountDto.getLastHearingCourtCode()) | ||
.lastMovement(defendantAccountDto.getLastMovementDate()) | ||
.commentField(List.of(defendantAccountDto.getAccountComments())) | ||
.pcr(defendantAccountDto.getProsecutorCaseReference()) | ||
.paymentDetails(DefendantAccountService.buildPaymentDetails( | ||
paymentTermsDto.getTermsTypeCode(), | ||
paymentTermsDto.getInstalmentAmount(), | ||
paymentTermsDto.getInstalmentPeriod(), | ||
paymentTermsDto.getTermsDate() | ||
)) | ||
.lumpSum(paymentTermsDto.getInstalmentLumpSum()) | ||
.commencing(paymentTermsDto.getTermsTypeCode().equals("I") | ||
? paymentTermsDto.getTermsDate() | ||
: null) | ||
.daysInDefault(defendantAccountDto.getPaymentTerms().getJailDays()) | ||
.sentencedDate(defendantAccountDto.getImposedHearingDate()) | ||
.lastEnforcement(defendantAccountDto.getLastEnforcement()) | ||
.override(defendantAccountDto.getEnfOverrideResultId()) | ||
.enforcer(defendantAccountDto.getEnfOverrideEnforcerCode()) | ||
.enforcementCourt(defendantAccountDto.getEnforcingCourtCode()) | ||
.imposed(defendantAccountDto.getAmountImposed()) | ||
.amountPaid(defendantAccountDto.getAmountPaid()) | ||
.balance(defendantAccountDto.getAccountBalance()) | ||
.build(); | ||
} | ||
|
||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/uk/gov/hmcts/opal/dto/legacy/PartiesDto.java
This file contains 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,19 @@ | ||
package uk.gov.hmcts.opal.dto.legacy; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
@Builder | ||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class PartiesDto { | ||
|
||
@JsonProperty(value = "party") | ||
private List<PartyDto> party; | ||
} |
Oops, something went wrong.