Skip to content

Commit

Permalink
bg always opt out
Browse files Browse the repository at this point in the history
  • Loading branch information
ap-justin committed Sep 13, 2024
1 parent 1093696 commit f0c08b1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/constants/common.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EMAIL_SUPPORT } from "./env";
import { EMAIL_SUPPORT, IS_TEST } from "./env";

export const GENERIC_ERROR_MESSAGE = `An unexpected error occurred and has been reported. Please get in touch with ${EMAIL_SUPPORT} if the problem persists.`;

Expand All @@ -11,5 +11,6 @@ export const PROCESSING_RATES = {
};

export const DONATION_INCREMENTS = [40, 100, 200];
export const BG_ID = IS_TEST ? 8 : 1;

export const logoUrl = (path: string) => `https://nowpayments.io${path}`;
9 changes: 9 additions & 0 deletions src/pages/Admin/Charity/Settings/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { yupResolver } from "@hookform/resolvers/yup";
import { DonateMethods, fill } from "components/DonateMethods";
import { LockedSplitSlider } from "components/donation";
import { CheckField, Field, RhfForm } from "components/form";
import { BG_ID } from "constants/common";
import { useErrorContext } from "contexts/ErrorContext";
import { useController, useForm } from "react-hook-form";
import { schema, stringNumber } from "schemas/shape";
import type { Endowment, EndowmentSettingsAttributes } from "types/aws";
Expand All @@ -19,6 +21,7 @@ const PAYOUT_MIN_USD = 50;

export default function Form(props: Props) {
const updateEndow = useUpdateEndowment();
const { displayError } = useErrorContext();

const methods = useForm({
resolver: yupResolver(
Expand Down Expand Up @@ -82,6 +85,12 @@ export default function Form(props: Props) {
donateMethods,
...fv
}) => {
if (props.id === BG_ID && fv.hide_bg_tip === false) {
return displayError(
"BG donation flow should not show BG tip screen"
);
}

await updateEndow({
...fv,
progDonationsAllowed: !programDonateDisabled,
Expand Down

0 comments on commit f0c08b1

Please sign in to comment.