-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat: add a resend email route for organizers #6163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
d71c128
17b2604
639a187
013ed41
94d374f
6d93fc7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -153,10 +153,8 @@ def after_create_object(self, order, data, view_kwargs): | |
|
|
||
| key = UPLOAD_PATHS['pdf']['order'].format(identifier=order_identifier) | ||
| invoice_path = 'generated/invoices/{}/{}/'.format(key, generate_hash(key)) + order_identifier + '.pdf' | ||
|
|
||
| # send email and notifications. | ||
| send_email_to_attendees(order=order, purchaser_id=current_user.id, attachments=[ticket_path, invoice_path]) | ||
|
|
||
| send_notif_to_attendees(order, current_user.id) | ||
|
|
||
| if order.payment_mode in ['free', 'bank', 'cheque', 'onsite']: | ||
|
|
@@ -535,3 +533,30 @@ def omise_checkout(order_identifier): | |
| logging.info(f"Successful charge: {charge.id}. Order ID: {order_identifier}") | ||
|
|
||
| return redirect(make_frontend_url('orders/{}/view'.format(order_identifier))) | ||
|
|
||
|
|
||
| @order_misc_routes.route('/orders/<string:order_identifier>/resend-email', methods=['POST']) | ||
|
||
| def resend_emails(order_identifier): | ||
| """ | ||
| Sends confirmation email for pending and completed orders on organizer request | ||
| :param order_identifier: | ||
| :return: JSON response if the email was succesfully sent | ||
| """ | ||
| order = safe_query(db, Order, 'identifier', order_identifier, 'identifier') | ||
|
||
| if (has_access('is_coorganizer', event_id=order.event_id)): | ||
| if order.status == 'completed' or order.status == 'placed': | ||
| # fetch tickets attachment | ||
| order_identifier = order.identifier | ||
| key = UPLOAD_PATHS['pdf']['tickets_all'].format(identifier=order_identifier) | ||
| ticket_path = 'generated/tickets/{}/{}/'.format(key, generate_hash(key)) + order_identifier + '.pdf' | ||
| key = UPLOAD_PATHS['pdf']['order'].format(identifier=order_identifier) | ||
| invoice_path = 'generated/invoices/{}/{}/'.format(key, generate_hash(key)) + order_identifier + '.pdf' | ||
|
|
||
| # send email. | ||
| send_email_to_attendees(order=order, purchaser_id=current_user.id, attachments=[ticket_path, invoice_path]) | ||
| return jsonify(status=True, message="Verification emails for order : {} has been sent succesfully". | ||
| format(order_identifier)) | ||
| else: | ||
| return jsonify(status=False, message="Only placed and complete orders are verified") | ||
| else: | ||
| raise ForbiddenException({'source': ''}, "Co-Organizer Access Required") | ||
Uh oh!
There was an error while loading. Please reload this page.