Skip to content
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

CIV-8923 specAoSApplicantCorrespondenceAddressdetails is being updated when defendant updates address #3547

Merged
merged 69 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from 65 commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
bae42b3
CIV-8923 respondent 1 working
dtortolaV1 Sep 21, 2023
eca2586
CIV-8923 respondent 2 working
dtortolaV1 Sep 21, 2023
4c86e58
Merge branch 'master' into CIV-8923
dtortolaV1 Sep 21, 2023
41098a5
CIV-8923 style
dtortolaV1 Sep 22, 2023
cb75228
Merge branch 'master' into CIV-8923
dtortolaV1 Sep 22, 2023
3fde1c0
CIV-8923 tests
dtortolaV1 Sep 22, 2023
94c29fb
Merge remote-tracking branch 'origin/master' into CIV-8923
dtortolaV1 Sep 27, 2023
c534164
Merge branch 'master' into CIV-8923
asthamalviya Sep 27, 2023
271c42c
Merge branch 'master' into CIV-8923
kdaHMCTS Oct 3, 2023
5b2d9e5
Merge branch 'master' into CIV-8923
kdaHMCTS Oct 5, 2023
aa0ce37
CIV-8923 ccd branch mapping
UshaPanneerselvam1 Oct 11, 2023
08dd9ee
CIV-8923 Merge Conflicts resolved
UshaPanneerselvam1 Oct 12, 2023
c3ddee0
Merge branch 'master' into feat/CIV-8923-11OCT
UshaPanneerselvam1 Oct 12, 2023
c61ee06
Merge branch 'master' into feat/CIV-8923-11OCT
UshaPanneerselvam1 Oct 12, 2023
6ef3e94
Merge branch 'master' into feat/CIV-8923-11OCT
UshaPanneerselvam1 Oct 13, 2023
06a6fd9
Merge branch 'master' into feat/CIV-8923-11OCT
UshaPanneerselvam1 Oct 16, 2023
db21d57
CIV-8923 Merge Conflicts resolved
UshaPanneerselvam1 Oct 17, 2023
42e46d0
Merge branch 'master' into feat/CIV-8923-11OCT
UshaPanneerselvam1 Oct 17, 2023
be405ba
Merge branch 'master' into feat/CIV-8923-11OCT
UshaPanneerselvam1 Oct 17, 2023
e406546
Merge branch 'master' into feat/CIV-8923-11OCT
UshaPanneerselvam1 Oct 18, 2023
d74bfde
Merge branch 'master' into feat/CIV-8923-11OCT
UshaPanneerselvam1 Oct 18, 2023
ad47f3b
CIV-8923 Unit tests for RespondToClaimSpecCallbackHandler
UshaPanneerselvam1 Oct 18, 2023
4a8ed7e
Merge branch 'feat/CIV-8923-11OCT' of github.com:hmcts/civil-service …
UshaPanneerselvam1 Oct 18, 2023
4d689b5
CIV-8923 Unit tests for RespondToClaimSpecCallbackHandler
UshaPanneerselvam1 Oct 18, 2023
f2c256d
Merge branch 'master' into feat/CIV-8923-11OCT
UshaPanneerselvam1 Oct 18, 2023
6f16790
Merge branch 'master' into feat/CIV-8923-11OCT
UshaPanneerselvam1 Oct 18, 2023
3bcae1c
CIV-8923 Unit tests for RespondToClaimSpecCallbackHandler
UshaPanneerselvam1 Oct 18, 2023
d22f716
Merge branch 'feat/CIV-8923-11OCT' of github.com:hmcts/civil-service …
UshaPanneerselvam1 Oct 18, 2023
a469b26
Merge branch 'master' into feat/CIV-8923-11OCT
UshaPanneerselvam1 Oct 19, 2023
7c4395b
CIV-8923 Unit tests for RespondToClaimSpecCallbackHandler
UshaPanneerselvam1 Oct 19, 2023
cf127c1
Merge branch 'master' into feat/CIV-8923-11OCT
UshaPanneerselvam1 Oct 19, 2023
8f12c60
Merge branch 'master' into feat/CIV-8923-11OCT
UshaPanneerselvam1 Oct 20, 2023
4a96f1a
CIV-8923 Unit tests for RespondToClaimSpecCallbackHandler
UshaPanneerselvam1 Oct 20, 2023
b7126c3
Merge branch 'master' into feat/CIV-8923-11OCT
UshaPanneerselvam1 Oct 23, 2023
f32872b
Merge branch 'master' into feat/CIV-8923-11OCT
UshaPanneerselvam1 Oct 24, 2023
78793d9
CIV-8923 Unit tests for RespondToClaimSpecCallbackHandler
UshaPanneerselvam1 Oct 24, 2023
bea4f11
Merge branch 'master' into feat/CIV-8923-11OCT
UshaPanneerselvam1 Oct 24, 2023
b75c0bb
Merge branch 'master' into feat/CIV-8923-11OCT
UshaPanneerselvam1 Oct 26, 2023
f222f35
CIV-8923 respondentX is not populated, using respondentXCopy
dtortolaV1 Oct 26, 2023
27eed86
Merge branch 'master' into feat/CIV-8923-11OCT
UshaPanneerselvam1 Oct 27, 2023
af5461e
Merge branch 'master' into feat/CIV-8923-11OCT
dtortolaV1 Oct 27, 2023
bb46a39
Merge branch 'master' into feat/CIV-8923-11OCT
UshaPanneerselvam1 Oct 27, 2023
e85c6bb
Merge branch 'master' into feat/CIV-8923-11OCT
UshaPanneerselvam1 Oct 30, 2023
7165074
Merge branch 'master' into feat/CIV-8923-11OCT
UshaPanneerselvam1 Oct 30, 2023
8fd210a
Merge branch 'master' into feat/CIV-8923-11OCT
UshaPanneerselvam1 Oct 30, 2023
289785e
Merge branch 'master' into feat/CIV-8923-11OCT
UshaPanneerselvam1 Oct 31, 2023
99b7d85
Merge branch 'master' into feat/CIV-8923-11OCT
UshaPanneerselvam1 Oct 31, 2023
2066892
Merge branch 'master' into feat/CIV-8923-11OCT
UshaPanneerselvam1 Oct 31, 2023
57a381b
Merge branch 'master' into feat/CIV-8923-11OCT
UshaPanneerselvam1 Oct 31, 2023
f0b1140
Merge branch 'master' into feat/CIV-8923-11OCT
UshaPanneerselvam1 Nov 1, 2023
c6fe14c
Merge branch 'master' into feat/CIV-8923-11OCT
UshaPanneerselvam1 Nov 1, 2023
a851ba8
Merge branch 'master' into feat/CIV-8923-11OCT
UshaPanneerselvam1 Nov 1, 2023
b5fbfb3
Merge branch 'master' into feat/CIV-8923-11OCT
UshaPanneerselvam1 Nov 1, 2023
f7fc49c
Merge branch 'master' into feat/CIV-8923-11OCT
UshaPanneerselvam1 Nov 2, 2023
7600eba
Merge branch 'master' into feat/CIV-8923-11OCT
UshaPanneerselvam1 Nov 3, 2023
0f2cc5e
Merge branch 'master' into feat/CIV-8923-11OCT
UshaPanneerselvam1 Nov 6, 2023
9049188
CIV-8923 Changing ccd brnach to master for testing
UshaPanneerselvam1 Nov 6, 2023
35bcfd4
Merge branch 'master' into feat/CIV-8923-11OCT
UshaPanneerselvam1 Nov 6, 2023
06f5af6
Merge branch 'master' into feat/CIV-8923-11OCT
UshaPanneerselvam1 Nov 6, 2023
7cd6f10
CIV-8923 Changing ccd branch
UshaPanneerselvam1 Nov 7, 2023
52f9e64
Merge branch 'master' into feat/CIV-8923-11OCT
UshaPanneerselvam1 Nov 7, 2023
327a9bf
CIV-8923 Pointing to ccd branch
UshaPanneerselvam1 Nov 9, 2023
2db5061
Merge branch 'master' into feat/CIV-8923-11OCT-2
UshaPanneerselvam1 Nov 9, 2023
5a7f936
Merge branch 'master' into feat/CIV-8923-11OCT-2
UshaPanneerselvam1 Nov 9, 2023
c2decba
CIV-8923 Resolving merge conflicts
UshaPanneerselvam1 Nov 13, 2023
28e5f87
CIV-8923 Pointing ccd branch to master
UshaPanneerselvam1 Nov 13, 2023
54d85c2
Merge branch 'master' into feat/CIV-8923-11OCT-2
UshaPanneerselvam1 Nov 13, 2023
6f42594
Merge branch 'master' into feat/CIV-8923-11OCT-2
UshaPanneerselvam1 Nov 13, 2023
4c47096
Merge branch 'master' into feat/CIV-8923-11OCT-2
asthamalviya Nov 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Jenkinsfile_CNP
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import uk.gov.hmcts.contino.GithubAPI
def type = "java"
def product = "civil"
def component = "service"
def ccdBranch = "master"
def ccdBranch = "feat/CIV-8923-11Oct-2"
asthamalviya marked this conversation as resolved.
Show resolved Hide resolved
def camundaBranch = "master"
def yarnBuilder = new uk.gov.hmcts.contino.YarnBuilder(this)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ protected Map<String, Callback> callbacks() {
.put(callbackKey(MID, "upload"), this::emptyCallbackResponse)
.put(callbackKey(MID, "statement-of-truth"), this::resetStatementOfTruth)
.put(callbackKey(MID, "validate-payment-date"), this::validateRespondentPaymentDate)
.put(callbackKey(MID, "specCorrespondenceAddress"), this::validateCorrespondenceApplicantAddress)
.put(callbackKey(MID, "specCorrespondenceAddress"), this::validateCorrespondenceAddress)
.put(callbackKey(MID, "determineLoggedInSolicitor"), this::determineLoggedInSolicitor)
.put(callbackKey(MID, "track"), this::handleDefendAllClaim)
.put(callbackKey(MID, "specHandleResponseType"), this::handleRespondentResponseTypeForSpec)
Expand Down Expand Up @@ -1060,12 +1060,26 @@ private AllocatedTrack getAllocatedTrack(CaseData caseData) {
);
}

