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

Add $200 donation option #355

Merged
merged 4 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Loading