-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8694445
commit 7bda927
Showing
3 changed files
with
71 additions
and
61 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 |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import datetime | ||
|
||
from ais.common import settings | ||
from util.email import send_mail | ||
|
||
|
||
def send_ir_confirmation_email( | ||
request, | ||
fair, | ||
signature, | ||
company, | ||
# How many days the company has to change their initial registration application after signing the contract | ||
ir_application_change_allowed_time=14, | ||
# How many days after the initial registration end date the company will receive a confirmation email | ||
ir_application_review_time=14, | ||
): | ||
# The deadline for the company to change their initial registration application | ||
# either x days after signature, or the registration end date, whichever comes last. | ||
ir_application_change_deadline = max( | ||
[ | ||
signature.timestamp | ||
+ datetime.timedelta(days=ir_application_change_allowed_time), | ||
fair.registration_end_date, | ||
] | ||
) | ||
|
||
# The latest date the company will receive a confirmation email | ||
ir_application_review_date = fair.registration_end_date + datetime.timedelta( | ||
days=ir_application_review_time | ||
) | ||
|
||
send_mail( | ||
request, | ||
template="register/email/ir_complete.html", | ||
context={ | ||
"company": company, | ||
"fair": fair, | ||
"signature": signature, | ||
"ir_application_change_deadline": ir_application_change_deadline, | ||
"ir_application_review_date": ir_application_review_date, | ||
"support_email": "[email protected]", | ||
}, | ||
subject="Initial registration received!", | ||
to=[signature.company_contact.email_address], | ||
file_paths=[settings.MEDIA_ROOT + signature.contract.contract.url[6:]], | ||
) | ||
|
||
|
||
def send_cr_confirmation_email(request, fair, company, exhibitor, signature): | ||
# Untested | ||
# Todo: Add packages to email | ||
send_mail( | ||
request, | ||
template="register/email/cr_complete.html", | ||
context={ | ||
"company": company, | ||
"fair": fair, | ||
"signature": signature, | ||
"deadline": exhibitor.deadline_complete_registration | ||
or fair.complete_registration_close_date, | ||
}, | ||
subject="Final registration received!", | ||
to=[signature.company_contact.email_address], | ||
file_paths=[settings.MEDIA_ROOT + signature.contract.contract.url[6:]], | ||
) |
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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
import datetime | ||
from ais.common import settings | ||
from dashboard.api.registration.email import ( | ||
send_cr_confirmation_email, | ||
send_ir_confirmation_email, | ||
) | ||
from dashboard.api.registration.types.registration import get_registration | ||
from exhibitors.models import Exhibitor | ||
from util import JSONError, get_contract_signature, get_exhibitor, status | ||
|
@@ -12,7 +14,6 @@ | |
from register.models import SignupLog | ||
from accounting.models import Order | ||
|
||
from util.email import send_mail | ||
from util.ip import get_client_ip | ||
|
||
|
||
|
@@ -80,22 +81,7 @@ def submit_cr(request, company, fair, contact, exhibitor): | |
unit_price=0, # A package product is free | ||
) | ||
|
||
# Untested | ||
# Todo: Add packages to email | ||
send_mail( | ||
request, | ||
template="register/email/cr_complete.html", | ||
context={ | ||
"company": company, | ||
"fair": fair, | ||
"signature": signature, | ||
"deadline": exhibitor.deadline_complete_registration | ||
or fair.complete_registration_close_date, | ||
}, | ||
subject="Final registration received!", | ||
to=[signature.company_contact.email_address], | ||
file_paths=[settings.MEDIA_ROOT + signature.contract.contract.url[6:]], | ||
) | ||
send_cr_confirmation_email(request, fair, company, exhibitor, signature) | ||
|
||
try: | ||
registration = get_registration(company, fair, contact, exhibitor) | ||
|
@@ -107,48 +93,6 @@ def submit_cr(request, company, fair, contact, exhibitor): | |
return JsonResponse(serializer.data, safe=False) | ||
|
||
|
||
def send_ir_confirmation_email( | ||
request, | ||
fair, | ||
signature, | ||
company, | ||
# How many days the company has to change their initial registration application after signing the contract | ||
ir_application_change_allowed_time=14, | ||
# How many days after the initial registration end date the company will receive a confirmation email | ||
ir_application_review_time=14, | ||
): | ||
# The deadline for the company to change their initial registration application | ||
# either x days after signature, or the registration end date, whichever comes last. | ||
ir_application_change_deadline = max( | ||
[ | ||
signature.timestamp | ||
+ datetime.timedelta(days=ir_application_change_allowed_time), | ||
fair.registration_end_date, | ||
] | ||
) | ||
|
||
# The latest date the company will receive a confirmation email | ||
ir_application_review_date = fair.registration_end_date + datetime.timedelta( | ||
days=ir_application_review_time | ||
) | ||
|
||
send_mail( | ||
request, | ||
template="register/email/ir_complete.html", | ||
context={ | ||
"company": company, | ||
"fair": fair, | ||
"signature": signature, | ||
"ir_application_change_deadline": ir_application_change_deadline, | ||
"ir_application_review_date": ir_application_review_date, | ||
"support_email": "[email protected]", | ||
}, | ||
subject="Initial registration received!", | ||
to=[signature.company_contact.email_address], | ||
file_paths=[settings.MEDIA_ROOT + signature.contract.contract.url[6:]], | ||
) | ||
|
||
|
||
@require_POST | ||
def submit_ir(request, company, fair, contact): | ||
try: | ||
|
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