last fix form master imp part 6
This commit is contained in:
@@ -192,23 +192,19 @@ class BillingViewSet(viewsets.GenericViewSet):
|
||||
@action(detail=False, methods=['get'], url_path='payment-methods', permission_classes=[AllowAny])
|
||||
def list_payment_methods(self, request):
|
||||
"""
|
||||
Get available payment methods for a specific country.
|
||||
Get available payment methods (global only).
|
||||
Public endpoint - only returns enabled payment methods.
|
||||
Does not expose sensitive configuration details.
|
||||
|
||||
Query params:
|
||||
country: ISO 2-letter country code (optional, defaults to global '*')
|
||||
|
||||
Returns payment methods - prioritizes global methods (country_code='*').
|
||||
|
||||
Note: Country-specific filtering has been removed per Phase 1.1.2.
|
||||
The country_code field is retained for future use but currently ignored.
|
||||
All enabled payment methods are returned regardless of country_code value.
|
||||
"""
|
||||
country = request.GET.get('country', '*').upper()
|
||||
|
||||
# Get global methods first (country_code='*'), then country-specific as fallback
|
||||
# Return all enabled payment methods (global approach - no country filtering)
|
||||
# Country-specific filtering removed per Task 1.1.2 of Master Implementation Plan
|
||||
methods = PaymentMethodConfig.objects.filter(
|
||||
is_enabled=True
|
||||
).filter(
|
||||
Q(country_code='*') | Q(country_code=country)
|
||||
).order_by('sort_order').distinct()
|
||||
).order_by('sort_order')
|
||||
|
||||
# Serialize using the proper serializer
|
||||
serializer = PaymentMethodConfigSerializer(methods, many=True)
|
||||
|
||||
Reference in New Issue
Block a user