Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion backend/integrations/plain_cards.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@


def create_grant_card(request, user, conference):
grant = Grant.objects.of_user(user).for_conference(conference).first()
grant = (
Grant.objects.of_user(user).for_conference(conference).first()
if user
else None
)

if not grant:
return {"key": "grant", "components": []}
Expand Down
2 changes: 1 addition & 1 deletion backend/integrations/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def test_cannot_get_plain_customer_cards_when_user_doesnt_exist(rest_api_client)
)

assert response.status_code == 200
assert response.data == {"cards": []}
assert response.data == {"cards": [{"key": "grant", "components": []}]}


@override_settings(PLAIN_INTEGRATION_TOKEN="secret")
Expand Down
3 changes: 0 additions & 3 deletions backend/integrations/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ def plain_customer_cards(request):

user = User.objects.filter(email=customer_email).first()

if not user:
return Response({"cards": []})

cards = []
if "grant" in card_keys:
cards.append(create_grant_card(request, user, conference))
Expand Down
Loading