private CallbackResponse validateCorrespondenceApplicantAddress(CallbackParams callbackParams) {
if (SpecJourneyConstantLRSpec.DEFENDANT_RESPONSE_SPEC.equals(callbackParams.getRequest().getEventId())) {
return validateCorrespondenceApplicantAddress(callbackParams, postcodeValidator);
private CallbackResponse validateCorrespondenceAddress(CallbackParams callbackParams) {
CaseData caseData = callbackParams.getCaseData();
if (caseData.getIsRespondent1() == YES
&& caseData.getRespondentSolicitor1ServiceAddressRequired() == NO) {
List<String> errors = postcodeValidator.validate(
caseData.getRespondentSolicitor1ServiceAddress().getPostCode());

return AboutToStartOrSubmitCallbackResponse.builder()
.errors(errors)
.build();
} else if (caseData.getIsRespondent2() == YES
&& caseData.getRespondentSolicitor2ServiceAddressRequired() == NO) {
List<String> errors = postcodeValidator.validate(
caseData.getRespondentSolicitor2ServiceAddress().getPostCode());

return AboutToStartOrSubmitCallbackResponse.builder()
.errors(errors)
.build();
}
return AboutToStartOrSubmitCallbackResponse.builder()
.build();
return AboutToStartOrSubmitCallbackResponse.builder().build();
}

private CallbackResponse determineLoggedInSolicitor(CallbackParams callbackParams) {
Expand Down Expand Up @@ -1118,6 +1132,10 @@ private CallbackResponse populateRespondent1Copy(CallbackParams callbackParams)
.respondent1Copy(caseData.getRespondent1())
.respondent1ClaimResponseTestForSpec(caseData.getRespondent1ClaimResponseTypeForSpec())
.respondent2ClaimResponseTestForSpec(caseData.getRespondent2ClaimResponseTypeForSpec())
.respondentSolicitor1ServiceAddress(Address.builder().build())
.respondentSolicitor2ServiceAddress(Address.builder().build())
.respondentSolicitor1ServiceAddressRequired(null)
.respondentSolicitor2ServiceAddressRequired(null)
.showConditionFlags(initialShowTags);

updatedCaseData.respondent1DetailsForClaimDetailsTab(caseData.getRespondent1().toBuilder().flags(null).build());
Expand Down Expand Up @@ -1265,9 +1283,9 @@ private CallbackResponse validateUnavailableDates(CallbackParams callbackParams)
}

private CallbackResponse validateDateOfBirth(CallbackParams callbackParams) {
Party respondent = callbackParams.getCaseData().getRespondent1();
if (respondent == null && callbackParams.getCaseData().getRespondent2() != null) {
respondent = callbackParams.getCaseData().getRespondent2();
Party respondent = callbackParams.getCaseData().getRespondent1Copy();
if (respondent == null && callbackParams.getCaseData().getRespondent2Copy() != null) {
respondent = callbackParams.getCaseData().getRespondent2Copy();
}
List<String> errors = dateOfBirthValidator.validate(respondent);

Expand Down Expand Up @@ -1345,9 +1363,9 @@ private CallbackResponse setApplicantResponseDeadline(CallbackParams callbackPar
AllocatedTrack allocatedTrack = caseData.getAllocatedTrack();
Party updatedRespondent1;

if (NO.equals(caseData.getSpecAoSApplicantCorrespondenceAddressRequired())) {
if (NO.equals(caseData.getTempAddress1Required())) {
updatedRespondent1 = caseData.getRespondent1().toBuilder()
.primaryAddress(caseData.getSpecAoSApplicantCorrespondenceAddressdetails()).build();
.primaryAddress(caseData.getTempAddress1()).build();
} else {
updatedRespondent1 = caseData.getRespondent1().toBuilder()
.primaryAddress(caseData.getRespondent1Copy().getPrimaryAddress())
Expand Down Expand Up @@ -1424,21 +1442,8 @@ && ifResponseTypeIsPartOrFullAdmission(caseData)) {
.businessProcess(BusinessProcess.ready(DEFENDANT_RESPONSE_SPEC));

if (caseData.getRespondent2() != null && caseData.getRespondent2Copy() != null) {
Party updatedRespondent2;

if (NO.equals(caseData.getSpecAoSRespondent2HomeAddressRequired())) {
updatedRespondent2 = caseData.getRespondent2().toBuilder()
.primaryAddress(caseData.getSpecAoSRespondent2HomeAddressDetails()).build();
} else {
updatedRespondent2 = caseData.getRespondent2().toBuilder()
.primaryAddress(caseData.getRespondent2Copy().getPrimaryAddress()).build();
}

updatedData
.respondent2(updatedRespondent2.toBuilder()
.flags(caseData.getRespondent2Copy().getFlags()).build())
.respondent2Copy(null);
updatedData.respondent2DetailsForClaimDetailsTab(updatedRespondent2.toBuilder().flags(null).build());
Party updatedRespondent2 = applyRespondent2Address(caseData, updatedData);
updatedData.respondent2DetailsForClaimDetailsTab(updatedRespondent2);
}

// moving statement of truth value to correct field, this was not possible in mid event.
Expand Down Expand Up @@ -1495,8 +1500,10 @@ && ifResponseTypeIsPartOrFullAdmission(caseData)) {
.build());
}

UnavailabilityDatesUtils.rollUpUnavailabilityDatesForRespondent(updatedData,
toggleService.isUpdateContactDetailsEnabled());
UnavailabilityDatesUtils.rollUpUnavailabilityDatesForRespondent(
updatedData,
toggleService.isUpdateContactDetailsEnabled()
);

updatedData.respondent1DetailsForClaimDetailsTab(updatedData.build().getRespondent1().toBuilder().flags(null).build());
if (ofNullable(caseData.getRespondent2()).isPresent()) {
Expand Down Expand Up @@ -1568,6 +1575,21 @@ && isAwaitingAnotherDefendantResponse(caseData)) {
.build();
}

private static Party applyRespondent2Address(CaseData caseData, CaseData.CaseDataBuilder<?, ?> updatedData) {
Party updatedRespondent2;

if (NO.equals(caseData.getTempAddress2Required())) {
updatedRespondent2 = caseData.getRespondent2().toBuilder()
.primaryAddress(caseData.getTempAddress2()).build();
} else {
updatedRespondent2 = caseData.getRespondent2().toBuilder()
.primaryAddress(caseData.getRespondent2Copy().getPrimaryAddress()).build();
}

updatedData.respondent2(updatedRespondent2).respondent2Copy(null);
return updatedRespondent2;
}

private boolean ifResponseTypeIsPartOrFullAdmission(CaseData caseData) {
return (RespondentResponseTypeSpec.PART_ADMISSION.equals(caseData.getRespondent1ClaimResponseTypeForSpec())
|| RespondentResponseTypeSpec.PART_ADMISSION.equals(
Expand All @@ -1582,19 +1604,19 @@ private void updateCorrespondenceAddress(CallbackParams callbackParams,
CaseData.CaseDataBuilder<?, ?> updatedCaseData,
CaseData caseData) {
if (solicitorHasCaseRole(callbackParams, RESPONDENTSOLICITORONE)
&& caseData.getSpecAoSRespondentCorrespondenceAddressRequired() == YesOrNo.NO) {
Address newAddress = caseData.getSpecAoSRespondentCorrespondenceAddressdetails();
&& caseData.getRespondentSolicitor1ServiceAddressRequired() == YesOrNo.NO) {
Address newAddress = caseData.getRespondentSolicitor1ServiceAddress();
updatedCaseData.specRespondentCorrespondenceAddressdetails(newAddress)
.specAoSRespondentCorrespondenceAddressdetails(Address.builder().build());
.respondentSolicitor1ServiceAddress(Address.builder().build());
if (getMultiPartyScenario(caseData) == ONE_V_TWO_ONE_LEGAL_REP) {
// to keep with heading tab
updatedCaseData.specRespondent2CorrespondenceAddressdetails(newAddress);
}
} else if (solicitorHasCaseRole(callbackParams, RESPONDENTSOLICITORTWO)
&& caseData.getSpecAoSRespondent2CorrespondenceAddressRequired() == YesOrNo.NO) {
&& caseData.getRespondentSolicitor2ServiceAddressRequired() == YesOrNo.NO) {
updatedCaseData.specRespondent2CorrespondenceAddressdetails(
caseData.getSpecAoSRespondent2CorrespondenceAddressdetails())
.specAoSRespondent2CorrespondenceAddressdetails(Address.builder().build());
caseData.getRespondentSolicitor2ServiceAddress())
.respondentSolicitor2ServiceAddress(Address.builder().build());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,23 @@ public boolean isApplicantNotRepresented() {

private FastTrackAllocation fastTrackAllocation;

/**
* used to temporary hold addresses.
*/
private final Address tempAddress1;
/**
* used with tempAddress1.
*/
private final YesOrNo tempAddress1Required;
/**
* used to temporary hold addresses.
*/
private final Address tempAddress2;
/**
* used with tempAddress1.
*/
private final YesOrNo tempAddress2Required;

@JsonIgnore
public boolean isResponseAcceptedByClaimant() {
return applicant1AcceptAdmitAmountPaidSpec == YesOrNo.YES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public static void rollUpUnavailabilityDatesForRespondent(CaseData.CaseDataBuild
.getUnavailableDates();

List<Element<UnavailableDate>> updatedUnavailableDates = addEventAndDate(
caseData.getRespondent1ResponseDate().toLocalDate(),
caseData.getRespondent2ResponseDate().toLocalDate(),
DEFENDANT_RESPONSE_EVENT,
respondent2DQUnavailableDates
);
Expand Down
Loading
Loading