Skip to content
Snippets Groups Projects
Commit b8817892 authored by Tom Teichler's avatar Tom Teichler :beers:
Browse files

Fix predicate and add missing import

parent a394002e
No related branches found
No related tags found
2 merge requests!9Resolve "Add payment processing UI",!3Implement payment backends and interaction
This commit is part of merge request !3. Comments created here will be created in the context of that merge request.
...@@ -4,6 +4,8 @@ from rules import predicate ...@@ -4,6 +4,8 @@ from rules import predicate
from .models.invoice import Invoice from .models.invoice import Invoice
User = get_user_model()
@predicate @predicate
def is_own_invoice(user: User, obj: Invoice): def is_own_invoice(user: User, obj: Invoice):
"""Predicate which checks if the invoice is linked to the current user.""" """Predicate which checks if the invoice is linked to the current user."""
...@@ -14,10 +16,10 @@ def has_no_payment_variant(user: User, obj: Invoice): ...@@ -14,10 +16,10 @@ def has_no_payment_variant(user: User, obj: Invoice):
"""Predicate which checks that the invoice has no payment variant.""" """Predicate which checks that the invoice has no payment variant."""
return not obj.variant return not obj.variant
@predicate
def is_in_payment_status(status: str): def is_in_payment_status(status: str):
"""Predicate which checks whether the invoice is in a specific state.""" """Predicate which checks whether the invoice is in a specific state."""
@predicate
def _predicate(user: User, obj: Invoice): def _predicate(user: User, obj: Invoice):
return obj.status == status return obj.status == status
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment