Files
django-vue3-admin/backend/plugins/eip_sync/sync/views.py
T

46 lines
1.4 KiB
Python

from rest_framework.permissions import IsAuthenticated
from rest_framework.permissions import AllowAny
from rest_framework.response import Response
from rest_framework.views import APIView
from dvadmin_ak_sk.libs.authentication import AkSkAuthentication
from sync.manager import SyncManager
class PricingAuditResultSyncView(APIView):
"""
EIP -> PIS:核价申请单审核完成后抛转审核结果。
POST ``/api/pricing/applications/result``
"""
authentication_classes = []
permission_classes = [AllowAny]
def post(self, request, *args, **kwargs):
manager = SyncManager()
result = manager.process_pricing_audit_webhook(request.data)
status_code = 200 if result.get("Status") is True else 400
return Response(result, status=status_code)
class MiscMaterialSyncView(APIView):
"""
EIP -> PIS: miscellaneous procurement material master (杂采料号).
Authenticated via dvadmin-ak-sk (X-NSF-* signature headers).
POST ``/api/sync/material/misc``
"""
# authentication_classes = [AkSkAuthentication]
# permission_classes = [IsAuthenticated]
authentication_classes = []
permission_classes = [AllowAny]
def post(self, request, *args, **kwargs):
manager = SyncManager()
result = manager.process_eip_webhook("misc_material", request.data)
status_code = 200 if result.get("Status") == "success" else 400
return Response(result, status=status_code)