Repository: dj-stripe/dj-stripe

Issue:
DJStripeSubscriptionPermission issue returning bool
This permission is not returning properly the bool.

**Current behaviour**

```python
class DJStripeSubscriptionPermission(BasePermission):
    """
    A permission to be used when wanting to permit users with active subscriptions.
    """

    def has_permission(self, request, view):
        """
        Check if the subscriber has an active subscription.

        Returns false if:
            * a subscriber isn't passed through the request

        See ``utils.subscriber_has_active_subscription`` for more rules.

        """
        try:
            subscriber_has_active_subscription(subscriber_request_callback(request))
        except AttributeError:
            return False
```

Here is not returning True or False except if it falls in the exception.


**Expected Behaviour**


```python
class DJStripeSubscriptionPermission(BasePermission):
    """
    A permission to be used when wanting to permit users with active subscriptions.
    """

    def has_permission(self, request, view):
        """
        Check if the subscriber has an active subscription.

        Returns false if:
            * a subscriber isn't passed through the request

        See ``utils.subscriber_has_active_subscription`` for more rules.

        """
        try:
            return bool(subscriber_has_active_subscription(subscriber_request_callback(request)))
        except AttributeError:
            return False
```

Just missing a return and it solves the problem. We don't need a bool directly there, I just added just to follow the same patterns as the DRF (also being added to the other project :-))


Discussion:
@tiagoarasilva good catch. Can you submit a quick PR with just adding the return?

Resolving patch:
diff --git a/djstripe/contrib/rest_framework/permissions.py b/djstripe/contrib/rest_framework/permissions.py
--- a/djstripe/contrib/rest_framework/permissions.py
+++ b/djstripe/contrib/rest_framework/permissions.py
@@ -17,7 +17,7 @@ class DJStripeSubscriptionPermission(BasePermission):
     A permission to be used when wanting to permit users with active subscriptions.
     """
 
-    def has_permission(self, request, view):
+    def has_permission(self, request, view) -> bool:
         """
         Check if the subscriber has an active subscription.
 
@@ -28,6 +28,8 @@ def has_permission(self, request, view):
 
         """
         try:
-            subscriber_has_active_subscription(subscriber_request_callback(request))
+            return subscriber_has_active_subscription(
+                subscriber_request_callback(request)
+            )
         except AttributeError:
             return False
diff --git a/djstripe/contrib/rest_framework/serializers.py b/djstripe/contrib/rest_framework/serializers.py
--- a/djstripe/contrib/rest_framework/serializers.py
+++ b/djstripe/contrib/rest_framework/serializers.py
@@ -28,7 +28,9 @@ class CreateSubscriptionSerializer(serializers.Serializer):
 
     stripe_token = serializers.CharField(max_length=200)
     plan = serializers.CharField(max_length=50)
-    charge_immediately = serializers.BooleanField(required=False, allow_null=True, default=None)
+    charge_immediately = serializers.BooleanField(
+        required=False, allow_null=True, default=None
+    )
     tax_percent = serializers.DecimalField(
         required=False, max_digits=5, decimal_places=2
     )


Test patch: