KFSPTS-36621 Add attachment to preq service and handle PO not found consisitently#1897
KFSPTS-36621 Add attachment to preq service and handle PO not found consisitently#1897
Conversation
ajd299
left a comment
There was a problem hiding this comment.
@jhulslander Please see my feedback items
| return (PaymentRequestDocument) savedPreqDoc; | ||
|
|
||
| } catch (Exception e) { | ||
| LOG.error("createPaymentRequestDocumentFromDto, There was an error create thePaymentRequestDocument", e); |
There was a problem hiding this comment.
I think the log message has a typo.
There was an error creating the PaymentRequestDocument
|
|
||
| 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. |
There was a problem hiding this comment.
Did you mean to remove error.paymentrequest.po.invalid?
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
Can this line be separated into multiple lines to make it easier to read?
| 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)); |
There was a problem hiding this comment.
typo mimeDefiition => mimeDefinition
| } 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); | ||
| } | ||
| } |
There was a problem hiding this comment.
Could this be refactored to an else if?
| } 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); | ||
| } | ||
| } |
There was a problem hiding this comment.
Could this be refactored to else if?
| } 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); |
There was a problem hiding this comment.
Can we use friendly name "File name" instead of ATTACHMENT_FILE_NAME?
|
This is ready for review again |
|
retest this please |
ajd299
left a comment
There was a problem hiding this comment.
I was able to get this to process in localdev. Merging to develop
No description provided.