Skip to content

Commit

Permalink
[PAGOPA-1967] feat: Update Stamp converter (#108)
Browse files Browse the repository at this point in the history
decode from base64 and keep the marshalling time base64 encoding for SANP compliance
  • Loading branch information
cap-ang authored Jul 25, 2024
1 parent 55191bb commit 40f4f94
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ __pycache__
local.settings.json
**/*.iml
/lib/
**/.env
**/*.env
bin/
**/application-azure.properties
.cache_ggshield
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import org.modelmapper.MappingException;
import org.modelmapper.spi.MappingContext;

import java.util.Base64;

public class ConvertMarcaDaBolloToCtRichiestaMarcaDaBollo
implements Converter<Stamp, CtRichiestaMarcaDaBollo> {

Expand All @@ -17,7 +19,10 @@ public CtRichiestaMarcaDaBollo convert(MappingContext<Stamp, CtRichiestaMarcaDaB
CtRichiestaMarcaDaBollo ctRichiestaMarcaDaBollo = new CtRichiestaMarcaDaBollo();
ctRichiestaMarcaDaBollo.setTipoBollo(source.getStampType());
ctRichiestaMarcaDaBollo.setProvinciaResidenza(source.getProvincialResidence());
ctRichiestaMarcaDaBollo.setHashDocumento(source.getHashDocument().getBytes());
// the given source.getHashDocument() is already taken as base64 from GPD-Core,
// so in this point decode the base64 byte array and encode it next (at the time of response marshalling)
ctRichiestaMarcaDaBollo.setHashDocumento(Base64.getDecoder().decode(source.getHashDocument().getBytes()));

return ctRichiestaMarcaDaBollo;
}
}
16 changes: 8 additions & 8 deletions src/main/java/it/gov/pagopa/payments/service/PartnerService.java
Original file line number Diff line number Diff line change
Expand Up @@ -479,14 +479,13 @@ private PaGetPaymentV2Response generatePaGetPaymentResponse(
transferList
.getTransfer()
.addAll(
source
.getTransfer()
.stream()
.map(
paymentsTransferModelResponse ->
getTransferResponseV2(
paymentsTransferModelResponse, request.getTransferType()))
.collect(Collectors.toList()));
source
.getTransfer()
.stream()
.map(
paymentsTransferModelResponse ->
getTransferResponseV2(
paymentsTransferModelResponse, request.getTransferType())).toList());

responseData.setTransferList(transferList);
responseData.setDebtor(debtor);
Expand Down Expand Up @@ -574,6 +573,7 @@ private CtTransferPAV2 getTransferResponseV2(

CtTransferPAV2 transferPA = new CtTransferPAV2();
transferPA.setFiscalCodePA(transfer.getOrganizationFiscalCode());
transferPA.setCompanyName(" "); // stText140(1, 140) todo: to be filled in with the correct company name for the PO Nth transfer
transferPA.setRichiestaMarcaDaBollo(richiestaMarcaDaBollo);
transferPA.setIdTransfer(Integer.parseInt(transfer.getIdTransfer()));
transferPA.setRemittanceInformation(transfer.getRemittanceInformation());
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application-local.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
properties.environment=local

server.port=8080
server.port=8081

pt.id_intermediario=80007580279
pt.id_stazione=80007580279_01
Expand Down

0 comments on commit 40f4f94

Please sign in to comment.