Skip to content

Commit

Permalink
fix: transferIndex as integer
Browse files Browse the repository at this point in the history
  • Loading branch information
antonioT90 committed Jan 29, 2025
1 parent 7debaee commit b214636
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion openapi/p4pa-pagopa-payments.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ components:
type: string
transferIndex:
type: integer
format: int64
format: int32
ReceiptDTO:
type: object
required:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.springframework.core.io.ResourceLoader;
import org.springframework.stereotype.Service;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;

import javax.xml.XMLConstants;
import javax.xml.namespace.QName;
Expand Down Expand Up @@ -107,8 +108,8 @@ public <T> T unmarshalling(byte[] bytes, Class<T> clazz, String xsdFile, boolean
JAXBElement<T> element = unmarshaller.unmarshal(source, clazz);
return element.getValue();
} catch (SAXException | IOException | JAXBException e ) {
if(tryStrippingNonValidChars && e instanceof UnmarshalException unmarshalException && unmarshalException.getLinkedException()!=null &&
StringUtils.containsIgnoreCase(unmarshalException.getLinkedException().getMessage(), "invalid XML character")) {
if(tryStrippingNonValidChars && e instanceof UnmarshalException unmarshalException &&
unmarshalException.getLinkedException() instanceof SAXParseException) {
log.warn("detected 'invalid XML character' error unmarshalling XML.. trying to strip invalid characters", e);
String string = new String(bytes, StandardCharsets.UTF_8);
string = stripNonValidXMLCharacters(string);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void givenValidInstallmentDTOWhenInstallmentDtoPagoPa2PaGetPaymentV2ResponseThen

installmentDTO.getDebtor().setEntityType(PersonDTO.EntityTypeEnum.F);
for(int idx = 0; idx<installmentDTO.getTransfers().size(); idx++){
installmentDTO.getTransfers().get(idx).setTransferIndex(idx+1L);
installmentDTO.getTransfers().get(idx).setTransferIndex(idx+1);
}
//when
PaGetPaymentV2Response responseV2 = PaGetPaymentMapper.installmentDto2PaGetPaymentV2Response(installmentDTO, organization, StTransferType.PAGOPA);
Expand Down Expand Up @@ -114,7 +114,7 @@ void givenValidInstallmentDTOPostalWhenInstallmentDto2PaGetPaymentV2ResponseThen

installmentDTO.getDebtor().setEntityType(PersonDTO.EntityTypeEnum.F);
for(int idx = 0; idx<installmentDTO.getTransfers().size(); idx++){
installmentDTO.getTransfers().get(idx).setTransferIndex(idx+1L);
installmentDTO.getTransfers().get(idx).setTransferIndex(idx+1);
}
//when
PaGetPaymentV2Response responseV2 = PaGetPaymentMapper.installmentDto2PaGetPaymentV2Response(installmentDTO, organization, StTransferType.POSTAL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void givenValidInstallmentDTOWhenInstallmentDto2PaVerifyPaymentNoticeResThenOk()

installmentDTO.getDebtor().setEntityType(PersonDTO.EntityTypeEnum.F);
for(int idx = 0; idx<installmentDTO.getTransfers().size(); idx++){
installmentDTO.getTransfers().get(idx).setTransferIndex(idx+1L);
installmentDTO.getTransfers().get(idx).setTransferIndex(idx+1);
}
//when
PaVerifyPaymentNoticeRes response = PaVerifyPaymentNoticeMapper.installmentDto2PaVerifyPaymentNoticeRes(installmentDTO, organization);
Expand Down

0 comments on commit b214636

Please sign in to comment.