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

23543 COLIN BE Services - Sync involuntary dissolution stages back to COLIN #3027

Closed
wants to merge 9 commits into from

Conversation

leodube-aot
Copy link
Collaborator

@leodube-aot leodube-aot commented Oct 11, 2024

Issue #: /bcgov/entity#23543

Description of changes:

  • Updated BatchProcessing model:
    • Added a static method to return eligible batch processings for COLIN
  • Updated Legal API:
    • Created a new GET endpoint to return the eligible batch_processings.
    • Created a new PATCH endpoint to create a colin_event_id entry for synced batch processings.
  • Updated COLIN API:
    • Created a new POST endpoint to create a CORP_STATE entry and an EVENT entry.
  • Updated the COLIN sync job to work with batch processings.
  • Created unit tests for legal api related changes.

Local Testing
In depth local testing can be found in the test notes of the ticket.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the lear license (Apache 2.0).

@leodube-aot leodube-aot self-assigned this Oct 11, 2024
@@ -154,6 +154,7 @@ def get(legal_type, identifier, name_type):
@cors_preflight('GET')
@API.route('/internal/<string:info_type>', methods=['GET'])
@API.route('/internal/<string:legal_type>/<string:identifier>/<string:info_type>', methods=['GET'])
@API.route('/internal/<string:legal_type>/<string:identifier>', methods=['PATCH'])
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't entirely sure where the best place was to add this endpoint. I figured since we are updating the corp state and not actually creating a filing, then using an internal PATCH endpoint on the business made the most sense.

Copy link

sonarcloud bot commented Oct 16, 2024

colin_ids = send_filing(app, token, filing, filing_id)
update = None
if colin_ids and any(colin_ids):
update = update_colin_id(app, token, filing_id, colin_ids)
Copy link
Collaborator Author

@leodube-aot leodube-aot Oct 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found that colin_ids can return as [None], which actually evaluates to True. We need to make sure to not attempt updating colin ids if they are None, as it will still insert into the colin_event_ids table using a default sequence value. Using if colin_ids and any(colin_ids) does the trick

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its not expected to receive [None]. When did you receive it? any specific filing?

Copy link
Collaborator

@vysakh-menon-aot vysakh-menon-aot Oct 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a successful sync we must receive an event id and if failed send_filing will return None

Copy link
Collaborator Author

@leodube-aot leodube-aot Oct 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup so I tracked down the source of the issue.

It's caused when an involuntary dissolution filing is passed to colin api without any meta_data, or with incorrectly formed meta_data. You can see that in Filing.add_involuntary_dissolution_event can return None if this is the case. This gets returned as event_id = None and saved into the colinIds for the filing (with HTTP status CREATED, even though nothing was created).

It's probably pretty low risk, as I only encountered it because I made a mistake manually creating local test data.

Thinking more about this, it should probably be fixed in colin api rather than the updater job like I did here. This PR may not get merged (see Argus' comment), but this bug might still be worth fixing.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch

BatchProcessing.BatchProcessingStep.WARNING_LEVEL_1,
BatchProcessing.BatchProcessingStep.WARNING_LEVEL_2,
])).\
filter(BatchProcessing.status == BatchProcessing.BatchProcessingStatus.PROCESSING).\
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking if it's proper to only select batch processing in PROCESSING status...?

Copy link
Collaborator Author

@leodube-aot leodube-aot Oct 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ticket is on hold for now, but to still answer your question: yes I think it should only select PROCESSING status. My analysis on the statuses is that:

If we were to sync COMPLETED and WITHDRAWN status batch processings, we would get duplicates in COLIN since we would be syncing both the batch processing and their associated filings.

@argush3
Copy link
Collaborator

argush3 commented Oct 16, 2024

As per our conversation, this work is on hold until we take another look at what really needs to be synced back to COLIN if anything.

@leodube-aot leodube-aot marked this pull request as draft October 16, 2024 19:00
@leodube-aot leodube-aot marked this pull request as draft October 16, 2024 19:00
@leodube-aot
Copy link
Collaborator Author

Closing as no longer a requirement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants