Skip to content

Commit

Permalink
Merge branch 'feat/PN-12552' of github.com:pagopa/pn-delivery-push in…
Browse files Browse the repository at this point in the history
…to feat/PN-12551
  • Loading branch information
SarahDonvito committed Sep 6, 2024
2 parents c68071f + 71f80d7 commit 5dd9945
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 3 deletions.
2 changes: 1 addition & 1 deletion config/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ pn.delivery-push.raddExperimentationStoresName[4]=radd-experimentation-zip-5

#Configuration for send notification attachment, AAR, and AAR type. Comma separated list made up by:
# "Configuration start time" (UTC);"Send attachment mode for analog";"Send attachment mode for simple registered letter";"Send attachment mode for legal mail";"AAR template type" - if <RADD_TEMPLATE_DEFINITION> is last parameter value ("AAR template type") it means that the AAR template type need to be obtained dynamically, used for RADD experimentation
pn.delivery-push.pn-send-mode=1970-01-01T00:00:00Z;AAR-DOCUMENTS-PAYMENTS;AAR;AAR;AAR_NOTIFICATION,2024-05-22T22:00:00Z;AAR-DOCUMENTS-PAYMENTS;AAR;AAR-DOCUMENTS-PAYMENTS;AAR_NOTIFICATION,2024-05-22T22:00:00Z;AAR-DOCUMENTS-PAYMENTS;AAR;AAR-DOCUMENTS-PAYMENTS;<RADD_TEMPLATE_DEFINITION>,2024-06-26T22:00:00Z;AAR-DOCUMENTS-PAYMENTS;AAR;AAR-DOCUMENTS-PAYMENTS;AAR_NOTIFICATION_RADD_ALT
pn.delivery-push.pn-send-mode=1970-01-01T00:00:00Z;AAR-DOCUMENTS-PAYMENTS;AAR;AAR;AAR_NOTIFICATION,2024-05-22T22:00:00Z;AAR-DOCUMENTS-PAYMENTS;AAR;AAR-DOCUMENTS-PAYMENTS;AAR_NOTIFICATION,2024-05-22T22:00:00Z;AAR-DOCUMENTS-PAYMENTS;AAR;AAR-DOCUMENTS-PAYMENTS;<RADD_TEMPLATE_DEFINITION>,2024-06-26T22:00:00Z;AAR-DOCUMENTS-PAYMENTS;AAR;AAR-DOCUMENTS-PAYMENTS;AAR_NOTIFICATION_RADD_ALT;AAR_NOTIFICATION_RADD_ALT_ITA;

# Attachment retention after validation.
# Note: This number is defined on safeStorage, so a change to these properties does not imply a change to effective file retention
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
public enum AarTemplateType {
AAR_NOTIFICATION(false, DocumentComposition.TemplateType.AAR_NOTIFICATION),
AAR_NOTIFICATION_RADD(true, DocumentComposition.TemplateType.AAR_NOTIFICATION_RADD),
AAR_NOTIFICATION_RADD_ALT(true, DocumentComposition.TemplateType.AAR_NOTIFICATION_RADD_ALT);
AAR_NOTIFICATION_RADD_ALT(true, DocumentComposition.TemplateType.AAR_NOTIFICATION_RADD_ALT),
AAR_NOTIFICATION_RADD_ALT_ITA(true,DocumentComposition.TemplateType.AAR_NOTIFICATION_RADD_ALT_ITA);

private final boolean aarRADD;
private final DocumentComposition.TemplateType templateType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public enum TemplateType {
AAR_NOTIFICATION("documents_composition_templates/NotificationAAR.html"),
AAR_NOTIFICATION_RADD("documents_composition_templates/NotificationAAR_RADD.html"),
AAR_NOTIFICATION_RADD_ALT("documents_composition_templates/NotificationAAR_RADDalt.html"),
AAR_NOTIFICATION_RADD_ALT_ITA("documents_composition_templates/NotificationAAR_RADDalt_ITA.html"),
AAR_NOTIFICATION_EMAIL("documents_composition_templates/NotificationAARForEMAIL.html"),
AAR_NOTIFICATION_PEC("documents_composition_templates/NotificationAARForPEC.html"),
AAR_NOTIFICATION_SUBJECT("documents_composition_templates/NotificationAARSubject.txt"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
public enum AarTemplateTypeEntity {
AAR_NOTIFICATION("AAR_NOTIFICATION"),
AAR_NOTIFICATION_RADD("AAR_NOTIFICATION_RADD"),
AAR_NOTIFICATION_RADD_ALT("AAR_NOTIFICATION_RADD_ALT");
AAR_NOTIFICATION_RADD_ALT("AAR_NOTIFICATION_RADD_ALT"),
AAR_NOTIFICATION_RADD_ALT_ITA("AAR_NOTIFICATION_RADD_ALT_ITA");

private final String value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,42 @@ void generateNotificationAAR_RADD_ALT_Test() {
System.out.print("*** ReceivedLegalFact pdf successfully created at: " + filePath);
}

@Test
@ExtendWith(SpringExtension.class)
void generateNotificationAAR_RADD_ALT_Test_ITA() {
Mockito.when(pnSendModeUtils.getPnSendMode(Mockito.any())).thenReturn(PnSendMode.builder()
.aarTemplateTypeChooseStrategy(new StaticAarTemplateChooseStrategy(AarTemplateType.AAR_NOTIFICATION_RADD_ALT_ITA))
.build());

Path filePath = Paths.get(TEST_DIR_NAME + File.separator + "test_NotificationAAR_RADDalt_ITA.pdf");
NotificationSenderInt notificationSenderInt = NotificationSenderInt.builder()
.paId("TEST_PA_ID")
.paTaxId("TEST_TAX_ID")
.paDenomination("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque porttitore")
.build();

NotificationInt notificationInt = NotificationInt.builder()
.sender(notificationSenderInt)
.sentAt(Instant.now().minus(Duration.ofDays(1).minus(Duration.ofMinutes(10))))
.iun("Example_IUN_1234_Test")
.subject("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas et libero velit. Cras dignissim consequat ornare. Etiam sed justo sit.")
.build();
String quickAccessToken = "test";
PhysicalAddressInt paPhysicalAddress = PhysicalAddressBuilder.builder()
.withAddress(ExternalChannelMock.EXTCHANNEL_SEND_SUCCESS + " Via Nuova")
.withZip("80078")
.build();
NotificationRecipientInt recipient = NotificationRecipientInt.builder()
.recipientType(RecipientTypeInt.PF)
.denomination("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque porttitore")
.taxId("LRMPSM80A01H501U")
.physicalAddress(paPhysicalAddress)
.build();
Assertions.assertDoesNotThrow(() -> Files.write(filePath,
pdfUtils.generateNotificationAAR(notificationInt, recipient, quickAccessToken).getBytesArrayGeneratedAar()));
System.out.print("*** ReceivedLegalFact pdf successfully created at: " + filePath);
}

@Test
@ExtendWith(SpringExtension.class)
void generateNotificationAAR_RADDPGTest() {
Expand Down

0 comments on commit 5dd9945

Please sign in to comment.