mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-16 09:37:03 +02:00
Rejected status and email
This commit is contained in:
parent
5763bb4a6a
commit
a6f8e64c0a
6 changed files with 143 additions and 3 deletions
|
@ -271,6 +271,8 @@ class DomainApplicationAdmin(ListHeaderAdmin):
|
|||
original_obj.approve(updated_domain_application=obj)
|
||||
elif obj.status == models.DomainApplication.WITHDRAWN:
|
||||
original_obj.withdraw()
|
||||
elif obj.status == models.DomainApplication.REJECTED:
|
||||
original_obj.reject()
|
||||
else:
|
||||
logger.warning("Unknown status selected in django admin")
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ class DomainApplication(TimeStampedModel):
|
|||
ACTION_NEEDED = "action needed"
|
||||
APPROVED = "approved"
|
||||
WITHDRAWN = "withdrawn"
|
||||
REJECTED = "rejected"
|
||||
STATUS_CHOICES = [
|
||||
(STARTED, STARTED),
|
||||
(SUBMITTED, SUBMITTED),
|
||||
|
@ -32,6 +33,7 @@ class DomainApplication(TimeStampedModel):
|
|||
(ACTION_NEEDED, ACTION_NEEDED),
|
||||
(APPROVED, APPROVED),
|
||||
(WITHDRAWN, WITHDRAWN),
|
||||
(REJECTED, REJECTED),
|
||||
]
|
||||
|
||||
class StateTerritoryChoices(models.TextChoices):
|
||||
|
@ -557,7 +559,7 @@ class DomainApplication(TimeStampedModel):
|
|||
"emails/status_change_in_review_subject.txt",
|
||||
)
|
||||
|
||||
@transition(field="status", source=[INVESTIGATING], target=ACTION_NEEDED)
|
||||
@transition(field="status", source=[INVESTIGATING, REJECTED], target=ACTION_NEEDED)
|
||||
def action_needed(self, updated_domain_application):
|
||||
"""Send back an application that is under investigation or rejected.
|
||||
|
||||
|
@ -569,7 +571,7 @@ class DomainApplication(TimeStampedModel):
|
|||
"emails/status_change_action_needed_subject.txt",
|
||||
)
|
||||
|
||||
@transition(field="status", source=[SUBMITTED, INVESTIGATING], target=APPROVED)
|
||||
@transition(field="status", source=[SUBMITTED, INVESTIGATING, REJECTED], target=APPROVED)
|
||||
def approve(self, updated_domain_application=None):
|
||||
"""Approve an application that has been submitted.
|
||||
|
||||
|
@ -619,6 +621,10 @@ class DomainApplication(TimeStampedModel):
|
|||
def withdraw(self):
|
||||
"""Withdraw an application that has been submitted."""
|
||||
|
||||
@transition(field="status", source=[INVESTIGATING, APPROVED], target=REJECTED)
|
||||
def reject(self):
|
||||
"""Reject an application that has been submitted."""
|
||||
|
||||
# ## Form policies ###
|
||||
#
|
||||
# These methods control what questions need to be answered by applicants
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
</span>
|
||||
{% if domainapplication.status == 'approved' %} Approved
|
||||
{% elif domainapplication.status == 'investigating' %} In Review
|
||||
{% elif domainapplication.status == 'action needed' %} Action Needed
|
||||
{% elif domainapplication.status == 'rejected' %} Rejected
|
||||
{% elif domainapplication.status == 'submitted' %} Received
|
||||
{% else %}ERROR Please contact technical support/dev
|
||||
{% endif %}
|
||||
|
|
32
src/registrar/templates/emails/status_change_rejected.txt
Normal file
32
src/registrar/templates/emails/status_change_rejected.txt
Normal file
|
@ -0,0 +1,32 @@
|
|||
{% autoescape off %}{# In a text file, we don't want to have HTML entities escaped #}
|
||||
Hi {{ application.submitter.first_name }}.
|
||||
|
||||
Your .gov domain request has been rejected.
|
||||
|
||||
DOMAIN REQUESTED: {{ application.requested_domain.name }}
|
||||
REQUEST RECEIVED ON: {{ application.updated_at|date }}
|
||||
REQUEST #: {{ application.id }}
|
||||
STATUS: Rejected
|
||||
|
||||
|
||||
YOU CAN SUBMIT A NEW REQUEST
|
||||
|
||||
The details of your request are included below. If your organization is eligible for a .gov
|
||||
domain and you meet our other requirements, you can submit a new request. Learn
|
||||
more about .gov domains <https://get.gov/help/domains/>.
|
||||
|
||||
|
||||
THANK YOU
|
||||
|
||||
.Gov helps the public identify official, trusted information. Thank you for
|
||||
requesting a .gov domain.
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
{% include 'emails/includes/application_summary.txt' %}
|
||||
----------------------------------------------------------------
|
||||
|
||||
The .gov team
|
||||
Contact us: <https://get.gov/contact/>
|
||||
Visit <https://get.gov>
|
||||
{% endautoescape %}
|
|
@ -0,0 +1 @@
|
|||
Your .gov domain request has been rejected
|
|
@ -162,6 +162,15 @@ class TestDomainApplication(TestCase):
|
|||
with self.assertRaises(TransitionNotAllowed):
|
||||
application.submit()
|
||||
|
||||
def test_transition_not_allowed_rejected_submitted(self):
|
||||
"""Create an application with status rejected and call submit
|
||||
against transition rules"""
|
||||
|
||||
application = completed_application(status=DomainApplication.REJECTED)
|
||||
|
||||
with self.assertRaises(TransitionNotAllowed):
|
||||
application.submit()
|
||||
|
||||
def test_transition_not_allowed_started_investigating(self):
|
||||
"""Create an application with status started and call in_review
|
||||
against transition rules"""
|
||||
|
@ -189,6 +198,24 @@ class TestDomainApplication(TestCase):
|
|||
with self.assertRaises(TransitionNotAllowed):
|
||||
application.in_review()
|
||||
|
||||
def test_transition_not_allowed_action_needed_investigating(self):
|
||||
"""Create an application with status action needed and call in_review
|
||||
against transition rules"""
|
||||
|
||||
application = completed_application(status=DomainApplication.ACTION_NEEDED)
|
||||
|
||||
with self.assertRaises(TransitionNotAllowed):
|
||||
application.in_review()
|
||||
|
||||
def test_transition_not_allowed_rejected_investigating(self):
|
||||
"""Create an application with status rejected and call in_review
|
||||
against transition rules"""
|
||||
|
||||
application = completed_application(status=DomainApplication.REJECTED)
|
||||
|
||||
with self.assertRaises(TransitionNotAllowed):
|
||||
application.in_review()
|
||||
|
||||
def test_transition_not_allowed_withdrawn_investigating(self):
|
||||
"""Create an application with status withdrawn and call in_review
|
||||
against transition rules"""
|
||||
|
@ -261,6 +288,15 @@ class TestDomainApplication(TestCase):
|
|||
with self.assertRaises(TransitionNotAllowed):
|
||||
application.approve()
|
||||
|
||||
def test_transition_not_allowed_action_needed_approved(self):
|
||||
"""Create an application with status action needed and call approve
|
||||
against transition rules"""
|
||||
|
||||
application = completed_application(status=DomainApplication.ACTION_NEEDED)
|
||||
|
||||
with self.assertRaises(TransitionNotAllowed):
|
||||
application.approve()
|
||||
|
||||
def test_transition_not_allowed_withdrawn_approved(self):
|
||||
"""Create an application with status withdrawn and call approve
|
||||
against transition rules"""
|
||||
|
@ -288,6 +324,24 @@ class TestDomainApplication(TestCase):
|
|||
with self.assertRaises(TransitionNotAllowed):
|
||||
application.withdraw()
|
||||
|
||||
def test_transition_not_allowed_action_needed_withdrawn(self):
|
||||
"""Create an application with status action needed and call withdraw
|
||||
against transition rules"""
|
||||
|
||||
application = completed_application(status=DomainApplication.ACTION_NEEDED)
|
||||
|
||||
with self.assertRaises(TransitionNotAllowed):
|
||||
application.withdraw()
|
||||
|
||||
def test_transition_not_allowed_rejected_withdrawn(self):
|
||||
"""Create an application with status rejected and call withdraw
|
||||
against transition rules"""
|
||||
|
||||
application = completed_application(status=DomainApplication.REJECTED)
|
||||
|
||||
with self.assertRaises(TransitionNotAllowed):
|
||||
application.withdraw()
|
||||
|
||||
def test_transition_not_allowed_withdrawn_withdrawn(self):
|
||||
"""Create an application with status withdrawn and call withdraw
|
||||
against transition rules"""
|
||||
|
@ -297,6 +351,51 @@ class TestDomainApplication(TestCase):
|
|||
with self.assertRaises(TransitionNotAllowed):
|
||||
application.withdraw()
|
||||
|
||||
def test_transition_not_allowed_started_rejected(self):
|
||||
"""Create an application with status started and call reject
|
||||
against transition rules"""
|
||||
|
||||
application = completed_application(status=DomainApplication.STARTED)
|
||||
|
||||
with self.assertRaises(TransitionNotAllowed):
|
||||
application.reject()
|
||||
|
||||
def test_transition_not_allowed_submitted_rejected(self):
|
||||
"""Create an application with status submitted and call reject
|
||||
against transition rules"""
|
||||
|
||||
application = completed_application(status=DomainApplication.SUBMITTED)
|
||||
|
||||
with self.assertRaises(TransitionNotAllowed):
|
||||
application.reject()
|
||||
|
||||
def test_transition_not_allowed_action_needed_rejected(self):
|
||||
"""Create an application with status action needed and call reject
|
||||
against transition rules"""
|
||||
|
||||
application = completed_application(status=DomainApplication.ACTION_NEEDED)
|
||||
|
||||
with self.assertRaises(TransitionNotAllowed):
|
||||
application.reject()
|
||||
|
||||
def test_transition_not_allowed_withdrawn_rejected(self):
|
||||
"""Create an application with status withdrawn and call reject
|
||||
against transition rules"""
|
||||
|
||||
application = completed_application(status=DomainApplication.WITHDRAWN)
|
||||
|
||||
with self.assertRaises(TransitionNotAllowed):
|
||||
application.reject()
|
||||
|
||||
def test_transition_not_allowed_rejected_rejected(self):
|
||||
"""Create an application with status rejected and call reject
|
||||
against transition rules"""
|
||||
|
||||
application = completed_application(status=DomainApplication.REJECTED)
|
||||
|
||||
with self.assertRaises(TransitionNotAllowed):
|
||||
application.reject()
|
||||
|
||||
|
||||
class TestPermissions(TestCase):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue