Skip to content
This repository was archived by the owner on Nov 4, 2024. It is now read-only.

Commit 316c08c

Browse files
DGordonV1DGordonV1
and
DGordonV1
authored
SSCS-12059 - Revert code to use org name if present, missing first na… (#592)
* SSCS-12059 - Revert code to use org name if present, missing first name errors. * SSCS-12059 - Revert code to use org name if present, missing first name errors. --------- Co-authored-by: DGordonV1 <[email protected]>
1 parent 8213e73 commit 316c08c

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

src/main/java/uk/gov/hmcts/reform/sscs/helper/mapping/HearingsPartiesMapping.java

+9-11
Original file line numberDiff line numberDiff line change
@@ -257,32 +257,30 @@ public static IndividualDetails getPartyIndividualDetails(Entity entity, Hearing
257257
}
258258

259259
public static String getIndividualFirstName(Entity entity) throws ListingException {
260-
String firstName = entity.getName().getFirstName();
260+
String org = getIndividualOrganisation(entity);
261+
if (isNotEmpty(org)) {
262+
return ORGANISATION_NAME_REPLACEMENT;
263+
}
261264

265+
String firstName = entity.getName().getFirstName();
262266
if (isEmpty(firstName)) {
263267
throw new ListingException("Missing first name");
264268
}
265269

270+
return firstName;
271+
}
272+
273+
public static String getIndividualLastName(Entity entity) throws ListingException {
266274
String org = getIndividualOrganisation(entity);
267275
if (isNotEmpty(org)) {
268276
return ORGANISATION_NAME_REPLACEMENT;
269277
}
270278

271-
return firstName;
272-
}
273-
274-
public static String getIndividualLastName(Entity entity) throws ListingException {
275279
String firstName = entity.getName().getLastName();
276-
277280
if (isEmpty(firstName)) {
278281
throw new ListingException("Missing last name");
279282
}
280283

281-
String org = getIndividualOrganisation(entity);
282-
if (!isEmpty(org)) {
283-
return ORGANISATION_NAME_REPLACEMENT;
284-
}
285-
286284
return firstName;
287285
}
288286

0 commit comments

Comments
 (0)