Files
acmcc/supabase/migrations/20260507164105_c0fb6a02-1da2-4097-972b-343933933cec.sql
2026-06-01 20:19:26 -04:00

21 lines
773 B
SQL

CREATE OR REPLACE FUNCTION public.get_association_payment_gateways(p_association_id uuid)
RETURNS jsonb
LANGUAGE sql
STABLE SECURITY DEFINER
SET search_path TO 'public'
AS $function$
SELECT jsonb_build_object(
'stripe', (
SELECT jsonb_build_object(
'id', id, 'association_id', association_id,
'stripe_account_id', stripe_account_id,
'stripe_public_key', stripe_public_key,
'is_active', is_active, 'label', label,
'pass_processing_fee', pass_processing_fee,
'processing_fee_percent', processing_fee_percent,
'processing_fee_fixed_cents', processing_fee_fixed_cents
) FROM public.stripe_account_mappings
WHERE association_id = p_association_id AND is_active = true LIMIT 1
)
);
$function$;