Skip to content

Commit

Permalink
CIV-9632 interest calc bulk (#85)
Browse files Browse the repository at this point in the history
* interest calculation data  mapped

* point at ccd

* Update Jenkinsfile_CNP

* point at civil

* bump version of org.springframework.boot to 3.1.6

* bump version of org.springframework.boot to 3.1.6

* bump version of org.springframework.boot to 3.1.6

* bump version of org.springframework.boot to 3.1.6

* point at civil and CCD change

* remove civil and ccd pointing
  • Loading branch information
drummondjm authored Dec 12, 2023
1 parent 10d9991 commit 0ae45ce
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ public interface CreateClaimMapperInterface {
@Mapping(target = "claimInterest", expression = "java(CreateClaimMappingUtils.claimInterest(createClaimRequest))")
@Mapping(target = "interestFromSpecificDate", source = "interest.interestOwedDate")
@Mapping(target = "interestFromSpecificDateDescription", expression = "java(null)")
@Mapping(target = "sameRateInterestSelection.differentRate", source = "interest.interestDailyAmount")
@Mapping(target = "sameRateInterestSelection.differentRateReason", expression = "java(null)")
@Mapping(target = "uiStatementOfTruth.name", source = "sotSignature")
@Mapping(target = "uiStatementOfTruth.role", source = "sotSignatureRole")
@Mapping(target = "applicantSolicitor1UserDetails", expression = "java(null)")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package uk.gov.hmcts.reform.civil.model.casedata;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;

import java.math.BigDecimal;

@Data
@Builder(toBuilder = true)
@AllArgsConstructor
public class SameRateInterestSelection {

//private final SameRateInterestType sameRateInterestType;
private final BigDecimal differentRate;
private final String differentRateReason;

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import uk.gov.hmcts.reform.civil.model.casedata.IdamUserDetails;
import uk.gov.hmcts.reform.civil.model.casedata.OrganisationPolicy;
import uk.gov.hmcts.reform.civil.model.casedata.Party;
import uk.gov.hmcts.reform.civil.model.casedata.SameRateInterestSelection;
import uk.gov.hmcts.reform.civil.model.casedata.SolicitorReferences;
import uk.gov.hmcts.reform.civil.model.casedata.StatementOfTruth;
import uk.gov.hmcts.reform.civil.model.casedata.YesOrNo;
Expand Down Expand Up @@ -46,9 +47,5 @@ public class CreateClaimCCD {
private String interestFromSpecificDateDescription;
private StatementOfTruth uiStatementOfTruth;
private IdamUserDetails applicantSolicitor1UserDetails;
// TODO: Add in fields if interest was requested
// private InterestClaimOptions interestClaimOptions;
// private SameRateInterestSelection sameRateInterestSelection;
// etc

private SameRateInterestSelection sameRateInterestSelection;
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
@AllArgsConstructor
public class Interest {
@Schema(example = "7")
private Integer interestDailyAmount;
private Long interestDailyAmount;
@NotNull(message = "Interest Owed Date should not be null")
@JsonFormat(pattern = "yyyy-MM-dd")
@Schema(example = "2023-07-25")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import uk.gov.hmcts.reform.civil.model.casedata.Address;
import uk.gov.hmcts.reform.civil.model.casedata.CorrectEmail;
import uk.gov.hmcts.reform.civil.model.casedata.Party;
import uk.gov.hmcts.reform.civil.model.casedata.SameRateInterestSelection;
import uk.gov.hmcts.reform.civil.model.casedata.SolicitorReferences;
import uk.gov.hmcts.reform.civil.model.casedata.StatementOfTruth;
import uk.gov.hmcts.reform.civil.model.casedata.YesOrNo;
Expand Down Expand Up @@ -118,12 +119,17 @@ void shouldMapFieldsRequiredFor1v1WithInterestAdded_whenInvoked() {
createClaimRequest.setInterest(Interest.builder()
.interestClaimDate(LocalDate.now().minusMonths(2))
.interestOwedDate(LocalDate.now().minusMonths(1))
.interestDailyAmount(5L)
.build());
// Mapping
createClaimCCD = mapper.claimToDto(createClaimRequest);
// Updated CCD test mappings should then be
testCreateClaimCCD.setClaimInterest(YesOrNo.YES);
testCreateClaimCCD.setInterestFromSpecificDate(LocalDate.now().minusMonths(1));
testCreateClaimCCD.setSameRateInterestSelection(SameRateInterestSelection.builder()
.differentRate(BigDecimal.valueOf(5L))
.differentRateReason(null)
.build());
//
assertThat(createClaimCCD).usingRecursiveComparison().isEqualTo(testCreateClaimCCD);
}
Expand Down Expand Up @@ -172,11 +178,16 @@ void shouldMapFieldsRequiredFor1v2WithInterestAdded_whenInvoked() {
createClaimRequest.setInterest(Interest.builder()
.interestClaimDate(LocalDate.now().minusMonths(2))
.interestOwedDate(LocalDate.now().minusMonths(1))
.interestDailyAmount(5L)
.build());
// Mapping
createClaimCCD = mapper.claimToDto(createClaimRequest);
// Updated CCD test mappings should then be
testCreateClaimCCD.setClaimInterest(YesOrNo.YES);
testCreateClaimCCD.setSameRateInterestSelection(SameRateInterestSelection.builder()
.differentRate(BigDecimal.valueOf(5L))
.differentRateReason(null)
.build());
testCreateClaimCCD.setInterestFromSpecificDate(LocalDate.now().minusMonths(1));
testCreateClaimCCD.setAdddRespondent2(YesOrNo.YES);
testCreateClaimCCD.setRespondent2(Party.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void init() {
@Test
void shouldThrowErrorMessageWhenInterestOwedDateIsNull() {

interest = Interest.builder().interestDailyAmount(200)
interest = Interest.builder().interestDailyAmount(200L)
.interestClaimDate(LocalDate.now())
.claimAmountInterestBase(20)
.build();
Expand All @@ -38,7 +38,7 @@ void shouldThrowErrorMessageWhenInterestOwedDateIsNull() {
@Test
void shouldNotThrowErrorMessageWhenInterestOwedDateIsNotNull() {

interest = Interest.builder().interestDailyAmount(200)
interest = Interest.builder().interestDailyAmount(200L)
.interestOwedDate(LocalDate.now())
.interestClaimDate(LocalDate.now())
.claimAmountInterestBase(20)
Expand Down

0 comments on commit 0ae45ce

Please sign in to comment.