mirror of
https://github.com/i701/sarlink-portal-api.git
synced 2025-06-28 09:50:05 +00:00
Refactor VerifyPaymentView to include checks for payment status and user authorization. Update logging level in settings.py to suppress certain logs during testing. Add comprehensive tests for device management in DeviceAPITestCase.
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 2m23s
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 2m23s
This commit is contained in:
@ -108,6 +108,13 @@ class VerifyPaymentView(StaffEditorPermissionMixin, generics.UpdateAPIView):
|
||||
payment = self.get_object()
|
||||
data = request.data
|
||||
user = request.user
|
||||
print("logged in user", user)
|
||||
print("Payment user", payment.user)
|
||||
if payment.paid:
|
||||
return Response(
|
||||
{"message": "Payment has already been verified."},
|
||||
status=status.HTTP_400_BAD_REQUEST,
|
||||
)
|
||||
if payment.user != user and not user.is_superuser:
|
||||
return Response(
|
||||
{"message": "You are not authorized to verify this payment."},
|
||||
@ -156,7 +163,7 @@ class VerifyPaymentView(StaffEditorPermissionMixin, generics.UpdateAPIView):
|
||||
)
|
||||
else:
|
||||
return Response(
|
||||
{"message": "Payment verification FAILED using [{method}]."}
|
||||
{"message": f"Payment verification FAILED using [{method}]."}
|
||||
)
|
||||
|
||||
def process_wallet_payment(self, user, payment):
|
||||
|
Reference in New Issue
Block a user