From 14a1e391a11e0851cde3dcc103bff47ef08ee0f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9E=C3=B3r=C3=B0ur=20H?= Date: Tue, 17 Dec 2024 09:53:45 +0000 Subject: [PATCH] fix(my-pages): Remove health doc button (#17261) * remove button * Remove unused import --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- apps/download-service/src/app/app.module.ts | 2 - .../payment-overview-documents.controller.ts | 73 ------------------- .../src/screens/Payments/PaymentOverview.tsx | 24 ------ 3 files changed, 99 deletions(-) delete mode 100644 apps/download-service/src/app/modules/health/payment-overview-documents.controller.ts diff --git a/apps/download-service/src/app/app.module.ts b/apps/download-service/src/app/app.module.ts index 2c3b3a9b69a6..994224f5e721 100644 --- a/apps/download-service/src/app/app.module.ts +++ b/apps/download-service/src/app/app.module.ts @@ -51,7 +51,6 @@ import { WorkMachinesClientConfig, WorkMachinesClientModule, } from '@island.is/clients/work-machines' -import { HealthPaymentsOverviewController } from './modules/health/payment-overview-documents.controller' import { RightsPortalClientConfig, RightsPortalClientModule, @@ -70,7 +69,6 @@ import { RegulationDocumentsController, WorkMachinesController, OccupationalLicensesController, - HealthPaymentsOverviewController, ], imports: [ AuditModule.forRoot(environment.audit), diff --git a/apps/download-service/src/app/modules/health/payment-overview-documents.controller.ts b/apps/download-service/src/app/modules/health/payment-overview-documents.controller.ts deleted file mode 100644 index 1bb2aa7e9701..000000000000 --- a/apps/download-service/src/app/modules/health/payment-overview-documents.controller.ts +++ /dev/null @@ -1,73 +0,0 @@ -import type { User } from '@island.is/auth-nest-tools' -import { - AuthMiddleware, - CurrentUser, - IdsUserGuard, - Scopes, - ScopesGuard, -} from '@island.is/auth-nest-tools' -import { ApiScope } from '@island.is/auth/scopes' -import { PaymentsOverviewApi } from '@island.is/clients/icelandic-health-insurance/rights-portal' -import { AuditService } from '@island.is/nest/audit' -import { Controller, Header, Param, Post, Res, UseGuards } from '@nestjs/common' -import { ApiOkResponse } from '@nestjs/swagger' -import { Response } from 'express' - -@UseGuards(IdsUserGuard, ScopesGuard) -@Scopes(ApiScope.healthPayments) -@Controller('health') -export class HealthPaymentsOverviewController { - constructor( - private readonly paymentApi: PaymentsOverviewApi, - private readonly auditService: AuditService, - ) {} - - @Post('/payments/:documentId') - @Header('Content-Type', 'application/pdf') - @ApiOkResponse({ - content: { 'application/pdf': {} }, - description: - 'Gets payment overview document for specific bill with documentId', - }) - async getHealthPaymentOverviewPdf( - @Param('documentId') documentId: string, - @CurrentUser() user: User, - @Res() res: Response, - ) { - const documentResponse = await this.paymentApi - .withMiddleware(new AuthMiddleware(user)) - .getPaymentsOverviewDocument({ - documentId: parseInt(documentId), - }) - - if (documentResponse) { - this.auditService.audit({ - action: 'getHealthPaymentOverviewPdf', - auth: user, - resources: documentId, - }) - - if (!documentResponse.data) - return res.status(404).end( - JSON.stringify({ - statusCode: 404, - message: 'Document not found', - }), - ) - - const buffer = Buffer.from(documentResponse.data, 'base64') - - res.header('Content-length', buffer.length.toString()) - res.header( - 'Content-Disposition', - `inline; filename=${user.nationalId}-health-payment-overview-${documentResponse.fileName}.pdf`, - ) - res.header('Content-Type', 'application/pdf') - res.header('Pragma', 'no-cache') - res.header('Cache-Control', 'no-cache') - res.header('Cache-Control', 'nmax-age=0') - return res.status(200).end(buffer) - } - return res.end() - } -} diff --git a/libs/portals/my-pages/health/src/screens/Payments/PaymentOverview.tsx b/libs/portals/my-pages/health/src/screens/Payments/PaymentOverview.tsx index b8c4ea75b5b9..a5ecc6b76e34 100644 --- a/libs/portals/my-pages/health/src/screens/Payments/PaymentOverview.tsx +++ b/libs/portals/my-pages/health/src/screens/Payments/PaymentOverview.tsx @@ -1,5 +1,4 @@ import { - AlertMessage, Box, DatePicker, SkeletonLoader, @@ -16,7 +15,6 @@ import { DownloadFileButtons, UserInfoLine, amountFormat, - formSubmit, m, } from '@island.is/portals/my-pages/core' import { messages } from '../../lib/messages' @@ -88,10 +86,6 @@ export const PaymentOverview = () => { }) } - const onFetchDocument = (url: string) => { - formSubmit(url) - } - useEffect(() => { onFetchBills() // eslint-disable-next-line react-hooks/exhaustive-deps @@ -209,9 +203,6 @@ export const PaymentOverview = () => { {formatMessage(messages.insuranceShare)} - - {formatMessage(messages.paymentDocument)} - @@ -229,21 +220,6 @@ export const PaymentOverview = () => { {amountFormat(item.insuranceAmount ?? 0)} - - - ) })}