Skip to content

Commit

Permalink
NOD-687: Fdr fase 1 modifica notifyFlussoRendicontazione
Browse files Browse the repository at this point in the history
  • Loading branch information
fparisitas committed Feb 1, 2024
1 parent a3e792d commit f4bb079
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
{
"type": "object",
"required": ["fdr", "pspId", "retry", "revision"],
"required": ["fdr", "pspId", "organizationId", "retry", "revision"],
"properties": {
"fdr" : {
"type" : "string"
},
"pspId" : {
"type" : "string"
},
"organizationId" : {
"type" : "string"
},
"retry" : {
"type" : "integer"
},
Expand Down
2 changes: 1 addition & 1 deletion fdr/src/main/scala/eu/sia/pagopa/TestDData.scala
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ object TestDData {
),
Map("Altro" -> CdsCategory("Altro"), "Tassa automobilistica" -> CdsCategory("Tassa automobilistica"), "Donazioni" -> CdsCategory("Donazioni")),
Map(
"GLOBAL-azureSdkClientReEventEnabled" -> ConfigurationKey("", "", "false", None),
"GLOBAL-azureSdkClientReEventEnabled" -> ConfigurationKey("", "", "true", None),
"GLOBAL-ccpRandomTraduttore" -> ConfigurationKey("", "", "true", None),
"GLOBAL-ftp.env.path" -> ConfigurationKey("", "", "pate_", None),
"GLOBAL-idCanaleAGID" -> ConfigurationKey("", "", TestItems.canaleAgid, None),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ object HttpFdrServiceManagement extends HttpBaseServiceManagement {
fdr: String,
rev: String,
psp: String,
organizationId: String,
actorProps: ActorProps,
re: Re
)(implicit log: NodoLogger, ec: ExecutionContext, as: ActorSystem) = {
Expand All @@ -35,7 +36,7 @@ object HttpFdrServiceManagement extends HttpBaseServiceManagement {
action,
ContentTypes.`application/json`,
HttpMethods.GET,
s"${url.replace("{fdr}",fdr).replace("{revision}",rev).replace("{pspId}",psp)}",
s"${url.replace("{organizationId}", organizationId).replace("{fdr}",fdr).replace("{revision}",rev).replace("{pspId}",psp)}",
None,
headers,
Some(receiver),
Expand Down Expand Up @@ -70,6 +71,7 @@ object HttpFdrServiceManagement extends HttpBaseServiceManagement {
fdr: String,
rev: String,
psp: String,
organizationId: String,
actorProps: ActorProps,
re: Re
)(implicit log: NodoLogger, ec: ExecutionContext, as: ActorSystem) = {
Expand All @@ -81,7 +83,7 @@ object HttpFdrServiceManagement extends HttpBaseServiceManagement {
action,
ContentTypes.`application/json`,
HttpMethods.GET,
s"${url.replace("{fdr}",fdr).replace("{revision}",rev).replace("{pspId}",psp)}",
s"${url.replace("{organizationId}", organizationId).replace("{fdr}",fdr).replace("{fdr}",fdr).replace("{revision}",rev).replace("{pspId}",psp)}",
None,
headers,
Some(receiver),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ object NotifyFdrRequest extends DefaultJsonProtocol {
JsObject(Map[String, JsValue](
"fdr" -> JsString(req.fdr),
"pspId" -> JsString(req.pspId),
"organizationId" -> JsString(req.organizationId),
"retry" -> JsNumber(req.retry),
"revision" -> JsNumber(req.revision)
))
Expand All @@ -23,6 +24,7 @@ object NotifyFdrRequest extends DefaultJsonProtocol {
NotifyFdrRequest(
map("fdr").asInstanceOf[JsString].value,
map("pspId").asInstanceOf[JsString].value,
map("organizationId").asInstanceOf[JsString].value,
map("retry").asInstanceOf[JsNumber].value.toInt,
map("revision").asInstanceOf[JsNumber].value.toInt
)
Expand All @@ -34,7 +36,7 @@ object NotifyFdrRequest extends DefaultJsonProtocol {
}
}

case class NotifyFdrRequest(fdr: String, pspId: String, retry: Integer, revision: Integer)
case class NotifyFdrRequest(fdr: String, pspId: String, organizationId: String, retry: Integer, revision: Integer)

//object NotifyFdrResponse extends DefaultJsonProtocol {
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ object AzureProducerBuilder {
}

private def saveBlobToAzure(r: ReRequest, system: ActorSystem): Option[BlobBodyRef] = {
val fileName = s"${sessionId}_${r.re.tipoEvento.get}_${r.re.sottoTipoEvento}"
val fileName = s"${r.sessionId}_${r.re.tipoEvento.get}_${r.re.sottoTipoEvento}"
val blobContainerClient = system.settings.config.getConfig("azure-hub-event.azure-sdk-client.blob-re")
val blocContainerName = blobContainerClient.getString("container-name")
val blobReConnectionString = blobContainerClient.getString("connection-string")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ case class NotifyFlussoRendicontazioneActorPerRequest(repositories: Repositories
var replyTo: ActorRef = _

private var _psp: String = _
private var _organizationId: String = _
private var _fdr: String = _
private var _rev: Integer = _
private var _retry: Integer = _
Expand Down Expand Up @@ -69,6 +70,7 @@ case class NotifyFlussoRendicontazioneActorPerRequest(repositories: Repositories

re_ = Re(
psp = Some(_psp),
idDominio = Some(_organizationId),
componente = Componente.NDP_FDR.toString,
categoriaEvento = CategoriaEvento.INTERNO.toString,
sessionId = Some(req.sessionId),
Expand All @@ -85,9 +87,9 @@ case class NotifyFlussoRendicontazioneActorPerRequest(repositories: Repositories
)
_ = reFlow = Some(re_)

getResponse <- HttpFdrServiceManagement.internalGetWithRevision(req.sessionId, req.testCaseId, "internalGetWithRevision", Componente.FDR.toString, _fdr, _rev.toString, _psp, actorProps, reFlow.get)
getResponse <- HttpFdrServiceManagement.internalGetWithRevision(req.sessionId, req.testCaseId, "internalGetWithRevision", Componente.FDR.toString, _fdr, _rev.toString, _psp, _organizationId, actorProps, reFlow.get)

getPaymentResponse <- HttpFdrServiceManagement.internalGetFdrPayment(req.sessionId, req.testCaseId, "internalGetFdrPayment", Componente.FDR.toString, _fdr, _rev.toString, _psp, actorProps, reFlow.get)
getPaymentResponse <- HttpFdrServiceManagement.internalGetFdrPayment(req.sessionId, req.testCaseId, "internalGetFdrPayment", Componente.FDR.toString, _fdr, _rev.toString, _psp, _organizationId, actorProps, reFlow.get)

_ = log.info(FdrLogConstant.logGeneraPayload(s"nodoInviaFlussoRendicontazione SOAP"))
flussoRiversamento = CtFlussoRiversamento(
Expand Down Expand Up @@ -164,21 +166,6 @@ case class NotifyFlussoRendicontazioneActorPerRequest(repositories: Repositories
repositories.fdrRepository
)

// _ <-
// if (sftpFile.isDefined) {
// notifySFTPSender(pa, req.sessionId, req.testCaseId, sftpFile.get).flatMap(resp => {
// if (resp.throwable.isDefined) {
// //HOTFIX non torno errore al chiamante se ftp non funziona
// log.warn(s"Error sending file first time for reporting flow [${resp.throwable.get.getMessage}]")
// Future.successful(())
// } else {
// Future.successful(())
// }
// })
// } else {
// Future.successful(())
// }
//
_ = if (esito == Constant.KO) {
throw RestException("Error saving fdr on Db", Constant.HttpStatusDescription.INTERNAL_SERVER_ERROR, StatusCodes.InternalServerError.intValue)
} else {
Expand Down Expand Up @@ -213,6 +200,8 @@ case class NotifyFlussoRendicontazioneActorPerRequest(repositories: Repositories
Failure(RestException("Invalid fdr", "", StatusCodes.BadRequest.intValue, e))
} else if (e.getMessage.contains("pspId")) {
Failure(RestException("Invalid pspId", "", StatusCodes.BadRequest.intValue, e))
} else if (e.getMessage.contains("organizationId")) {
Failure(RestException("Invalid organizationId", "", StatusCodes.BadRequest.intValue, e))
} else if (e.getMessage.contains("retry")) {
Failure(RestException("Invalid retry", "", StatusCodes.BadRequest.intValue, e))
} else if (e.getMessage.contains("revision")) {
Expand All @@ -224,6 +213,7 @@ case class NotifyFlussoRendicontazioneActorPerRequest(repositories: Repositories
}

val psp = nfrReq.get.pspId
val organizationId = nfrReq.get.organizationId
val fdr = nfrReq.get.fdr
val revision = nfrReq.get.revision
val retry = nfrReq.get.retry
Expand All @@ -242,6 +232,7 @@ case class NotifyFlussoRendicontazioneActorPerRequest(repositories: Repositories
throw RestException("Error during check fdr format", Constant.HttpStatusDescription.INTERNAL_SERVER_ERROR, StatusCodes.InternalServerError.intValue)
}
_psp = psp
_organizationId = organizationId
_fdr = fdr
_rev = revision
_retry = retry
Expand Down
4 changes: 2 additions & 2 deletions helm/config/dev/config-app.conf
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,11 @@ app {
}
fdr{
internalGetWithRevision {
url="https://api.dev.platform.pagopa.it/fdr/service-internal/v1/internal/organizations/ndp/fdrs/{fdr}/revisions/{revision}/psps/{pspId}"
url="https://api.dev.platform.pagopa.it/fdr/service-internal/v1/internal/organizations/{organizationId}/fdrs/{fdr}/revisions/{revision}/psps/{pspId}"
method="GET"
}
internalGetFdrPayment {
url="https://api.dev.platform.pagopa.it/fdr/service-internal/v1/internal/organizations/ndp/fdrs/{fdr}/revisions/{revision}/psps/{pspId}/payments"
url="https://api.dev.platform.pagopa.it/fdr/service-internal/v1/internal/{organizationId}/fdrs/{fdr}/revisions/{revision}/psps/{pspId}/payments"
method="GET"
}
subscriptionKey=${FDR_SUBSCRIPTION_KEY}
Expand Down
4 changes: 2 additions & 2 deletions helm/config/prod/config-app.conf
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,11 @@ app {
}
fdr{
internalGetWithRevision {
url="https://api.platform.pagopa.it/fdr/service-internal/v1/internal/organizations/ndp/fdrs/{fdr}/revisions/{revision}/psps/{pspId}"
url="https://api.platform.pagopa.it/fdr/service-internal/v1/internal/organizations/{organizationId}/fdrs/{fdr}/revisions/{revision}/psps/{pspId}"
method="GET"
}
internalGetFdrPayment {
url="https://api.platform.pagopa.it/fdr/service-internal/v1/internal/organizations/ndp/fdrs/{fdr}/revisions/{revision}/psps/{pspId}/payments"
url="https://api.platform.pagopa.it/fdr/service-internal/v1/internal/organizations/{organizationId}/fdrs/{fdr}/revisions/{revision}/psps/{pspId}/payments"
method="GET"
}
subscriptionKey=${FDR_SUBSCRIPTION_KEY}
Expand Down
4 changes: 2 additions & 2 deletions helm/config/uat/config-app.conf
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,11 @@ app {
}
fdr{
internalGetWithRevision {
url="https://api.uat.platform.pagopa.it/fdr/service-internal/v1/internal/organizations/ndp/fdrs/{fdr}/revisions/{revision}/psps/{pspId}"
url="https://api.uat.platform.pagopa.it/fdr/service-internal/v1/internal/organizations/{organizationId}/fdrs/{fdr}/revisions/{revision}/psps/{pspId}"
method="GET"
}
internalGetFdrPayment {
url="https://api.uat.platform.pagopa.it/fdr/service-internal/v1/internal/organizations/ndp/fdrs/{fdr}/revisions/{revision}/psps/{pspId}/payments"
url="https://api.uat.platform.pagopa.it/fdr/service-internal/v1/internal/organizations/{organizationId}/fdrs/{fdr}/revisions/{revision}/psps/{pspId}/payments"
method="GET"
}
subscriptionKey=${FDR_SUBSCRIPTION_KEY}
Expand Down
4 changes: 2 additions & 2 deletions localresources/config-app.conf
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,11 @@ app {
}
fdr{
internalGetWithRevision {
url="https://api.dev.platform.pagopa.it/fdr/service-internal/v1/internal/organizations/ndp/fdrs/{fdr}/revisions/{revision}/psps/{pspId}"
url="https://api.dev.platform.pagopa.it/fdr/service-internal/v1/internal/organizations/{organizationId}/fdrs/{fdr}/revisions/{revision}/psps/{pspId}"
method="GET"
}
internalGetFdrPayment {
url="https://api.dev.platform.pagopa.it/fdr/service-internal/v1/internal/organizations/ndp/fdrs/{fdr}/revisions/{revision}/psps/{pspId}/payments"
url="https://api.dev.platform.pagopa.it/fdr/service-internal/v1/internal/organizations/{organizationId}/fdrs/{fdr}/revisions/{revision}/psps/{pspId}/payments"
method="GET"
}
subscriptionKey=${FDR_SUBSCRIPTION_KEY}
Expand Down

0 comments on commit f4bb079

Please sign in to comment.