Skip to content

Commit

Permalink
Add $200 donation option (#355)
Browse files Browse the repository at this point in the history
* Add $200 donation option

* Add $200 donation option

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

---------

Co-authored-by: Chinemerem <[email protected]>
  • Loading branch information
sherryhli and ChinemeremChigbo authored Jun 21, 2024
1 parent cb36e24 commit 141e654
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 6 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
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
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
2 changes: 1 addition & 1 deletion tools/applicant/renewal-form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit 141e654

Please sign in to comment.