diff --git a/functions/checkout_complete/lambda_function.py b/functions/checkout_complete/lambda_function.py
index dc485cd4..f4e2409e 100644
--- a/functions/checkout_complete/lambda_function.py
+++ b/functions/checkout_complete/lambda_function.py
@@ -84,6 +84,25 @@ def lambda_handler(event, context):
'body': json.dumps({'error': 'Checkout session does not exist'})
}
+ if stripe_response['metadata'].get('ticket_upgrade', False):
+ ticket_number = stripe_response.get('client_reference_id', None)
+ full_name = next((item for item in stripe_response['custom_fields'] if item["key"] == "fullname"), {})['text'].get('value', "unknown")
+ payload = {
+ 'ticket_number': ticket_number,
+ 'source': "stripe_checkout",
+ 'upgrade_type': stripe_response['metadata'].get('upgrade_type', 'unknown'),
+ 'full_name': full_name
+ }
+
+ # upgrade the ticket
+ logger.info("Invoking ticket_upgrade lambda")
+ response = lambda_client.invoke(
+ FunctionName=os.environ.get("TICKET_UPGRADE_LAMBDA"),
+ InvocationType='Event',
+ Payload=json.dumps(payload, cls=shared.DecimalEncoder),
+ )
+ logger.info(response)
+
access, line_items = process_line_items(stripe_response['line_items'])
student_ticket = True if stripe_response['line_items']['data'][0]['price']['nickname' ] == "student_active" else False
meal = json.loads(stripe_response['metadata']['preferences']) if 'preferences' in stripe_response['metadata'] else None
diff --git a/functions/send_email/example.html b/functions/send_email/example.html
index 2281a904..66e4f1da 100644
--- a/functions/send_email/example.html
+++ b/functions/send_email/example.html
@@ -1,538 +1,153 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- THANK YOU FOR YOUR PURCHASE!
-
-
Your Event Ticket
-
-
-
-
-
-
-
Name: CK Monaghan
-
Email: c.monaghan@liverpool.ac.uk
-
Ticket Number: 5520910259
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Find out more details and view your ticket details online.
- If your ticket includes the Saturday Dinner you can check and modify your meal preferences online by following this link.
-
-
-
-
-
-
-
-
-
-
-
- View Online
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $body
+
+
+
+
+
+
+
Do not hesitate to get in touch with us if you have any questions regarding your ticket.
+
+
We hope you enjoy the festival!
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
-
-
-
-
-
-
-
-
-
- Transferred From
-
-
-
-
-
-
-
-
-
-
-
-
-
- Name:
- $oldname
-
-
- Email:
- $oldemail
-
-
-
-
-
-
-
-
-
-
- Do not hesitate to get in touch with us if you have any questions regarding your ticket.
-
-
We hope you enjoy the festival!
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+
+
+
+