From 385c1b485e0cdeac52bd023587d6bff5960026a9 Mon Sep 17 00:00:00 2001 From: Sherry Li Date: Sun, 3 Mar 2024 18:21:31 -0800 Subject: [PATCH 1/3] Add $200 donation option --- components/applicant/renewals/RenewalForm/DonationSection.tsx | 1 + lib/applications/resolvers.ts | 2 +- lib/applications/validation.ts | 2 +- lib/shopify/utils.ts | 4 ++-- tools/applicant/renewal-form.ts | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/components/applicant/renewals/RenewalForm/DonationSection.tsx b/components/applicant/renewals/RenewalForm/DonationSection.tsx index aa5870cb..82672fa1 100644 --- a/components/applicant/renewals/RenewalForm/DonationSection.tsx +++ b/components/applicant/renewals/RenewalForm/DonationSection.tsx @@ -59,6 +59,7 @@ const DonationSection: FC = () => { $50 $75 $100 + $200 No Donation diff --git a/lib/applications/resolvers.ts b/lib/applications/resolvers.ts index 208efe50..ec781fe0 100644 --- a/lib/applications/resolvers.ts +++ b/lib/applications/resolvers.ts @@ -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, diff --git a/lib/applications/validation.ts b/lib/applications/validation.ts index 010928ca..772d56ba 100644 --- a/lib/applications/validation.ts +++ b/lib/applications/validation.ts @@ -538,7 +538,7 @@ export const applicantFacingRenewalMutationSchema = applicantFacingRenewalPerson */ export const applicantFacingRenewalDonationSchema = object({ donationAmount: mixed() - .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); diff --git a/lib/shopify/utils.ts b/lib/shopify/utils.ts index 98a29bf1..8cbcff14 100644 --- a/lib/shopify/utils.ts +++ b/lib/shopify/utils.ts @@ -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 @@ -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 { diff --git a/tools/applicant/renewal-form.ts b/tools/applicant/renewal-form.ts index 018c2e03..8d7a07fd 100644 --- a/tools/applicant/renewal-form.ts +++ b/tools/applicant/renewal-form.ts @@ -33,4 +33,4 @@ export enum Step { } /** Donation amount type */ -export type DonationAmount = 0 | 5 | 10 | 25 | 50 | 75 | 100; +export type DonationAmount = 0 | 5 | 10 | 25 | 50 | 75 | 100 | 200; From 9527cf9a58157bb2bf1ba57ba63845682c7580f5 Mon Sep 17 00:00:00 2001 From: Sherry Li Date: Sun, 3 Mar 2024 18:21:31 -0800 Subject: [PATCH 2/3] Add $200 donation option --- components/applicant/renewals/RenewalForm/DonationSection.tsx | 1 + lib/applications/resolvers.ts | 2 +- lib/applications/validation.ts | 2 +- lib/shopify/utils.ts | 4 ++-- tools/applicant/renewal-form.ts | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/components/applicant/renewals/RenewalForm/DonationSection.tsx b/components/applicant/renewals/RenewalForm/DonationSection.tsx index aa5870cb..82672fa1 100644 --- a/components/applicant/renewals/RenewalForm/DonationSection.tsx +++ b/components/applicant/renewals/RenewalForm/DonationSection.tsx @@ -59,6 +59,7 @@ const DonationSection: FC = () => { $50 $75 $100 + $200 No Donation diff --git a/lib/applications/resolvers.ts b/lib/applications/resolvers.ts index 208efe50..ec781fe0 100644 --- a/lib/applications/resolvers.ts +++ b/lib/applications/resolvers.ts @@ -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, diff --git a/lib/applications/validation.ts b/lib/applications/validation.ts index 010928ca..772d56ba 100644 --- a/lib/applications/validation.ts +++ b/lib/applications/validation.ts @@ -538,7 +538,7 @@ export const applicantFacingRenewalMutationSchema = applicantFacingRenewalPerson */ export const applicantFacingRenewalDonationSchema = object({ donationAmount: mixed() - .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); diff --git a/lib/shopify/utils.ts b/lib/shopify/utils.ts index 98a29bf1..8cbcff14 100644 --- a/lib/shopify/utils.ts +++ b/lib/shopify/utils.ts @@ -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 @@ -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 { diff --git a/tools/applicant/renewal-form.ts b/tools/applicant/renewal-form.ts index 018c2e03..8d7a07fd 100644 --- a/tools/applicant/renewal-form.ts +++ b/tools/applicant/renewal-form.ts @@ -33,4 +33,4 @@ export enum Step { } /** Donation amount type */ -export type DonationAmount = 0 | 5 | 10 | 25 | 50 | 75 | 100; +export type DonationAmount = 0 | 5 | 10 | 25 | 50 | 75 | 100 | 200; From 38042fc1d773f655d88a9f7e7f6ca7bd3d9283fc Mon Sep 17 00:00:00 2001 From: Sherry Li Date: Wed, 19 Jun 2024 21:32:23 -0700 Subject: [PATCH 3/3] Update .env.sample with $200 donation product id --- .env.sample | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.sample b/.env.sample index a4004c2d..383d8d29 100644 --- a/.env.sample +++ b/.env.sample @@ -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