Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

22203 - Added furnishings logging #2909

Merged
merged 4 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,17 @@ def _update_furnishings_status(self, furnishing_group_id):
def process(self):
"""Postprocess to generate and upload file to external resources(BC Laws)."""
self._format_furnishings()
self._app.logger.debug('Formatted furnishing details presented in XML file')
self._set_meta_info()
payload = self._build_xml_data(self._xml_data)
furnishing_group, _ = self._save_xml_payload(payload)
self._app.logger.debug('Saved XML payload')
# TODO: SFTP to BC Laws

# mark furnishing records processed
self._update_furnishings_status(furnishing_group.id)
self._app.logger.debug(
f'furnishing records with group id: {furnishing_group.id} marked as processed')


class XmlMeta:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,22 +92,29 @@ async def _send_first_round_notification(self, batch_processing: BatchProcessing
business.legal_name,
email
)
self._app.logger.debug(f'New furnishing has been created with ID (first round): {new_furnishing.id}')

mailing_address = business.mailing_address.one_or_none()
if mailing_address:
self._create_furnishing_address(mailing_address, new_furnishing.id)
self._app.logger.debug(f'Created address (first round) with furnishing ID: {new_furnishing.id}')
if email:
# send email letter
await self._send_email(new_furnishing)
self._app.logger.debug(
f'Successfully put email message on the queue for furnishing entry with ID: {new_furnishing.id}')
else:
# send paper letter if business doesn't have email address
new_furnishing.furnishing_type = Furnishing.FurnishingType.MAIL
new_furnishing.save()
self._app.logger.debug(f'Changed furnishing type to MAIL for funishing with ID: {new_furnishing.id}')

# TODO: create and add letter to either AR or transition pdf
# TODO: send AR and transition pdf to BCMail+
new_furnishing.status = Furnishing.FurnishingStatus.PROCESSED
new_furnishing.processed_date = datetime.utcnow()
new_furnishing.save()
self._app.logger.debug(f'Changed furnishing status to PROCESSED for funishing with ID: {new_furnishing.id}')

async def _send_second_round_notification(self, batch_processing: BatchProcessing):
"""Send paper letter if business is still not in good standing after 5 days of email letter sent out."""
Expand All @@ -127,10 +134,12 @@ async def _send_second_round_notification(self, batch_processing: BatchProcessin
business.last_ar_date if business.last_ar_date else business.founding_date,
business.legal_name
)
self._app.logger.debug(f'New furnishing has been created with ID (second round): {new_furnishing.id}')

mailing_address = business.mailing_address.one_or_none()
if mailing_address:
self._create_furnishing_address(mailing_address, new_furnishing.id)
self._app.logger.debug(f'Created address (second round) with furnishing ID: {new_furnishing.id}')

# TODO: create and add letter to either AR or transition pdf
# TODO: send AR and transition pdf to BCMail+
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def process(app: Flask):
business_name=business.legal_name
)
new_furnishing.save()
app.logger.debug(f'Created corp dissolved furnishing entry with ID: {new_furnishing.id}')
# TODO: create data files and SFTPing to BC Laws
# TODO: mark furnishings entry processed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def process(app: Flask, xml_furnishings: dict):
business_name=business.legal_name
)
new_furnishing.save()
app.logger.debug(f'Created intent to dissolve furnishing entry with ID: {new_furnishing.id}')

if business != Business.LegalTypes.EXTRA_PRO_A.value:
bc_furnishings.append(new_furnishing)
Expand Down
6 changes: 6 additions & 0 deletions jobs/furnishings/src/furnishings/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,16 @@ async def run(application: Flask, qsm: QueueService): # pylint: disable=redefin
xml_furnishings_dict = {}

if stage_1_valid:
application.logger.debug('Entering stage 1 of furnishings job.')
await stage_one.process(application, qsm)
application.logger.debug('Exiting stage 1 of furnishings job.')
if stage_2_valid:
application.logger.debug('Entering stage 2 of furnishings job.')
stage_two.process(application, xml_furnishings_dict)
application.logger.debug('Exiting stage 2 of furnishings job.')
if stage_3_valid:
application.logger.debug('Entering stage 3 of furnishings job.')
stage_three.process(application)
application.logger.debug('Exiting stage 3 of furnishings job.')

post_processor.process(application, xml_furnishings_dict)
Loading