Skip to content

KFSPTS-36621 Add attachment to preq service and handle PO not found consisitently#1897

Merged
ajd299 merged 9 commits intodevelopfrom
KFSPTS-36621
Mar 23, 2026
Merged

KFSPTS-36621 Add attachment to preq service and handle PO not found consisitently#1897
ajd299 merged 9 commits intodevelopfrom
KFSPTS-36621

Conversation

@jhulslander
Copy link
Copy Markdown
Contributor

No description provided.

@jhulslander jhulslander requested a review from ajd299 March 18, 2026 17:42
Copy link
Copy Markdown
Contributor

@ajd299 ajd299 left a comment

Choose a reason for hiding this comment

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

@jhulslander Please see my feedback items

return (PaymentRequestDocument) savedPreqDoc;

} catch (Exception e) {
LOG.error("createPaymentRequestDocumentFromDto, There was an error create thePaymentRequestDocument", e);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think the log message has a typo.
There was an error creating the PaymentRequestDocument

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ok


error.paymentrequest.at.least.one.must.be.entered=At least one {0} must be entered.
error.paymentrequest.vendor.invalid=Vendor Number {0} is not valid.
error.paymentrequest.po.invalid=PO Number {0} is not valid.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Did you mean to remove error.paymentrequest.po.invalid?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

good catch, yes, thank you

AttributeDefinition fileNameDefiition = Mockito.mock(AttributeDefinition.class);
Mockito.when(fileNameDefiition.getMaxLength()).thenReturn(Integer.valueOf(15));
Mockito.when(fileNameDefiition.getValidationPattern()).thenReturn(new AnyCharacterValidationPattern());
Mockito.when(service.getAttributeDefinition(Attachment.class.getName(), PaymentRequestDtoFields.ATTACHMENT_FILE_NAME.datadictionaryFieldName)).thenReturn(fileNameDefiition);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can this line be separated into multiple lines to make it easier to read?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ok

Mockito.when(service.getAttributeDefinition(Attachment.class.getName(), PaymentRequestDtoFields.ATTACHMENT_FILE_NAME.datadictionaryFieldName)).thenReturn(fileNameDefiition);

AttributeDefinition mimeDefiition = Mockito.mock(AttributeDefinition.class);
Mockito.when(mimeDefiition.getMaxLength()).thenReturn(Integer.valueOf(15));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

typo mimeDefiition => mimeDefinition

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ok

Comment on lines +244 to +250
} else {
if (!validateAttachmentField(noteDto.getAttachmentMimeType(), PaymentRequestDtoFields.ATTACHMENT_MIME_TYPE.datadictionaryFieldName, results)) {
String messageBase = configurationService.getPropertyValueAsString(CUPurapKeyConstants.ERROR_PAYMENTREQUEST_FIELD_FORMATTING);
String formattedMessage = MessageFormat.format(messageBase, PaymentRequestDtoFields.ATTACHMENT_MIME_TYPE);
results.getErrorMessages().add(formattedMessage);
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could this be refactored to an else if?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ok

Comment on lines +234 to +240
} else {
if (!validateAttachmentField(noteDto.getAttachmentFileName(), PaymentRequestDtoFields.ATTACHMENT_FILE_NAME.datadictionaryFieldName, results)) {
String messageBase = configurationService.getPropertyValueAsString(CUPurapKeyConstants.ERROR_PAYMENTREQUEST_FIELD_FORMATTING);
String formattedMessage = MessageFormat.format(messageBase, PaymentRequestDtoFields.ATTACHMENT_FILE_NAME);
results.getErrorMessages().add(formattedMessage);
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could this be refactored to else if?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ok

} else {
if (!validateAttachmentField(noteDto.getAttachmentFileName(), PaymentRequestDtoFields.ATTACHMENT_FILE_NAME.datadictionaryFieldName, results)) {
String messageBase = configurationService.getPropertyValueAsString(CUPurapKeyConstants.ERROR_PAYMENTREQUEST_FIELD_FORMATTING);
String formattedMessage = MessageFormat.format(messageBase, PaymentRequestDtoFields.ATTACHMENT_FILE_NAME);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we use friendly name "File name" instead of ATTACHMENT_FILE_NAME?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes, good idea

@jhulslander
Copy link
Copy Markdown
Contributor Author

This is ready for review again

@CU-CommunityApps CU-CommunityApps deleted a comment from ajd299 Mar 20, 2026
@jhulslander
Copy link
Copy Markdown
Contributor Author

retest this please

Copy link
Copy Markdown
Contributor

@ajd299 ajd299 left a comment

Choose a reason for hiding this comment

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

I was able to get this to process in localdev. Merging to develop

@ajd299 ajd299 merged commit bbd2b06 into develop Mar 23, 2026
1 check passed
jhulslander added a commit that referenced this pull request Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants