From 4cdfdf5c6d2ec5381ac6c3dd475a822a91c46436 Mon Sep 17 00:00:00 2001 From: Ny1ka Date: Tue, 22 Apr 2025 19:08:33 -0400 Subject: [PATCH 1/4] Added new rejection types and submitted to ASA status --- src/entities/finance.entity.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/entities/finance.entity.ts b/src/entities/finance.entity.ts index 8f2a0f22..b6e2e4fb 100644 --- a/src/entities/finance.entity.ts +++ b/src/entities/finance.entity.ts @@ -16,9 +16,22 @@ export enum Status { PENDING = "PENDING", APPROVED = "APPROVED", REJECTED = "REJECTED", + SUBMITTED_TO_ASA = "SUBMITTED_TO_ASA", DEPOSIT = "DEPOSIT", } +export enum RejectionReason { + INVALID_RECEIPT = "Invalid receipt", + WRONG_ADDRESS = "Wrong address", + WRONG_DESCRIPTION = "Wrong description", + INCORRECT_AMOUNT = "Incorrect amount", + DUPLICATE_SUBMISSION = "Duplicate submission", + MISSING_INFORMATION = "Missing required information", + INELIGIBLE_EXPENSE = "Ineligible expense", + EXPIRED_SUBMISSION = "Expired submission deadline", + OTHER = "Other" +} + export enum SubmitterType { USER = "USER", ORGANIZER = "ORGANIZER", @@ -242,6 +255,17 @@ export class Finance extends Entity { @Column({ type: "string" }) status: Status; + @ApiProperty({ + description: "Reason for rejection when status is REJECTED", + enum: RejectionReason, + required: false, + example: RejectionReason.INVALID_RECEIPT, + }) + @IsEnum(RejectionReason) + @IsOptional() + @Column({ type: "string", nullable: true }) + rejectionReason?: RejectionReason; + @ApiProperty({ description: "Type of the submitter (USER or ORGANIZER)", enum: SubmitterType, @@ -346,6 +370,7 @@ export class FinanceEntity extends PickType(Finance, [ "id", "amount", "status", + "rejectionReason", "submitterType", "submitterId", "receiptUrl", From 46a4d58b42b16afbe57e3d9a445c423a3e365d4a Mon Sep 17 00:00:00 2001 From: "i-nyika@se2.ai" Date: Fri, 29 Aug 2025 16:58:34 -0400 Subject: [PATCH 2/4] feat: add reimbursement rejection types and submitted_to_asa status - Added multiple REJECTED_* reimbursement status types and the submitted_to_asa status in status enum directly - Updated finance controller to check for any rejection status starting with REJECTED to handle rejected reimbursement requests --- src/entities/finance.entity.ts | 11 ++++++++++- src/modules/finance/finance.controller.ts | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/entities/finance.entity.ts b/src/entities/finance.entity.ts index b6e2e4fb..9b48fb45 100644 --- a/src/entities/finance.entity.ts +++ b/src/entities/finance.entity.ts @@ -15,9 +15,18 @@ import { ID, Column, Table } from "common/objection"; export enum Status { PENDING = "PENDING", APPROVED = "APPROVED", - REJECTED = "REJECTED", SUBMITTED_TO_ASA = "SUBMITTED_TO_ASA", DEPOSIT = "DEPOSIT", + + REJECTED_INVALID_RECEIPT = "REJECTED_INVALID_RECEIPT", + REJECTED_WRONG_ADDRESS = "REJECTED_WRONG_ADDRESS", + REJECTED_WRONG_DESCRIPTION = "REJECTED_WRONG_DESCRIPTION", + REJECTED_INCORRECT_AMOUNT = "REJECTED_INCORRECT_AMOUNT", + REJECTED_DUPLICATE_SUBMISSION = "REJECTED_DUPLICATE_SUBMISSION", + REJECTED_MISSING_INFORMATION = "REJECTED_MISSING_INFORMATION", + REJECTED_INELIGIBLE_EXPENSE = "REJECTED_INELIGIBLE_EXPENSE", + REJECTED_EXPIRED_SUBMISSION = "REJECTED_EXPIRED_SUBMISSION", + REJECTED_OTHER = "REJECTED_OTHER" } export enum RejectionReason { diff --git a/src/modules/finance/finance.controller.ts b/src/modules/finance/finance.controller.ts index 218dd905..4ab667e1 100644 --- a/src/modules/finance/finance.controller.ts +++ b/src/modules/finance/finance.controller.ts @@ -335,7 +335,7 @@ export class FinanceController { subject: "HackPSU Reimbursement Approved", message: reimbursementApprovedMessage, }); - } else if (updatedFinance.status === Status.REJECTED) { + } else if (updatedFinance.status.startsWith("REJECTED")) { const reimbursementRejectedMessage = await this.sendGridService.populateTemplate( DefaultTemplate.reimbursementRejected, From cba6cf59b9073f70528604381bfdf15e6dd3e54b Mon Sep 17 00:00:00 2001 From: "i-nyika@se2.ai" Date: Mon, 1 Sep 2025 14:14:09 -0400 Subject: [PATCH 3/4] removed rejectionReason enum and ApiProperty and updated controller to handle submitted_to_asa status by sending email to asa team --- src/entities/finance.entity.ts | 24 ----------------------- src/modules/finance/finance.controller.ts | 10 +++++++++- 2 files changed, 9 insertions(+), 25 deletions(-) diff --git a/src/entities/finance.entity.ts b/src/entities/finance.entity.ts index 9b48fb45..e5114a09 100644 --- a/src/entities/finance.entity.ts +++ b/src/entities/finance.entity.ts @@ -29,18 +29,6 @@ export enum Status { REJECTED_OTHER = "REJECTED_OTHER" } -export enum RejectionReason { - INVALID_RECEIPT = "Invalid receipt", - WRONG_ADDRESS = "Wrong address", - WRONG_DESCRIPTION = "Wrong description", - INCORRECT_AMOUNT = "Incorrect amount", - DUPLICATE_SUBMISSION = "Duplicate submission", - MISSING_INFORMATION = "Missing required information", - INELIGIBLE_EXPENSE = "Ineligible expense", - EXPIRED_SUBMISSION = "Expired submission deadline", - OTHER = "Other" -} - export enum SubmitterType { USER = "USER", ORGANIZER = "ORGANIZER", @@ -264,17 +252,6 @@ export class Finance extends Entity { @Column({ type: "string" }) status: Status; - @ApiProperty({ - description: "Reason for rejection when status is REJECTED", - enum: RejectionReason, - required: false, - example: RejectionReason.INVALID_RECEIPT, - }) - @IsEnum(RejectionReason) - @IsOptional() - @Column({ type: "string", nullable: true }) - rejectionReason?: RejectionReason; - @ApiProperty({ description: "Type of the submitter (USER or ORGANIZER)", enum: SubmitterType, @@ -379,7 +356,6 @@ export class FinanceEntity extends PickType(Finance, [ "id", "amount", "status", - "rejectionReason", "submitterType", "submitterId", "receiptUrl", diff --git a/src/modules/finance/finance.controller.ts b/src/modules/finance/finance.controller.ts index 4ab667e1..26101cb6 100644 --- a/src/modules/finance/finance.controller.ts +++ b/src/modules/finance/finance.controller.ts @@ -350,8 +350,16 @@ export class FinanceController { subject: "HackPSU Reimbursement Rejected", message: reimbursementRejectedMessage, }); + } else if (updatedFinance.status === Status.SUBMITTED_TO_ASA) { + const asaNotificationMessage = `Reimbursement ${updatedFinance.id} has been submitted to ASA for processing.`; + await this.sendGridService.send({ + from: "finance@hackpsu.org", + to: "asa-team@hackpsu.org", + subject: "Reimbursement Submitted to ASA", + message: asaNotificationMessage, + }); } - + return updatedFinance; } } From 8d244e2af721f122295558517037d6e12a6b76b7 Mon Sep 17 00:00:00 2001 From: Kanishk Sachdev Date: Mon, 1 Sep 2025 17:37:06 -0400 Subject: [PATCH 4/4] Remove email --- src/entities/finance.entity.ts | 2 +- src/modules/finance/finance.controller.ts | 10 +--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/entities/finance.entity.ts b/src/entities/finance.entity.ts index e5114a09..a8e159f3 100644 --- a/src/entities/finance.entity.ts +++ b/src/entities/finance.entity.ts @@ -26,7 +26,7 @@ export enum Status { REJECTED_MISSING_INFORMATION = "REJECTED_MISSING_INFORMATION", REJECTED_INELIGIBLE_EXPENSE = "REJECTED_INELIGIBLE_EXPENSE", REJECTED_EXPIRED_SUBMISSION = "REJECTED_EXPIRED_SUBMISSION", - REJECTED_OTHER = "REJECTED_OTHER" + REJECTED_OTHER = "REJECTED_OTHER", } export enum SubmitterType { diff --git a/src/modules/finance/finance.controller.ts b/src/modules/finance/finance.controller.ts index 26101cb6..4ab667e1 100644 --- a/src/modules/finance/finance.controller.ts +++ b/src/modules/finance/finance.controller.ts @@ -350,16 +350,8 @@ export class FinanceController { subject: "HackPSU Reimbursement Rejected", message: reimbursementRejectedMessage, }); - } else if (updatedFinance.status === Status.SUBMITTED_TO_ASA) { - const asaNotificationMessage = `Reimbursement ${updatedFinance.id} has been submitted to ASA for processing.`; - await this.sendGridService.send({ - from: "finance@hackpsu.org", - to: "asa-team@hackpsu.org", - subject: "Reimbursement Submitted to ASA", - message: asaNotificationMessage, - }); } - + return updatedFinance; } }