Example #1
0
 def get(org_id):
     """GET a new product subscription to the org using the request body."""
     try:
         response, status = json.dumps(
             ProductService.get_all_product_subscription(
                 org_id)), http_status.HTTP_200_OK
     except BusinessException as exception:
         response, status = {
             'code': exception.code,
             'message': exception.message
         }, exception.status_code
     return response, status
Example #2
0
    def get(org_id):
        """GET a new product subscription to the org using the request body."""
        try:
            include_internal_products = request.args.get(
                'includeInternal', 'true').lower() == 'true'

            products = ProductService.get_all_product_subscription(
                org_id,
                include_internal_products=include_internal_products,
                token_info=g.jwt_oidc_token_info)
            if products is None:
                response, status = {'message': 'Not authorized to perform this action'}, \
                                   http_status.HTTP_401_UNAUTHORIZED
            else:
                response, status = json.dumps(
                    products), http_status.HTTP_200_OK
        except BusinessException as exception:
            response, status = {
                'code': exception.code,
                'message': exception.message
            }, exception.status_code
        return response, status