Add: is_test_request
This commit is contained in:
parent
d6bccec51d
commit
4500d7dc1f
@ -122,6 +122,9 @@ class CtelViewSet(viewsets.ViewSet):
|
|||||||
'redemption_ID': {
|
'redemption_ID': {
|
||||||
'type': 'string'
|
'type': 'string'
|
||||||
},
|
},
|
||||||
|
'is_test_request': {
|
||||||
|
'type': 'boolean',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
'required': {'imei_files'}
|
'required': {'imei_files'}
|
||||||
}
|
}
|
||||||
@ -144,7 +147,7 @@ class CtelViewSet(viewsets.ViewSet):
|
|||||||
"invoice": invoice_file_objs
|
"invoice": invoice_file_objs
|
||||||
}
|
}
|
||||||
total_page = len(files.keys())
|
total_page = len(files.keys())
|
||||||
|
is_test_request = validated_data.get("is_test_request", False)
|
||||||
rq_id = provider_code + "_" + datetime.now().strftime("%Y%m%d%H%M%S") + "_" + uuid.uuid4().hex
|
rq_id = provider_code + "_" + datetime.now().strftime("%Y%m%d%H%M%S") + "_" + uuid.uuid4().hex
|
||||||
p_type = validated_data['type']
|
p_type = validated_data['type']
|
||||||
new_request: SubscriptionRequest = SubscriptionRequest(pages=total_page,
|
new_request: SubscriptionRequest = SubscriptionRequest(pages=total_page,
|
||||||
@ -152,7 +155,8 @@ class CtelViewSet(viewsets.ViewSet):
|
|||||||
process_type=p_type, status=1, request_id=rq_id,
|
process_type=p_type, status=1, request_id=rq_id,
|
||||||
provider_code=provider_code,
|
provider_code=provider_code,
|
||||||
subscription=sub,
|
subscription=sub,
|
||||||
redemption_id=validated_data["redemption_ID"])
|
redemption_id=validated_data["redemption_ID"],
|
||||||
|
is_test_request=is_test_request)
|
||||||
new_request.save()
|
new_request.save()
|
||||||
count = 0
|
count = 0
|
||||||
compact_files = []
|
compact_files = []
|
||||||
@ -194,6 +198,9 @@ class CtelViewSet(viewsets.ViewSet):
|
|||||||
'redemption_ID': {
|
'redemption_ID': {
|
||||||
'type': 'string'
|
'type': 'string'
|
||||||
},
|
},
|
||||||
|
'is_test_request': {
|
||||||
|
'type': 'boolean',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
'required': {'imei_files'}
|
'required': {'imei_files'}
|
||||||
}
|
}
|
||||||
@ -216,7 +223,7 @@ class CtelViewSet(viewsets.ViewSet):
|
|||||||
"invoice": invoice_file_objs
|
"invoice": invoice_file_objs
|
||||||
}
|
}
|
||||||
rq_id = provider_code + "_" + datetime.now().strftime("%Y%m%d%H%M%S") + "_" + uuid.uuid4().hex
|
rq_id = provider_code + "_" + datetime.now().strftime("%Y%m%d%H%M%S") + "_" + uuid.uuid4().hex
|
||||||
|
is_test_request = validated_data.get("is_test_request", False)
|
||||||
count = 0
|
count = 0
|
||||||
doc_files_with_type = []
|
doc_files_with_type = []
|
||||||
for doc_type, doc_files in files.items():
|
for doc_type, doc_files in files.items():
|
||||||
@ -236,7 +243,9 @@ class CtelViewSet(viewsets.ViewSet):
|
|||||||
pages_left=total_page,
|
pages_left=total_page,
|
||||||
process_type=p_type, status=1, request_id=rq_id,
|
process_type=p_type, status=1, request_id=rq_id,
|
||||||
provider_code=provider_code,
|
provider_code=provider_code,
|
||||||
subscription=sub)
|
subscription=sub,
|
||||||
|
redemption_id=validated_data["redemption_ID"],
|
||||||
|
is_test_request=is_test_request)
|
||||||
new_request.save()
|
new_request.save()
|
||||||
|
|
||||||
# Run file processing in a pool of 2 threads. TODO: Convert to Celery worker when possible
|
# Run file processing in a pool of 2 threads. TODO: Convert to Celery worker when possible
|
||||||
|
Loading…
Reference in New Issue
Block a user