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

Fix error where applicant name was not correct in metatdata sent with SNAP app. #724

Merged
merged 1 commit into from
May 17, 2024
Merged
Changes from all commits
Commits
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
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