Skip to content

Commit

Permalink
Merge pull request #162 from pagopa/fix-typo
Browse files Browse the repository at this point in the history
feat: Fix typo
  • Loading branch information
andrea-putzu authored Sep 29, 2022
2 parents a621f0a + 8ba7d53 commit 27e6073
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,29 +66,29 @@ class PublicApiServiceImpl(
tokenIdUUID <- tokenId.toFutureUUID
token <- partyManagementService.verifyToken(tokenIdUUID)
legalsRelationships = token.legals.filter(_.role == PartyMgmtRole.MANAGER)
legalUsers <- Future.traverse(legalsRelationships)(legal =>
legalUsers <- Future.traverse(legalsRelationships)(legal =>
userRegistryManagementService.getUserWithEmailById(legal.partyId)
)
institutionId <- Future.traverse(legalsRelationships)(legalUser =>
partyManagementService.getInstitutionId(legalUser.relationshipId)
)
institutionEmail = istitutionId.headOption.map(_.digitalAddress)
institutionInternalId = istitutionId.headOption.map(_.to.toString)
institutionEmail = institutionId.headOption.map(_.digitalAddress)
institutionInternalId = institutionId.headOption.map(_.to.toString)
legalUserWithEmails = legalUsers.filter(_.email.get(institutionInternalId.getOrElse("")).nonEmpty)
legalEmails = legalUserWithEmails.map(u => u.email.get(institutionInternalId.getOrElse("")))

validator <- signatureService.createDocumentValidator(Files.readAllBytes(contract._2.toPath))
_ <- SignatureValidationService.validateSignature(signatureValidationService.isDocumentSigned(validator))
_ <- SignatureValidationService.validateSignature(signatureValidationService.verifyOriginalDocument(validator))
_ <- SignatureValidationService.validateSignature(signatureValidationService.verifyOriginalDocument(validator))
reports <- signatureValidationService.validateDocument(validator)
_ <- SignatureValidationService.validateSignature(
signatureValidationService.verifySignatureForm(validator),
signatureValidationService.verifySignature(reports),
signatureValidationService.verifyDigest(validator, token.checksum),
signatureValidationService.verifyManagerTaxCode(reports, legalUsers)
)
logo <- getLogoFile(ApplicationConfiguration.emailLogoPath)
product <- productManagementService.getProductById(istitutionId.head.product)
logo <- getLogoFile(ApplicationConfiguration.emailLogoPath)
product <- productManagementService.getProductById(institutionId.head.product)
onboardingMailParameters <- getOnboardingMailParameters(product.name)
emails = legalEmails ++ institutionEmail.toSeq
_ <- sendOnboardingCompleteEmail(emails, onboardingMailParameters, logo)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ case object SignatureValidationServiceImpl extends SignatureValidationService {
}

val subjectSerialNumbers: Either[SignatureValidationError, List[String]] = {
val subjectSNs: List[String] =
val subjectSNs: List[String] =
reports.getDiagnosticData.getUsedCertificates.asScala.toList.flatMap(c => Option(c.getSubjectSerialNumber))
val subjectSNCFs: List[String] = subjectSNs.filter(signatureRegex.matches)
val subjectSNCFs: List[String] = subjectSNs.filter(signatureRegex.matches)
if (subjectSNCFs.nonEmpty) Right(subjectSNCFs) else Left(TaxCodeNotFoundInSignature)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1877,6 +1877,7 @@ trait PartyApiSpec
val institutionInternalId: UUID = UUID.randomUUID()
val productTestId = "prod-test"
val productTestName = "Product Test"
val institutionEmail = "[email protected]"

val reports: Reports =
new Reports(new XmlDiagnosticData(), new XmlDetailedReport(), new XmlSimpleReport(), new ValidationReportType())
Expand All @@ -1899,7 +1900,8 @@ trait PartyApiSpec
)
)

val institutionId: InstitutionId = InstitutionId(relationshipIdManager, institutionInternalId, productTestId)
val institutionId: InstitutionId =
InstitutionId(relationshipIdManager, institutionInternalId, productTestId, institutionEmail)

val path = Paths.get("src/test/resources/contract-test-01.pdf")

Expand Down

0 comments on commit 27e6073

Please sign in to comment.