Skip to content

Commit

Permalink
Fix error where applicant name was not correct in metatdata file for …
Browse files Browse the repository at this point in the history
…the SNAP delivery (#724)
  • Loading branch information
bseeger authored May 17, 2024
1 parent 2138e42 commit d2339e7
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/main/java/org/ladocuploader/app/cli/SubmissionTransfer.java
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ private void packageUploadedDocuments(String batchIndex, ZipOutputStream zos, St
for (UserFile userFile : userFiles) {
fileCount += 1;
String docUploadFilename = SubmissionUtilities.createFileNameForUploadedDocument(submission, userFile, fileCount, userFiles.size());
String docOwnerName = submission.getInputData().get("documentOwner_wildcard_" + userFile.getFileId())
.toString().replace(" ", "_");
ZipEntry docEntry = new ZipEntry(batchIndex + "/" + subfolder + "/" + docUploadFilename);
docEntry.setSize(userFile.getFilesize().longValue());
zos.putNextEntry(docEntry);
Expand All @@ -232,7 +234,8 @@ private void packageUploadedDocuments(String batchIndex, ZipOutputStream zos, St

// write doc metadata
String docType = getDocType(submission, userFile);
String metaEntry = generateMetaDataEntry(batchIndex, subfolder, docUploadFilename, docType, submission);
String metaEntry = generateMetaDataEntry(batchIndex, subfolder, docUploadFilename, docType, submission,
docOwnerName.split("_")[0], docOwnerName.split("_")[1]);
docMeta.append(metaEntry);
}
}
Expand All @@ -251,16 +254,22 @@ private void packageSnapApplication(String batchIndex, ZipOutputStream zos, Stri
zos.putNextEntry(entry);
zos.write(file);
zos.closeEntry();
String metaEntry = generateMetaDataEntry(batchIndex, subfolder, fileName, "APP-OFS 4 APP", submission);
String metaEntry = generateMetaDataEntry(batchIndex, subfolder, fileName, "APP-OFS 4 APP", submission,
submission.getInputData().getOrDefault("firstName", "").toString(),
submission.getInputData().getOrDefault("lastName", "").toString());
docMeta.append(metaEntry);
}

private String generateMetaDataEntry(String batchIndex, String subfolder, String filename, String documentType, Submission submission) {
private String generateMetaDataEntry(String batchIndex,
String subfolder,
String filename,
String documentType,
Submission submission,
String documentOwnerFirstName,
String documentOwnerLastName) {
Map<String, Object> inputData = submission.getInputData();
String formattedSSN = formatSSN(inputData);
String formattedFilename = removeFileExtension(filename);
String documentOwnerFirstName = formattedFilename.split("_")[0];
String documentOwnerLastName = formattedFilename.split("_")[1];
String formattedBirthdate = formatBirthdate(submission.getInputData());
ZonedDateTime submittedAt = submission.getSubmittedAt().atZoneSameInstant(ZoneId.systemDefault());
String formattedSubmissionDate = submittedAt.withZoneSameInstant(CST).format(MMDDYYYY_HHMMSS);
Expand Down

0 comments on commit d2339e7

Please sign in to comment.