Skip to content

Commit

Permalink
Merge pull request #62 from companieshouse/feature/DSND-1957
Browse files Browse the repository at this point in the history
Fixing a bug relating to setting country of residence. The PscDocumen…
  • Loading branch information
lbedrosyanCH authored Dec 4, 2023
2 parents 24417c2 + 919b8fb commit 40fafe8
Showing 1 changed file with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,12 @@ public PscDocument transformPscOnInsert(

if (externalData.getData() != null) {
Data data = externalData.getData();
pscDocument.setIdentification(new PscIdentification(data.getIdentification()));
if (data.getIdentification() != null) {
pscDocument.setIdentification(new PscIdentification(data.getIdentification()));
}

pscDocument.setData(transformDataFields(data));
PscData pscData;
pscData = transformDataFields(data);

String kind = data.getKind();
if (IndividualPscRoles.includes(kind)) {
Expand All @@ -337,13 +340,15 @@ public PscDocument transformPscOnInsert(
externalData.getSensitiveData()));
}

handleIndividualFields(data, pscDocument.getData());
handleIndividualFields(data, pscData);
}
if (SecurePscRoles.includes(kind)) {
handleSecureFields(data, pscDocument.getData());
handleSecureFields(data, pscData);
} else {
pscDocument.getData().setAddress(new Address(data.getServiceAddress()));
pscData.setAddress(new Address(data.getServiceAddress()));
}

pscDocument.setData(pscData);
}
}
if (requestBody.getInternalData() != null) {
Expand Down Expand Up @@ -387,7 +392,7 @@ private PscData transformDataFields(Data data) {

private void handleIndividualFields(Data data, PscData pscData) {
pscData.setNameElements(new NameElements(data.getNameElements()));
data.setCountryOfResidence(data.getCountryOfResidence());
pscData.setCountryOfResidence(data.getCountryOfResidence());
}

private void handleSecureFields(Data data, PscData pscData) {
Expand Down

0 comments on commit 40fafe8

Please sign in to comment.