9 Commits

Author SHA1 Message Date
xoliqberdiyev
f71dfa50c1 remote: tex_passport_file field removed from quick evaluation serializers 2026-04-21 15:21:14 +05:00
ab68a6a463 Merge pull request 'feat: add Tech Passport API integration for vehicle information retrieval' (#76) from tech-passport into main
All checks were successful
Deploy to Production / build-and-deploy (push) Successful in 2m0s
Reviewed-on: #76
Reviewed-by: xoliqberdiyev <behruz@felixits.uz>
2026-04-21 10:19:01 +00:00
github-actions[bot]
d246406384 🔄 Update image to 96 [CI SKIP] 2026-04-21 10:15:49 +00:00
0a74f71efa Merge pull request 'fix: change the evaluation-request when creating auto evaluation to this evaluation-request' (#77) from behruz into main
All checks were successful
Deploy to Production / build-and-deploy (push) Successful in 2m2s
Reviewed-on: #77
2026-04-21 10:14:13 +00:00
komoliddin
406477fc33 feat: add Tech Passport API integration for vehicle information retrieval 2026-04-21 15:11:46 +05:00
github-actions[bot]
2aa73e15a0 🔄 Update image to 95 [CI SKIP] 2026-04-21 09:52:02 +00:00
372a289447 Merge pull request 'change region models name field from unique to typical' (#75) from behruz into main
All checks were successful
Deploy to Production / build-and-deploy (push) Successful in 1m58s
Reviewed-on: #75
2026-04-21 09:50:28 +00:00
github-actions[bot]
5c4d5fbb71 🔄 Update image to 94 [CI SKIP] 2026-04-21 09:47:17 +00:00
20043db5b3 Merge pull request 'change ws response' (#74) from behruz into main
All checks were successful
Deploy to Production / build-and-deploy (push) Successful in 2m1s
Reviewed-on: #74
2026-04-21 09:45:41 +00:00
11 changed files with 134 additions and 7 deletions

View File

@@ -13,7 +13,7 @@ from config.env import env
def home(request):
return HttpResponse("OK: #8a1a66a05dfdf0a268b2db2da73cc5046266f4c1")
return HttpResponse("OK: #0a74f71efa31f99a832fd38261b2d8f125ad1213")
urlpatterns = [

View File

@@ -11,3 +11,4 @@ from .report import * # noqa
from .request import * # noqa
from .valuation import * # noqa
from .vehicle import * # noqa
from .tech_passport import * # noqa

View File

@@ -53,7 +53,6 @@ class RetrieveQuickevaluationSerializer(BaseQuickevaluationSerializer):
"tex_passport_serie_num",
"tech_passport_issued_date",
"tech_passport_issued_place",
"tex_passport_file",
"car_position",
"car_position_name",
"distance_covered",
@@ -76,7 +75,6 @@ class CreateQuickevaluationSerializer(serializers.ModelSerializer):
"tex_passport_serie_num",
"tech_passport_issued_date",
"tech_passport_issued_place",
"tex_passport_file",
"car_type",
"brand",
"marka",

View File

@@ -0,0 +1 @@
from .tech_passport import * # noqa

View File

@@ -0,0 +1,6 @@
from rest_framework import serializers
class TechPassportSerializer(serializers.Serializer):
autonumber = serializers.CharField(required=True, max_length=20)
tech_pass_number = serializers.CharField(required=True, max_length=20)
tech_pass_series = serializers.CharField(required=True, max_length=20)

View File

@@ -27,7 +27,7 @@ from .views import (
AutoEvaluationSetAppraisersView,
AutoEvaluationRemoveAppraisersView,
DidoxCompanyInfoAPIView,
TechPassportAPIView,
)
router = DefaultRouter()
@@ -66,4 +66,9 @@ urlpatterns = [
DidoxCompanyInfoAPIView.as_view(),
name="didox-info"
),
path(
"tech-passport/",
TechPassportAPIView.as_view(),
name="tech-passport"
),
]

View File

@@ -12,3 +12,4 @@ from .request import * # noqa
from .valuation import * # noqa
from .vehicle import * # noqa
from .didox import * # noqa
from .tech_passport import * # noqa

View File

@@ -0,0 +1,50 @@
from rest_framework.response import Response
from rest_framework import status
from rest_framework.permissions import AllowAny
from rest_framework.generics import GenericAPIView
from drf_spectacular.utils import (
extend_schema,
OpenApiExample,
)
from core.services.tech_passport import TechPassportService
from ..serializers import TechPassportSerializer
class TechPassportAPIView(GenericAPIView):
authentication_classes = []
permission_classes = [AllowAny]
@extend_schema(
tags=["Tech Passport"],
summary="Get vehicle information by technical passport",
description=(
"This endpoint retrieves vehicle information using "
"autonumber, technical passport number, and technical passport series "
"via Gross Insurance API integration."
),
request=TechPassportSerializer,
responses={
200: dict,
400: dict,
},
)
def post(self, request, *args, **kwargs):
serializer = TechPassportSerializer(data=request.data)
serializer.is_valid(raise_exception=True)
data = serializer.validated_data
try:
result = TechPassportService.get_auto_info(
autonumber=data["autonumber"],
tech_pass_number=data["tech_pass_number"],
tech_pass_series=data["tech_pass_series"],
)
return Response(result, status=status.HTTP_200_OK)
except Exception as e:
return Response(
{"detail": str(e)},
status=status.HTTP_400_BAD_REQUEST
)

View File

@@ -2,3 +2,4 @@ from .otp import * # noqa
from .sms import * # noqa
from .user import * # noqa
from .didox import * # noqa
from .tech_passport import * # noqa

View File

@@ -0,0 +1,64 @@
import requests
import logging
logger = logging.getLogger(__name__)
class TechPassportService:
BASE_URL = "https://api-test.gross.uz/api/v1/osago/check-tech-data"
@classmethod
def get_auto_info(
cls,
autonumber: str,
tech_pass_number: str,
tech_pass_series: str
):
payload = {
"tech_data": {
"autonumber": autonumber,
"tech_pass_number": tech_pass_number,
"tech_pass_series": tech_pass_series,
},
"payload": {
"promo": "",
"autotype": 1,
"citizen": 1,
"number": 1,
"period": 1,
"region": 1,
"coeff": 1
}
}
headers = {
"Content-Type": "application/json"
}
try:
response = requests.post(
cls.BASE_URL,
json=payload,
headers=headers,
timeout=30,
verify=False
)
response.raise_for_status()
logger.info(
f"Tech passport info fetched successfully: {response.status_code}"
)
response_data = response.json()
return response_data.get("data", {})
except requests.exceptions.RequestException as e:
logger.error(
f"Error while fetching tech passport info: {str(e)}"
)
return {
"success": False,
"message": str(e)
}

View File

@@ -84,7 +84,7 @@ services:
max-file: "5"
web:
image: husanjon/sifatbaho:93
image: husanjon/sifatbaho:96
env_file:
- .env
environment:
@@ -129,7 +129,7 @@ services:
max-file: "5"
celery:
image: husanjon/sifatbaho:93
image: husanjon/sifatbaho:96
env_file:
- .env
environment: