Skip to content

Commit

Permalink
[PAGOPA-2180] fix: correct handling of stamps in RT
Browse files Browse the repository at this point in the history
  • Loading branch information
andrea-deri committed Sep 25, 2024
1 parent 8969687 commit bb2c65e
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ public List<CtDatiSingoloPagamentoRT> toCtDatiSingoloPagamentoRTListForOkRT(CtRe
@Mapping(target = "identificativoUnivocoRiscossione", constant = "0")
@Mapping(source = "transferDTO.remittanceInformation", target = "causaleVersamento")
@Mapping(source = "transferDTO.category", target = "datiSpecificiRiscossione")
@Mapping(target = "allegatoRicevuta", expression = "java(extractStamp(transferDTO.getDigitalStamp()))")
public abstract CtDatiSingoloPagamentoRT toCtDatiSingoloPagamentoRT(TransferDTO transferDTO, Instant instant, String paymentOutcome);

@Mapping(source = "ctTransferPAReceiptV2.transferAmount", target = "singoloImportoPagato")
Expand All @@ -194,4 +195,16 @@ public String extractMetadata(List<CtMapEntry> ctMapEntries) {
.filter(v -> v.getKey().equals("DatiSpecificiRiscossione"))
.map(CtMapEntry::getValue).findFirst().orElse(null);
}


@Named("extractStamp")
public CtAllegatoRicevuta extractStamp(DigitalStampDTO digitalStamp) {
CtAllegatoRicevuta allegatoRicevuta = null;
if (digitalStamp != null) {
allegatoRicevuta = new CtAllegatoRicevuta();
allegatoRicevuta.setTipoAllegatoRicevuta(StTipoAllegatoRicevuta.BD);
allegatoRicevuta.setTestoAllegato(digitalStamp.getDocumentHash());
}
return allegatoRicevuta;
}
}

0 comments on commit bb2c65e

Please sign in to comment.