create bank account for organization
This commit is contained in:
@@ -321,6 +321,21 @@ class BankAccountViewSet(ModelViewSet):
|
||||
queryset = BankAccountInformation.objects.all()
|
||||
serializer_class = BankAccountSerializer
|
||||
|
||||
@transaction.atomic
|
||||
def create(self, request, *args, **kwargs):
|
||||
""" add bank account for each organization """
|
||||
|
||||
if 'organization' not in request.data.keys():
|
||||
organization = get_organization_by_user(request.user)
|
||||
request.data.update({'organization': organization.id})
|
||||
|
||||
serializer = self.serializer_class(data=request.data)
|
||||
if serializer.is_valid(raise_exception=True):
|
||||
serializer.save()
|
||||
|
||||
return Response(serializer.data, status=status.HTTP_201_CREATED)
|
||||
return Response(serializer.errors, status=status.HTTP_403_FORBIDDEN)
|
||||
|
||||
|
||||
class GeneralOTPViewSet(ModelViewSet):
|
||||
""" general OTP user authorization """
|
||||
|
||||
Reference in New Issue
Block a user