def createOrder(self, request, context):
     products = {}
     for product in request.products:
         products[product.name] = product.stock
     id_, message = helpers.create_order(request.destination, request.date, products, request.is_paid, request.is_shipped)
     if id_ == -1:
         context.set_details(message)
         context.set_code(grpc.StatusCode.NOT_FOUND)
         return InventorySystem_pb2.OrderID()
     elif id_ == -2:
         context.set_details(message)
         context.set_code(grpc.StatusCode.PERMISSION_DENIED)
         return InventorySystem_pb2.OrderID()
     return InventorySystem_pb2.OrderID(value=id_)
 def get_order(self, stub, order_id):
     try:
         response = stub.getOrder(
             InventorySystem_pb2.OrderID(value=order_id))
     except grpc.RpcError as e:
         print(e.details())
     else:
         print(response, end="\n\n")