Skip to content

Commit

Permalink
[PAGOPA-2341] Merge branch 'main' into PAGOPA-2341-dismissione-wisp-r…
Browse files Browse the repository at this point in the history
…est-modificare-stati-re # Conflicts: # openapi/openapi.json # openapi/openapi_redirect.json # src/main/java/it/gov/pagopa/wispconverter/service/ReceiptService.java
  • Loading branch information
jacopocarlini committed Nov 8, 2024
2 parents 6c66f57 + b020e25 commit d6bcd2b
Show file tree
Hide file tree
Showing 12 changed files with 1,035 additions and 868 deletions.
4 changes: 2 additions & 2 deletions helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: v2
name: pagopa-wisp-converter
description: A service that permits to handle nodoInviaRPT and nodoInviaCarrelloRPT request from WISP, interfacing them with GPD system
type: application
version: 0.261.0
appVersion: 0.4.25
version: 0.264.0
appVersion: 0.4.27
dependencies:
- name: microservice-chart
version: 3.0.0
Expand Down
2 changes: 1 addition & 1 deletion helm/values-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ microservice-chart: &microservice-chart
fullnameOverride: ""
image:
repository: ghcr.io/pagopa/pagopa-wisp-converter
tag: "0.4.25"
tag: "0.4.27"
pullPolicy: Always
livenessProbe:
httpGet:
Expand Down
2 changes: 1 addition & 1 deletion helm/values-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ microservice-chart: &microservice-chart
fullnameOverride: ""
image:
repository: ghcr.io/pagopa/pagopa-wisp-converter
tag: "0.4.25"
tag: "0.4.27"
pullPolicy: Always
livenessProbe:
httpGet:
Expand Down
2 changes: 1 addition & 1 deletion helm/values-uat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ microservice-chart: &microservice-chart
fullnameOverride: ""
image:
repository: ghcr.io/pagopa/pagopa-wisp-converter
tag: "0.4.25"
tag: "0.4.27"
pullPolicy: Always
livenessProbe:
httpGet:
Expand Down
1,647 changes: 888 additions & 759 deletions openapi/openapi.json

Large diffs are not rendered by default.

