master - part 2

This commit is contained in:
IGNY8 VPS (Salman)
2025-12-30 09:47:58 +00:00
parent 2af7bb725f
commit 885158e152
13 changed files with 538 additions and 63 deletions

View File

@@ -197,17 +197,18 @@ class BillingViewSet(viewsets.GenericViewSet):
Does not expose sensitive configuration details.
Query params:
country: ISO 2-letter country code (default: 'US')
country: ISO 2-letter country code (optional, defaults to global '*')
Returns payment methods filtered by country.
Returns payment methods - prioritizes global methods (country_code='*').
"""
country = request.GET.get('country', 'US').upper()
country = request.GET.get('country', '*').upper()
# Get country-specific methods
# Get global methods first (country_code='*'), then country-specific as fallback
methods = PaymentMethodConfig.objects.filter(
country_code=country,
is_enabled=True
).order_by('sort_order')
).filter(
Q(country_code='*') | Q(country_code=country)
).order_by('sort_order').distinct()
# Serialize using the proper serializer
serializer = PaymentMethodConfigSerializer(methods, many=True)