Skip to content

Commit

Permalink
[Release] Version 0.3.3 (#365)
Browse files Browse the repository at this point in the history
* Add Sharujan to employees.ts (#360)

* [Improvement] Add Mail Lost Option as Replacement Reason (#340)

* initial commit for the mail lost option

* changed the processing fee for mail lost

* made the migrations for mail lost

* reverted yarn lock to staging

* initial commit for the mail lost option

* changed the processing fee for mail lost

* made the migrations for mail lost

* reverted yarn lock to staging

---------

Co-authored-by: Chinemerem <[email protected]>

* Add $200 donation option (#355)

* Add $200 donation option

* Add $200 donation option

* Update .env.sample with $200 donation product id

---------

Co-authored-by: Chinemerem <[email protected]>

* Change address from unit 842 to 968 (#361)

* [Fix] Add AMEX as a second payment option (#362)

* [Feature] Add receipt numbers to application reports (#363)

* [Misc] Update README.md (#364)

---------

Co-authored-by: Chinemerem <[email protected]>
Co-authored-by: Keane Moraes <[email protected]>
Co-authored-by: Sherry Li <[email protected]>
  • Loading branch information
4 people authored Jun 21, 2024
1 parent b775102 commit 53d690c
Show file tree
Hide file tree
Showing 20 changed files with 89 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ NA_JWT_SECRET=""
NEXT_PUBLIC_SHOPIFY_DOMAIN=""
SHOPIFY_STOREFRONT_ACCESS_TOKEN=""
SHOPIFY_PERMIT_PRODUCT_ID=""
SHOPIFY_DONATION_PRODUCT_IDS="5:,10:,25:,50:,75:,100:"
SHOPIFY_DONATION_PRODUCT_IDS="5:,10:,25:,50:,75:,100:,200:"
SHOPIFY_WEBHOOK_SECRET=""

# AWS S3
Expand Down
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ yarn dev
npx prisma migrate deploy
```

4. Seed database
4. Reset and seed database (ensure node is v14.17.0 or else it will stall)

```bash
npx prisma db seed --preview-feature
npx prisma migrate reset
```

5. Verify database
Expand All @@ -84,6 +84,14 @@ npx prisma db seed --preview-feature
docker exec -it rcd_db bash -c "psql -U postgres -d rcd"
```

## Migrations

To create a new migration (after making changes to the Prisma schema):

```bash
npx prisma migrate dev --name <migration-name> --create-only
```

## Run locally (Heroku)

Duplicate `.env.sample` to `.env` and configure environment variables.
Expand Down
1 change: 1 addition & 0 deletions components/admin/requests/payment-information/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export default function PaymentDetailsForm({ paymentInformation }: PaymentDetail
label="Second payment method"
>
<Stack>
<Radio value={'AMEX' as PaymentType}>{'American Express'}</Radio>
<Radio value={'MASTERCARD' as PaymentType}>{'Mastercard'}</Radio>
<Radio value={'VISA' as PaymentType}>{'Visa'}</Radio>
<Radio value={'DEBIT' as PaymentType}>{'Debit'}</Radio>
Expand Down
10 changes: 9 additions & 1 deletion components/admin/requests/reason-for-replacement/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,21 @@ export default function ReasonForReplacementForm({
{'Stolen'}
</Radio>
<Radio
value={'OTHER'}
value={'MAIL_LOST'}
onChange={() => {
setFieldValue('paymentInformation.processingFee', '0');
}}
>
{'Mail Lost'}
</Radio>
<Radio
value={'OTHER'}
onChange={() => {
setFieldValue('paymentInformation.processingFee', '0');
}}
>
{'Other'}
</Radio>
</Stack>
</RadioGroupField>
</Box>
Expand Down
4 changes: 2 additions & 2 deletions components/admin/requests/reports/GenerateModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export default function GenerateReportModal(props: Props) {
<Modal isOpen={isOpen} onClose={handleClose} isCentered size={'xl'}>
<ModalOverlay />
{step === GenerateReportStep.SelectColumns ? (
<ModalContent paddingLeft="16px" maxWidth="45rem" maxHeight="600px" paddingRight="16px">
<ModalContent paddingLeft="16px" maxWidth="45rem" maxHeight="700px" paddingRight="16px">
<ModalHeader paddingTop="24px" paddingBottom="12px">
<Text textStyle="display-medium-bold">Requests Report</Text>
</ModalHeader>
Expand Down Expand Up @@ -205,7 +205,7 @@ export default function GenerateReportModal(props: Props) {
</ModalFooter>
</ModalContent>
) : step === GenerateReportStep.Export ? (
<ModalContent paddingLeft="16px" maxWidth="46rem" maxHeight="438px" paddingRight="16px">
<ModalContent paddingLeft="16px" maxWidth="46rem" maxHeight="500px" paddingRight="16px">
<ModalHeader paddingTop="24px" paddingBottom="0px">
<Stack direction="row">
<Text textStyle="display-medium-bold" paddingRight="10px">
Expand Down
2 changes: 1 addition & 1 deletion components/applicant/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function Footer() {
Location
</Text>
<Text textStyle="caption">
#842 - 5300, No.3 Rd
#968 - 5300, No.3 Rd
<br />
Lansdowne Centre
<br />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const DonationSection: FC = () => {
<Radio value={50}>$50</Radio>
<Radio value={75}>$75</Radio>
<Radio value={100}>$100</Radio>
<Radio value={200}>$200</Radio>
<Radio value={0}>No Donation</Radio>
</VStack>
</RadioGroupField>
Expand Down
2 changes: 1 addition & 1 deletion lib/applications/resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ export const createExternalRenewalApplication: Resolver<

// TODO: Replace validation for donation amount
const { donationAmount = 0 } = input;
if (donationAmount !== null && ![0, 5, 10, 25, 50, 75, 100].includes(donationAmount)) {
if (donationAmount !== null && ![0, 5, 10, 25, 50, 75, 100, 200].includes(donationAmount)) {
return {
ok: false,
applicationId: null,
Expand Down
2 changes: 1 addition & 1 deletion lib/applications/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ export const applicantFacingRenewalMutationSchema = applicantFacingRenewalPerson
*/
export const applicantFacingRenewalDonationSchema = object({
donationAmount: mixed<number>()
.oneOf([0, 5, 10, 25, 50, 75, 100])
.oneOf([0, 5, 10, 25, 50, 75, 100, 200])
.required('Please select a donation amount')
.transform((_value, originalValue) => {
return Number(originalValue);
Expand Down
1 change: 1 addition & 0 deletions lib/graphql/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ export default gql`
enum ReasonForReplacement {
LOST
STOLEN
MAIL_LOST
OTHER
}
Expand Down
5 changes: 4 additions & 1 deletion lib/graphql/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,9 @@ export type ApplicationsReportColumn =
| 'SECOND_PAYMENT_METHOD'
| 'SECOND_FEE_AMOUNT'
| 'SECOND_DONATION_AMOUNT'
| 'TOTAL_AMOUNT';
| 'TOTAL_AMOUNT'
| 'INVOICE_RECEIPT_NUMBER'
| 'TAX_RECEIPT_NUMBER';

export type ApplicationsResult = {
__typename?: 'ApplicationsResult';
Expand Down Expand Up @@ -1073,6 +1075,7 @@ export type QueryComparePhysiciansArgs = {
export type ReasonForReplacement =
| 'LOST'
| 'STOLEN'
| 'MAIL_LOST'
| 'OTHER';

export type RejectApplicationInput = {
Expand Down
4 changes: 2 additions & 2 deletions lib/invoices/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ const applicationPdfDefinition = (input: {
{
text: [
'Tel: 604-232-2404, Fax: 604-232-2415 Web: www.rcdrichmond.org\n',
'#842 - 5300, No.3 RD Lansdowne Centre Richmond BC V6X 2X9',
'#968 - 5300, No.3 RD Lansdowne Centre Richmond BC V6X 2X9',
],
alignment: 'center',
margin: [0, 15, 0, 0],
Expand Down Expand Up @@ -563,7 +563,7 @@ const donationPdfDefinition = (input: {
'Sincerely,\n\n\n',
'RICHMOND CENTRE FOR DISABILITY\n',
'(Charity Number: 88832-8432-RR0001)\n',
'#842 - 5300 No. 3 Road\n',
'#968 - 5300 No. 3 Road\n',
'Richmond, BC V6x 2X9\n',
'Tel: 604-232-2404\n',
'Website:www.rcdrichmond.org\n',
Expand Down
19 changes: 17 additions & 2 deletions lib/reports/resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,12 @@ export const generateApplicationsReport: Resolver<
dateOfBirth: true,
},
},
applicationProcessing: {
select: {
appNumber: true,
invoiceNumber: true,
},
},
newApplication: {
select: {
dateOfBirth: true,
Expand All @@ -263,6 +269,7 @@ export const generateApplicationsReport: Resolver<
secondProcessingFee,
secondDonationAmount,
applicant,
applicationProcessing: { appNumber, invoiceNumber } = {},
newApplication,
permit,
...application
Expand All @@ -283,9 +290,10 @@ export const generateApplicationsReport: Resolver<
return {
...application,
id: applicant?.id,
applicantName: formatFullName(firstName, middleName, lastName),
dateOfBirth: dateOfBirth && formatDateYYYYMMDD(dateOfBirth),
rcdPermitId: permit?.rcdPermitId ? `#${permit.rcdPermitId}` : null,
applicationDate: createdAt ? formatDateYYYYMMDDLocal(createdAt, true) : null,
applicantName: formatFullName(firstName, middleName, lastName),
processingFee: `$${processingFee}`,
donationAmount: `$${donationAmount}`,
secondProcessingFee: `$${secondProcessingFee || 0}`,
Expand All @@ -294,7 +302,14 @@ export const generateApplicationsReport: Resolver<
Prisma.Decimal.add(processingFee, donationAmount),
Prisma.Decimal.add(secondProcessingFee || 0, secondDonationAmount || 0)
)}`,
rcdPermitId: permit?.rcdPermitId ? `#${permit.rcdPermitId}` : null,
invoiceReceiptNumber:
createdAt && invoiceNumber
? `${formatDateYYYYMMDD(createdAt).replace(/-/g, '')}-${invoiceNumber}`
: null,
taxReceiptNumber:
createdAt && appNumber
? `PPD_${formatDateYYYYMMDD(createdAt).replace(/-/g, '')}_${appNumber}`
: null,
};
}
);
Expand Down
2 changes: 2 additions & 0 deletions lib/reports/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export default gql`
SECOND_FEE_AMOUNT
SECOND_DONATION_AMOUNT
TOTAL_AMOUNT
INVOICE_RECEIPT_NUMBER
TAX_RECEIPT_NUMBER
}
# Generate permit holders report
Expand Down
4 changes: 2 additions & 2 deletions lib/shopify/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Client from 'shopify-buy';
* Possible donation amounts in dollars,
* configured in env variable (SHOPIFY_DONATION_PRODUCT_IDS)
*/
export type DonationAmount = 0 | 5 | 10 | 25 | 50 | 75 | 100;
export type DonationAmount = 0 | 5 | 10 | 25 | 50 | 75 | 100 | 200;

/**
* ShopifyCheckout class
Expand Down Expand Up @@ -53,7 +53,7 @@ export class ShopifyCheckout {
/**
* Set up Shopify checkout and get the checkout URL
* @param applicationId Application ID to be paid for
* @param donationAmount Donation amount in dollars (5, 10, 25, 50, 75, 100), default 0
* @param donationAmount Donation amount in dollars (5, 10, 25, 50, 75, 100, 200), default 0
* @returns Shopify checkout URL
*/
async setUpCheckout(applicationId: number, donationAmount: DonationAmount = 0): Promise<string> {
Expand Down
5 changes: 5 additions & 0 deletions prisma/dev-seed-utils/employees.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ const employees = [
lastName: 'Wang',
email: '[email protected]',
},
{
firstName: 'Sharujan',
lastName: 'Sreekaran',
email: '[email protected]',
},
];

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterEnum
ALTER TYPE "reasonforreplacement" ADD VALUE 'MAIL_LOST';
31 changes: 16 additions & 15 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -349,15 +349,15 @@ enum ApplicantStatus {
ACTIVE
INACTIVE
@@map("applicantstatus")
@@map("applicantstatus")
}

enum Gender {
MALE
FEMALE
OTHER
@@map("gender")
@@map("gender")
}

enum PaymentType {
Expand All @@ -370,14 +370,14 @@ enum PaymentType {
DEBIT
SHOPIFY
@@map("paymenttype")
@@map("paymenttype")
}

enum PhysicianStatus {
ACTIVE
INACTIVE
@@map("physicianstatus")
@@map("physicianstatus")
}

enum Province {
Expand All @@ -395,15 +395,15 @@ enum Province {
NT
YT
@@map("province")
@@map("province")
}

enum Role {
ADMIN
ACCOUNTING
SECRETARY
@@map("role")
@@map("role")
}

enum ApplicationStatus {
Expand All @@ -412,37 +412,38 @@ enum ApplicationStatus {
REJECTED
COMPLETED
@@map("applicationstatus")
@@map("applicationstatus")
}

enum ReasonForReplacement {
LOST
STOLEN
OTHER
MAIL_LOST
@@map("reasonforreplacement")
@@map("reasonforreplacement")
}

enum PermitType {
PERMANENT
TEMPORARY
@@map("permittype")
@@map("permittype")
}

enum AccessibleConvertedVanLoadingMethod {
SIDE_LOADING
END_LOADING
@@map("accessibleconvertedvanloadingmethod")
@@map("accessibleconvertedvanloadingmethod")
}

enum ApplicationType {
NEW
RENEWAL
REPLACEMENT
@@map("applicationtype")
@@map("applicationtype")
}

enum MobilityAid {
Expand All @@ -454,7 +455,7 @@ enum MobilityAid {
CRUTCHES
OTHERS
@@map("mobilityaid")
@@map("mobilityaid")
}

enum PatientCondition {
Expand All @@ -463,20 +464,20 @@ enum PatientCondition {
CANNOT_WALK_100M
OTHER
@@map("patientcondition")
@@map("patientcondition")
}

enum RequiresWiderParkingSpaceReason {
HAS_ACCESSIBLE_VAN
MEDICAL_REASONS
OTHER
@@map("requireswiderparkingspacereason")
@@map("requireswiderparkingspacereason")
}

enum ShopifyPaymentStatus {
PENDING
RECEIVED
@@map("shopifypaymentstatus")
@@map("shopifypaymentstatus")
}
Loading

0 comments on commit 53d690c

Please sign in to comment.