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

SSCSCI-1356 fixing draft appeals for IBC #4177

Merged
merged 11 commits into from
Dec 12, 2024
2 changes: 1 addition & 1 deletion charts/sscs-tribunals-api/values.preview.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ elastic:
sscs-tribunals-frontend:
enabled: true
nodejs:
image: hmctspublic.azurecr.io/sscs/tribunals-frontend:latest
image: hmctspublic.azurecr.io/sscs/tribunals-frontend:pr-1563
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverty

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left in for QA, will remember to revert on merge

ingressHost: sya-${SERVICE_FQDN}
registerAdditionalDns:
enabled: true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package uk.gov.hmcts.reform.sscs.model.draft;

import lombok.Value;

@Value
public class SessionAppellantIbcRole {
String ibcRole;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package uk.gov.hmcts.reform.sscs.model.draft;

import lombok.Value;

@Value
public class SessionAppellantIbcaReference {
String ibcaReference;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ public class SessionContactDetails {
private String addressLine2;
private String townCity;
private String county;
private String country;
private String postCode;
private String portOfEntry;
private String phoneNumber;
private String emailAddress;
private String postcodeLookup;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,21 @@ public class SessionDraft {
@JsonProperty("AppellantNINO")
SessionAppellantNino appellantNino;

@JsonProperty("AppellantIBCAReference")
SessionAppellantIbcaReference appellantIbcaReference;

@JsonProperty("AppellantRole")
SessionAppellantIbcRole appellantIbcRole;

@JsonProperty("AppellantInMainlandUk")
SessionInMainlandUk appellantInMainlandUk;

@JsonProperty("AppellantContactDetails")
SessionContactDetails appellantContactDetails;

@JsonProperty("AppellantInternationalContactDetails")
SessionContactDetails appellantInternationalContactDetails;

@JsonProperty("SameAddress")
SessionSameAddress sameAddress;

Expand All @@ -87,6 +99,12 @@ public class SessionDraft {
@JsonProperty("Representative")
SessionRepresentative representative;

@JsonProperty("RepresentativeInMainlandUk")
SessionInMainlandUk representativeInMainlandUk;

@JsonProperty("RepresentativeInternationalDetails")
SessionRepresentativeDetails representativeInternationalDetails;

@JsonProperty("RepresentativeDetails")
SessionRepresentativeDetails representativeDetails;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package uk.gov.hmcts.reform.sscs.model.draft;

import lombok.Value;

@Value
public class SessionInMainlandUk {
String inMainlandUk;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class SessionRepresentativeDetails {
private String addressLine2;
private String townCity;
private String county;
private String country;
private String postCode;
private String phoneNumber;
private String emailAddress;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,25 @@ public SessionDraft convert(SscsCaseData caseData) {
.dwpIssuingOfficeEsa(buildDwpIssuingOfficeEsa(appeal))
.appointeeName(buildName(getAppointeeName(appeal)))
.appointeeDob(buildDob(getAppointeeIdentity(appeal)))
.appointeeContactDetails(buildContactDetails(getAppointeeAddress(appeal), getAppointeeContact(appeal)))
.appointeeContactDetails(buildContactDetails(getAppointeeAddress(appeal), getAppointeeContact(appeal), YesNo.NO))
.appointee(buildAppointee(appeal))
.appellantName(buildName(getAppellantName(appeal)))
.appellantDob(buildDob(getAppellantIdentity(appeal)))
.appellantNino(buildAppellantNino(appeal))
.appellantContactDetails(buildContactDetails(getAppellantAddress(appeal), getAppellantContact(appeal)))
.appellantIbcaReference(getAppellantIbcaReference(appeal))
.appellantIbcRole(getAppellantIbcRole(appeal))
.appellantInMainlandUk(getAppellantInMainlandUk(appeal))
.appellantContactDetails(buildContactDetails(getAppellantAddress(appeal), getAppellantContact(appeal), YesNo.NO))
.appellantInternationalContactDetails(buildContactDetails(getAppellantAddress(appeal), getAppellantContact(appeal), YesNo.YES))
.sameAddress(buildSameAddress(appeal))
.textReminders(buildTextReminders(caseData.getSubscriptions()))
.sendToNumber(buildSendToNumber(caseData))
.enterMobile(buildEnterMobile(caseData))
.smsConfirmation(buildSmsConfirmation(caseData))
.representative(buildRepresentative(appeal))
.representativeDetails(buildRepresentativeDetails(appeal))
.representativeInMainlandUk(getRepresentativeInMainlandUk(appeal))
.representativeDetails(buildRepresentativeDetails(appeal, YesNo.NO))
.representativeInternationalDetails(buildRepresentativeDetails(appeal, YesNo.YES))
.reasonForAppealing(buildReasonForAppealing(appeal))
.otherReasonForAppealing(buildOtherReasonForAppealing(appeal))
.evidenceProvide(buildEvidenceProvide(caseData.getEvidencePresent()))
Expand Down Expand Up @@ -287,7 +293,15 @@ private SessionRepresentative buildRepresentative(Appeal appeal) {
return new SessionRepresentative(StringUtils.lowerCase(appeal.getRep().getHasRepresentative()));
}

private SessionRepresentativeDetails buildRepresentativeDetails(Appeal appeal) {
private SessionInMainlandUk getRepresentativeInMainlandUk(Appeal appeal) {
if (!hasRep(appeal) || appeal.getRep().getAddress() == null || appeal.getRep().getAddress().getInMainlandUk() == null) {
return null;
}

return new SessionInMainlandUk(appeal.getRep().getAddress().getInMainlandUk().getValue().toLowerCase());
}

private SessionRepresentativeDetails buildRepresentativeDetails(Appeal appeal, YesNo international) {
SessionRepresentative sessionRepresentative = buildRepresentative(appeal);
if (!hasRep(appeal)
|| sessionRepresentative == null
Expand All @@ -307,12 +321,16 @@ private SessionRepresentativeDetails buildRepresentativeDetails(Appeal appeal) {
boolean hasAddress = appeal.getRep().getAddress() != null;
boolean hasContact = appeal.getRep().getContact() != null;

if (hasAddress && international.equals(appeal.getRep().getAddress().getInMainlandUk())) {
return null;
}
return new SessionRepresentativeDetails(
repName,
hasAddress ? appeal.getRep().getAddress().getLine1() : null,
hasAddress ? appeal.getRep().getAddress().getLine2() : null,
hasAddress ? appeal.getRep().getAddress().getTown() : null,
hasAddress ? appeal.getRep().getAddress().getCounty() : null,
hasAddress ? appeal.getRep().getAddress().getCountry() : null,
hasAddress ? appeal.getRep().getAddress().getPostcode() : null,
hasContact ? appeal.getRep().getContact().getMobile() : null,
hasContact ? appeal.getRep().getContact().getEmail() : null,
Expand Down Expand Up @@ -512,6 +530,35 @@ private SessionAppellantNino buildAppellantNino(Appeal appeal) {
return new SessionAppellantNino(appeal.getAppellant().getIdentity().getNino());
}

private SessionAppellantIbcaReference getAppellantIbcaReference(Appeal appeal) {
if (appeal.getAppellant() == null
|| appeal.getAppellant().getIdentity() == null
|| appeal.getAppellant().getIdentity().getIbcaReference() == null) {
return null;
}

return new SessionAppellantIbcaReference(appeal.getAppellant().getIdentity().getIbcaReference());
}

private SessionAppellantIbcRole getAppellantIbcRole(Appeal appeal) {
if (appeal.getAppellant() == null
|| appeal.getAppellant().getIbcRole() == null) {
return null;
}

return new SessionAppellantIbcRole(appeal.getAppellant().getIbcRole());
}

private SessionInMainlandUk getAppellantInMainlandUk(Appeal appeal) {
if (appeal.getAppellant() == null
|| appeal.getAppellant().getAddress() == null
|| appeal.getAppellant().getAddress().getInMainlandUk() == null) {
return null;
}

return new SessionInMainlandUk(appeal.getAppellant().getAddress().getInMainlandUk().getValue().toLowerCase());
}

private Address getAppellantAddress(Appeal appeal) {
if (appeal.getAppellant() == null) {
return null;
Expand Down Expand Up @@ -544,16 +591,18 @@ private Contact getAppointeeContact(Appeal appeal) {
return appeal.getAppellant().getAppointee().getContact();
}

private SessionContactDetails buildContactDetails(Address address, Contact contact) {
if (address == null || address.getLine1() == null) {
private SessionContactDetails buildContactDetails(Address address, Contact contact, YesNo international) {
if (address == null || address.getLine1() == null || international.equals(address.getInMainlandUk())) {
return null;
}
return new SessionContactDetails(
address.getLine1(),
address.getLine2(),
address.getTown(),
address.getCounty(),
address.getCountry(),
address.getPostcode(),
address.getPortOfEntry(),
contact.getMobile(),
contact.getEmail(),
StringUtils.isEmpty(address.getPostcodeLookup()) ? null : address.getPostcodeLookup(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,9 @@ public void givenGetDraftIsCalled_shouldReturn200AndTheDraft() throws Exception
"line2",
"town-city",
"county",
null,
"AP1 4NT",
null,
"07000000000",
"appellant@test.com",
null,
Expand Down Expand Up @@ -478,7 +480,9 @@ public void givenGetDraftWithRepIsCalled_shouldReturn200AndTheDraft() throws Exc
"line2",
"town-city",
"county",
null,
"AP1 4NT",
null,
"07000000000",
"appellant@test.com",
null,
Expand All @@ -500,6 +504,7 @@ public void givenGetDraftWithRepIsCalled_shouldReturn200AndTheDraft() throws Exc
"rep-line2",
"rep-town-city",
"rep-county",
null,
"RE7 7ES",
"07222222222",
"representative@test.com",
Expand Down Expand Up @@ -577,7 +582,9 @@ public void givenGetDraftWithAppointeeIsCalled_shouldReturn200AndTheDraft() thro
"tee-line2",
"tee-town-city",
"tee-county",
null,
"AP1 33T",
null,
"07111111111",
"appointee@test.com",
null,
Expand Down
Loading
Loading