diff --git a/api/namex/VERSION.py b/api/namex/VERSION.py index 3d26e8255..ff436ff2e 100644 --- a/api/namex/VERSION.py +++ b/api/namex/VERSION.py @@ -1 +1 @@ -__version__ = '1.2.23' +__version__ = '1.2.24' diff --git a/api/namex/resources/payment_societies.py b/api/namex/resources/payment_societies.py index 5664593ec..5d6d13f58 100644 --- a/api/namex/resources/payment_societies.py +++ b/api/namex/resources/payment_societies.py @@ -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 @@ -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...') diff --git a/api/namex/services/name_request/utils.py b/api/namex/services/name_request/utils.py index d18355661..bdaea1f4f 100644 --- a/api/namex/services/name_request/utils.py +++ b/api/namex/services/name_request/utils.py @@ -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)) \