Skip to content

Commit

Permalink
24361 - fix missing pdf continuation application (bcgov#3078)
Browse files Browse the repository at this point in the history
* remove receipt and continuation application document for COMPLETED status and adjust the email template follows the new design
* change get corp_name logic for continuation-in, amalg and IA
  • Loading branch information
eason-pan-bc authored Nov 15, 2024
1 parent 0c794b1 commit fbc2c94
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ def _get_pdfs(
)
attach_order += 1

corp_name = business.get('legalName')
# add receipt
if not (corp_name := business.get('legalName')): # pylint: disable=superfluous-parens
legal_type = business.get('legalType')
corp_name = Business.BUSINESSES.get(legal_type, {}).get('numberedDescription')

receipt = requests.post(
f'{current_app.config.get("PAY_API_URL")}/{filing.payment_token}/receipts',
json={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,22 @@ def _get_pdfs(
attach_order += 1

# add receipt
corp_name = business.get('legalName')
if not (corp_name := business.get('legalName')): # pylint: disable=superfluous-parens
legal_type = business.get('legalType')
corp_name = Business.BUSINESSES.get(legal_type, {}).get('numberedDescription')
# Debugging logger for #24361, will have another PR before closing the ticket to remove it
current_app.logger.debug(
f'\U0001F4D2 - Business: {business}\n'
f"""\U0001F4D2 - Payload to get receipt: json:
corpName: {corp_name},
filingDateTime: {filing_date_time},
effectiveDateTime: {effective_date if effective_date != filing_date_time else ''},
filingIdentifier: {str(filing.id)},
businessNumber: {business.get('taxId', '')}
"""
)
# debugging logger end

receipt = requests.post(
f'{current_app.config.get("PAY_API_URL")}/{filing.payment_token}/receipts',
json={
Expand All @@ -80,6 +95,9 @@ def _get_pdfs(
headers=headers
)
if receipt.status_code != HTTPStatus.CREATED:
# Debugging logger for #24361, will have another PR before closing the ticket to remove it
current_app.logger.debug(f'\U0001F4D2 - Error getting receipt, when PAID Response: {receipt.text}')
# debugging logger end
logger.error('Failed to get receipt pdf for filing: %s', filing.id)
else:
receipt_encoded = base64.b64encode(receipt.content)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,11 @@ def _get_pdfs(
}
)
attach_order += 1

# add receipt pdf
if filing.filing_type == 'incorporationApplication':
corp_name = filing.filing_json['filing']['incorporationApplication']['nameRequest'].get(
'legalName', 'Numbered Company')
else:
corp_name = business.get('legalName')
if not (corp_name := business.get('legalName')): # pylint: disable=superfluous-parens
legal_type = business.get('legalType')
corp_name = Business.BUSINESSES.get(legal_type, {}).get('numberedDescription')

receipt = requests.post(
f'{current_app.config.get("PAY_API_URL")}/{filing.payment_token}/receipts',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@
</ul>
{% else %}
<ul class="outputs">
<li>Continuation Application</li>
<li>Notice of Articles</li>
<li>Certificate of Continuation</li>
<li>Receipt</li>
</ul>
{% endif %}

Expand Down
4 changes: 3 additions & 1 deletion queue_services/entity-emailer/src/entity_emailer/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ def process_email(email_msg: dict, flask_app: Flask): # pylint: disable=too-man
"""Process the email contained in the submission."""
if not flask_app:
raise QueueException('Flask App not available.')

# Debugging logger for #24361, will have another PR before closing the ticket to remove it
flask_app.logger.debug(f'\U0001F4D2 email_msg: {email_msg}')
# debugging logger end
with flask_app.app_context():
logger.debug('Attempting to process email: %s', email_msg)
token = AccountService.get_bearer_token()
Expand Down

0 comments on commit fbc2c94

Please sign in to comment.