File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
packages/donate-button-v4/src/components/widget
components/PaymentProcess/PaymentMethodSelect Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import {
1212} from 'src/components/widget/components/PaymentProcess/PaymentMethodSelect/styles' ;
1313import { legendCss } from 'src/components/widget/components/PaymentProcess/styles' ;
1414import { useConfigContext } from 'src/components/widget/hooks/useConfigContext' ;
15+ import { useNonprofitOrError } from 'src/components/widget/hooks/useNonprofit' ;
1516import { useWidgetContext } from 'src/components/widget/hooks/useWidgetContext' ;
1617import { AppleIcon } from 'src/components/widget/icons/AppleIcon' ;
1718import { GoogleIcon } from 'src/components/widget/icons/GoogleIcon' ;
@@ -38,11 +39,18 @@ interface PaymentMethodListItemProps {
3839const usePaymentMethods = ( ) => {
3940 const { methods, frequency : fixedFrequency , previewMode} = useConfigContext ( ) ;
4041 const { paymentRequestAvailable} = useWidgetContext ( ) ;
42+ const nonprofit = useNonprofitOrError ( ) ;
4143
4244 const filteredMethods = useMemo (
4345 ( ) =>
4446 methods
4547 . filter ( ( method ) => {
48+ if (
49+ nonprofit ?. metadata ?. disabledPaymentFlowOptions ?. includes ( method )
50+ ) {
51+ return false ;
52+ }
53+
4654 if (
4755 fixedFrequency === DonationFrequency . Monthly &&
4856 OneTimeFrequencyMethods . includes ( method )
Original file line number Diff line number Diff line change @@ -18,6 +18,9 @@ export interface Nonprofit {
1818 nteeCode : string | null ;
1919 metadata ?: {
2020 customTaxDeductible ?: string ;
21+ // Note that multiple payment methods can be disabled, but it still arrives as a single
22+ // comma-separated string from the API eg "card,paypal" so we type it as such here
23+ disabledPaymentFlowOptions ?: string ;
2124 disablePrivateNotes ?: boolean ;
2225 granteeName ?: string ;
2326 prefixWithThe ?: boolean ;
You can’t perform that action at this time.
0 commit comments