crpt
This commit is contained in:
		@@ -32,6 +32,20 @@ def create_assembly():
 | 
				
			|||||||
                'userName': existing_assembly.user.login
 | 
					                'userName': existing_assembly.user.login
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            return jsonify(response)
 | 
					            return jsonify(response)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        need_crpt_for_order_response = sipro.api.orders.need_crpt_by_order_id(order_id)
 | 
				
			||||||
 | 
					        need_crpt_value = need_crpt_for_order_response.get('needCrpt')
 | 
				
			||||||
 | 
					        if need_crpt_value:
 | 
				
			||||||
 | 
					            valid_app = request.headers.get('CrptAvailable')
 | 
				
			||||||
 | 
					            if not valid_app:
 | 
				
			||||||
 | 
					                response = {
 | 
				
			||||||
 | 
					                    'ok': False,
 | 
				
			||||||
 | 
					                    'message': 'Для сборки этого заказа необходимо приложение с поддержкой Честного Знака',
 | 
				
			||||||
 | 
					                    'assemblyId': -1,
 | 
				
			||||||
 | 
					                    'statusCode': 'USER_ALREADY_HAS_ACTIVE_ASSEMBLY',
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                return jsonify(response)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        active_assembly = database.Assembly.query.filter(database.Assembly.user_id == user_id,
 | 
					        active_assembly = database.Assembly.query.filter(database.Assembly.user_id == user_id,
 | 
				
			||||||
                                                         database.Assembly.is_active == True).first()
 | 
					                                                         database.Assembly.is_active == True).first()
 | 
				
			||||||
        if active_assembly:
 | 
					        if active_assembly:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -53,3 +53,9 @@ def attach_crpt(order_product_id, crpt):
 | 
				
			|||||||
    data = {'orderProductId': order_product_id, 'crpt': crpt}
 | 
					    data = {'orderProductId': order_product_id, 'crpt': crpt}
 | 
				
			||||||
    response = client.method('POST', method, data=data)
 | 
					    response = client.method('POST', method, data=data)
 | 
				
			||||||
    return response
 | 
					    return response
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def need_crpt_by_order_id(order_id):
 | 
				
			||||||
 | 
					    method = f'{router}/needCrptByOrder?orderId={order_id}'
 | 
				
			||||||
 | 
					    response = client.method('GET', method)
 | 
				
			||||||
 | 
					    return response
 | 
				
			||||||
		Reference in New Issue
	
	Block a user