diff --git a/libs/application/template-api-modules/src/lib/modules/templates/transport-authority/transfer-of-vehicle-ownership/transfer-of-vehicle-ownership.service.ts b/libs/application/template-api-modules/src/lib/modules/templates/transport-authority/transfer-of-vehicle-ownership/transfer-of-vehicle-ownership.service.ts index 2ea45322f6c7..2974f7dbdffd 100644 --- a/libs/application/template-api-modules/src/lib/modules/templates/transport-authority/transfer-of-vehicle-ownership/transfer-of-vehicle-ownership.service.ts +++ b/libs/application/template-api-modules/src/lib/modules/templates/transport-authority/transfer-of-vehicle-ownership/transfer-of-vehicle-ownership.service.ts @@ -333,7 +333,7 @@ export class TransferOfVehicleOwnershipService extends BaseTemplateApiService { async addReview({ application, auth, - }: TemplateApiModuleActionProps): Promise { + }: TemplateApiModuleActionProps): Promise> { const answers = application.answers as TransferOfVehicleOwnershipAnswers // 1. Make sure review comes from buyer, he is the only one that can add more reviewers @@ -342,7 +342,7 @@ export class TransferOfVehicleOwnershipService extends BaseTemplateApiService { !answers.buyer.nationalId || auth.nationalId !== answers.buyer.nationalId ) { - return + return [] } // 2. Notify users that were added that need to review @@ -365,10 +365,11 @@ export class TransferOfVehicleOwnershipService extends BaseTemplateApiService { ) if (buyerCoOwners) { for (let i = 0; i < buyerCoOwners.length; i++) { - const oldEntry = oldRecipientList.find((x) => { - x.role === EmailRole.buyerCoOwner && - x.ssn === buyerCoOwners[i].nationalId - }) + const oldEntry = oldRecipientList.find( + (x) => + x.role === EmailRole.buyerCoOwner && + x.ssn === buyerCoOwners[i].nationalId, + ) const emailChanged = oldEntry ? oldEntry.email !== buyerCoOwners[i].email : true @@ -393,10 +394,11 @@ export class TransferOfVehicleOwnershipService extends BaseTemplateApiService { ) if (buyerOperators) { for (let i = 0; i < buyerOperators.length; i++) { - const oldEntry = oldRecipientList.find((x) => { - x.role === EmailRole.buyerOperator && - x.ssn === buyerOperators[i].nationalId - }) + const oldEntry = oldRecipientList.find( + (x) => + x.role === EmailRole.buyerOperator && + x.ssn === buyerOperators[i].nationalId, + ) const emailChanged = oldEntry ? oldEntry.email !== buyerOperators[i].email : true @@ -453,6 +455,8 @@ export class TransferOfVehicleOwnershipService extends BaseTemplateApiService { }) } } + + return newlyAddedRecipientList } async rejectApplication(props: TemplateApiModuleActionProps): Promise { diff --git a/libs/application/templates/aosh/transfer-of-machine-ownership/src/lib/messages/payment.ts b/libs/application/templates/aosh/transfer-of-machine-ownership/src/lib/messages/payment.ts index 3573842f697a..939de1252627 100644 --- a/libs/application/templates/aosh/transfer-of-machine-ownership/src/lib/messages/payment.ts +++ b/libs/application/templates/aosh/transfer-of-machine-ownership/src/lib/messages/payment.ts @@ -14,16 +14,6 @@ export const payment = { }, }), paymentChargeOverview: defineMessages({ - forPayment: { - id: 'aosh.tmo.application:payment.paymentChargeOverview.forPayment', - defaultMessage: 'Til greiðslu', - description: 'For payment label', - }, - total: { - id: 'aosh.tmo.application:payment.paymentChargeOverview.total', - defaultMessage: 'Samtals', - description: 'Total amount label', - }, alertTitle: { id: 'aosh.tmo.application:payment.paymentChargeOverview.alertTitle', defaultMessage: 'Til athugunar!', diff --git a/libs/application/templates/directorate-of-immigration/citizenship/src/lib/messages/payment.ts b/libs/application/templates/directorate-of-immigration/citizenship/src/lib/messages/payment.ts index 0f207aa213e0..6c504b1c2bea 100644 --- a/libs/application/templates/directorate-of-immigration/citizenship/src/lib/messages/payment.ts +++ b/libs/application/templates/directorate-of-immigration/citizenship/src/lib/messages/payment.ts @@ -13,18 +13,6 @@ export const payment = { description: 'Payment page title', }, }), - paymentChargeOverview: defineMessages({ - forPayment: { - id: 'doi.cs.application:payment.paymentChargeOverview.forPayment', - defaultMessage: 'Til greiðslu', - description: 'For payment label', - }, - total: { - id: 'doi.cs.application:payment.paymentChargeOverview.total', - defaultMessage: 'Samtals', - description: 'Total amount label', - }, - }), confirmation: defineMessages({ confirm: { id: 'doi.cs.application:payment.confirmation.confirm', diff --git a/libs/application/templates/healthcare-license-certificate/src/lib/messages/payment.ts b/libs/application/templates/healthcare-license-certificate/src/lib/messages/payment.ts index ebfa02b10376..37e82a8cf3ea 100644 --- a/libs/application/templates/healthcare-license-certificate/src/lib/messages/payment.ts +++ b/libs/application/templates/healthcare-license-certificate/src/lib/messages/payment.ts @@ -13,18 +13,6 @@ export const payment = { description: 'Payment page title', }, }), - paymentChargeOverview: defineMessages({ - forPayment: { - id: 'hlc.application:payment.paymentChargeOverview.forPayment', - defaultMessage: 'Til greiðslu', - description: 'For payment label', - }, - total: { - id: 'hlc.application:payment.paymentChargeOverview.total', - defaultMessage: 'Samtals', - description: 'Total amount label', - }, - }), confirmation: defineMessages({ confirm: { id: 'hlc.application:payment.confirmation.confirm', diff --git a/libs/application/templates/healthcare-work-permit/src/lib/messages/payment.ts b/libs/application/templates/healthcare-work-permit/src/lib/messages/payment.ts index 9b6d48dd2766..21fa21aa3ac7 100644 --- a/libs/application/templates/healthcare-work-permit/src/lib/messages/payment.ts +++ b/libs/application/templates/healthcare-work-permit/src/lib/messages/payment.ts @@ -13,18 +13,7 @@ export const payment = { description: 'Payment page title', }, }), - paymentChargeOverview: defineMessages({ - forPayment: { - id: 'hwp.application:payment.paymentChargeOverview.forPayment', - defaultMessage: 'Til greiðslu', - description: 'For payment label', - }, - total: { - id: 'hwp.application:payment.paymentChargeOverview.total', - defaultMessage: 'Samtals', - description: 'Total amount label', - }, - }), + confirmation: defineMessages({ confirm: { id: 'hwp.application:payment.confirmation.confirm', diff --git a/libs/application/templates/id-card/src/lib/messages/payment.ts b/libs/application/templates/id-card/src/lib/messages/payment.ts index 4af3ecb4bd03..ee649c63d4f6 100644 --- a/libs/application/templates/id-card/src/lib/messages/payment.ts +++ b/libs/application/templates/id-card/src/lib/messages/payment.ts @@ -13,18 +13,6 @@ export const payment = { description: 'Payment page title', }, }), - paymentChargeOverview: defineMessages({ - forPayment: { - id: 'id.application:payment.paymentChargeOverview.forPayment', - defaultMessage: 'Til greiðslu', - description: 'For payment label', - }, - total: { - id: 'id.application:payment.paymentChargeOverview.total', - defaultMessage: 'Samtals', - description: 'Total amount label', - }, - }), confirmation: defineMessages({ confirm: { id: 'id.application:payment.confirmation.confirm', diff --git a/libs/application/templates/mortgage-certificate/src/dataProviders/index.ts b/libs/application/templates/mortgage-certificate/src/dataProviders/index.ts index 37f69272d6b1..e0ccb3b4a9f3 100644 --- a/libs/application/templates/mortgage-certificate/src/dataProviders/index.ts +++ b/libs/application/templates/mortgage-certificate/src/dataProviders/index.ts @@ -1,5 +1,6 @@ import { InstitutionNationalIds, + MockablePaymentCatalogApi, PaymentCatalogApi, } from '@island.is/application/types' @@ -11,3 +12,11 @@ export const SyslumadurPaymentCatalogApi = PaymentCatalogApi.configure({ }, externalDataId: 'payment', }) + +export const MockableSyslumadurPaymentCatalogApi = + MockablePaymentCatalogApi.configure({ + params: { + organizationId: InstitutionNationalIds.SYSLUMENN, + }, + externalDataId: 'payment', + }) diff --git a/libs/application/templates/mortgage-certificate/src/forms/MortgageCertificateForm.ts b/libs/application/templates/mortgage-certificate/src/forms/MortgageCertificateForm.ts index 6b025791e05a..aee592b0f510 100644 --- a/libs/application/templates/mortgage-certificate/src/forms/MortgageCertificateForm.ts +++ b/libs/application/templates/mortgage-certificate/src/forms/MortgageCertificateForm.ts @@ -10,7 +10,6 @@ import { confirmation, externalData, overview, - payment, property, propertySearch, } from '../lib/messages' @@ -83,8 +82,6 @@ export const MortgageCertificateForm = ( ], }), buildFormPaymentChargeOverviewSection({ - sectionTitle: payment.general.sectionTitle, - forPaymentLabel: payment.labels.forPayment, getSelectedChargeItems: (application) => getChargeItemCodesAndExtraLabel(application), }), diff --git a/libs/application/templates/mortgage-certificate/src/forms/Prerequisites.ts b/libs/application/templates/mortgage-certificate/src/forms/Prerequisites.ts index b92435ef2f30..773e7be9b419 100644 --- a/libs/application/templates/mortgage-certificate/src/forms/Prerequisites.ts +++ b/libs/application/templates/mortgage-certificate/src/forms/Prerequisites.ts @@ -11,6 +11,7 @@ import { IdentityApi, UserProfileApi, SyslumadurPaymentCatalogApi, + MockableSyslumadurPaymentCatalogApi, } from '../dataProviders' import { confirmation, externalData, payment, property } from '../lib/messages' import Logo from '../assets/Logo' @@ -60,6 +61,10 @@ export const PrerequisitesForm: Form = buildForm({ provider: SyslumadurPaymentCatalogApi, title: '', }), + buildDataProviderItem({ + provider: MockableSyslumadurPaymentCatalogApi, + title: '', + }), ], }), ], diff --git a/libs/application/templates/mortgage-certificate/src/lib/messages/payment.ts b/libs/application/templates/mortgage-certificate/src/lib/messages/payment.ts index 3bd2a7300ecc..85141ec5e0a7 100644 --- a/libs/application/templates/mortgage-certificate/src/lib/messages/payment.ts +++ b/libs/application/templates/mortgage-certificate/src/lib/messages/payment.ts @@ -8,11 +8,4 @@ export const payment = { description: 'Payment section title', }, }), - labels: defineMessages({ - forPayment: { - id: 'mc.application:payment.labels.forPayment', - defaultMessage: 'Til greiðslu', - description: 'Payment for payment label', - }, - }), } diff --git a/libs/application/templates/mortgage-certificate/src/lib/mortgageCertificateTemplate.ts b/libs/application/templates/mortgage-certificate/src/lib/mortgageCertificateTemplate.ts index 12fcde99929c..34578e7e3b5e 100644 --- a/libs/application/templates/mortgage-certificate/src/lib/mortgageCertificateTemplate.ts +++ b/libs/application/templates/mortgage-certificate/src/lib/mortgageCertificateTemplate.ts @@ -21,6 +21,7 @@ import { IdentityApi, UserProfileApi, SyslumadurPaymentCatalogApi, + MockableSyslumadurPaymentCatalogApi, } from '../dataProviders' import { AuthDelegationType } from '@island.is/shared/types' import { buildPaymentState } from '@island.is/application/utils' @@ -84,7 +85,12 @@ const template: ApplicationTemplate< write: 'all', read: 'all', delete: true, - api: [IdentityApi, UserProfileApi, SyslumadurPaymentCatalogApi], + api: [ + IdentityApi, + UserProfileApi, + SyslumadurPaymentCatalogApi, + MockableSyslumadurPaymentCatalogApi, + ], }, ], }, diff --git a/libs/application/templates/transport-authority/order-vehicle-license-plate/src/fields/VehiclesField/VehicleSelectField.tsx b/libs/application/templates/transport-authority/order-vehicle-license-plate/src/fields/VehiclesField/VehicleSelectField.tsx index f8ef114e8373..8a75865a36ba 100644 --- a/libs/application/templates/transport-authority/order-vehicle-license-plate/src/fields/VehiclesField/VehicleSelectField.tsx +++ b/libs/application/templates/transport-authority/order-vehicle-license-plate/src/fields/VehiclesField/VehicleSelectField.tsx @@ -87,11 +87,16 @@ export const VehicleSelectField: FC< const disabled = !!response?.vehiclePlateOrderChecksByPermno?.validationErrorMessages ?.length - setPlate(disabled ? '' : currentVehicle.permno || '') - setValue( - 'pickVehicle.plate', - disabled ? '' : currentVehicle.permno || '', - ) + + const permno = disabled ? '' : currentVehicle.permno || '' + + setPlate(permno) + + setValue('pickVehicle.plate', permno) + + setValue('plateSize.frontPlateSize', []) + setValue('plateSize.rearPlateSize', []) + setIsLoading(false) }) .catch((error) => console.error(error)) diff --git a/libs/application/templates/transport-authority/order-vehicle-license-plate/src/lib/dataSchema.ts b/libs/application/templates/transport-authority/order-vehicle-license-plate/src/lib/dataSchema.ts index 985eb0b9fae9..f8ac10213e78 100644 --- a/libs/application/templates/transport-authority/order-vehicle-license-plate/src/lib/dataSchema.ts +++ b/libs/application/templates/transport-authority/order-vehicle-license-plate/src/lib/dataSchema.ts @@ -11,10 +11,14 @@ export const OrderVehicleLicensePlateSchema = z.object({ plate: z.string(), type: z.string(), }), - plateSize: z.object({ - frontPlateSize: z.array(z.string()), - rearPlateSize: z.array(z.string()), - }), + plateSize: z + .object({ + frontPlateSize: z.array(z.string()), + rearPlateSize: z.array(z.string()), + }) + .refine(({ frontPlateSize, rearPlateSize }) => { + return frontPlateSize.length !== 0 || rearPlateSize.length !== 0 + }), plateDelivery: z.object({ deliveryMethodIsDeliveryStation: z.enum([YES, NO]), deliveryStationTypeCode: z.string().optional(), diff --git a/libs/application/templates/university/src/lib/messages/payment.ts b/libs/application/templates/university/src/lib/messages/payment.ts index 8995d3536af5..2224458691c5 100644 --- a/libs/application/templates/university/src/lib/messages/payment.ts +++ b/libs/application/templates/university/src/lib/messages/payment.ts @@ -13,18 +13,6 @@ export const payment = { description: 'Payment page title', }, }), - paymentChargeOverview: defineMessages({ - forPayment: { - id: 'uni.application:payment.paymentChargeOverview.forPayment', - defaultMessage: 'Til greiðslu', - description: 'For payment label', - }, - total: { - id: 'uni.application:payment.paymentChargeOverview.total', - defaultMessage: 'Samtals', - description: 'Total amount label', - }, - }), confirmation: defineMessages({ confirm: { id: 'uni.application:payment.confirmation.confirm', diff --git a/libs/application/ui-fields/src/lib/FindVehicleFormField/FindVehicleFormField.tsx b/libs/application/ui-fields/src/lib/FindVehicleFormField/FindVehicleFormField.tsx index 5b8d1a2cd4e5..ca57d4b6e732 100644 --- a/libs/application/ui-fields/src/lib/FindVehicleFormField/FindVehicleFormField.tsx +++ b/libs/application/ui-fields/src/lib/FindVehicleFormField/FindVehicleFormField.tsx @@ -250,6 +250,9 @@ export const FindVehicleFormField: FC> = ({ setValue('vehicleMileage.requireMileage', vehicleDetails?.requireMileage) setValue('vehicleMileage.mileageReading', vehicleDetails?.mileageReading) + setValue('plateSize.frontPlateSize', []) + setValue('plateSize.rearPlateSize', []) + if (permno) setValue('vehicleInfo.plate', permno) if (permno) setValue('vehicleInfo.type', vehicleDetails.make) diff --git a/libs/application/ui-fields/src/lib/VehicleRadioFormField/VehicleRadioFormField.tsx b/libs/application/ui-fields/src/lib/VehicleRadioFormField/VehicleRadioFormField.tsx index ba01109c9e21..69a2cb6fc86d 100644 --- a/libs/application/ui-fields/src/lib/VehicleRadioFormField/VehicleRadioFormField.tsx +++ b/libs/application/ui-fields/src/lib/VehicleRadioFormField/VehicleRadioFormField.tsx @@ -64,6 +64,9 @@ export const VehicleRadioFormField: FC> = ({ setValue('vehicleMileage.requireMileage', currentVehicle?.requireMileage) setValue('vehicleMileage.mileageReading', currentVehicle?.mileageReading) + setValue('plateSize.frontPlateSize', []) + setValue('plateSize.rearPlateSize', []) + if (permno) setValue('vehicleInfo.plate', permno) if (permno) setValue('vehicleInfo.type', currentVehicle?.make) } else if (field.itemType === 'PLATE') {