add acceptor & terminal device to assignment - add phone to organization - set password for device when assignment
This commit is contained in:
@@ -66,7 +66,7 @@ class POSDeviceViewSet(viewsets.ModelViewSet, POSDeviceMixin):
|
||||
device.is_activated = True
|
||||
device.save()
|
||||
|
||||
if device.is_activated and device.assigned_state:
|
||||
if device.is_activated and device.assigned_state:
|
||||
# when device is logged in, its has an organization owner client, if not it will show error
|
||||
device_owner_org = self.get_device_organization()
|
||||
|
||||
@@ -74,7 +74,7 @@ class POSDeviceViewSet(viewsets.ModelViewSet, POSDeviceMixin):
|
||||
if not session:
|
||||
session = pos_models.Sessions.objects.create(
|
||||
device=device,
|
||||
name = headers_data['device-name'],
|
||||
name=headers_data['device-name'],
|
||||
version=headers_data['device-version'],
|
||||
mac=headers_data['device-mac'],
|
||||
ip=get_client_ip(request),
|
||||
@@ -100,23 +100,23 @@ class POSDeviceViewSet(viewsets.ModelViewSet, POSDeviceMixin):
|
||||
}
|
||||
|
||||
return Response({
|
||||
"message": "خوش آمدید",
|
||||
"message": "خوش آمدید", # noqa
|
||||
"device_identity": device.device_identity,
|
||||
"serial": device.serial,
|
||||
"password": device.password,
|
||||
"provider": organization.name,
|
||||
"provider_tell": '0214021',
|
||||
"provider_tell": organization.phone,
|
||||
"device_owner": org_data,
|
||||
"device_owner_users": get_users_of_organization(device_owner_org)
|
||||
}, status=status.HTTP_200_OK)
|
||||
|
||||
return Response({
|
||||
"message": "دستگاه در سیستم ثبت در انتظار فعال سازی توسط پذیرنده می باشد",
|
||||
"message": "دستگاه در سیستم ثبت در انتظار فعال سازی توسط پذیرنده می باشد", # noqa
|
||||
"device_identity": device.device_identity,
|
||||
"password": "****",
|
||||
"serial": device.serial,
|
||||
"provider": organization.name,
|
||||
"provider_tell": '0214021',
|
||||
"provider_tell": organization.phone,
|
||||
}, status=status.HTTP_401_UNAUTHORIZED)
|
||||
|
||||
else:
|
||||
@@ -129,11 +129,11 @@ class POSDeviceViewSet(viewsets.ModelViewSet, POSDeviceMixin):
|
||||
)
|
||||
|
||||
return Response({
|
||||
"message": "دستگاه در سیستم ثبت در انتظار فعال سازی توسط پذیرنده می باشد",
|
||||
"message": "دستگاه در سیستم ثبت در انتظار فعال سازی توسط پذیرنده می باشد", # noqa
|
||||
"device_identity": pre_device.device_identity,
|
||||
"password": "****",
|
||||
"provider": organization.name,
|
||||
"provider_tell": '0214021',
|
||||
"provider_tell": organization.phone,
|
||||
}, status=status.HTTP_412_PRECONDITION_FAILED)
|
||||
|
||||
@action(
|
||||
|
||||
Reference in New Issue
Block a user