stranck-dev #25
2
app.py
2
app.py
|
@ -55,7 +55,7 @@ async def handleException(request, exception):
|
|||
traceback.print_exc()
|
||||
|
||||
if statusCode == 403:
|
||||
clear_session(r)
|
||||
await clear_session(r)
|
||||
return r
|
||||
|
||||
|
||||
|
|
|
@ -80,16 +80,17 @@ async def send_unconfirm_message(room_order, orders):
|
|||
issues_html += "</ul>"
|
||||
|
||||
for member in orders:
|
||||
plain_body = EMAILS_TEXT["ROOM_UNCONFIRM_TEXT"]['plain'].format(member.name, room_order.room_name, issues_plain)
|
||||
html_body = render_email_template(EMAILS_TEXT["ROOM_UNCONFIRM_TITLE"], EMAILS_TEXT["ROOM_UNCONFIRM_TEXT"]['html'].format(member.name, room_order.room_name, issues_html))
|
||||
plain_text = MIMEText(plain_body, "plain")
|
||||
html_text = MIMEText(html_body, "html")
|
||||
message = MIMEMultipart("alternative")
|
||||
message.attach(plain_text)
|
||||
message.attach(html_text)
|
||||
message['Subject'] = f'[{EMAIL_SENDER_NAME}] Your room cannot be confirmed'
|
||||
message['To'] = f"{member.name} <{member.email}>"
|
||||
memberMessages.append(message)
|
||||
if(member.status != 'canceled'):
|
||||
plain_body = EMAILS_TEXT["ROOM_UNCONFIRM_TEXT"]['plain'].format(member.name, room_order.room_name, issues_plain)
|
||||
html_body = render_email_template(EMAILS_TEXT["ROOM_UNCONFIRM_TITLE"], EMAILS_TEXT["ROOM_UNCONFIRM_TEXT"]['html'].format(member.name, room_order.room_name, issues_html))
|
||||
plain_text = MIMEText(plain_body, "plain")
|
||||
html_text = MIMEText(html_body, "html")
|
||||
message = MIMEMultipart("alternative")
|
||||
message.attach(plain_text)
|
||||
message.attach(html_text)
|
||||
message['Subject'] = f'[{EMAIL_SENDER_NAME}] Your room cannot be confirmed'
|
||||
message['To'] = f"{member.name} <{member.email}>"
|
||||
memberMessages.append(message)
|
||||
|
||||
if len(memberMessages) == 0: return
|
||||
|
||||
|
|
9
ext.py
9
ext.py
|
@ -20,6 +20,10 @@ class Order:
|
|||
|
||||
self.time = time()
|
||||
self.data = data
|
||||
if(len(self.data['positions']) == 0):
|
||||
for fee in data['fees']:
|
||||
if(fee['fee_type'] == "cancellation"):
|
||||
self.data['status'] = 'c'
|
||||
self.status = {'n': 'pending', 'p': 'paid', 'e': 'expired', 'c': 'canceled'}[self.data['status']]
|
||||
self.secret = data['secret']
|
||||
|
||||
|
@ -218,8 +222,9 @@ class Order:
|
|||
#if ans['question'] == 40:
|
||||
# del self.answers[i]['options']
|
||||
# del self.answers[i]['option_identifiers']
|
||||
|
||||
res = await pretixClient.patch(f'orderpositions/{self.position_id}/', json={'answers': self.answers}, expectedStatusCodes=None)
|
||||
|
||||
ans = [] if self.status == "canceled" else self.answers
|
||||
res = await pretixClient.patch(f'orderpositions/{self.position_id}/', json={'answers': ans}, expectedStatusCodes=None)
|
||||
|
||||
if res.status_code != 200:
|
||||
e = res.json()
|
||||
|
|
Loading…
Reference in New Issue