From 390404e0bca7756e5ab683056f1f015d87157dcb Mon Sep 17 00:00:00 2001 From: Krishnan Subramanian <84348052+krishnan-aot@users.noreply.github.com> Date: Tue, 7 Jan 2025 09:58:10 -0800 Subject: [PATCH 1/2] ORV2-3148 Hide Pay in person text for CV clients with its own feature flag (#1730) --- .../dbo.ORBC_FEATURE_FLAG.Table.sql | 22 +++++++++++++++++++ .../components/pay/ChoosePaymentMethod.tsx | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/database/mssql/scripts/sampledata/dbo.ORBC_FEATURE_FLAG.Table.sql b/database/mssql/scripts/sampledata/dbo.ORBC_FEATURE_FLAG.Table.sql index 51342bab3..e66c2e2d9 100644 --- a/database/mssql/scripts/sampledata/dbo.ORBC_FEATURE_FLAG.Table.sql +++ b/database/mssql/scripts/sampledata/dbo.ORBC_FEATURE_FLAG.Table.sql @@ -279,6 +279,28 @@ VALUES N'dbo', GETUTCDATE() ); +INSERT INTO + [dbo].[ORBC_FEATURE_FLAG] ( + [FEATURE_ID], + [FEATURE_KEY], + [FEATURE_VALUE], + [CONCURRENCY_CONTROL_NUMBER], + [DB_CREATE_USERID], + [DB_CREATE_TIMESTAMP], + [DB_LAST_UPDATE_USERID], + [DB_LAST_UPDATE_TIMESTAMP] + ) +VALUES + ( + '13', + 'CVCLIENT-PAY-IN-PERSON', + 'DISABLED', + NULL, + N'dbo', + GETUTCDATE(), + N'dbo', + GETUTCDATE() + ); SET IDENTITY_INSERT [dbo].[ORBC_FEATURE_FLAG] OFF diff --git a/frontend/src/features/permits/pages/Application/components/pay/ChoosePaymentMethod.tsx b/frontend/src/features/permits/pages/Application/components/pay/ChoosePaymentMethod.tsx index bcb7c33ff..1c72076e8 100644 --- a/frontend/src/features/permits/pages/Application/components/pay/ChoosePaymentMethod.tsx +++ b/frontend/src/features/permits/pages/Application/components/pay/ChoosePaymentMethod.tsx @@ -74,7 +74,7 @@ export const ChoosePaymentMethod = ({ /> ))} {showPayInPersonInfo && - featureFlags?.["STAFF-CAN-PAY"] === "ENABLED" ? ( + featureFlags?.["CVCLIENT-PAY-IN-PERSON"] === "ENABLED" ? ( ) : null} From 366ce4629a526f2a7584e55a754bb68e85866cf7 Mon Sep 17 00:00:00 2001 From: Praveen Raju <80779423+praju-aot@users.noreply.github.com> Date: Tue, 7 Jan 2025 14:55:36 -0500 Subject: [PATCH 2/2] ORV2-3106 Incorrect Payment Receipts Being Sent Out (#1731) --- .../payment/payment.module.ts | 7 +++++- .../payment/payment.service.ts | 3 +-- .../permit-receipt-document.service.ts | 23 +++++++++++-------- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/vehicles/src/modules/permit-application-payment/payment/payment.module.ts b/vehicles/src/modules/permit-application-payment/payment/payment.module.ts index e6af1a02e..3eeee2a44 100644 --- a/vehicles/src/modules/permit-application-payment/payment/payment.module.ts +++ b/vehicles/src/modules/permit-application-payment/payment/payment.module.ts @@ -28,7 +28,12 @@ import { SpecialAuth } from 'src/modules/special-auth/entities/special-auth.enti ]), ], controllers: [PaymentController], - providers: [PaymentService, TransactionProfile, PaymentReportService, SpecialAuthService], + providers: [ + PaymentService, + TransactionProfile, + PaymentReportService, + SpecialAuthService, + ], exports: [PaymentService], }) export class PaymentModule {} diff --git a/vehicles/src/modules/permit-application-payment/payment/payment.service.ts b/vehicles/src/modules/permit-application-payment/payment/payment.service.ts index 90c60f518..3b324b2bf 100644 --- a/vehicles/src/modules/permit-application-payment/payment/payment.service.ts +++ b/vehicles/src/modules/permit-application-payment/payment/payment.service.ts @@ -828,9 +828,8 @@ export class PaymentService { return fee; } - /** - * + * * This function is deprecated and will be removed once the validation endpoints are established. */ @LogAsyncMethodExecution() diff --git a/vehicles/src/modules/permit-application-payment/permit-receipt-document/permit-receipt-document.service.ts b/vehicles/src/modules/permit-application-payment/permit-receipt-document/permit-receipt-document.service.ts index 7e4d2d550..bf8cf432a 100644 --- a/vehicles/src/modules/permit-application-payment/permit-receipt-document/permit-receipt-document.service.ts +++ b/vehicles/src/modules/permit-application-payment/permit-receipt-document/permit-receipt-document.service.ts @@ -40,6 +40,7 @@ import { validateEmailandFaxList, } from '../../../common/helper/notification.helper'; import { getPermitTemplateName } from '../../../common/helper/template.helper'; +import { Nullable } from '../../../common/types/common'; @Injectable() export class PermitReceiptDocumentService { @@ -67,10 +68,6 @@ export class PermitReceiptDocumentService { const permitQB = this.permitRepository.createQueryBuilder('permit'); permitQB .select('transaction.transactionId', 'transactionId') - .addSelect( - 'COUNT(permit.permitId) OVER (PARTITION BY transaction.transactionId)', - 'permitCountPerTransactionId', - ) .distinct(true) .leftJoin('permit.company', 'company') .innerJoin('permit.permitTransactions', 'permitTransactions') @@ -90,7 +87,6 @@ export class PermitReceiptDocumentService { const transactions = await permitQB.getRawMany<{ transactionId: string; - permitCountPerTransactionId: number; }>(); const transactionPermitList: { @@ -105,9 +101,10 @@ export class PermitReceiptDocumentService { transaction.transactionId, ); - if ( - fetchedApplications?.length === transaction.permitCountPerTransactionId - ) { + const unIssuedApplications = fetchedApplications.filter( + (application) => !application.permitNumber, + ); + if (!unIssuedApplications?.length) { transactionPermitList.push({ transactionId: transaction.transactionId, permits: fetchedApplications, @@ -125,12 +122,14 @@ export class PermitReceiptDocumentService { * @param applicationIds Array of application IDs to filter the permits. If empty, will search by transactionId. * @param companyId The ID of the company to which the permits may belong, optional. * @param transactionId A specific transaction ID to find the related permit, optional. If provided, applicationIds should be empty. + * @param issued A boolean to filter results to return only issued permits. * @returns A promise that resolves with an array of permits matching the criteria. */ private async findManyWithSuccessfulTransaction( permitIds: string[], companyId?: number, transactionId?: string, + issued?: Nullable, ): Promise { if ( (!permitIds?.length && !transactionId) || @@ -152,8 +151,10 @@ export class PermitReceiptDocumentService { 'applicationOwner.userContact', 'applicationOwnerContact', ) - .where('receipt.receiptNumber IS NOT NULL') - .where('permit.permitNumber IS NOT NULL'); + .where('receipt.receiptNumber IS NOT NULL'); + if (issued) { + permitQB.andWhere('permit.permitNumber IS NOT NULL'); + } if (permitIds?.length) { permitQB.andWhere('permit.permitId IN (:...permitIds)', { @@ -233,6 +234,8 @@ export class PermitReceiptDocumentService { const fetchedPermits = await this.findManyWithSuccessfulTransaction( permitIds, companyId, + null, + true, ); if (!fetchedPermits?.length) {