-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore : Release v1.11 Co-authored-by: Areeb Jamal <[email protected]> Co-authored-by: Suneet Srivastava <[email protected]> Co-authored-by: null <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Prateek Jain <[email protected]> Co-authored-by: Amit Aronovitch <[email protected]> Co-authored-by: D.Rohit <[email protected]> Co-authored-by: Ritik Jain <[email protected]> Co-authored-by: Nitin Kumar <[email protected]> Co-authored-by: Sai Charan <[email protected]>
- Loading branch information
Showing
122 changed files
with
1,417 additions
and
1,182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,9 +2,9 @@ DATABASE_URL=postgresql://open_event_user:[email protected]:5432/oevent | |
INTEGRATE_SOCKETIO=false | ||
TEST_DATABASE_URL=postgresql://open_event_user:[email protected]:5432/opev_test | ||
APP_CONFIG=config.DevelopmentConfig | ||
ENABLE_ELASTICSEARCH=false | ||
ELASTICSEARCH_HOST=localhost:9200 | ||
|
||
POSTGRES_USER=open_event_user | ||
POSTGRES_PASSWORD=opev_pass | ||
POSTGRES_DB=open_event | ||
|
||
FLASK_APP=app.instance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from flask import Blueprint, request, jsonify, abort, make_response | ||
from flask_jwt_extended import current_user | ||
from sqlalchemy.orm.exc import NoResultFound | ||
|
||
from app.api.helpers.mail import send_email_to_attendees | ||
from app.api.helpers.permissions import jwt_required | ||
from app.api.helpers.errors import ( | ||
UnprocessableEntityError, | ||
NotFoundError, | ||
ForbiddenError, | ||
) | ||
from app.api.helpers.permission_manager import has_access | ||
|
||
from app.models.order import Order | ||
from app.models import db | ||
|
||
attendee_blueprint = Blueprint('attendee_blueprint', __name__, url_prefix='/v1') | ||
|
||
|
||
@attendee_blueprint.route('/attendees/send-receipt', methods=['POST']) | ||
@jwt_required | ||
def send_receipt(): | ||
""" | ||
Send receipts to attendees related to the provided order. | ||
:return: | ||
""" | ||
order_identifier = request.json.get('order-identifier') | ||
if order_identifier: | ||
try: | ||
order = db.session.query(Order).filter_by(identifier=order_identifier).one() | ||
except NoResultFound: | ||
return NotFoundError({'parameter': '{order_identifier}'}, "Order not found").respond() | ||
|
||
if (order.user_id != current_user.id) and (not has_access('is_registrar', event_id=order.event_id)): | ||
return ForbiddenError({'source': ''}, | ||
'You need to be the event organizer or order buyer to send receipts.').respond() | ||
elif order.status != 'completed': | ||
abort( | ||
make_response(jsonify(error="Cannot send receipt for an incomplete order"), 409) | ||
) | ||
else: | ||
send_email_to_attendees(order, current_user.id) | ||
return jsonify(message="receipt sent to attendees") | ||
else: | ||
return UnprocessableEntityError({'source': ''}, 'Order identifier missing').respond() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.