Skip to content

Commit

Permalink
fix: allow users modify cancel from legacy side (#1673)
Browse files Browse the repository at this point in the history
  • Loading branch information
EPortman authored Jan 13, 2025
1 parent 6187e97 commit df87482
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion api/namex/VERSION.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.2.23'
__version__ = '1.2.24'
5 changes: 3 additions & 2 deletions api/namex/resources/payment_societies.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from sqlalchemy.orm.exc import NoResultFound

from namex import jwt
from namex.models import PaymentSociety as PaymentSocietyDAO, Request as RequestDAO, User
from namex.models import State, PaymentSociety as PaymentSocietyDAO, Request as RequestDAO, User
from namex.utils.auth import cors_preflight

from namex.utils.logging import setup_logging
Expand Down Expand Up @@ -121,7 +121,8 @@ def post(self):
ps_instance.save_to_db()
current_app.logger.debug(f'ps_instance saved...')

nrd.stateCd = 'DRAFT'
if nrd.stateCd == State.PENDING_PAYMENT:
nrd.stateCd = 'DRAFT'
nrd.save_to_db()
current_app.logger.debug(f'nrd saved...')

Expand Down
6 changes: 6 additions & 0 deletions api/namex/services/name_request/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,12 @@ def valid_state_transition(user, nr, new_state):
:param new_state:
:return: (bool)
"""
# when the legacy user just created a new NR from legacy side, the user should be allowed to
# modify and cancel it from the legacy side (while the NR still in DRAFT state).
if (nr.stateCd == State.DRAFT or nr.stateCd == State.APPROVED or nr.stateCd == State.CANCELLED) \
and (new_state == State.DRAFT or new_state == State.CANCELLED):
return True

if (new_state in (State.APPROVED,
State.REJECTED,
State.CONDITIONAL)) \
Expand Down

0 comments on commit df87482

Please sign in to comment.