master - part 2
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user