Skip to content

Commit

Permalink
PIN-3913 Updated Agreement Process
Browse files Browse the repository at this point in the history
  • Loading branch information
nttdata-rtorsoli committed Sep 8, 2023
1 parent 2dce524 commit 3f751e1
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
7 changes: 2 additions & 5 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,11 @@ object Dependencies {
namespace %% "interop-selfcare-user-registry-client" % userRegistryManagementVersion

lazy val commons = namespace %% "interop-commons-utils" % commonsVersion
lazy val commonsMailManager = namespace %% "interop-commons-mail-manager" % commonsVersion
lazy val commonsFileManager = namespace %% "interop-commons-file-manager" % commonsVersion
lazy val commonsJWT = namespace %% "interop-commons-jwt" % commonsVersion
lazy val commonsCqrs = namespace %% "interop-commons-cqrs" % commonsVersion
lazy val commonsQueueManager = namespace %% "interop-commons-queue-manager" % commonsVersion

lazy val certifiedMailSenderModels =
namespace %% "interop-be-certified-mail-sender-models" % certifiedMailSenderModelsVersion

}

private[this] object cats {
Expand Down Expand Up @@ -118,7 +115,7 @@ object Dependencies {
pagopa.authorizationManagementClient % Compile,
pagopa.catalogManagementModels % Compile,
pagopa.tenantManagementModels % Compile,
pagopa.certifiedMailSenderModels % Compile,
pagopa.commonsMailManager % Compile,
pagopa.commons % Compile,
pagopa.commonsFileManager % Compile,
pagopa.commonsJWT % Compile,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ import it.pagopa.interop.catalogmanagement.model.{
Published,
SingleAttribute
}
import it.pagopa.interop.certifiedMailSender.InteropEnvelope
import it.pagopa.interop.commons.mail.InteropEnvelope
import it.pagopa.interop.commons.mail.Mail
import it.pagopa.interop.commons.cqrs.service.ReadModelService
import it.pagopa.interop.commons.files.service.FileManager
import it.pagopa.interop.commons.jwt._
Expand Down Expand Up @@ -859,9 +860,11 @@ final case class AgreementApiServiceImpl(
version <- eservice.descriptors
.find(_.id == agreement.descriptorId)
.toFuture(DescriptorNotFound(eServiceId = eservice.id, descriptorId = agreement.descriptorId))
producerAddress <- Mail.addresses(producer.digitalAddress).toFuture
consumerAddress <- Mail.addresses(consumer.digitalAddress).toFuture
} yield InteropEnvelope(
id = envelopeId,
recipients = List(producer.digitalAddress, consumer.digitalAddress),
recipients = producerAddress ++ consumerAddress,
subject = subject,
body = createBody(
activationDate = activationDate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package it.pagopa.interop.agreementprocess.api

import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport
import it.pagopa.interop.agreementprocess.model._
import it.pagopa.interop.certifiedMailSender.{InteropEnvelope, MailAttachment}
import it.pagopa.interop.commons.mail.{InteropEnvelope, MailAttachment}
import it.pagopa.interop.commons.utils.SprayCommonFormats.{offsetDateTimeFormat, uuidFormat}
import spray.json.{DefaultJsonProtocol, RootJsonFormat}
import spray.json._
import javax.mail.internet.InternetAddress

package object impl extends SprayJsonSupport with DefaultJsonProtocol {

Expand Down Expand Up @@ -38,9 +39,16 @@ package object impl extends SprayJsonSupport with DefaultJsonProtocol {
jsonFormat4(VerifiedTenantAttribute)
implicit def tenantAttributeFormat: RootJsonFormat[TenantAttribute] = jsonFormat3(TenantAttribute)
implicit def compactTenantFormat: RootJsonFormat[CompactTenant] = jsonFormat2(CompactTenant)
implicit def mailAttachmentFormat: RootJsonFormat[MailAttachment] = jsonFormat3(MailAttachment)
implicit def interopEnvelopFormat: RootJsonFormat[InteropEnvelope] = jsonFormat5(InteropEnvelope)
implicit def mailInfoFormat: RootJsonFormat[MailTemplate] = jsonFormat2(MailTemplate.apply)
implicit object InternetAddressFormat extends JsonFormat[InternetAddress] {
def write(ia: InternetAddress) = JsString(s"${ia.getAddress()}")
def read(json: JsValue) = json match {
case JsString(address) => new InternetAddress(address)
case _ => deserializationError("String expected")
}
}
implicit def mailAttachmentFormat: RootJsonFormat[MailAttachment] = jsonFormat3(MailAttachment)
implicit def interopEnvelopFormat: RootJsonFormat[InteropEnvelope] = jsonFormat5(InteropEnvelope)
implicit def mailInfoFormat: RootJsonFormat[MailTemplate] = jsonFormat2(MailTemplate.apply)
implicit def computeAgreementPayloadFormat: RootJsonFormat[ComputeAgreementStatePayload] =
jsonFormat2(ComputeAgreementStatePayload)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import it.pagopa.interop.authorizationmanagement.client.model.{
import it.pagopa.interop.catalogmanagement.model.CatalogItem
import it.pagopa.interop.agreementmanagement.model.agreement.{PersistentAgreement, PersistentAgreementState}
import it.pagopa.interop.tenantmanagement.model.tenant.PersistentTenant
import it.pagopa.interop.certifiedMailSender.InteropEnvelope
import it.pagopa.interop.commons.mail.InteropEnvelope
import it.pagopa.interop.commons.files.service.FileManager
import it.pagopa.interop.commons.utils.service.{OffsetDateTimeSupplier, UUIDSupplier}
import it.pagopa.interop.commons.utils.{ORGANIZATION_ID_CLAIM, UID, USER_ROLES}
Expand Down

0 comments on commit 3f751e1

Please sign in to comment.