device login import mai8n company data
This commit is contained in:
@@ -3,6 +3,7 @@ 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
|
||||
@@ -52,6 +53,9 @@ class POSDeviceViewSet(viewsets.ModelViewSet, POSDeviceMixin):
|
||||
mac = headers_data['device-mac']
|
||||
psp_name = headers_data['device-provider']
|
||||
|
||||
# MNPC Company object information # noqa
|
||||
main_company = Organization.objects.get(national_unique_id='1111111111')
|
||||
|
||||
# provider organization
|
||||
organization = pos_models.Organization.objects.get(en_name=psp_name)
|
||||
|
||||
@@ -99,6 +103,7 @@ class POSDeviceViewSet(viewsets.ModelViewSet, POSDeviceMixin):
|
||||
'en_name': device_owner_org.en_name,
|
||||
'phone': device_owner_org.phone,
|
||||
'type': device_owner_org.type.name,
|
||||
'shaba': device_owner_org.bank_information.all().first().sheba # noqa
|
||||
}
|
||||
|
||||
return Response({
|
||||
@@ -109,7 +114,13 @@ class POSDeviceViewSet(viewsets.ModelViewSet, POSDeviceMixin):
|
||||
"provider": organization.name,
|
||||
"provider_tell": organization.phone,
|
||||
"device_owner": org_data,
|
||||
"device_owner_users": get_users_of_organization(device_owner_org)
|
||||
"device_owner_users": get_users_of_organization(device_owner_org),
|
||||
"main_company": {
|
||||
"name": main_company.name,
|
||||
"phone": main_company.phone,
|
||||
"shaba": main_company.bank_information.all().first().sheba, # noqa
|
||||
"amount": 400
|
||||
}
|
||||
}, status=status.HTTP_200_OK)
|
||||
|
||||
return Response({
|
||||
|
||||
Reference in New Issue
Block a user