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

feat(PN-13919): replace notification dto with model from bff #1470

Merged
merged 5 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 59 additions & 6 deletions packages/pn-pa-webapp/src/__mocks__/NewNotification.mock.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import {
DigitalDomicileType,
PhysicalCommunicationType,
RecipientType,
} from '@pagopa-pn/pn-commons';

import {
NewNotification,
NewNotificationDTO,
NewNotificationDigitalAddressType,
NewNotificationDocument,
NewNotificationRecipient,
NotificationFeePolicy,
PaymentModel,
} from '../models/NewNotification';
import { UserGroup } from '../models/user';
import { newNotificationMapper } from '../utility/notification.utility';
import { userResponse } from './Auth.mock';
import { BffNewNotificationRequest, NotificationDigitalAddressTypeEnum, NotificationDocument, NotificationRecipientV23 } from '../generated-client/notifications';

export const newNotificationGroups: Array<UserGroup> = [
{
Expand Down Expand Up @@ -43,7 +42,7 @@ const newNotificationRecipients: Array<NewNotificationRecipient> = [
firstName: 'Mario',
lastName: 'Rossi',
recipientType: RecipientType.PF,
type: DigitalDomicileType.PEC,
type: NewNotificationDigitalAddressType.PEC,
digitalDomicile: '[email protected]',
address: 'via del corso',
addressDetails: '',
Expand All @@ -61,7 +60,7 @@ const newNotificationRecipients: Array<NewNotificationRecipient> = [
firstName: 'Sara Gallo srl',
lastName: '',
recipientType: RecipientType.PG,
type: DigitalDomicileType.PEC,
type: NewNotificationDigitalAddressType.PEC,
digitalDomicile: '',
address: 'via delle cicale',
addressDetails: '',
Expand All @@ -74,6 +73,22 @@ const newNotificationRecipients: Array<NewNotificationRecipient> = [
},
];

const newNotificationRecipientsForBff: Array<NotificationRecipientV23> = [
{
taxId: 'MRARSS90P08H501Q',
denomination: 'Mario Rossi',
recipientType: RecipientType.PF,
digitalDomicile: {type: NotificationDigitalAddressTypeEnum.Pec,address: '[email protected]'},
physicalAddress: {address:'via del corso 49', zip: '00122', municipality: 'Roma', province: 'Roma', foreignState: 'Italia'},
},
{
taxId: '12345678901',
denomination: 'Sara Gallo srl',
recipientType: RecipientType.PG,
physicalAddress: {address:'via delle cicale 21', zip: '00035', municipality: 'Anzio', province: 'Roma', foreignState: 'Italia'}
},
]

const newNotificationDocuments: Array<NewNotificationDocument> = [
{
id: 'mocked-id-0',
Expand Down Expand Up @@ -115,6 +130,31 @@ const newNotificationDocuments: Array<NewNotificationDocument> = [
},
];

const newNotificationDocumentsForBff: Array<NotificationDocument> = [
{
title: 'mocked-name-0',
contentType: 'application/pdf',
digests: {
sha256: 'mocked-sha256-0',
},
ref: {
key: 'mocked-key-0',
versionToken: 'mocked-versionToken-0',
},
},
{
title: 'mocked-name-1',
contentType: 'application/pdf',
digests: {
sha256: 'mocked-sha256-1',
},
ref: {
key: 'mocked-key-1',
versionToken: 'mocked-versionToken-1',
},
},
];

const newNotificationPagoPa: NewNotificationDocument = {
id: 'mocked-pagopa-id',
idx: 0,
Expand Down Expand Up @@ -190,8 +230,21 @@ export const newNotificationEmpty: NewNotification = {
paymentMode: '' as PaymentModel,
group: '',
taxonomyCode: '',
senderTaxId:'',
notificationFeePolicy: '' as NotificationFeePolicy,
senderDenomination: userResponse.organization.name,
};

export const newNotificationDTO: NewNotificationDTO = newNotificationMapper(newNotification);
export const newNotificationForBff: BffNewNotificationRequest = {
abstract: '',
paProtocolNumber: '12345678910',
subject: 'Multone esagerato',
recipients: newNotificationRecipientsForBff,
documents: newNotificationDocumentsForBff,
physicalCommunicationType: PhysicalCommunicationType.REGISTERED_LETTER_890,
group: newNotificationGroups[2].id,
taxonomyCode: '010801N',
notificationFeePolicy: NotificationFeePolicy.FLAT_RATE,
senderDenomination: userResponse.organization.name,
senderTaxId: userResponse.organization.fiscal_code,
};
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ import { LangCode } from '@pagopa/mui-italia';
import {
NewNotification,
NewNotificationLangOther,
PreliminaryInformationsPayload,
} from '../../models/NewNotification';
import { GroupStatus } from '../../models/user';
import { useAppDispatch, useAppSelector } from '../../redux/hooks';
import { NEW_NOTIFICATION_ACTIONS, getUserGroups } from '../../redux/newNotification/actions';
import { setPreliminaryInformations } from '../../redux/newNotification/reducers';
import { PreliminaryInformationsPayload } from '../../redux/newNotification/types';
import { RootState } from '../../redux/store';
import { getConfiguration } from '../../services/configuration.service';
import { requiredStringFieldValidation } from '../../utility/validation.utility';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import { useTranslation } from 'react-i18next';
import { TextField, Typography, useFormControl } from '@mui/material';
import { LangCode, LangLabels } from '@pagopa/mui-italia';

import { NewNotificationLangOther } from '../../models/NewNotification';
import { PreliminaryInformationsPayload } from '../../redux/newNotification/types';
import { NewNotificationLangOther, PreliminaryInformationsPayload } from '../../models/NewNotification';
import { FormBox, FormBoxSubtitle, FormBoxTitle } from './NewNotificationFormElelements';

type SubjectFocusHelperTextProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ import {
import { CustomDropdown } from '@pagopa-pn/pn-commons';
import { LangCode, LangLabels } from '@pagopa/mui-italia';

import { BILINGUALISM_LANGUAGES, NewNotificationLangOther } from '../../models/NewNotification';
import { PreliminaryInformationsPayload } from '../../redux/newNotification/types';
import { BILINGUALISM_LANGUAGES, NewNotificationLangOther, PreliminaryInformationsPayload } from '../../models/NewNotification';
import { FormBox, FormBoxSubtitle, FormBoxTitle } from './NewNotificationFormElelements';

type Props = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import {
Stack,
Typography,
} from '@mui/material';
import { DigitalDomicileType, RecipientType, dataRegex } from '@pagopa-pn/pn-commons';
import { RecipientType, dataRegex } from '@pagopa-pn/pn-commons';
import { ButtonNaked } from '@pagopa/mui-italia';

import { NewNotificationRecipient, PaymentModel } from '../../models/NewNotification';
import { NewNotificationDigitalAddressType, NewNotificationRecipient, PaymentModel } from '../../models/NewNotification';
import { useAppDispatch } from '../../redux/hooks';
import { saveRecipients } from '../../redux/newNotification/reducers';
import {
Expand All @@ -36,7 +36,7 @@ const singleRecipient = {
taxId: '',
firstName: '',
lastName: '',
type: DigitalDomicileType.PEC,
type: NewNotificationDigitalAddressType.PEC,
digitalDomicile: '',
address: '',
houseNumber: '',
Expand Down
Loading