diff --git a/jobs/furnishings/src/furnishings/stage_processors/post_processor.py b/jobs/furnishings/src/furnishings/stage_processors/post_processor.py index 7332a4458..aac46a168 100644 --- a/jobs/furnishings/src/furnishings/stage_processors/post_processor.py +++ b/jobs/furnishings/src/furnishings/stage_processors/post_processor.py @@ -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: diff --git a/jobs/furnishings/src/furnishings/stage_processors/stage_one.py b/jobs/furnishings/src/furnishings/stage_processors/stage_one.py index d5b217546..ed121f5a3 100644 --- a/jobs/furnishings/src/furnishings/stage_processors/stage_one.py +++ b/jobs/furnishings/src/furnishings/stage_processors/stage_one.py @@ -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.""" @@ -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+ diff --git a/jobs/furnishings/src/furnishings/stage_processors/stage_three.py b/jobs/furnishings/src/furnishings/stage_processors/stage_three.py index f5ddbef71..f5d176729 100644 --- a/jobs/furnishings/src/furnishings/stage_processors/stage_three.py +++ b/jobs/furnishings/src/furnishings/stage_processors/stage_three.py @@ -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 diff --git a/jobs/furnishings/src/furnishings/stage_processors/stage_two.py b/jobs/furnishings/src/furnishings/stage_processors/stage_two.py index f66265775..a7b8756f7 100644 --- a/jobs/furnishings/src/furnishings/stage_processors/stage_two.py +++ b/jobs/furnishings/src/furnishings/stage_processors/stage_two.py @@ -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) diff --git a/jobs/furnishings/src/furnishings/worker.py b/jobs/furnishings/src/furnishings/worker.py index b4f245dae..7b58c5204 100644 --- a/jobs/furnishings/src/furnishings/worker.py +++ b/jobs/furnishings/src/furnishings/worker.py @@ -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)