201 changes: 110 additions & 91 deletions openapi/openapi_redirect.json
Original file line number Diff line number Diff line change
@@ -1,123 +1,142 @@
{
"openapi" : "3.0.1",
"info" : {
"title" : "WISP-Converter-redirect",
"version" : "0.4.25"
"openapi": "3.0.1",
"info": {
"title": "WISP-Converter-redirect",
"version": "0.4.27"
},
"servers" : [ {
"url" : "http://localhost",
"description" : "Generated server url"
} ],
"tags" : [ {
"description" : "Application info APIs",
"name" : "Home"
}, {
"description" : "Conversion and redirection APIs",
"name" : "Redirect"
} ],
"paths" : {
"/info" : {
"get" : {
"operationId" : "healthCheck",
"responses" : {
"200" : {
"content" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/AppInfoResponse"
"servers": [
{
"url": "http://localhost",
"description": "Generated server url"
}
],
"tags": [
{
"description": "Application info APIs",
"name": "Home"
},
{
"description": "Conversion and redirection APIs",
"name": "Redirect"
}
],
"paths": {
"/info": {
"get": {
"operationId": "healthCheck",
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AppInfoResponse"
}
}
},
"description" : "OK.",
"headers" : {
"X-Request-Id" : {
"description" : "This header identifies the call",
"schema" : {
"type" : "string"
"description": "OK.",
"headers": {
"X-Request-Id": {
"description": "This header identifies the call",
"schema": {
"type": "string"
}
}
}
}
},
"security" : [ {
"ApiKey" : [ ]
} ],
"summary" : "Return OK if application is started",
"tags" : [ "Home" ]
"security": [
{
"ApiKey": []
}
],
"summary": "Return OK if application is started",
"tags": [
"Home"
]
},
"parameters" : [ {
"description" : "This header identifies the call, if not passed it is self-generated. This ID is returned in the response.",
"in" : "header",
"name" : "X-Request-Id",
"schema" : {
"type" : "string"
"parameters": [
{
"description": "This header identifies the call, if not passed it is self-generated. This ID is returned in the response.",
"in": "header",
"name": "X-Request-Id",
"schema": {
"type": "string"
}
}
} ]
]
},
"/payments" : {
"get" : {
"operationId" : "redirect",
"parameters" : [ {
"example" : "identificativoIntermediarioPA_sessionId",
"in" : "query",
"name" : "idSession",
"required" : true,
"schema" : {
"type" : "string"
"/payments": {
"get": {
"operationId": "redirect",
"parameters": [
{
"example": "identificativoIntermediarioPA_sessionId",
"in": "query",
"name": "idSession",
"required": true,
"schema": {
"type": "string"
}
}
} ],
"responses" : {
"302" : {
"description" : "Redirect to Checkout service.",
"headers" : {
"X-Request-Id" : {
"description" : "This header identifies the call",
"schema" : {
"type" : "string"
],
"responses": {
"302": {
"description": "Redirect to Checkout service.",
"headers": {
"X-Request-Id": {
"description": "This header identifies the call",
"schema": {
"type": "string"
}
}
}
}
},
"security" : [ {
"ApiKey" : [ ]
} ],
"tags" : [ "Redirect" ]
"security": [
{
"ApiKey": []
}
],
"tags": [
"Redirect"
]
},
"parameters" : [ {
"description" : "This header identifies the call, if not passed it is self-generated. This ID is returned in the response.",
"in" : "header",
"name" : "X-Request-Id",
"schema" : {
"type" : "string"
"parameters": [
{
"description": "This header identifies the call, if not passed it is self-generated. This ID is returned in the response.",
"in": "header",
"name": "X-Request-Id",
"schema": {
"type": "string"
}
}
} ]
]
}
},
"components" : {
"schemas" : {
"AppInfoResponse" : {
"type" : "object",
"properties" : {
"environment" : {
"type" : "string"
"components": {
"schemas": {
"AppInfoResponse": {
"type": "object",
"properties": {
"environment": {
"type": "string"
},
"name" : {
"type" : "string"
"name": {
"type": "string"
},
"version" : {
"type" : "string"
"version": {
"type": "string"
}
}
}
},
"securitySchemes" : {
"ApiKey" : {
"description" : "The API key to access this function app.",
"in" : "header",
"name" : "Ocp-Apim-Subscription-Key",
"type" : "apiKey"
"securitySchemes": {
"ApiKey": {
"description": "The API key to access this function app.",
"in": "header",
"name": "Ocp-Apim-Subscription-Key",
"type": "apiKey"
}
}
}
}
}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<groupId>it.gov.pagopa</groupId>
<artifactId>wisp-converter</artifactId>
<version>0.4.25</version>
<version>0.4.27</version>
<name>pagoPA WISP Converter</name>
<description>A service that permits to handle nodoInviaRPT and nodoInviaCarrelloRPT request from WISP, converting them in NMU payments.</description>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import it.gov.pagopa.wispconverter.repository.model.enumz.WorkflowStatus;
import it.gov.pagopa.wispconverter.service.mapper.RTMapper;
import it.gov.pagopa.wispconverter.service.model.CachedKeysMapping;
import it.gov.pagopa.wispconverter.service.model.PaymentSubjectDTO;
import it.gov.pagopa.wispconverter.service.model.ReceiptDto;
import it.gov.pagopa.wispconverter.service.model.re.RePaymentContext;
import it.gov.pagopa.wispconverter.service.model.session.CommonFieldsDTO;
Expand Down Expand Up @@ -171,7 +172,6 @@ public static PaSendRTV2Request extractDataFromPaSendRT(
*
* @param receipts a list of receipts
*/
// TODO review, no dead-letter functionalities
public void sendKoPaaInviaRtToCreditorInstitution(List<ReceiptDto> receipts) {
try {

Expand Down Expand Up @@ -637,6 +637,9 @@ private CtRicevutaTelematica generateRTContentForKoReceipt(
// populate ctSoggettoVersante tag
CtSoggettoVersante ctSoggettoVersante = objectFactory.createCtSoggettoVersante();
this.rtMapper.toCtSoggettoVersante(ctSoggettoVersante, rpt.getRpt().getPayerDelegate());
if (ctSoggettoVersante.getIdentificativoUnivocoVersante() == null || ctSoggettoVersante.getAnagraficaVersante() == null) {
ctSoggettoVersante = null;
}

// populate ctDatiVersamentoRT tag
CtDatiVersamentoRT ctDatiVersamentoRT = objectFactory.createCtDatiVersamentoRT();
Expand Down Expand Up @@ -681,10 +684,8 @@ private CtRicevutaTelematica generateRTContentForOkReceipt(

// populate ctSoggettoVersante tag
CtSoggettoVersante ctSoggettoVersante = objectFactory.createCtSoggettoVersante();
// this.rtMapper.toCtSoggettoVersante(ctSoggettoVersante,
// paSendRTV2Request.getReceipt().getPayer());
this.rtMapper.toCtSoggettoVersante(ctSoggettoVersante, rpt.getRpt().getPayerDelegate());
if (ctSoggettoVersante.getIdentificativoUnivocoVersante() == null) {
if (ctSoggettoVersante.getIdentificativoUnivocoVersante() == null || ctSoggettoVersante.getAnagraficaVersante() == null) {
ctSoggettoVersante = null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,16 @@ public void toCtIstitutoAttestante(@MappingTarget CtIstitutoAttestante ctIstitut

@Mapping(target = "versioneOggetto", expression = "java(this.versioneOggetto)")
@Mapping(target = "identificativoMessaggioRicevuta", expression = "java(java.util.UUID.randomUUID().toString().replaceAll(\"-\", \"\"))")
@Mapping(target = "dataOraMessaggioRicevuta", expression = "java(it.gov.pagopa.wispconverter.util.XmlUtil.toXMLGregoirianCalendar(instant))")
@Mapping(target = "dataOraMessaggioRicevuta", expression = "java(it.gov.pagopa.wispconverter.util.XmlUtil.toXMLGregorianCalendar(instant))")
@Mapping(source = "rpt.messageRequestId", target = "riferimentoMessaggioRichiesta")
@Mapping(source = "rpt.messageRequestDatetime", target = "riferimentoDataRichiesta")
@Mapping(target= "riferimentoDataRichiesta", expression = "java(it.gov.pagopa.wispconverter.util.XmlUtil.toXMLGregorianCalendar(rpt.getMessageRequestDatetime()))")
public abstract void toCtRicevutaTelematicaNegativa(@MappingTarget CtRicevutaTelematica ctRicevutaTelematica, PaymentRequestDTO rpt, Instant instant);

@Mapping(target = "versioneOggetto", expression = "java(this.versioneOggetto)")
@Mapping(target = "identificativoMessaggioRicevuta", expression = "java(java.util.UUID.randomUUID().toString().replaceAll(\"-\", \"\"))")
@Mapping(source = "paSendRTV2Request.receipt.paymentDateTime", target = "dataOraMessaggioRicevuta")
@Mapping(source = "rpt.messageRequestId", target = "riferimentoMessaggioRichiesta")
@Mapping(source = "rpt.messageRequestDatetime", target = "riferimentoDataRichiesta")
@Mapping(target= "riferimentoDataRichiesta", expression = "java(it.gov.pagopa.wispconverter.util.XmlUtil.toXMLGregorianCalendar(rpt.getMessageRequestDatetime()))")
public abstract void toCtRicevutaTelematicaPositiva(@MappingTarget CtRicevutaTelematica ctRicevutaTelematica, PaymentRequestDTO rpt, PaSendRTV2Request paSendRTV2Request);

@Mapping(source = "domainId", target = "identificativoDominio")
Expand Down Expand Up @@ -172,7 +172,7 @@ public List<CtDatiSingoloPagamentoRT> toCtDatiSingoloPagamentoRTListForOkRT(CtRe

@Mapping(target = "singoloImportoPagato", expression = "java(it.gov.pagopa.wispconverter.util.XmlUtil.toBigDecimalWithScale(java.math.BigDecimal.ZERO, 2))")
@Mapping(source = "paymentOutcome", target = "esitoSingoloPagamento")
@Mapping(target = "dataEsitoSingoloPagamento", expression = "java(it.gov.pagopa.wispconverter.util.XmlUtil.toXMLGregoirianCalendar(instant))")
@Mapping(target = "dataEsitoSingoloPagamento", expression = "java(it.gov.pagopa.wispconverter.util.XmlUtil.toXMLGregorianCalendar(instant))")
@Mapping(target = "identificativoUnivocoRiscossione", constant = "0")
@Mapping(source = "transferDTO.remittanceInformation", target = "causaleVersamento")
@Mapping(source = "transferDTO.category", target = "datiSpecificiRiscossione")
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/it/gov/pagopa/wispconverter/util/XmlUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@
import java.math.RoundingMode;
import java.time.Instant;
import java.util.GregorianCalendar;
import java.util.TimeZone;

public class XmlUtil {

public static XMLGregorianCalendar toXMLGregoirianCalendar(Instant instant) {
public static XMLGregorianCalendar toXMLGregorianCalendar(Instant instant) {
GregorianCalendar gregorianCalendar = new GregorianCalendar();
gregorianCalendar.setTimeZone(TimeZone.getTimeZone("Europe/Rome"));
gregorianCalendar.setTimeInMillis(instant.toEpochMilli());
try {
XMLGregorianCalendar xmlGregorianCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(gregorianCalendar);
Expand All @@ -27,6 +29,12 @@ public static XMLGregorianCalendar toXMLGregoirianCalendar(Instant instant) {
}
}

public static XMLGregorianCalendar toXMLGregorianCalendar(XMLGregorianCalendar xmlGregorianCalendar) {
xmlGregorianCalendar.setMillisecond(DatatypeConstants.FIELD_UNDEFINED); // removing info about milliseconds
xmlGregorianCalendar.setTimezone(DatatypeConstants.FIELD_UNDEFINED); // removing all references about timezone
return xmlGregorianCalendar;
}

public static BigDecimal toBigDecimalWithScale(BigDecimal target, int scale) {
return target.setScale(scale, RoundingMode.UNNECESSARY);
}
Expand Down
Loading

0 comments on commit d6bcd2b

Please sign in to comment.