Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
from app.views import BlueprintsManager
from app.api.helpers.auth import AuthManager
from app.api.helpers.scheduled_jobs import send_after_event_mail, send_event_fee_notification, \
send_event_fee_notification_followup, change_session_state_on_event_completion, expire_pending_tickets_after_one_day
send_event_fee_notification_followup, change_session_state_on_event_completion, \
expire_pending_tickets_after_three_days
from app.models.event import Event
from app.models.role_invite import RoleInvite
from app.views.healthcheck import health_check_celery, health_check_db, health_check_migrations, check_migrations
Expand Down Expand Up @@ -232,7 +233,7 @@ def update_sent_state(sender=None, headers=None, **kwargs):
scheduler.add_job(send_event_fee_notification, 'cron', day=1)
scheduler.add_job(send_event_fee_notification_followup, 'cron', day=15)
scheduler.add_job(change_session_state_on_event_completion, 'cron', hour=5, minute=30)
scheduler.add_job(expire_pending_tickets_after_one_day, 'cron', hour=5)
scheduler.add_job(expire_pending_tickets_after_three_days, 'cron', hour=5)
scheduler.start()


Expand Down
2 changes: 1 addition & 1 deletion app/api/helpers/scheduled_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def send_event_fee_notification_followup():
incomplete_invoice.event.id)


def expire_pending_tickets_after_one_day():
def expire_pending_tickets_after_three_days():
from app import current_app as app
with app.app_context():
db.session.query(Order).filter(Order.status == 'pending',
Expand Down
14 changes: 7 additions & 7 deletions app/api/orders.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ def before_post(self, args, kwargs, data=None):
del data['on_site_tickets']
require_relationship(['ticket_holders'], data)

# Ensuring that default status is always pending, unless the user is event co-organizer
# Ensuring that default status is always initializing, unless the user is event co-organizer
if not has_access('is_coorganizer', event_id=data['event']):
data['status'] = 'pending'
data['status'] = 'initializing'

def before_create_object(self, data, view_kwargs):
"""
Expand Down Expand Up @@ -201,7 +201,7 @@ def query(self, view_kwargs):
# orders under an event
query_ = event_query(self, query_, view_kwargs)

# expire the pending orders if the time limit is over.
# expire the initializing orders if the time limit is over.
orders = query_.all()
for order in orders:
set_expiry_for_order(order)
Expand Down Expand Up @@ -241,7 +241,7 @@ def before_get_object(self, view_kwargs):
if not has_access('is_coorganizer_or_user_itself', event_id=order.event_id, user_id=order.user_id):
return ForbiddenException({'source': ''}, 'You can only access your orders or your event\'s orders')

# expire the pending order if time limit is over.
# expire the initializing order if time limit is over.
set_expiry_for_order(order)

def before_update_object(self, order, data, view_kwargs):
Expand All @@ -251,7 +251,7 @@ def before_update_object(self, order, data, view_kwargs):
2. event organizer
a. own orders: he/she can update selected fields.
b. other's orders: can only update the status that too when the order mode is free. No refund system.
3. order user can update selected fields of his/her order when the status is pending.
3. order user can update selected fields of his/her order when the status is initializing.
The selected fields mentioned above can be taken from get_updatable_fields method from order model.
:param order:
:param data:
Expand Down Expand Up @@ -287,9 +287,9 @@ def before_update_object(self, order, data, view_kwargs):
"You cannot update the status of a cancelled order")

elif current_user.id == order.user_id:
if order.status != 'pending':
if order.status != 'initializing' and order.status != 'pending':
raise ForbiddenException({'pointer': ''},
"You cannot update a non-pending order")
"You cannot update a non-initialized or non-pending order")
else:
for element in data:
if element == 'is_billing_enabled' and order.status == 'completed' and data[element]\
Expand Down