-
Notifications
You must be signed in to change notification settings - Fork 81
Business filer DRS integration #3654
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
Open
flutistar
wants to merge
18
commits into
bcgov:main
Choose a base branch
from
flutistar:28412-drs-integration-business-filer
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
9e7fe0a
Business filer DRS integration
flutistar 288dc1f
Moved to its own service
flutistar b3823f4
updated sync function
flutistar dfeacd2
added FIRMs doc types
flutistar de0c5cc
fixed linting issue
flutistar 5fac055
removed unused doc types
flutistar f88dcf1
add condition to verify staff filing
flutistar 743e60a
replaced direct http call
flutistar 01bd60d
addressed comment
flutistar 04d64e9
added logging block
flutistar 56cdcb0
addressed comment
flutistar 77d70ed
updated env variables
flutistar d27c6ab
addressed comment
flutistar edc8ad8
addressed comments
flutistar 82aa714
fixed linting issue
flutistar fab99bd
fixed linting issue
flutistar df2bd08
updated config
flutistar 1fdaa19
updated env variable
flutistar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
4 changes: 2 additions & 2 deletions
4
python/common/document-record-service/src/document_record_service/utils/__init__.py
This file contains hidden or 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,4 +1,4 @@ | ||
| from .request_info import RequestInfo, get_request_info | ||
| from .common import get_document_class | ||
| from .common import get_document_class, get_document_type | ||
|
|
||
| __all__ = [get_request_info, RequestInfo, get_document_class] | ||
| __all__ = [get_request_info, RequestInfo, get_document_class, get_document_type] |
This file contains hidden or 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
This file contains hidden or 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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
This file contains hidden or 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
60 changes: 60 additions & 0 deletions
60
queue_services/business-filer/src/business_filer/services/document_service.py
This file contains hidden or 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,60 @@ | ||
| import copy | ||
|
|
||
| from business_model.models import Business, Filing, UserRoles | ||
| from document_record_service import DocumentRecordService, get_document_class | ||
| from document_record_service import RequestInfo as DrsRequestInfo | ||
| from flask import current_app | ||
|
|
||
| from business_filer.services import Flags | ||
| from business_filer.services.publish_event import PublishEvent | ||
|
|
||
|
|
||
| def update_drs_with_busienss_id(filing_submission: Filing, flags: Flags, business: Business): | ||
| document_id_state = filing_submission.filing_json["filing"]["header"].get("documentIdState", {}) | ||
| submitter_roles = filing_submission.submitter_roles | ||
|
|
||
| if document_id_state and flags.is_on("enable-document-records"): | ||
| filing_type = filing_submission.filing_type | ||
| temp_reg = filing_submission.temp_reg | ||
|
|
||
| # Replace temp_reg with business_identifier for static documents(or staff filing) | ||
| if (filing_type in ["incorporationApplication", "continuationIn"] | ||
| or ( | ||
| # If a filing (example amalgamationApplication) is created by staff, | ||
| # then staff uploads a scanned paper document to DRS and enter the document id at the time of filing | ||
| # replace temp identifier with the business identifier | ||
| submitter_roles == UserRoles.staff | ||
| and document_id_state["valid"] | ||
| and temp_reg | ||
| )): | ||
| # Get existing document on DRS | ||
| doc_list = DocumentRecordService().get_document( | ||
| DrsRequestInfo( | ||
| document_class=get_document_class(business.legal_type), | ||
| consumer_identifier=temp_reg | ||
| ) | ||
| ) | ||
|
|
||
| if not isinstance(doc_list, list): | ||
| current_app.logger.info( | ||
| f"No associated documents found for temporary registration ID: {temp_reg}" | ||
| ) | ||
| else: | ||
| # Update missing consumer document id | ||
vysakh-menon-aot marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if document_id_state["valid"] and document_id_state["consumerDocumentId"] == "": | ||
| copied_json = copy.deepcopy(filing_submission.filing_json) | ||
| copied_json["filing"]["header"]["documentIdState"]["consumerDocumentId"] = doc_list[0]["consumerDocumentId"] | ||
| filing_submission._filing_json = copied_json | ||
| current_app.logger.info( | ||
| f"Updated missing document id {doc_list[0]["consumerDocumentId"]}" | ||
| ) | ||
| # Replace temp registration id with business identifier: | ||
| for associated_document in doc_list: | ||
| doc_service_id = associated_document["documentServiceId"] | ||
| PublishEvent.publish_drs_creation_event(current_app, | ||
| DrsRequestInfo( | ||
| document_service_id=doc_service_id, | ||
| consumer_identifier=business.identifier, | ||
| consumer_reference_id=str(filing_submission.id) | ||
| ).json | ||
| ) | ||
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.