Skip to content
Snippets Groups Projects
Commit e68ef488 authored by magicfelix's avatar magicfelix
Browse files

Fix mail handling

parent a1b24842
No related branches found
Tags 1.12.1
1 merge request!78Resolve "Rewrite registration wizard"
...@@ -55,6 +55,17 @@ class SendEventRegistrationMutation(graphene.Mutation): ...@@ -55,6 +55,17 @@ class SendEventRegistrationMutation(graphene.Mutation):
print(event_registration) print(event_registration)
email = None
if event_registration["email"] is not None:
_mail_address = MailAddress.objects.create(
local_part=event_registration["email"]["local_part"],
domain=event_registration["email"]["domain"],
)
email = str(_mail_address)
elif event_registration["user"] is not None:
email = event_registration["user"]["email"]
# Create user # Create user
if event_registration is not None: if event_registration is not None:
user = User.objects.create( user = User.objects.create(
...@@ -69,7 +80,7 @@ class SendEventRegistrationMutation(graphene.Mutation): ...@@ -69,7 +80,7 @@ class SendEventRegistrationMutation(graphene.Mutation):
person, created = Person.objects.get_or_create( person, created = Person.objects.get_or_create(
user=user, user=user,
defaults={ defaults={
"email": event_registration["person"]["email"], "email": email,
"first_name": event_registration["person"]["first_name"], "first_name": event_registration["person"]["first_name"],
"last_name": event_registration["person"]["last_name"], "last_name": event_registration["person"]["last_name"],
}, },
...@@ -134,7 +145,7 @@ class SendEventRegistrationMutation(graphene.Mutation): ...@@ -134,7 +145,7 @@ class SendEventRegistrationMutation(graphene.Mutation):
registration.cost = event.cost registration.cost = event.cost
if event.max_cost is not None and event.max_cost > 0: if event.max_cost is not None and event.max_cost > 0:
amount = event_registration["payment"].amount amount = event_registration["payment"]["amount"]
if amount < event.cost: if amount < event.cost:
voucher_amount = event.cost - amount voucher_amount = event.cost - amount
......
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