Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#257 - Merge Release v1.15.0 into main #3940

Merged
merged 8 commits into from
Nov 14, 2024
Prev Previous commit
Next Next commit
#3924 - Ecert Creation - "Prefer not to answer" Gender (#3927)
- Update the gender to have a white space as a default option.
- Adjusted and created some E2E tests for e-Certs.
- Adjusted MSFAA E2E that was already using "preferNotToAnswer".
- SIN is using the same method from e-Cert and MSFAA.
andrewsignori-aot authored Nov 13, 2024
commit d6ce0a54e0fd7a9b9ef2bffe9df2d82e9e40eac5
Original file line number Diff line number Diff line change
@@ -183,6 +183,7 @@ describe(
formatDate(coeUpdatedAtDate, "YYYYMMDD"),
);
expect(record1Parsed.postalCode).toBe("V1V 1V1");
expect(record1Parsed.gender).toBe("X");
// TODO Add other fields as needed.
});

Original file line number Diff line number Diff line change
@@ -394,6 +394,7 @@ describe(
const recordParsed = new PartTimeCertRecordParser(record);
expect(recordParsed.recordType).toBe("02");
expect(recordParsed.hasUser(student.user)).toBe(true);
expect(recordParsed.gender).toBe("X");
expect(recordParsed.disbursementAmount).toBe("000123500");
// TODO include other fields as needed.

@@ -410,6 +411,70 @@ describe(
expect(scheduleIsSent).toBe(true);
});

it("Should create an e-Cert with valid student profile data when the student has necessary profile data and gender defined as 'Prefer not to answer'.", async () => {
// Arrange
// Student with valid SIN.
const student = await saveFakeStudent(db.dataSource, null, {
initialValue: {
gender: "preferNotToAnswer",
},
});
// Valid MSFAA Number.
const msfaaNumber = await db.msfaaNumber.save(
createFakeMSFAANumber(
{ student },
{
msfaaState: MSFAAStates.Signed,
msfaaInitialValues: {
offeringIntensity: OfferingIntensity.partTime,
},
},
),
);
// Student application eligible for e-Cert.
await saveFakeApplicationDisbursements(
db.dataSource,
{
student,
msfaaNumber,
firstDisbursementValues: [
createFakeDisbursementValue(
DisbursementValueType.CanadaLoan,
"CSLP",
1234.57,
),
],
},
{
offeringIntensity: OfferingIntensity.partTime,
applicationStatus: ApplicationStatus.Completed,
currentAssessmentInitialValues: {
assessmentData: { weeks: 5 } as Assessment,
assessmentDate: new Date(),
},
firstDisbursementInitialValues: {
coeStatus: COEStatus.completed,
},
},
);
// Queued job.
const { job } = mockBullJob<void>();

// Act
await processor.processECert(job);

// Assert
// Assert student profile data.
const uploadedFile = getUploadedFile(sftpClientMock);
expect(uploadedFile.fileLines).toHaveLength(3);
const [, record] = uploadedFile.fileLines;
// TODO: include other student profile fields as needed.
const recordParsed = new PartTimeCertRecordParser(record);
expect(recordParsed.recordType).toBe("02");
expect(recordParsed.hasUser(student.user)).toBe(true);
expect(recordParsed.gender).toBe(" ");
});

it("Should adjust tuition remittance when requested tuition remittance is greater than the max tuition remittance.", async () => {
// Arrange

Original file line number Diff line number Diff line change
@@ -30,6 +30,11 @@ export abstract class ECertRecordParser {
*/
abstract get lastName(): string;

/**
* Student's gender.
*/
abstract get gender(): string;

/**
* Validate if the first name and last names belongs to the
* provided student user.
Original file line number Diff line number Diff line change
@@ -50,6 +50,13 @@ export class FullTimeCertRecordParser extends ECertRecordParser {
return this.record.substring(151, 176).trim();
}

/**
* Student's gender.
*/
get gender(): string {
return this.record.substring(594, 595);
}

/**
* Federal CSLF amount (loan).
*/
Original file line number Diff line number Diff line change
@@ -29,6 +29,13 @@ export class PartTimeCertRecordParser extends ECertRecordParser {
return this.record.substring(2, 27).trim();
}

/**
* Student's gender.
*/
get gender(): string {
return this.record.substring(54, 55);
}

/**
* Disbursement amount.
* This field includes 2 decimals in the file.
Original file line number Diff line number Diff line change
@@ -113,7 +113,7 @@ describe(
`2000000001000900000000PABCD19950630${processDateFormatted}Doe AAAAAAC John EEEEIIII MMNOOOOO Address Line 1 UUUU Address Line 2 Calgary AB H1H 1H1 Canada 00000000001111111111john.doe@somedomain.com PT `,
);
expect(msfaaPartTimeOtherCountry).toBe(
`2000000001001900000001PEFDG20000101${processDateFormatted}Other Doe aaaaaac Jane eeeeiiii Snooooo Address Line 1 Some city in the United S United States 00000000000000000049jane.doe@somedomain.com PT `,
`2000000001001900000001PEFDG20000101${processDateFormatted}Other Doe aaaaaac Jane eeeeiiii Snooooo Address Line 1 Some city in the United S United States 00000000000000000049jane.doe@somedomain.com PT `,
);
expect(msfaaPartTimeRelationshipOther).toBe(
`2000000001002900000002PIHKL20011231${processDateFormatted}Other Doe uuuuyy Other John ???? FOAddress Line 1 Address Line 2 Victoria BC H1H 1H1 Canada 99999999999999999999jane.doe@someotherdomain.com PT `,
Original file line number Diff line number Diff line change
@@ -147,7 +147,7 @@ export class ECertFullTimeFileRecord extends ECertFileRecord {
*/
postalCode?: string;
/**
* Gender (M=man, F=woman, X=nonBinary empty=preferNotToAnswer).
* Gender (M=man, F=woman, X=nonBinary, white space=preferNotToAnswer).
*/
gender: string;
/**
Original file line number Diff line number Diff line change
@@ -108,7 +108,7 @@ export class ECertPartTimeFileRecord extends ECertFileRecord {
*/
postalCode?: string;
/**
* Gender (M=man, F=woman, X=nonBinary empty=preferNotToAnswer).
* Gender (M=man, F=woman, X=nonBinary, white space=preferNotToAnswer).
*/
gender: string;
/**
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ export class SINValidationFileRequest implements FixedFormatFileLine {
*/
lastName: string;
/**
* Gender (M=man, F=woman, X=nonBinary empty=preferNotToAnswer).
* Gender (M=man, F=woman, X=nonBinary, white space=preferNotToAnswer).
*/
gender: string;
/**
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ export function createFakeStudent(
student.birthDate =
options?.initialValue?.birthDate ??
getISODateOnlyString(faker.date.past(18));
student.gender = "nonBinary";
student.gender = options?.initialValue?.gender ?? "nonBinary";
student.contactInfo = options?.initialValue?.contactInfo ?? {
address: {
addressLine1: faker.address.streetAddress(),
5 changes: 4 additions & 1 deletion sources/packages/backend/libs/utilities/src/esdc-utils.ts
Original file line number Diff line number Diff line change
@@ -32,7 +32,10 @@ export function getGenderCode(gender: string): string {
case "nonBinary":
return "X";
default:
return "";
// Gender should have at least one character code.
// The default option as an empty space would represent
// the "Prefer not to answer"(preferNotToAnswer) option.
return " ";
}
}