add - new device fields (url & checksum) in device login
This commit is contained in:
@@ -1,18 +1,17 @@
|
|||||||
import traceback
|
|
||||||
|
|
||||||
from apps.pos_device.pos.api.v1.serializers.device import DeviceSerializer
|
|
||||||
from apps.authentication.services.service import get_users_of_organization
|
|
||||||
from apps.pos_device.mixins.pos_device_mixin import POSDeviceMixin
|
|
||||||
from apps.authentication.models import Organization
|
|
||||||
from apps.pos_device import models as pos_models
|
|
||||||
from rest_framework.permissions import AllowAny
|
|
||||||
from rest_framework.decorators import action
|
|
||||||
from rest_framework.response import Response
|
|
||||||
from django.http.response import JsonResponse
|
|
||||||
from common.generics import get_client_ip
|
|
||||||
from rest_framework import viewsets
|
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
|
from django.http.response import JsonResponse
|
||||||
from rest_framework import status
|
from rest_framework import status
|
||||||
|
from rest_framework import viewsets
|
||||||
|
from rest_framework.decorators import action
|
||||||
|
from rest_framework.permissions import AllowAny
|
||||||
|
from rest_framework.response import Response
|
||||||
|
|
||||||
|
from apps.authentication.models import Organization
|
||||||
|
from apps.authentication.services.service import get_users_of_organization
|
||||||
|
from apps.pos_device import models as pos_models
|
||||||
|
from apps.pos_device.mixins.pos_device_mixin import POSDeviceMixin
|
||||||
|
from apps.pos_device.pos.api.v1.serializers.device import DeviceSerializer
|
||||||
|
from common.generics import get_client_ip
|
||||||
|
|
||||||
|
|
||||||
def test_web_server(request):
|
def test_web_server(request):
|
||||||
@@ -59,6 +58,9 @@ class POSDeviceViewSet(viewsets.ModelViewSet, POSDeviceMixin):
|
|||||||
# provider organization
|
# provider organization
|
||||||
organization = pos_models.Organization.objects.get(en_name=psp_name)
|
organization = pos_models.Organization.objects.get(en_name=psp_name)
|
||||||
|
|
||||||
|
# device version
|
||||||
|
device_version = pos_models.DeviceVersion.objects.filter(organization=organization).order_by('-code')
|
||||||
|
|
||||||
device = self.device_queryset.filter(serial=serial).first()
|
device = self.device_queryset.filter(serial=serial).first()
|
||||||
|
|
||||||
if not device and 'device_identity' in request.data.keys() and request.data['device_identity'] != "":
|
if not device and 'device_identity' in request.data.keys() and request.data['device_identity'] != "":
|
||||||
@@ -120,7 +122,10 @@ class POSDeviceViewSet(viewsets.ModelViewSet, POSDeviceMixin):
|
|||||||
"phone": main_company.phone,
|
"phone": main_company.phone,
|
||||||
"shaba": main_company.bank_information.all().first().sheba, # noqa
|
"shaba": main_company.bank_information.all().first().sheba, # noqa
|
||||||
"amount": 400
|
"amount": 400
|
||||||
}
|
},
|
||||||
|
'latest_version_code': device_version.first().code if device_version.exists() else None,
|
||||||
|
'latest_version_link': device_version.first().url if device_version.exists() else None,
|
||||||
|
'latest_version_checksum': device_version.first().checksum if device_version.exists() else None,
|
||||||
}, status=status.HTTP_200_OK)
|
}, status=status.HTTP_200_OK)
|
||||||
|
|
||||||
return Response({
|
return Response({
|
||||||
|
|||||||
Reference in New Issue
Block a user