Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,8 @@ const usePaymentMethods = () => {
() =>
methods
.filter((method) => {
// There is a bug where instead of being a proper array of disabled methods,
// it comes as an array of length 1 with a comma-separated string inside
if (
nonprofit?.metadata?.disabledPaymentFlowOptions?.length === 1 &&
nonprofit?.metadata?.disabledPaymentFlowOptions[0]?.includes(method)
nonprofit?.metadata?.disabledPaymentFlowOptions?.includes(method)
Copy link

Copilot AI Oct 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replacing the previous substring check removes support for the malformed API case where disabledPaymentFlowOptions could be ["card,paypal"]. With the new logic, methods like "card" or "paypal" inside a single comma-separated element will no longer be filtered out. If that response shape can still occur, retain a fallback by splitting a single comma-containing element: const disabled = nonprofit?.metadata?.disabledPaymentFlowOptions; if (disabled?.length === 1 && disabled[0]?.includes(',')) { const parts = disabled[0].split(',').map(p => p.trim()); if (parts.includes(method)) return false; } else if (disabled?.includes(method)) return false;

Copilot uses AI. Check for mistakes.
) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ export interface Nonprofit {
nteeCode: string | null;
metadata?: {
customTaxDeductible?: string;
// Note that multiple payment methods can be disabled, but for some reason it arrives
// as an array of length 1 eg ["card,paypal"] from the API, so we type it as such here
disabledPaymentFlowOptions?: string[];
disablePrivateNotes?: boolean;
granteeName?: string;
Expand Down