Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PIN-5909: update riskAnalysis document #1347

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from
6 changes: 6 additions & 0 deletions packages/models/src/purpose/purpose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ export const PurposeDocumentEServiceInfo = z.object({
consumerName: z.string(),
consumerOrigin: z.string(),
consumerIPACode: z.string(),
producerDelegationId: z.string().optional(),
producerDelegateName: z.string().optional(),
producerDelegateIpaCode: z.string().optional(),
});
export type PurposeDocumentEServiceInfo = z.infer<
typeof PurposeDocumentEServiceInfo
Expand All @@ -96,4 +99,7 @@ export type RiskAnalysisDocumentPDFPayload = {
freeOfChargeReason: string;
date: string;
eServiceMode: string;
producerDelegationId: string | undefined;
AsterITA marked this conversation as resolved.
Show resolved Hide resolved
producerDelegateName: string | undefined;
producerDelegateIpaCode: string | undefined;
};
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@
<!-- Titolo del documento -->
<h1>Analisi del rischio</h1>

<!-- Intro legale -->
<div class="legal-intro">
Ai sensi dell’art. 26, comma 11, del decreto-legge, PagoPA s.p.a. nella
sua qualità di gestore ex lege della Piattaforma Interoperabilità PDND di
cui allo stesso art. 26, con ogni valore legale per l'opponibilità a
terzi, ATTESTA CHE:
</div>

<!-- Informazioni di contesto -->
<div class="purpose-info">
<div class="item">
Expand All @@ -48,12 +56,24 @@ <h1>Analisi del rischio</h1>
</div>

<div class="item">
<div class="label">Erogatore</div>
<div class="label">Ente erogatore</div>
<div class="value">{{producerText}}</div>
AsterITA marked this conversation as resolved.
Show resolved Hide resolved
</div>

{{#if producerDelegationId}}
<div class="item">
<div class="label">Ente delegato all’erogazione</div>
<div class="value">
{{producerDelegateName}}{{#if producerDelegateIpaCode}} (codice IPA:
{{producerDelegateIpaCode}}){{/if}}
</div>
</div>
{{/if}}

<br />

<div class="item">
<div class="label">Fruitore</div>
<div class="label">Ente fruitore</div>
<div class="value">{{consumerText}}</div>
AsterITA marked this conversation as resolved.
Show resolved Hide resolved
</div>

Expand Down
13 changes: 12 additions & 1 deletion packages/purpose-process/src/services/purposeService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1562,11 +1562,19 @@ async function generateRiskAnalysisDocument({
pdfGenerator: PDFGenerator;
logger: Logger;
}): Promise<PurposeVersionDocument> {
const [producer, consumer] = await Promise.all([
const [producer, consumer, producerDelegation] = await Promise.all([
retrieveTenant(eservice.producerId, readModelService),
retrieveTenant(purpose.consumerId, readModelService),
readModelService.getActiveDelegation(
eservice.id,
delegationKind.delegatedProducer
),
]);

const producerDelegate =
producerDelegation &&
(await retrieveTenant(producerDelegation.delegateId, readModelService));

const eserviceInfo: PurposeDocumentEServiceInfo = {
name: eservice.name,
mode: eservice.mode,
Expand All @@ -1576,6 +1584,9 @@ async function generateRiskAnalysisDocument({
consumerName: consumer.name,
consumerOrigin: consumer.externalId.origin,
consumerIPACode: consumer.externalId.value,
producerDelegationId: producerDelegation?.id,
producerDelegateName: producerDelegate?.name,
producerDelegateIpaCode: producerDelegate?.externalId.value,
};

function getTenantKind(tenant: Tenant): TenantKind {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ const getPdfPayload = ({
freeOfChargeReason: freeOfChargeReasonHtml,
date: dateAtRomeZone(new Date()),
eServiceMode,
producerDelegationId: eserviceInfo.producerDelegationId,
producerDelegateName: eserviceInfo.producerDelegateName,
producerDelegateIpaCode: eserviceInfo.producerDelegateIpaCode,
};
};

Expand Down
Loading