From ab5c1734e020b842095bb0e339109ab4ab63610f Mon Sep 17 00:00:00 2001 From: obmagnusson Date: Wed, 4 Sep 2024 13:36:07 +0000 Subject: [PATCH] pr fixes --- .../domains/payment/src/lib/api-domains-payment.types.ts | 8 ++++---- .../api/payment/src/lib/payment-callback.controller.ts | 6 +++--- .../examplePaymentActions.service.ts | 1 - .../src/components/PaymentPending/PaymentPending.tsx | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/libs/api/domains/payment/src/lib/api-domains-payment.types.ts b/libs/api/domains/payment/src/lib/api-domains-payment.types.ts index 95217d2f4091..afffa7ebe032 100644 --- a/libs/api/domains/payment/src/lib/api-domains-payment.types.ts +++ b/libs/api/domains/payment/src/lib/api-domains-payment.types.ts @@ -18,7 +18,7 @@ export interface CallbackResult { data?: Callback } -export enum paidStatus { +export enum PaidStatus { paid = 'paid', cancelled = 'cancelled', recreated = 'recreated', @@ -37,7 +37,7 @@ export class Callback { readonly chargeItemSubject!: string @IsNotEmpty() - @IsEnum(paidStatus) - @ApiProperty({ enum: paidStatus }) - readonly status!: paidStatus + @IsEnum(PaidStatus) + @ApiProperty({ enum: PaidStatus }) + readonly status!: PaidStatus } diff --git a/libs/application/api/payment/src/lib/payment-callback.controller.ts b/libs/application/api/payment/src/lib/payment-callback.controller.ts index 1df66e79ad67..3333aaf6d1e7 100644 --- a/libs/application/api/payment/src/lib/payment-callback.controller.ts +++ b/libs/application/api/payment/src/lib/payment-callback.controller.ts @@ -2,7 +2,8 @@ import { Body, Controller, Param, Post, ParseUUIDPipe } from '@nestjs/common' import { Callback } from '@island.is/api/domains/payment' import { PaymentService } from './payment.service' import { ApplicationService } from '@island.is/application/api/core' -import { ApiCreatedResponse, ApiTags } from '@nestjs/swagger' +import { ApiTags } from '@nestjs/swagger' +import addMonths from 'date-fns/addMonths' @ApiTags('payment-callback') @Controller() @@ -30,8 +31,7 @@ export class PaymentCallbackController { const application = await this.applicationService.findOneById(applicationId) if (application) { - const oneMonthFromNow = new Date() - oneMonthFromNow.setMonth(oneMonthFromNow.getMonth() + 1) + const oneMonthFromNow = addMonths(new Date(), 1) //Applications payment states are default to be pruned in 24 hours. //If the application is paid, we want to hold on to it for longer in case we get locked in an error state. diff --git a/libs/application/template-api-modules/src/lib/modules/templates/example-payment-actions/examplePaymentActions.service.ts b/libs/application/template-api-modules/src/lib/modules/templates/example-payment-actions/examplePaymentActions.service.ts index a3e72a99f68a..fe3fed81acc6 100644 --- a/libs/application/template-api-modules/src/lib/modules/templates/example-payment-actions/examplePaymentActions.service.ts +++ b/libs/application/template-api-modules/src/lib/modules/templates/example-payment-actions/examplePaymentActions.service.ts @@ -66,7 +66,6 @@ export class ExamplePaymentActionsService extends BaseTemplateApiService { // Note: after this point, you can be asured that the payment has been made, so you can // safely do appropriate api calls at this point. - throw new Error('External api call fails here !! oh no...') return { success: true, diff --git a/libs/application/ui-components/src/components/PaymentPending/PaymentPending.tsx b/libs/application/ui-components/src/components/PaymentPending/PaymentPending.tsx index 7d63cec6164a..d4c040b47b4e 100644 --- a/libs/application/ui-components/src/components/PaymentPending/PaymentPending.tsx +++ b/libs/application/ui-components/src/components/PaymentPending/PaymentPending.tsx @@ -102,7 +102,7 @@ export const PaymentPending: FC<