diff --git a/gcp-jobs/bn-retry/poetry.lock b/gcp-jobs/bn-retry/poetry.lock index 557c9b06ce..0e677d7bdb 100644 --- a/gcp-jobs/bn-retry/poetry.lock +++ b/gcp-jobs/bn-retry/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 2.1.3 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.4.1 and should not be changed by hand. [[package]] name = "aiofiles" @@ -286,10 +286,10 @@ files = [ [[package]] name = "business-model" -version = "3.3.13" +version = "3.4.1" description = "" optional = false -python-versions = ">=3.9,<4" +python-versions = ">=3.13,<3.14" groups = ["main"] files = [] develop = false @@ -306,14 +306,14 @@ pg8000 = ">=1.31.2,<2.0.0" pycountry = ">=24.6.1,<25.0.0" pydantic = ">=2.10.6,<3.0.0" pytz = ">=2025.1,<2026.0" -registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", rev = "2.18.54"} +registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", rev = "2.18.74"} sql-versioning = {git = "https://github.com/bcgov/lear.git", rev = "main", subdirectory = "python/common/sql-versioning-alt"} [package.source] type = "git" url = "https://github.com/bcgov/lear.git" reference = "main" -resolved_reference = "05a0c09709460b0ba216089efc2ebed555ed3a4e" +resolved_reference = "ab63e41cf55bbea31a66c4f12d608bd619eef05d" subdirectory = "python/common/business-registry-model" [[package]] @@ -1531,7 +1531,7 @@ fqdn = {version = "*", optional = true, markers = "extra == \"format\""} idna = {version = "*", optional = true, markers = "extra == \"format\""} isoduration = {version = "*", optional = true, markers = "extra == \"format\""} jsonpointer = {version = ">1.13", optional = true, markers = "extra == \"format\""} -jsonschema-specifications = ">=2023.03.6" +jsonschema-specifications = ">=2023.3.6" referencing = ">=0.28.4" rfc3339-validator = {version = "*", optional = true, markers = "extra == \"format\""} rfc3987 = {version = "*", optional = true, markers = "extra == \"format\""} @@ -2439,7 +2439,7 @@ rpds-py = ">=0.7.0" [[package]] name = "registry_schemas" -version = "2.18.54" +version = "2.18.74" description = "A short description of the project" optional = false python-versions = ">=3.6" @@ -2457,8 +2457,8 @@ strict-rfc3339 = "*" [package.source] type = "git" url = "https://github.com/bcgov/business-schemas.git" -reference = "2.18.54" -resolved_reference = "be9cf4995e213d185ca2bd4e5f600e878661e734" +reference = "2.18.74" +resolved_reference = "5abdc89a0f6eb06cbbac9ad66b580d7c76190ebc" [[package]] name = "requests" diff --git a/gcp-jobs/bn-retry/pyproject.toml b/gcp-jobs/bn-retry/pyproject.toml index f328452081..40457e85db 100644 --- a/gcp-jobs/bn-retry/pyproject.toml +++ b/gcp-jobs/bn-retry/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "bn-retry" -version = "0.1.1" +version = "0.1.2" description = "BN15 retry job for firms in LEAR" authors = [{name = "vysakh-menon"}] license = {text = "BSD-3-clause"} diff --git a/gcp-jobs/email-reminder/poetry.lock b/gcp-jobs/email-reminder/poetry.lock index 1f6197ec6c..0c78b261d6 100644 --- a/gcp-jobs/email-reminder/poetry.lock +++ b/gcp-jobs/email-reminder/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 2.3.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.4.1 and should not be changed by hand. [[package]] name = "aiofiles" @@ -294,7 +294,7 @@ files = [ [[package]] name = "business-model" -version = "3.3.22" +version = "3.4.1" description = "" optional = false python-versions = ">=3.13,<3.14" @@ -314,14 +314,14 @@ pg8000 = ">=1.31.2,<2.0.0" pycountry = ">=24.6.1,<25.0.0" pydantic = ">=2.10.6,<3.0.0" pytz = ">=2025.1,<2026.0" -registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", rev = "2.18.62"} +registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", rev = "2.18.74"} sql-versioning = {git = "https://github.com/bcgov/lear.git", rev = "main", subdirectory = "python/common/sql-versioning-alt"} [package.source] type = "git" url = "https://github.com/bcgov/lear.git" reference = "main" -resolved_reference = "0078d2e1d22319c9875e06ad77ee680973c09552" +resolved_reference = "ab63e41cf55bbea31a66c4f12d608bd619eef05d" subdirectory = "python/common/business-registry-model" [[package]] @@ -351,23 +351,25 @@ subdirectory = "python/common/business-registry-account" [[package]] name = "business-registry-common" -version = "0.1.0" +version = "0.1.1" description = "" optional = false -python-versions = "^3.13" +python-versions = ">=3.13,<3.14" groups = ["main"] files = [] develop = false [package.dependencies] -datedelta = "^1.4" -pytz = "^2025.1" +datedelta = ">=1.4,<2.0" +flask = ">=3.1.0,<4.0.0" +python-dateutil = ">=2.9.0,<3.0.0" +pytz = ">=2025.1,<2026.0" [package.source] type = "git" url = "https://github.com/bcgov/lear.git" reference = "main" -resolved_reference = "a18fd64eeac8736a8481b90e50409188a91cc601" +resolved_reference = "deecf506fc9e76fb9e52e91a69db0db10d93f068" subdirectory = "python/common/business-registry-common" [[package]] @@ -2541,7 +2543,7 @@ rpds-py = ">=0.7.0" [[package]] name = "registry_schemas" -version = "2.18.62" +version = "2.18.74" description = "A short description of the project" optional = false python-versions = ">=3.6" @@ -2559,8 +2561,8 @@ strict-rfc3339 = "*" [package.source] type = "git" url = "https://github.com/bcgov/business-schemas.git" -reference = "2.18.62" -resolved_reference = "1cea81cf14104fb7d4989169236eff13b3df16c4" +reference = "2.18.74" +resolved_reference = "5abdc89a0f6eb06cbbac9ad66b580d7c76190ebc" [[package]] name = "requests" diff --git a/gcp-jobs/email-reminder/pyproject.toml b/gcp-jobs/email-reminder/pyproject.toml index 21c3c6012d..b25fee9d0f 100644 --- a/gcp-jobs/email-reminder/pyproject.toml +++ b/gcp-jobs/email-reminder/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "email-reminder" -version = "0.1.3" +version = "0.1.4" description = "" authors = [ {name = "SBC-Connect"} diff --git a/gcp-jobs/filings-notebook-report/poetry.lock b/gcp-jobs/filings-notebook-report/poetry.lock index a5429ca4d1..d4a4fbc19e 100644 --- a/gcp-jobs/filings-notebook-report/poetry.lock +++ b/gcp-jobs/filings-notebook-report/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 2.3.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.4.1 and should not be changed by hand. [[package]] name = "aiofiles" @@ -1056,10 +1056,10 @@ botocore = ["botocore"] [[package]] name = "business-model" -version = "3.1.0" +version = "3.4.1" description = "" optional = false -python-versions = ">=3.9,<4" +python-versions = ">=3.13,<3.14" groups = ["test"] files = [] develop = false @@ -1076,14 +1076,14 @@ pg8000 = ">=1.31.2,<2.0.0" pycountry = ">=24.6.1,<25.0.0" pydantic = ">=2.10.6,<3.0.0" pytz = ">=2025.1,<2026.0" -registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", rev = "2.18.39"} +registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", rev = "2.18.74"} sql-versioning = {git = "https://github.com/bcgov/lear.git", rev = "main", subdirectory = "python/common/sql-versioning-alt"} [package.source] type = "git" url = "https://github.com/bcgov/lear.git" reference = "HEAD" -resolved_reference = "e35f54b80a210de908855cc09b3f09d4efed048f" +resolved_reference = "ab63e41cf55bbea31a66c4f12d608bd619eef05d" subdirectory = "python/common/business-registry-model" [[package]] @@ -5368,7 +5368,7 @@ files = [ [[package]] name = "registry_schemas" -version = "2.18.39" +version = "2.18.74" description = "A short description of the project" optional = false python-versions = ">=3.6" @@ -5386,8 +5386,8 @@ strict-rfc3339 = "*" [package.source] type = "git" url = "https://github.com/bcgov/business-schemas.git" -reference = "2.18.39" -resolved_reference = "c0aeb44d47f8cd126c85b6ca9a8a747f33266db1" +reference = "2.18.74" +resolved_reference = "5abdc89a0f6eb06cbbac9ad66b580d7c76190ebc" [[package]] name = "requests" diff --git a/gcp-jobs/filings-notebook-report/pyproject.toml b/gcp-jobs/filings-notebook-report/pyproject.toml index 5df84d6a24..34d6c0c8b7 100644 --- a/gcp-jobs/filings-notebook-report/pyproject.toml +++ b/gcp-jobs/filings-notebook-report/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "filings-notebook-report" -version = "0.1.2" +version = "0.1.3" description = "" authors = ["BrandonSharratt "] readme = "README.md" diff --git a/gcp-jobs/involuntary-dissolutions/poetry.lock b/gcp-jobs/involuntary-dissolutions/poetry.lock index b852438a8f..0e961d6dc2 100644 --- a/gcp-jobs/involuntary-dissolutions/poetry.lock +++ b/gcp-jobs/involuntary-dissolutions/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 2.1.3 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.4.1 and should not be changed by hand. [[package]] name = "aiofiles" @@ -294,10 +294,10 @@ files = [ [[package]] name = "business-model" -version = "3.0.0" +version = "3.4.1" description = "" optional = false -python-versions = ">=3.9,<4" +python-versions = ">=3.13,<3.14" groups = ["main"] files = [] develop = false @@ -314,14 +314,14 @@ pg8000 = ">=1.31.2,<2.0.0" pycountry = ">=24.6.1,<25.0.0" pydantic = ">=2.10.6,<3.0.0" pytz = ">=2025.1,<2026.0" -registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", rev = "2.18.39"} +registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", rev = "2.18.74"} sql-versioning = {git = "https://github.com/bcgov/lear.git", rev = "main", subdirectory = "python/common/sql-versioning-alt"} [package.source] type = "git" url = "https://github.com/bcgov/lear.git" reference = "HEAD" -resolved_reference = "f888b656fa266eb108880a467bf6728dc6efc171" +resolved_reference = "ab63e41cf55bbea31a66c4f12d608bd619eef05d" subdirectory = "python/common/business-registry-model" [[package]] @@ -351,23 +351,25 @@ subdirectory = "python/common/business-registry-account" [[package]] name = "business-registry-common" -version = "0.1.0" +version = "0.1.1" description = "" optional = false -python-versions = "^3.13" +python-versions = ">=3.13,<3.14" groups = ["main"] files = [] develop = false [package.dependencies] -datedelta = "^1.4" -pytz = "^2025.1" +datedelta = ">=1.4,<2.0" +flask = ">=3.1.0,<4.0.0" +python-dateutil = ">=2.9.0,<3.0.0" +pytz = ">=2025.1,<2026.0" [package.source] type = "git" url = "https://github.com/bcgov/lear.git" reference = "HEAD" -resolved_reference = "f888b656fa266eb108880a467bf6728dc6efc171" +resolved_reference = "deecf506fc9e76fb9e52e91a69db0db10d93f068" subdirectory = "python/common/business-registry-common" [[package]] @@ -1240,7 +1242,7 @@ files = [ [package.dependencies] google-auth = ">=2.14.1,<3.0.0" googleapis-common-protos = ">=1.56.2,<2.0.0" -grpcio = {version = ">=1.49.1,<2.0dev", optional = true, markers = "python_version >= \"3.11\" and extra == \"grpc\""} +grpcio = {version = ">=1.49.1,<2.0.dev0", optional = true, markers = "python_version >= \"3.11\" and extra == \"grpc\""} grpcio-status = {version = ">=1.49.1,<2.0.dev0", optional = true, markers = "python_version >= \"3.11\" and extra == \"grpc\""} proto-plus = {version = ">=1.25.0,<2.0.0", markers = "python_version >= \"3.13\""} protobuf = ">=3.19.5,<3.20.0 || >3.20.0,<3.20.1 || >3.20.1,<4.21.0 || >4.21.0,<4.21.1 || >4.21.1,<4.21.2 || >4.21.2,<4.21.3 || >4.21.3,<4.21.4 || >4.21.4,<4.21.5 || >4.21.5,<7.0.0" @@ -1248,7 +1250,7 @@ requests = ">=2.18.0,<3.0.0" [package.extras] async-rest = ["google-auth[aiohttp] (>=2.35.0,<3.0.dev0)"] -grpc = ["grpcio (>=1.33.2,<2.0dev)", "grpcio (>=1.49.1,<2.0dev) ; python_version >= \"3.11\"", "grpcio-status (>=1.33.2,<2.0.dev0)", "grpcio-status (>=1.49.1,<2.0.dev0) ; python_version >= \"3.11\""] +grpc = ["grpcio (>=1.33.2,<2.0.dev0)", "grpcio (>=1.49.1,<2.0.dev0) ; python_version >= \"3.11\"", "grpcio-status (>=1.33.2,<2.0.dev0)", "grpcio-status (>=1.49.1,<2.0.dev0) ; python_version >= \"3.11\""] grpcgcp = ["grpcio-gcp (>=0.2.2,<1.0.dev0)"] grpcio-gcp = ["grpcio-gcp (>=0.2.2,<1.0.dev0)"] @@ -1506,7 +1508,7 @@ files = [ [package.dependencies] googleapis-common-protos = ">=1.5.5" grpcio = ">=1.71.0" -protobuf = ">=5.26.1,<6.0dev" +protobuf = ">=5.26.1,<6.0.dev0" [[package]] name = "idna" @@ -1634,7 +1636,7 @@ fqdn = {version = "*", optional = true, markers = "extra == \"format\""} idna = {version = "*", optional = true, markers = "extra == \"format\""} isoduration = {version = "*", optional = true, markers = "extra == \"format\""} jsonpointer = {version = ">1.13", optional = true, markers = "extra == \"format\""} -jsonschema-specifications = ">=2023.03.6" +jsonschema-specifications = ">=2023.3.6" referencing = ">=0.28.4" rfc3339-validator = {version = "*", optional = true, markers = "extra == \"format\""} rfc3987 = {version = "*", optional = true, markers = "extra == \"format\""} @@ -2553,7 +2555,7 @@ rpds-py = ">=0.7.0" [[package]] name = "registry_schemas" -version = "2.18.39" +version = "2.18.74" description = "A short description of the project" optional = false python-versions = ">=3.6" @@ -2571,8 +2573,8 @@ strict-rfc3339 = "*" [package.source] type = "git" url = "https://github.com/bcgov/business-schemas.git" -reference = "2.18.39" -resolved_reference = "c0aeb44d47f8cd126c85b6ca9a8a747f33266db1" +reference = "2.18.74" +resolved_reference = "5abdc89a0f6eb06cbbac9ad66b580d7c76190ebc" [[package]] name = "requests" diff --git a/gcp-jobs/involuntary-dissolutions/pyproject.toml b/gcp-jobs/involuntary-dissolutions/pyproject.toml index 6eae234134..78fb2b2e2d 100644 --- a/gcp-jobs/involuntary-dissolutions/pyproject.toml +++ b/gcp-jobs/involuntary-dissolutions/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "involuntary_dissolutions" -version = "0.1.1" +version = "0.1.2" description = "" authors = ["BrandonSharratt "] readme = "README.md" diff --git a/legal-api/poetry.lock b/legal-api/poetry.lock index 3fb3b281b0..b50f55e319 100644 --- a/legal-api/poetry.lock +++ b/legal-api/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 2.3.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.4.1 and should not be changed by hand. [[package]] name = "aiofiles" @@ -316,7 +316,7 @@ files = [ [[package]] name = "business-model" -version = "3.3.33" +version = "3.4.1" description = "" optional = false python-versions = ">=3.13,<3.14" @@ -342,8 +342,8 @@ sql-versioning = {git = "https://github.com/bcgov/lear.git", rev = "main", subdi [package.source] type = "git" url = "https://github.com/bcgov/lear.git" -reference = "hotfix-34201-ar-schema-2" -resolved_reference = "3ba5dec9437f839e052e02d811c234d899cd3f78" +reference = "main" +resolved_reference = "ab63e41cf55bbea31a66c4f12d608bd619eef05d" subdirectory = "python/common/business-registry-model" [[package]] @@ -396,7 +396,7 @@ subdirectory = "python/common/business-registry-common" [[package]] name = "business-registry-digital-credentials" -version = "0.2.1" +version = "0.2.0" description = "" optional = false python-versions = ">=3.13,<3.14" @@ -405,7 +405,7 @@ files = [] develop = false [package.dependencies] -business-model = {git = "https://github.com/bcgov/lear.git", branch = "hotfix-34201-ar-schema-2", subdirectory = "python/common/business-registry-model"} +business-model = {git = "https://github.com/bcgov/lear.git", branch = "main", subdirectory = "python/common/business-registry-model"} business-registry-common = {git = "https://github.com/bcgov/lear.git", branch = "main", subdirectory = "python/common/business-registry-common"} flask-jwt-oidc = "^0.8.0" pyjwt = "^2.8.0" @@ -414,13 +414,13 @@ requests = "^2.32.3" [package.source] type = "git" url = "https://github.com/bcgov/lear.git" -reference = "hotfix-34201-ar-schema-2" -resolved_reference = "3ba5dec9437f839e052e02d811c234d899cd3f78" +reference = "main" +resolved_reference = "a84cfb9b8707e9f12b156f296393eb63c3297412" subdirectory = "python/common/business-registry-digital-credentials" [[package]] name = "business-registry-dissolution" -version = "0.1.3" +version = "0.1.2" description = "" optional = false python-versions = ">=3.13,<3.14" @@ -429,7 +429,7 @@ files = [] develop = false [package.dependencies] -business-model = {git = "https://github.com/bcgov/lear.git", rev = "hotfix-34201-ar-schema-2", subdirectory = "python/common/business-registry-model"} +business-model = {git = "https://github.com/bcgov/lear.git", rev = "main", subdirectory = "python/common/business-registry-model"} business-registry-account = {git = "https://github.com/bcgov/lear.git", rev = "main", subdirectory = "python/common/business-registry-account"} business-registry-common = {git = "https://github.com/bcgov/lear.git", rev = "main", subdirectory = "python/common/business-registry-common"} flask = ">=3.1.0,<4.0.0" @@ -438,8 +438,8 @@ python-dotenv = ">=1.1.0,<2.0.0" [package.source] type = "git" url = "https://github.com/bcgov/lear.git" -reference = "hotfix-34201-ar-schema-2" -resolved_reference = "3ba5dec9437f839e052e02d811c234d899cd3f78" +reference = "main" +resolved_reference = "b415feb9f1a091ecc87a3a353e3a0985da4d094c" subdirectory = "python/common/business-registry-dissolution" [[package]] @@ -4436,4 +4436,4 @@ type = ["pytest-mypy"] [metadata] lock-version = "2.1" python-versions = ">=3.13,<3.14" -content-hash = "49aa0bd054c02a0804165f8bdf66cb5381dee1073b5243fc8dfca12f4e8165bc" +content-hash = "38eb06e163c276a193e17597b91b0b3b3a58f445a1d060dfda9f4d68d813871e" diff --git a/legal-api/pyproject.toml b/legal-api/pyproject.toml index 377078a57b..9776690fd4 100644 --- a/legal-api/pyproject.toml +++ b/legal-api/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "legal-api" -version = "3.1.2" +version = "3.1.3" description = "" authors = [ {name = "thor",email = "1042854+thorwolpert@users.noreply.github.com"} @@ -32,11 +32,11 @@ dependencies = [ "html-sanitizer (==2.4.1)", "lxml (>=6.1.1)", - "business-model @ git+https://github.com/bcgov/lear.git@hotfix-34201-ar-schema-2#subdirectory=python/common/business-registry-model", + "business-model @ git+https://github.com/bcgov/lear.git@main#subdirectory=python/common/business-registry-model", "business-registry-account @ git+https://github.com/bcgov/lear.git@main#subdirectory=python/common/business-registry-account", "business-registry-common @ git+https://github.com/bcgov/lear.git@main#subdirectory=python/common/business-registry-common", - "business-registry-digital-credentials @ git+https://github.com/bcgov/lear.git@hotfix-34201-ar-schema-2#subdirectory=python/common/business-registry-digital-credentials", - "business-registry-dissolution @ git+https://github.com/bcgov/lear.git@hotfix-34201-ar-schema-2#subdirectory=python/common/business-registry-dissolution", + "business-registry-digital-credentials @ git+https://github.com/bcgov/lear.git@main#subdirectory=python/common/business-registry-digital-credentials", + "business-registry-dissolution @ git+https://github.com/bcgov/lear.git@main#subdirectory=python/common/business-registry-dissolution", "cloud-sql-connector @ git+https://github.com/bcgov/sbc-connect-common.git@main#subdirectory=python/cloud-sql-connector", "gcp-queue @ git+https://github.com/bcgov/sbc-connect-common.git@main#subdirectory=python/gcp-queue", "structured-logging @ git+https://github.com/bcgov/sbc-connect-common.git@main#subdirectory=python/structured-logging" diff --git a/legal-api/src/legal_api/core/filing.py b/legal-api/src/legal_api/core/filing.py index 8eb407a144..bb7abb1919 100644 --- a/legal-api/src/legal_api/core/filing.py +++ b/legal-api/src/legal_api/core/filing.py @@ -443,9 +443,7 @@ def ledger(business_id: int, # noqa: PLR0913 if filing.meta_data: ledger_filing["data"] = filing.meta_data - # orders - if filing.court_order_file_number or filing.order_details: - Filing._add_ledger_order(filing, ledger_filing) + Filing._add_ledger_order(filing, ledger_filing) core_filing: Filing = Filing() # Filing.get_document_list needs a core Filing. core_filing._storage = filing # pylint: disable=protected-access @@ -474,14 +472,24 @@ def common_ledger_items(business_identifier: str, filing_storage: FilingStorage) } @staticmethod - def _add_ledger_order(filing: FilingStorage, ledger_filing: dict) -> dict: - court_order_data = {"fileNumber": filing.court_order_file_number} - if filing.court_order_date: - court_order_data["orderDate"] = filing.court_order_date - if filing.court_order_effect_of_order: - court_order_data["effectOfOrder"] = filing.court_order_effect_of_order - if filing.order_details: - court_order_data["orderDetails"] = filing.order_details + def _add_ledger_order(filing: FilingStorage, ledger_filing: dict): + if not (court_order := filing.court_orders.one_or_none()) and not filing.details: + return + + court_order_data = {} + if court_order and court_order.file_number: + court_order_data["fileNumber"] = court_order.file_number + if court_order.order_date: + court_order_data["orderDate"] = court_order.order_date + if court_order.effect_of_order: + court_order_data["effectOfOrder"] = court_order.effect_of_order + if court_order.order_details: + court_order_data["orderDetails"] = court_order.order_details + + # None of the filings have both court_order.order_details and filing.details and UI depends on the orderDetails + # Future: would be ideal to sepatate the two and have both in the ledger_filing if they exist + if filing.details: + court_order_data["orderDetails"] = filing.details if not ledger_filing.get("data"): ledger_filing["data"] = {} @@ -654,4 +662,4 @@ def get_document_list(business, # noqa: PLR0912, PLR0915 NOSONAR(S3776) if user_is_ca: del documents["documents"]["receipt"] - return documents \ No newline at end of file + return documents diff --git a/legal-api/tests/unit/resources/v2/test_business_filings/test_filings_ledger.py b/legal-api/tests/unit/resources/v2/test_business_filings/test_filings_ledger.py index af1c094b75..1e4bf0b801 100644 --- a/legal-api/tests/unit/resources/v2/test_business_filings/test_filings_ledger.py +++ b/legal-api/tests/unit/resources/v2/test_business_filings/test_filings_ledger.py @@ -24,7 +24,7 @@ import datedelta import pytest -from business_model.models import Business, Comment, Filing as FilingStorage, UserRoles +from business_model.models import Business, Comment, CourtOrder, Filing as FilingStorage, UserRoles from legal_api.core import Filing, FILINGS from legal_api.services.authz import STAFF_ROLE from registry_schemas.example_data import ( @@ -255,14 +255,18 @@ def test_ledger_court_order(app, session, client, jwt, test_name, file_number, o """Assert that the ledger returns court_order values.""" # setup identifier = 'BC1234567' - business, filing_storage = ledger_element_setup_help(identifier) + business, filing = ledger_element_setup_help(identifier, filing_name='courtOrder') - filing_storage.court_order_file_number = file_number - filing_storage.court_order_date = order_date - filing_storage.court_order_effect_of_order = effect_of_order - filing_storage.order_details = order_details + if expected: + filing.court_orders.append(CourtOrder( + business_id=business.id, + file_number=file_number, + effect_of_order=effect_of_order, + order_details=order_details, + order_date=order_date + )) + filing.save() - filing_storage.save() headers=create_header(jwt, [UserRoles.system], identifier) def mock_auth(one, two): # pylint: disable=unused-argument; mocks of library methods return headers[one] diff --git a/python/common/business-registry-digital-credentials/poetry.lock b/python/common/business-registry-digital-credentials/poetry.lock index b86aad484a..81e82cc343 100644 --- a/python/common/business-registry-digital-credentials/poetry.lock +++ b/python/common/business-registry-digital-credentials/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 2.3.2 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.4.1 and should not be changed by hand. [[package]] name = "alembic" @@ -105,7 +105,7 @@ files = [ [[package]] name = "business-model" -version = "3.3.30" +version = "3.4.1" description = "" optional = false python-versions = ">=3.13,<3.14" @@ -125,14 +125,14 @@ pg8000 = ">=1.31.2,<2.0.0" pycountry = ">=24.6.1,<25.0.0" pydantic = ">=2.10.6,<3.0.0" pytz = ">=2025.1,<2026.0" -registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", rev = "2.18.69"} +registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", rev = "2.18.74"} sql-versioning = {git = "https://github.com/bcgov/lear.git", rev = "main", subdirectory = "python/common/sql-versioning-alt"} [package.source] type = "git" url = "https://github.com/bcgov/lear.git" reference = "main" -resolved_reference = "b23c6da0282d8ab9387e3d4d618cf000489d2359" +resolved_reference = "ab63e41cf55bbea31a66c4f12d608bd619eef05d" subdirectory = "python/common/business-registry-model" [[package]] @@ -1572,8 +1572,8 @@ strict-rfc3339 = "*" [package.source] type = "git" url = "https://github.com/bcgov/business-schemas.git" -reference = "2.18.69" -resolved_reference = "25282bd6cf4de87e9dc6bc44f619ed723b64c7f2" +reference = "2.18.74" +resolved_reference = "5abdc89a0f6eb06cbbac9ad66b580d7c76190ebc" [[package]] name = "requests" diff --git a/python/common/business-registry-digital-credentials/pyproject.toml b/python/common/business-registry-digital-credentials/pyproject.toml index 98fe00c6e4..9d14110d1c 100644 --- a/python/common/business-registry-digital-credentials/pyproject.toml +++ b/python/common/business-registry-digital-credentials/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "business-registry-digital-credentials" -version = "0.2.0" +version = "0.2.1" description = "" authors = ["Lucas O'Neil "] readme = "README.md" diff --git a/python/common/business-registry-dissolution/poetry.lock b/python/common/business-registry-dissolution/poetry.lock index c9d49a6ca1..788f23a3fa 100644 --- a/python/common/business-registry-dissolution/poetry.lock +++ b/python/common/business-registry-dissolution/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 2.3.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.4.1 and should not be changed by hand. [[package]] name = "alembic" @@ -113,7 +113,7 @@ files = [ [[package]] name = "business-model" -version = "3.3.30" +version = "3.4.1" description = "" optional = false python-versions = ">=3.13,<3.14" @@ -133,14 +133,14 @@ pg8000 = ">=1.31.2,<2.0.0" pycountry = ">=24.6.1,<25.0.0" pydantic = ">=2.10.6,<3.0.0" pytz = ">=2025.1,<2026.0" -registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", rev = "2.18.69"} +registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", rev = "2.18.74"} sql-versioning = {git = "https://github.com/bcgov/lear.git", rev = "main", subdirectory = "python/common/sql-versioning-alt"} [package.source] type = "git" url = "https://github.com/bcgov/lear.git" reference = "main" -resolved_reference = "c9c4669cbe5630e05a48179619c7c19432e6fdec" +resolved_reference = "ab63e41cf55bbea31a66c4f12d608bd619eef05d" subdirectory = "python/common/business-registry-model" [[package]] @@ -1440,7 +1440,7 @@ rpds-py = ">=0.7.0" [[package]] name = "registry_schemas" -version = "2.18.69" +version = "2.18.74" description = "A short description of the project" optional = false python-versions = ">=3.6" @@ -1458,8 +1458,8 @@ strict-rfc3339 = "*" [package.source] type = "git" url = "https://github.com/bcgov/business-schemas.git" -reference = "2.18.69" -resolved_reference = "25282bd6cf4de87e9dc6bc44f619ed723b64c7f2" +reference = "2.18.74" +resolved_reference = "5abdc89a0f6eb06cbbac9ad66b580d7c76190ebc" [[package]] name = "requests" diff --git a/python/common/business-registry-dissolution/pyproject.toml b/python/common/business-registry-dissolution/pyproject.toml index 3cd24b5b70..0e22abf609 100644 --- a/python/common/business-registry-dissolution/pyproject.toml +++ b/python/common/business-registry-dissolution/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "business-registry-dissolution" -version = "0.1.2" +version = "0.1.3" description = "" authors = [{name = "BC Business Registry"}] readme = "README.md" diff --git a/queue_services/business-bn/poetry.lock b/queue_services/business-bn/poetry.lock index 4945782566..70cdd48c1d 100644 --- a/queue_services/business-bn/poetry.lock +++ b/queue_services/business-bn/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 2.3.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.4.1 and should not be changed by hand. [[package]] name = "aiofiles" @@ -301,7 +301,7 @@ files = [ [[package]] name = "business-model" -version = "3.3.23" +version = "3.4.1" description = "" optional = false python-versions = ">=3.13,<3.14" @@ -321,14 +321,14 @@ pg8000 = ">=1.31.2,<2.0.0" pycountry = ">=24.6.1,<25.0.0" pydantic = ">=2.10.6,<3.0.0" pytz = ">=2025.1,<2026.0" -registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", rev = "2.18.62"} +registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", rev = "2.18.74"} sql-versioning = {git = "https://github.com/bcgov/lear.git", rev = "main", subdirectory = "python/common/sql-versioning-alt"} [package.source] type = "git" url = "https://github.com/bcgov/lear.git" reference = "main" -resolved_reference = "b745e248a60f21f23171b495cb5e1098ccf08079" +resolved_reference = "deecf506fc9e76fb9e52e91a69db0db10d93f068" subdirectory = "python/common/business-registry-model" [[package]] @@ -358,23 +358,25 @@ subdirectory = "python/common/business-registry-account" [[package]] name = "business-registry-common" -version = "0.1.0" +version = "0.1.1" description = "" optional = false -python-versions = ">=3.9,<4.0" +python-versions = ">=3.13,<3.14" groups = ["main"] files = [] develop = false [package.dependencies] -datedelta = "^1.4" -pytz = "^2025.1" +datedelta = ">=1.4,<2.0" +flask = ">=3.1.0,<4.0.0" +python-dateutil = ">=2.9.0,<3.0.0" +pytz = ">=2025.1,<2026.0" [package.source] type = "git" url = "https://github.com/bcgov/lear.git" reference = "main" -resolved_reference = "b745e248a60f21f23171b495cb5e1098ccf08079" +resolved_reference = "deecf506fc9e76fb9e52e91a69db0db10d93f068" subdirectory = "python/common/business-registry-common" [[package]] @@ -2761,7 +2763,7 @@ files = [ [[package]] name = "registry_schemas" -version = "2.18.62" +version = "2.18.74" description = "A short description of the project" optional = false python-versions = ">=3.6" @@ -2779,8 +2781,8 @@ strict-rfc3339 = "*" [package.source] type = "git" url = "https://github.com/bcgov/business-schemas.git" -reference = "2.18.62" -resolved_reference = "1cea81cf14104fb7d4989169236eff13b3df16c4" +reference = "2.18.74" +resolved_reference = "5abdc89a0f6eb06cbbac9ad66b580d7c76190ebc" [[package]] name = "requests" diff --git a/queue_services/business-bn/pyproject.toml b/queue_services/business-bn/pyproject.toml index 6a7d23ad84..b2cc15b1d6 100644 --- a/queue_services/business-bn/pyproject.toml +++ b/queue_services/business-bn/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "business-bn" -version = "0.1.5" +version = "0.1.6" description = "" authors = ["Patrick Wang "] readme = "README.md" diff --git a/queue_services/business-digital-credentials/poetry.lock b/queue_services/business-digital-credentials/poetry.lock index e7a6f29981..754fe170fa 100644 --- a/queue_services/business-digital-credentials/poetry.lock +++ b/queue_services/business-digital-credentials/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 2.3.2 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.4.1 and should not be changed by hand. [[package]] name = "aiofiles" @@ -286,7 +286,7 @@ files = [ [[package]] name = "business-model" -version = "3.3.30" +version = "3.4.1" description = "" optional = false python-versions = ">=3.13,<3.14" @@ -306,14 +306,14 @@ pg8000 = ">=1.31.2,<2.0.0" pycountry = ">=24.6.1,<25.0.0" pydantic = ">=2.10.6,<3.0.0" pytz = ">=2025.1,<2026.0" -registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", rev = "2.18.69"} +registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", rev = "2.18.74"} sql-versioning = {git = "https://github.com/bcgov/lear.git", rev = "main", subdirectory = "python/common/sql-versioning-alt"} [package.source] type = "git" url = "https://github.com/bcgov/lear.git" reference = "main" -resolved_reference = "2b62a37bf206edda1241cb2748213e2ef956bbe1" +resolved_reference = "deecf506fc9e76fb9e52e91a69db0db10d93f068" subdirectory = "python/common/business-registry-model" [[package]] @@ -2751,7 +2751,7 @@ rpds-py = ">=0.7.0" [[package]] name = "registry_schemas" -version = "2.18.62" +version = "2.18.74" description = "A short description of the project" optional = false python-versions = ">=3.6" @@ -2769,8 +2769,8 @@ strict-rfc3339 = "*" [package.source] type = "git" url = "https://github.com/bcgov/business-schemas.git" -reference = "2.18.69" -resolved_reference = "25282bd6cf4de87e9dc6bc44f619ed723b64c7f2" +reference = "2.18.74" +resolved_reference = "5abdc89a0f6eb06cbbac9ad66b580d7c76190ebc" [[package]] name = "requests" diff --git a/queue_services/business-digital-credentials/pyproject.toml b/queue_services/business-digital-credentials/pyproject.toml index 571fde9540..f5616d0f2f 100644 --- a/queue_services/business-digital-credentials/pyproject.toml +++ b/queue_services/business-digital-credentials/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "business-digital-credentials" -version = "0.2.0" +version = "0.2.1" description = "This module is the service worker for handling events that deal with Digital Business Card credential tasks." authors = ["Lucas O'Neil "] license = "BSD-3-Clause" diff --git a/queue_services/business-emailer/poetry.lock b/queue_services/business-emailer/poetry.lock index 8938b0dfbe..bf47849ab4 100644 --- a/queue_services/business-emailer/poetry.lock +++ b/queue_services/business-emailer/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 2.3.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.4.1 and should not be changed by hand. [[package]] name = "aiofiles" @@ -368,7 +368,7 @@ files = [ [[package]] name = "business-model" -version = "3.3.31" +version = "3.4.1" description = "" optional = false python-versions = ">=3.13,<3.14" @@ -388,14 +388,14 @@ pg8000 = ">=1.31.2,<2.0.0" pycountry = ">=24.6.1,<25.0.0" pydantic = ">=2.10.6,<3.0.0" pytz = ">=2025.1,<2026.0" -registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", rev = "2.18.71"} +registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", rev = "2.18.74"} sql-versioning = {git = "https://github.com/bcgov/lear.git", rev = "main", subdirectory = "python/common/sql-versioning-alt"} [package.source] type = "git" url = "https://github.com/bcgov/lear.git" reference = "HEAD" -resolved_reference = "76a8ad5a4f6665897dac21611558d7533f97a762" +resolved_reference = "deecf506fc9e76fb9e52e91a69db0db10d93f068" subdirectory = "python/common/business-registry-model" [[package]] @@ -2932,7 +2932,7 @@ rpds-py = ">=0.7.0" [[package]] name = "registry_schemas" -version = "2.18.71" +version = "2.18.74" description = "A short description of the project" optional = false python-versions = ">=3.6" @@ -2950,8 +2950,8 @@ strict-rfc3339 = "*" [package.source] type = "git" url = "https://github.com/bcgov/business-schemas.git" -reference = "2.18.71" -resolved_reference = "e8f9a9c1a2ae9a98f7fa8bb05a6f982cb765263c" +reference = "2.18.74" +resolved_reference = "5abdc89a0f6eb06cbbac9ad66b580d7c76190ebc" [[package]] name = "reportlab" diff --git a/queue_services/business-emailer/pyproject.toml b/queue_services/business-emailer/pyproject.toml index 24e55f1b98..1ceb65d334 100644 --- a/queue_services/business-emailer/pyproject.toml +++ b/queue_services/business-emailer/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "business-emailer" -version = "0.1.9" +version = "0.1.10" description = "This module is the service worker for sending emails about entity related events." authors = ["Hrvoje Fekete "] license = "BSD-3-Clause" diff --git a/queue_services/business-filer/poetry.lock b/queue_services/business-filer/poetry.lock index 8b2132cd1d..cb724c25be 100644 --- a/queue_services/business-filer/poetry.lock +++ b/queue_services/business-filer/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 2.3.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.4.1 and should not be changed by hand. [[package]] name = "aiofiles" @@ -294,7 +294,7 @@ files = [ [[package]] name = "business-model" -version = "3.3.32" +version = "3.4.1" description = "" optional = false python-versions = ">=3.13,<3.14" @@ -314,14 +314,14 @@ pg8000 = ">=1.31.2,<2.0.0" pycountry = ">=24.6.1,<25.0.0" pydantic = ">=2.10.6,<3.0.0" pytz = ">=2025.1,<2026.0" -registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", rev = "2.18.73"} +registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", rev = "2.18.74"} sql-versioning = {git = "https://github.com/bcgov/lear.git", rev = "main", subdirectory = "python/common/sql-versioning-alt"} [package.source] type = "git" url = "https://github.com/bcgov/lear.git" reference = "main" -resolved_reference = "295ecb7a24620142f1a18af02fb191df4cafcc85" +resolved_reference = "deecf506fc9e76fb9e52e91a69db0db10d93f068" subdirectory = "python/common/business-registry-model" [[package]] @@ -2791,7 +2791,7 @@ rpds-py = ">=0.7.0" [[package]] name = "registry_schemas" -version = "2.18.73" +version = "2.18.70" description = "A short description of the project" optional = false python-versions = ">=3.6" @@ -2809,8 +2809,8 @@ strict-rfc3339 = "*" [package.source] type = "git" url = "https://github.com/bcgov/business-schemas.git" -reference = "2.18.73" -resolved_reference = "e6999a46b6e38c52cc79f0e5a3c9fcbd0c473434" +reference = "2.18.74" +resolved_reference = "5abdc89a0f6eb06cbbac9ad66b580d7c76190ebc" [[package]] name = "requests" diff --git a/queue_services/business-filer/pyproject.toml b/queue_services/business-filer/pyproject.toml index 626f7e1dc7..05c0cbabb7 100644 --- a/queue_services/business-filer/pyproject.toml +++ b/queue_services/business-filer/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "business-filer" -version = "3.0.22" +version = "3.0.23" description = "Business Registry Filer Service" authors = [ {name = "thor",email = "1042854+thorwolpert@users.noreply.github.com"} diff --git a/queue_services/business-filer/src/business_filer/filing_processors/alteration.py b/queue_services/business-filer/src/business_filer/filing_processors/alteration.py index d7ee95361a..7ddfbe234f 100644 --- a/queue_services/business-filer/src/business_filer/filing_processors/alteration.py +++ b/queue_services/business-filer/src/business_filer/filing_processors/alteration.py @@ -91,7 +91,7 @@ def process( # update court order, if any is present with suppress(IndexError, KeyError, TypeError): court_order_json = dpath.get(filing, "/alteration/courtOrder") - filings.update_filing_court_order(filing_submission, court_order_json) + filings.create_court_order(filing_submission, court_order_json) # update name translations, if any with suppress(IndexError, KeyError, TypeError): diff --git a/queue_services/business-filer/src/business_filer/filing_processors/amalgamation_application.py b/queue_services/business-filer/src/business_filer/filing_processors/amalgamation_application.py index da91db0294..27e419f427 100644 --- a/queue_services/business-filer/src/business_filer/filing_processors/amalgamation_application.py +++ b/queue_services/business-filer/src/business_filer/filing_processors/amalgamation_application.py @@ -129,7 +129,7 @@ def process(business: Business, # pylint: disable=too-many-branches, too-many-l aliases.update_aliases(business, name_translations) if court_order := amalgamation_filing.get("courtOrder"): - filings.update_filing_court_order(filing_rec, court_order) + filings.create_court_order(filing_rec, court_order, business) # Update the filing json with identifier and founding date. amalgamation_json = copy.deepcopy(filing_rec.filing_json) diff --git a/queue_services/business-filer/src/business_filer/filing_processors/amalgamation_out.py b/queue_services/business-filer/src/business_filer/filing_processors/amalgamation_out.py index 520ea7e3c3..59c0a7734d 100644 --- a/queue_services/business-filer/src/business_filer/filing_processors/amalgamation_out.py +++ b/queue_services/business-filer/src/business_filer/filing_processors/amalgamation_out.py @@ -27,7 +27,7 @@ def process(business: Business, amalgamation_out_filing: Filing, filing: dict, f # update amalgamation out, if any is present with suppress(IndexError, KeyError, TypeError): court_order_json = dpath.get(filing, "/amalgamationOut/courtOrder") - filings.update_filing_court_order(amalgamation_out_filing, court_order_json) + filings.create_court_order(amalgamation_out_filing, court_order_json) amalgamation_out_json = filing["amalgamationOut"] diff --git a/queue_services/business-filer/src/business_filer/filing_processors/change_of_liquidators.py b/queue_services/business-filer/src/business_filer/filing_processors/change_of_liquidators.py index de9e63c69f..9e27fcc97c 100644 --- a/queue_services/business-filer/src/business_filer/filing_processors/change_of_liquidators.py +++ b/queue_services/business-filer/src/business_filer/filing_processors/change_of_liquidators.py @@ -40,7 +40,7 @@ from business_filer.common.services import InvoluntaryDissolutionService from business_filer.filing_meta import FilingMeta -from business_filer.filing_processors.filing_components.filings import update_filing_court_order +from business_filer.filing_processors.filing_components.filings import create_court_order from business_filer.filing_processors.filing_components.offices import update_or_create_offices from business_filer.filing_processors.filing_components.relationships import ( cease_relationships, @@ -96,4 +96,4 @@ def process(business: Business, filing_rec: Filing, filing_meta: FilingMeta): # update court order, if any is present if court_order := filing_json["filing"]["changeOfLiquidators"].get("courtOrder"): - update_filing_court_order(filing_rec, court_order) + create_court_order(filing_rec, court_order) diff --git a/queue_services/business-filer/src/business_filer/filing_processors/change_of_receivers.py b/queue_services/business-filer/src/business_filer/filing_processors/change_of_receivers.py index c8a5824559..43170b90c1 100644 --- a/queue_services/business-filer/src/business_filer/filing_processors/change_of_receivers.py +++ b/queue_services/business-filer/src/business_filer/filing_processors/change_of_receivers.py @@ -37,7 +37,7 @@ from business_model.models import Business, Filing, PartyRole from business_filer.filing_meta import FilingMeta -from business_filer.filing_processors.filing_components.filings import update_filing_court_order +from business_filer.filing_processors.filing_components.filings import create_court_order from business_filer.filing_processors.filing_components.relationships import ( cease_relationships, create_relationships, @@ -67,4 +67,4 @@ def process(business: Business, filing_rec: Filing, filing_meta: FilingMeta): # update court order, if any is present if court_order := filing_json["filing"]["changeOfReceivers"].get("courtOrder"): - update_filing_court_order(filing_rec, court_order) + create_court_order(filing_rec, court_order) diff --git a/queue_services/business-filer/src/business_filer/filing_processors/change_of_registration.py b/queue_services/business-filer/src/business_filer/filing_processors/change_of_registration.py index a5d020dc23..79b7e8b5b0 100644 --- a/queue_services/business-filer/src/business_filer/filing_processors/change_of_registration.py +++ b/queue_services/business-filer/src/business_filer/filing_processors/change_of_registration.py @@ -91,7 +91,7 @@ def process(business: Business, change_filing_rec: Filing, change_filing: dict, # update court order, if any is present with suppress(IndexError, KeyError, TypeError): court_order_json = dpath.get(change_filing, "/changeOfRegistration/courtOrder") - filings.update_filing_court_order(change_filing_rec, court_order_json) + filings.create_court_order(change_filing_rec, court_order_json) def update_parties(business: Business, parties: dict, change_filing_rec: Filing): diff --git a/queue_services/business-filer/src/business_filer/filing_processors/consent_amalgamation_out.py b/queue_services/business-filer/src/business_filer/filing_processors/consent_amalgamation_out.py index 8197be4d5a..9c6558a6cf 100644 --- a/queue_services/business-filer/src/business_filer/filing_processors/consent_amalgamation_out.py +++ b/queue_services/business-filer/src/business_filer/filing_processors/consent_amalgamation_out.py @@ -27,7 +27,7 @@ def process(business: Business, cco_filing: Filing, filing: dict, filing_meta: F # update consent amalgamation out, if any is present with suppress(IndexError, KeyError, TypeError): consent_amalgamation_out_json = dpath.get(filing, "/consentAmalgamationOut/courtOrder") - filings.update_filing_court_order(cco_filing, consent_amalgamation_out_json) + filings.create_court_order(cco_filing, consent_amalgamation_out_json) foreign_jurisdiction = filing["consentAmalgamationOut"]["foreignJurisdiction"] consent_amalgamation_out = ConsentContinuationOut() diff --git a/queue_services/business-filer/src/business_filer/filing_processors/consent_continuation_out.py b/queue_services/business-filer/src/business_filer/filing_processors/consent_continuation_out.py index a10c868b63..ead62b7ee8 100644 --- a/queue_services/business-filer/src/business_filer/filing_processors/consent_continuation_out.py +++ b/queue_services/business-filer/src/business_filer/filing_processors/consent_continuation_out.py @@ -48,7 +48,7 @@ def process(business: Business, cco_filing: Filing, filing: dict, filing_meta: F # update consent continuation out, if any is present with suppress(IndexError, KeyError, TypeError): consent_continuation_out_json = dpath.get(filing, "/consentContinuationOut/courtOrder") - filings.update_filing_court_order(cco_filing, consent_continuation_out_json) + filings.create_court_order(cco_filing, consent_continuation_out_json) cco_json = filing["consentContinuationOut"] foreign_jurisdiction = cco_json["foreignJurisdiction"] diff --git a/queue_services/business-filer/src/business_filer/filing_processors/continuation_in.py b/queue_services/business-filer/src/business_filer/filing_processors/continuation_in.py index 4d7a2b7d63..b06dd50855 100644 --- a/queue_services/business-filer/src/business_filer/filing_processors/continuation_in.py +++ b/queue_services/business-filer/src/business_filer/filing_processors/continuation_in.py @@ -148,7 +148,7 @@ def process(business: Business, # noqa: PLR0912 aliases.update_aliases(business, name_translations) if court_order := continuation_in.get("courtOrder"): - filings.update_filing_court_order(filing_rec, court_order) + filings.create_court_order(filing_rec, court_order, business) if not filing_rec.colin_event_ids: # Update the filing json with identifier and founding date. diff --git a/queue_services/business-filer/src/business_filer/filing_processors/continuation_out.py b/queue_services/business-filer/src/business_filer/filing_processors/continuation_out.py index 03b56ad515..9e3e6349d9 100644 --- a/queue_services/business-filer/src/business_filer/filing_processors/continuation_out.py +++ b/queue_services/business-filer/src/business_filer/filing_processors/continuation_out.py @@ -82,7 +82,7 @@ def process(business: Business, continuation_out_filing: Filing, filing: dict, f # update continuation out, if any is present with suppress(IndexError, KeyError, TypeError): court_order_json = dpath.get(filing, "/continuationOut/courtOrder") - filings.update_filing_court_order(continuation_out_filing, court_order_json) + filings.create_court_order(continuation_out_filing, court_order_json) continuation_out_json = filing["continuationOut"] diff --git a/queue_services/business-filer/src/business_filer/filing_processors/court_order.py b/queue_services/business-filer/src/business_filer/filing_processors/court_order.py index 7bb572292c..e467ecdff1 100644 --- a/queue_services/business-filer/src/business_filer/filing_processors/court_order.py +++ b/queue_services/business-filer/src/business_filer/filing_processors/court_order.py @@ -32,24 +32,18 @@ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. """File processing rules and actions for the court order filing.""" -from contextlib import suppress -from datetime import datetime - from business_model.models import Business, Document, DocumentType, Filing from business_filer.filing_meta import FilingMeta +from business_filer.filing_processors.filing_components import filings def process(business: Business, court_order_filing: Filing, filing: dict, filing_meta: FilingMeta): """Render the court order filing into the business model objects.""" - court_order_filing.court_order_file_number = filing["courtOrder"].get("fileNumber") - court_order_filing.court_order_effect_of_order = filing["courtOrder"].get("effectOfOrder") - court_order_filing.order_details = filing["courtOrder"].get("orderDetails") - - with suppress(IndexError, KeyError, TypeError, ValueError): - court_order_filing.court_order_date = datetime.fromisoformat(filing["courtOrder"].get("orderDate")) + court_order_data = filing["courtOrder"] + filings.create_court_order(court_order_filing, court_order_data) - if file_key := filing["courtOrder"].get("fileKey"): + if file_key := court_order_data.get("fileKey"): document = Document() document.type = DocumentType.COURT_ORDER.value document.file_key = file_key diff --git a/queue_services/business-filer/src/business_filer/filing_processors/dissolution.py b/queue_services/business-filer/src/business_filer/filing_processors/dissolution.py index 6e4f968ffa..369bf4f2e9 100644 --- a/queue_services/business-filer/src/business_filer/filing_processors/dissolution.py +++ b/queue_services/business-filer/src/business_filer/filing_processors/dissolution.py @@ -87,12 +87,12 @@ def process(business: Business, filing: dict, filing_rec: Filing, filing_meta: F if parties := dissolution_filing.get("parties"): update_parties(business, parties, filing_rec, False) - filing_rec.order_details = dissolution_filing.get("details") + filing_rec.details = dissolution_filing.get("details") # update court order, if any is present with suppress(IndexError, KeyError, TypeError): court_order_json = dpath.get(dissolution_filing, "/courtOrder") - filings.update_filing_court_order(filing_rec, court_order_json) + filings.create_court_order(filing_rec, court_order_json) if business.legal_type == Business.LegalTypes.COOP: _update_cooperative(dissolution_filing, business, filing_rec, dissolution_type) diff --git a/queue_services/business-filer/src/business_filer/filing_processors/filing_components/correction.py b/queue_services/business-filer/src/business_filer/filing_processors/filing_components/correction.py index 468be1c2b5..8706365384 100644 --- a/queue_services/business-filer/src/business_filer/filing_processors/filing_components/correction.py +++ b/queue_services/business-filer/src/business_filer/filing_processors/filing_components/correction.py @@ -139,7 +139,7 @@ def correct_business_data(business: Business, # noqa: PLR0915 # update court order, if any is present with suppress(IndexError, KeyError, TypeError): court_order_json = dpath.get(correction_filing, "/correction/courtOrder") - filings.update_filing_court_order(correction_filing_rec, court_order_json) + filings.create_court_order(correction_filing_rec, court_order_json) # update business start date, if any is present with suppress(IndexError, KeyError, TypeError): diff --git a/queue_services/business-filer/src/business_filer/filing_processors/filing_components/filings.py b/queue_services/business-filer/src/business_filer/filing_processors/filing_components/filings.py index ca8707e82b..2d2cdc9e86 100644 --- a/queue_services/business-filer/src/business_filer/filing_processors/filing_components/filings.py +++ b/queue_services/business-filer/src/business_filer/filing_processors/filing_components/filings.py @@ -34,22 +34,35 @@ """Manages the names of a Business.""" from contextlib import suppress -from business_model.models import Filing +from business_model.models import Business, CourtOrder, Filing from flask_babel import _ as babel from business_filer.common.datetime import datetime -def update_filing_court_order(filing_submission: Filing, court_order: dict) -> dict | None: - """Update the court_order info for a Filing.""" - if not Filing: - return {"error": babel("Filing required before alternate names can be set.")} +def create_court_order(filing_submission: Filing, + court_order: dict, + new_business: Business = None) -> dict | None: + """Create a court order.""" + if not filing_submission: + return {"error": babel("Filing is required before a court order can be created.")} - filing_submission.court_order_file_number = court_order.get("fileNumber") - filing_submission.court_order_effect_of_order = court_order.get("effectOfOrder") - filing_submission.order_details = court_order.get("orderDetails") + if not (file_number := court_order.get("fileNumber")): + return + court_order_obj = CourtOrder( + file_number=file_number, + effect_of_order=court_order.get("effectOfOrder"), + order_details=court_order.get("orderDetails"), + ) with suppress(IndexError, KeyError, TypeError, ValueError): - filing_submission.court_order_date = datetime.fromisoformat(court_order.get("orderDate")) + court_order_obj.order_date = datetime.fromisoformat(court_order.get("orderDate")) + + if new_business: + court_order_obj.filing_id = filing_submission.id + new_business.court_orders.append(court_order_obj) + else: + court_order_obj.business_id = filing_submission.business_id + filing_submission.court_orders.append(court_order_obj) return None diff --git a/queue_services/business-filer/src/business_filer/filing_processors/incorporation_filing.py b/queue_services/business-filer/src/business_filer/filing_processors/incorporation_filing.py index f4386bc566..1d4929eb82 100644 --- a/queue_services/business-filer/src/business_filer/filing_processors/incorporation_filing.py +++ b/queue_services/business-filer/src/business_filer/filing_processors/incorporation_filing.py @@ -97,7 +97,7 @@ def process(business: Business, # noqa: PLR0912 aliases.update_aliases(business, name_translations) if court_order := incorp_filing.get("courtOrder"): - filings.update_filing_court_order(filing_rec, court_order) + filings.create_court_order(filing_rec, court_order, business) if not filing_rec.colin_event_ids: # Update the filing json with identifier and founding date. diff --git a/queue_services/business-filer/src/business_filer/filing_processors/notice_of_withdrawal.py b/queue_services/business-filer/src/business_filer/filing_processors/notice_of_withdrawal.py index 7d08b2614a..0792f457dc 100644 --- a/queue_services/business-filer/src/business_filer/filing_processors/notice_of_withdrawal.py +++ b/queue_services/business-filer/src/business_filer/filing_processors/notice_of_withdrawal.py @@ -30,7 +30,7 @@ def process( current_app.logger.debug("start notice_of_withdrawal filing process, noticeOfWithdrawal: %s", now_filing) if court_order := now_filing.get("courtOrder"): - filings.update_filing_court_order(filing_submission, court_order) + filings.create_court_order(filing_submission, court_order) withdrawn_filing_id = now_filing.get("filingId") withdrawn_filing = Filing.find_by_id(withdrawn_filing_id) diff --git a/queue_services/business-filer/src/business_filer/filing_processors/put_back_off.py b/queue_services/business-filer/src/business_filer/filing_processors/put_back_off.py index 59060683db..e2d599e395 100644 --- a/queue_services/business-filer/src/business_filer/filing_processors/put_back_off.py +++ b/queue_services/business-filer/src/business_filer/filing_processors/put_back_off.py @@ -38,9 +38,9 @@ def process(business: Business, filing: dict, filing_rec: Filing, filing_meta: F # update court order, if any is present with suppress(IndexError, KeyError, TypeError): court_order_json = dpath.get(put_back_off_filing, "/courtOrder") - filings.update_filing_court_order(filing_rec, court_order_json) + filings.create_court_order(filing_rec, court_order_json) - filing_rec.order_details = put_back_off_filing.get("details") + filing_rec.details = put_back_off_filing.get("details") if business.restoration_expiry_date: filing_meta.put_back_off = { diff --git a/queue_services/business-filer/src/business_filer/filing_processors/put_back_on.py b/queue_services/business-filer/src/business_filer/filing_processors/put_back_on.py index d0afbdef39..61e672540d 100644 --- a/queue_services/business-filer/src/business_filer/filing_processors/put_back_on.py +++ b/queue_services/business-filer/src/business_filer/filing_processors/put_back_on.py @@ -56,9 +56,9 @@ def process(business: Business, filing: dict, filing_rec: Filing, filing_meta: F # update court order, if any is present with suppress(IndexError, KeyError, TypeError): court_order_json = dpath.get(put_back_on_filing, "/courtOrder") - filings.update_filing_court_order(filing_rec, court_order_json) + filings.create_court_order(filing_rec, court_order_json) - filing_rec.order_details = put_back_on_filing.get("details") + filing_rec.details = put_back_on_filing.get("details") restoration.cease_custodian(business) diff --git a/queue_services/business-filer/src/business_filer/filing_processors/registrars_notation.py b/queue_services/business-filer/src/business_filer/filing_processors/registrars_notation.py index ea2b1bd2e5..e413c49858 100644 --- a/queue_services/business-filer/src/business_filer/filing_processors/registrars_notation.py +++ b/queue_services/business-filer/src/business_filer/filing_processors/registrars_notation.py @@ -32,20 +32,16 @@ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. """File processing rules and actions for the registrars notation filing.""" -from contextlib import suppress -from datetime import datetime - from business_model.models import Filing from business_filer.filing_meta import FilingMeta +from business_filer.filing_processors.filing_components import filings def process(registrars_notation_filing: Filing, filing: dict, filing_meta: FilingMeta): """Render the registrars notation filing into the business model objects.""" - registrars_notation_filing.court_order_file_number = filing["registrarsNotation"].get("fileNumber") - registrars_notation_filing.court_order_effect_of_order = filing["registrarsNotation"].get("effectOfOrder") - registrars_notation_filing.order_details = filing["registrarsNotation"]["orderDetails"] - - with suppress(IndexError, KeyError, TypeError, ValueError): - registrars_notation_filing.court_order_date = datetime.fromisoformat( - filing["registrarsNotation"].get("orderDate")) + filings.create_court_order(registrars_notation_filing, { + "fileNumber": filing["registrarsNotation"].get("fileNumber"), + "effectOfOrder": filing["registrarsNotation"].get("effectOfOrder") + }) + registrars_notation_filing.details = filing["registrarsNotation"]["orderDetails"] diff --git a/queue_services/business-filer/src/business_filer/filing_processors/registrars_order.py b/queue_services/business-filer/src/business_filer/filing_processors/registrars_order.py index 31bb3aae07..496d5dd545 100644 --- a/queue_services/business-filer/src/business_filer/filing_processors/registrars_order.py +++ b/queue_services/business-filer/src/business_filer/filing_processors/registrars_order.py @@ -32,20 +32,16 @@ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. """File processing rules and actions for the registrars order filing.""" -from contextlib import suppress -from datetime import datetime - from business_model.models import Filing from business_filer.filing_meta import FilingMeta +from business_filer.filing_processors.filing_components import filings def process(registrars_order_filing: Filing, filing: dict, filing_meta: FilingMeta): """Render the registrars order filing into the business model objects.""" - registrars_order_filing.court_order_file_number = filing["registrarsOrder"].get("fileNumber") - registrars_order_filing.court_order_effect_of_order = filing["registrarsOrder"].get("effectOfOrder") - registrars_order_filing.order_details = filing["registrarsOrder"]["orderDetails"] - - with suppress(IndexError, KeyError, TypeError, ValueError): - registrars_order_filing.court_order_date = datetime.fromisoformat( - filing["registrarsOrder"].get("orderDate")) + filings.create_court_order(registrars_order_filing, { + "fileNumber": filing["registrarsOrder"].get("fileNumber"), + "effectOfOrder": filing["registrarsOrder"].get("effectOfOrder") + }) + registrars_order_filing.details = filing["registrarsOrder"]["orderDetails"] diff --git a/queue_services/business-filer/src/business_filer/filing_processors/registration.py b/queue_services/business-filer/src/business_filer/filing_processors/registration.py index cdb5fbb531..50fb90feea 100644 --- a/queue_services/business-filer/src/business_filer/filing_processors/registration.py +++ b/queue_services/business-filer/src/business_filer/filing_processors/registration.py @@ -94,7 +94,7 @@ def process(business: Business, # pylint: disable=too-many-branches # update court order, if any is present if court_order := registration_filing.get("courtOrder"): - filings.update_filing_court_order(filing_rec, court_order) + filings.create_court_order(filing_rec, court_order, business) # Update the filing json with identifier and founding date. registration_json = copy.deepcopy(filing_rec.filing_json) diff --git a/queue_services/business-filer/src/business_filer/filing_processors/restoration.py b/queue_services/business-filer/src/business_filer/filing_processors/restoration.py index 032812f8aa..d59e00c7cd 100644 --- a/queue_services/business-filer/src/business_filer/filing_processors/restoration.py +++ b/queue_services/business-filer/src/business_filer/filing_processors/restoration.py @@ -98,7 +98,7 @@ def process(business: Business, filing: dict, filing_rec: Filing, filing_meta: F if filing_rec.approval_type == "courtOrder": with suppress(IndexError, KeyError, TypeError): court_order_json = dpath.get(restoration_filing, "/courtOrder") - filings.update_filing_court_order(filing_rec, court_order_json) + filings.create_court_order(filing_rec, court_order_json) elif filing_rec.approval_type == "registrar": application_date = restoration_filing.get("applicationDate") notice_date = restoration_filing.get("noticeDate") diff --git a/queue_services/business-filer/tests/unit/filing_processors/filing_components/test_filing.py b/queue_services/business-filer/tests/unit/filing_processors/filing_components/test_filing.py index 2e6818a381..3669e094d4 100644 --- a/queue_services/business-filer/tests/unit/filing_processors/filing_components/test_filing.py +++ b/queue_services/business-filer/tests/unit/filing_processors/filing_components/test_filing.py @@ -33,37 +33,43 @@ # POSSIBILITY OF SUCH DAMAGE. """The Unit Tests for the Name Request filing component.""" import copy +import random from datetime import datetime, timezone from typing import Final from registry_schemas.example_data import ALTERATION_FILING_TEMPLATE from business_filer.filing_processors.filing_components import filings -from tests.unit import create_filing +from tests.unit import create_business, create_filing -def test_update_filing_court_order(app, session): +def test_create_court_order(app, session): """Assert that the new aliases are created.""" # setup file_number: Final = '#1234-5678/90' order_date: Final = '2021-01-30T09:56:01+08:00' effect_of_order: Final = 'hasPlan' + order_details: Final = 'Some order details' + identifier = f'BC{random.randint(1000000, 9999999)}' + business = create_business(identifier, legal_type='BC') filing = copy.deepcopy(ALTERATION_FILING_TEMPLATE) - alteration_filing = create_filing(token='123', json_filing=filing) - court_order_json= {'courtOrder': + alteration_filing = create_filing(token='123', json_filing=filing, business_id=business.id) + court_order_json = {'courtOrder': { 'fileNumber': file_number, 'orderDate': order_date, - 'effectOfOrder': effect_of_order + 'effectOfOrder': effect_of_order, + 'orderDetails': order_details } } # test - filings.update_filing_court_order(alteration_filing, court_order_json['courtOrder']) + filings.create_court_order(alteration_filing, court_order_json['courtOrder']) # validate - assert file_number == alteration_filing.court_order_file_number - assert datetime.fromisoformat(order_date) == alteration_filing.court_order_date - assert effect_of_order == alteration_filing.court_order_effect_of_order - + court_order = alteration_filing.court_orders[0] + assert file_number == court_order.file_number + assert datetime.fromisoformat(order_date) == court_order.order_date + assert effect_of_order == court_order.effect_of_order + assert order_details == court_order.order_details diff --git a/queue_services/business-filer/tests/unit/filing_processors/test_dissolution.py b/queue_services/business-filer/tests/unit/filing_processors/test_dissolution.py index dce013bdb0..453427e91c 100644 --- a/queue_services/business-filer/tests/unit/filing_processors/test_dissolution.py +++ b/queue_services/business-filer/tests/unit/filing_processors/test_dissolution.py @@ -255,7 +255,7 @@ def test_administrative_dissolution(app, session, legal_type, identifier, dissol assert filing_meta.dissolution['dissolutionDate'] == dissolution_date_str final_filing = Filing.find_by_id(filing_id) - assert filing_json['filing']['dissolution']['details'] == final_filing.order_details + assert filing_json['filing']['dissolution']['details'] == final_filing.details @pytest.mark.parametrize('dissolution_type', [ diff --git a/queue_services/business-filer/tests/unit/filing_processors/test_incorporation_filing.py b/queue_services/business-filer/tests/unit/filing_processors/test_incorporation_filing.py index 60bd86c934..716f49ce45 100644 --- a/queue_services/business-filer/tests/unit/filing_processors/test_incorporation_filing.py +++ b/queue_services/business-filer/tests/unit/filing_processors/test_incorporation_filing.py @@ -111,9 +111,12 @@ def test_incorporation_filing_process_with_nr(app, session, legal_type, filing, assert len(filing_rec.filing_party_roles.all()) == 2 assert len(business.share_classes.all()) == 2 assert len(business.offices.all()) == 2 # One office is created in create_business method. - if legal_type == 'CC': - assert filing_rec.court_order_file_number == '12356' - assert filing_rec.court_order_effect_of_order == 'planOfArrangement' + if legal_type == 'CC': + court_order_obj = business.court_orders[0] + court_order = filing['filing']['incorporationApplication']['courtOrder'] + assert court_order['fileNumber'] == court_order_obj.file_number + assert court_order['effectOfOrder'] == court_order_obj.effect_of_order + if legal_type == 'CP': assert len(filing_rec.filing_party_roles.all()) == 1 assert len(business.offices.all()) == 1 @@ -161,8 +164,11 @@ def test_incorporation_filing_process_no_nr(app, session, legal_type, filing, le assert len(business.offices.all()) == 2 # One office is created in create_business method. assert len(business.party_roles.all()) == 1 assert len(filing_rec.filing_party_roles.all()) == 2 - assert filing_rec.court_order_file_number == '12356' - assert filing_rec.court_order_effect_of_order == 'planOfArrangement' + + court_order_obj = business.court_orders[0] + court_order = filing['filing']['incorporationApplication']['courtOrder'] + assert court_order['fileNumber'] == court_order_obj.file_number + assert court_order['effectOfOrder'] == court_order_obj.effect_of_order # Parties parties = filing_rec.filing_json['filing']['incorporationApplication']['parties'] diff --git a/queue_services/business-filer/tests/unit/filing_processors/test_registration.py b/queue_services/business-filer/tests/unit/filing_processors/test_registration.py index fac1d83155..b521c70b54 100644 --- a/queue_services/business-filer/tests/unit/filing_processors/test_registration.py +++ b/queue_services/business-filer/tests/unit/filing_processors/test_registration.py @@ -108,6 +108,13 @@ def test_registration_process(app, session, legal_type, filing): business, filing_rec, filing_meta = registration.process(None, filing, filing_rec, filing_meta) # Assertions + + court_order_obj = business.court_orders[0] + court_order = filing['filing']['registration']['courtOrder'] + assert court_order['fileNumber'] == court_order_obj.file_number + assert court_order['effectOfOrder'] == court_order_obj.effect_of_order + assert court_order['orderDetails'] == court_order_obj.order_details + assert business.identifier.startswith('FM') assert business.founding_date == effective_date assert business.start_date == datetime.fromisoformat(f'{now}T08:00:00+00:00') @@ -155,10 +162,9 @@ def test_registration_affiliation(app, session, legal_type, filing, party_type, filing['filing']['registration']['parties'][0]['officer']['lastName'] = last_name filing['filing']['registration']['parties'][0]['officer']['middleName'] = middle_name - create_filing('123', filing) + filing_rec = create_filing('123', filing) effective_date = datetime.now(timezone.utc) - filing_rec = Filing(effective_date=effective_date, filing_json=filing) filing_meta = FilingMeta(application_date=effective_date) naics_response = { diff --git a/queue_services/business-filer/tests/unit/test_filer/test_alteration.py b/queue_services/business-filer/tests/unit/test_filer/test_alteration.py index 5be0a6fc29..87b4ed94d1 100644 --- a/queue_services/business-filer/tests/unit/test_filer/test_alteration.py +++ b/queue_services/business-filer/tests/unit/test_filer/test_alteration.py @@ -227,9 +227,11 @@ def tests_filer_alteration_court_order(app, session, mocker): # Check outcome final_filing = Filing.find_by_id(filing_id) - assert file_number == final_filing.court_order_file_number - assert datetime.fromisoformat(order_date) == final_filing.court_order_date - assert effect_of_order == final_filing.court_order_effect_of_order + + court_order_obj = final_filing.court_orders[0] + assert file_number == court_order_obj.file_number + assert datetime.fromisoformat(order_date) == court_order_obj.order_date + assert effect_of_order == court_order_obj.effect_of_order @pytest.mark.parametrize('new_association_type', [ diff --git a/queue_services/business-filer/tests/unit/test_filer/test_amalgamation_application.py b/queue_services/business-filer/tests/unit/test_filer/test_amalgamation_application.py index 2d1ef50cbe..86a1e14d55 100644 --- a/queue_services/business-filer/tests/unit/test_filer/test_amalgamation_application.py +++ b/queue_services/business-filer/tests/unit/test_filer/test_amalgamation_application.py @@ -83,6 +83,13 @@ def test_regular_amalgamation_application_process(app, session, set_publish_mock filing_rec = Filing.find_by_id(filing_rec.id) business = Business.find_by_identifier(next_corp_num) + court_order_obj = filing_rec.court_orders[0] + court_order = filing['filing'][filing_type]['courtOrder'] + assert business.id == court_order_obj.business_id + assert court_order['orderDetails'] == court_order_obj.order_details + assert court_order['fileNumber'] == court_order_obj.file_number + assert court_order['effectOfOrder'] == court_order_obj.effect_of_order + assert filing_rec.business_id == business.id assert filing_rec.status == Filing.Status.COMPLETED.value assert business.identifier diff --git a/queue_services/business-filer/tests/unit/test_filer/test_amalgamation_out.py b/queue_services/business-filer/tests/unit/test_filer/test_amalgamation_out.py index f83ee2d104..80268d630b 100644 --- a/queue_services/business-filer/tests/unit/test_filer/test_amalgamation_out.py +++ b/queue_services/business-filer/tests/unit/test_filer/test_amalgamation_out.py @@ -50,8 +50,10 @@ def tests_filer_amalgamation_out(app, session): amalgamation_out_date_str = filing_json['filing']['amalgamationOut']['amalgamationOutDate'] amalgamation_out_date = LegislationDatetime.as_utc_timezone_from_legislation_date_str(amalgamation_out_date_str) - assert filing_json['filing']['amalgamationOut']['courtOrder']['fileNumber'] == final_filing.court_order_file_number - assert filing_json['filing']['amalgamationOut']['courtOrder']['effectOfOrder'] == final_filing.court_order_effect_of_order + court_order_obj = final_filing.court_orders[0] + court_order = filing_json['filing']['amalgamationOut']['courtOrder'] + assert court_order['fileNumber'] == court_order_obj.file_number + assert court_order['effectOfOrder'] == court_order_obj.effect_of_order assert business.state == Business.State.HISTORICAL assert business.state_filing_id == final_filing.id diff --git a/queue_services/business-filer/tests/unit/test_filer/test_change_of_registration.py b/queue_services/business-filer/tests/unit/test_filer/test_change_of_registration.py index 3bd2edd041..6735b7ce1e 100644 --- a/queue_services/business-filer/tests/unit/test_filer/test_change_of_registration.py +++ b/queue_services/business-filer/tests/unit/test_filer/test_change_of_registration.py @@ -249,9 +249,10 @@ def tests_filer_change_of_registration_court_order(app, session, mocker, test_na # Check outcome final_filing = Filing.find_by_id(filing_id) - assert file_number == final_filing.court_order_file_number - assert datetime.fromisoformat(order_date) == final_filing.court_order_date - assert effect_of_order == final_filing.court_order_effect_of_order + court_order_obj = final_filing.court_orders[0] + assert file_number == court_order_obj.file_number + assert datetime.fromisoformat(order_date) == court_order_obj.order_date + assert effect_of_order == court_order_obj.effect_of_order def tests_filer_proprietor_name_and_address_change(app, session, mocker): diff --git a/queue_services/business-filer/tests/unit/test_filer/test_consent_amalgamation_out.py b/queue_services/business-filer/tests/unit/test_filer/test_consent_amalgamation_out.py index 999deec538..741661f69e 100644 --- a/queue_services/business-filer/tests/unit/test_filer/test_consent_amalgamation_out.py +++ b/queue_services/business-filer/tests/unit/test_filer/test_consent_amalgamation_out.py @@ -71,10 +71,10 @@ def tests_filer_consent_amalgamation_out(app, session, mocker, test_name, effect # Check outcome final_filing = Filing.find_by_id(cco_filing.id) - assert filing_json['filing']['consentAmalgamationOut']['courtOrder']['fileNumber'] == \ - final_filing.court_order_file_number - assert filing_json['filing']['consentAmalgamationOut']['courtOrder']['effectOfOrder'] == \ - final_filing.court_order_effect_of_order + court_order_obj = final_filing.court_orders[0] + court_order = filing_json['filing']['consentAmalgamationOut']['courtOrder'] + assert court_order['fileNumber'] == court_order_obj.file_number + assert court_order['effectOfOrder'] == court_order_obj.effect_of_order expiry_date_utc = LegislationDatetime.as_utc_timezone(expiry_date) diff --git a/queue_services/business-filer/tests/unit/test_filer/test_consent_continuation_out.py b/queue_services/business-filer/tests/unit/test_filer/test_consent_continuation_out.py index bef79d82b5..22115be00b 100644 --- a/queue_services/business-filer/tests/unit/test_filer/test_consent_continuation_out.py +++ b/queue_services/business-filer/tests/unit/test_filer/test_consent_continuation_out.py @@ -91,10 +91,10 @@ def tests_filer_consent_continuation_out(app, session, mocker, test_name, effect # Check outcome final_filing = Filing.find_by_id(cco_filing.id) - assert filing_json['filing']['consentContinuationOut']['courtOrder']['fileNumber'] == \ - final_filing.court_order_file_number - assert filing_json['filing']['consentContinuationOut']['courtOrder']['effectOfOrder'] == \ - final_filing.court_order_effect_of_order + court_order_obj = final_filing.court_orders[0] + court_order = filing_json['filing']['consentContinuationOut']['courtOrder'] + assert court_order['fileNumber'] == court_order_obj.file_number + assert court_order['effectOfOrder'] == court_order_obj.effect_of_order expiry_date_utc = LegislationDatetime.as_utc_timezone(expiry_date) diff --git a/queue_services/business-filer/tests/unit/test_filer/test_continuation_in.py b/queue_services/business-filer/tests/unit/test_filer/test_continuation_in.py index fe0dc371f8..2f1c4aa394 100644 --- a/queue_services/business-filer/tests/unit/test_filer/test_continuation_in.py +++ b/queue_services/business-filer/tests/unit/test_filer/test_continuation_in.py @@ -53,6 +53,9 @@ def test_continuation_in_process(app, session): filing_rec = Filing.find_by_id(filing_rec.id) business = Business.find_by_identifier(next_corp_num) + court_order_obj = filing_rec.court_orders.all() + assert len(court_order_obj) == 0 + assert filing_rec.business_id == business.id assert filing_rec.status == Filing.Status.COMPLETED.value assert business.identifier diff --git a/queue_services/business-filer/tests/unit/test_filer/test_continuation_out.py b/queue_services/business-filer/tests/unit/test_filer/test_continuation_out.py index 464f507ab2..1d960fd32d 100644 --- a/queue_services/business-filer/tests/unit/test_filer/test_continuation_out.py +++ b/queue_services/business-filer/tests/unit/test_filer/test_continuation_out.py @@ -70,8 +70,10 @@ def tests_filer_continuation_out(app, session): continuation_out_date_str = filing_json['filing']['continuationOut']['continuationOutDate'] continuation_out_date = LegislationDatetime.as_utc_timezone_from_legislation_date_str(continuation_out_date_str) - assert filing_json['filing']['continuationOut']['courtOrder']['fileNumber'] == final_filing.court_order_file_number - assert filing_json['filing']['continuationOut']['courtOrder']['effectOfOrder'] == final_filing.court_order_effect_of_order + court_order_obj = final_filing.court_orders[0] + court_order = filing_json['filing']['continuationOut']['courtOrder'] + assert court_order['fileNumber'] == court_order_obj.file_number + assert court_order['effectOfOrder'] == court_order_obj.effect_of_order assert business.state == Business.State.HISTORICAL assert business.state_filing_id == final_filing.id diff --git a/queue_services/business-filer/tests/unit/test_filer/test_correction_bcia.py b/queue_services/business-filer/tests/unit/test_filer/test_correction_bcia.py index 0a7de2f821..00f0e613fa 100644 --- a/queue_services/business-filer/tests/unit/test_filer/test_correction_bcia.py +++ b/queue_services/business-filer/tests/unit/test_filer/test_correction_bcia.py @@ -506,9 +506,10 @@ def tests_filer_correction_court_order(app, session, mocker, test_name, legal_ty # Check outcome final_filing = Filing.find_by_id(filing_id) - assert file_number == final_filing.court_order_file_number - assert datetime.fromisoformat(order_date) == final_filing.court_order_date - assert effect_of_order == final_filing.court_order_effect_of_order + court_order_obj = final_filing.court_orders[0] + assert file_number == court_order_obj.file_number + assert datetime.fromisoformat(order_date) == court_order_obj.order_date + assert effect_of_order == court_order_obj.effect_of_order diff --git a/queue_services/business-filer/tests/unit/test_filer/test_correction_firms.py b/queue_services/business-filer/tests/unit/test_filer/test_correction_firms.py index b4b8743854..27fe687995 100644 --- a/queue_services/business-filer/tests/unit/test_filer/test_correction_firms.py +++ b/queue_services/business-filer/tests/unit/test_filer/test_correction_firms.py @@ -269,9 +269,10 @@ def tests_filer_correction_court_order(app, session, mocker, test_name, legal_ty # Check outcome final_filing = Filing.find_by_id(filing_id) - assert file_number == final_filing.court_order_file_number - assert datetime.fromisoformat(order_date) == final_filing.court_order_date - assert effect_of_order == final_filing.court_order_effect_of_order + court_order_obj = final_filing.court_orders[0] + assert file_number == court_order_obj.file_number + assert datetime.fromisoformat(order_date) == court_order_obj.order_date + assert effect_of_order == court_order_obj.effect_of_order diff --git a/queue_services/business-filer/tests/unit/test_filer/test_court_order.py b/queue_services/business-filer/tests/unit/test_filer/test_court_order.py index e4bb9d6b79..df1f20cdd1 100644 --- a/queue_services/business-filer/tests/unit/test_filer/test_court_order.py +++ b/queue_services/business-filer/tests/unit/test_filer/test_court_order.py @@ -61,9 +61,10 @@ def tests_filer_court_order(app, session): # Check outcome final_filing = Filing.find_by_id(filing_id) - assert filing['filing']['courtOrder']['fileNumber'] == final_filing.court_order_file_number - assert filing['filing']['courtOrder']['effectOfOrder'] == final_filing.court_order_effect_of_order - assert filing['filing']['courtOrder']['orderDetails'] == final_filing.order_details + court_order = final_filing.court_orders[0] + assert filing['filing']['courtOrder']['fileNumber'] == court_order.file_number + assert filing['filing']['courtOrder']['effectOfOrder'] == court_order.effect_of_order + assert filing['filing']['courtOrder']['orderDetails'] == court_order.order_details court_order_file = final_filing.documents.one_or_none() assert court_order_file diff --git a/queue_services/business-filer/tests/unit/test_filer/test_notice_of_withdrawal.py b/queue_services/business-filer/tests/unit/test_filer/test_notice_of_withdrawal.py index e7d07ceae9..ca63fd0dcf 100644 --- a/queue_services/business-filer/tests/unit/test_filer/test_notice_of_withdrawal.py +++ b/queue_services/business-filer/tests/unit/test_filer/test_notice_of_withdrawal.py @@ -72,7 +72,12 @@ def tests_filer_notice_of_withdrawal(session, test_name, filing_type, filing_tem final_withdrawn_filing = Filing.find_by_id(withdrawn_filing.id) final_now_filing = Filing.find_by_id(now_filing.id) - assert now_filing_json['filing']['noticeOfWithdrawal']['courtOrder']['orderDetails'] == final_now_filing.order_details + court_order_obj = final_now_filing.court_orders[0] + court_order = now_filing_json['filing']['noticeOfWithdrawal']['courtOrder'] + assert court_order['orderDetails'] == court_order_obj.order_details + assert court_order['fileNumber'] == court_order_obj.file_number + assert court_order['effectOfOrder'] == court_order_obj.effect_of_order + assert final_withdrawn_filing.status == Filing.Status.WITHDRAWN.value assert final_withdrawn_filing.withdrawal_pending == False assert final_withdrawn_filing.meta_data.get('withdrawnDate') diff --git a/queue_services/business-filer/tests/unit/test_filer/test_put_back_off.py b/queue_services/business-filer/tests/unit/test_filer/test_put_back_off.py index 3f4c6d61eb..daf3826ee9 100644 --- a/queue_services/business-filer/tests/unit/test_filer/test_put_back_off.py +++ b/queue_services/business-filer/tests/unit/test_filer/test_put_back_off.py @@ -53,7 +53,7 @@ def tests_filer_put_back_off(session): assert business.state == Business.State.HISTORICAL assert business.state_filing_id == filing.id assert business.restoration_expiry_date is None - assert filing.order_details == final_filing.order_details + assert filing.details == final_filing.details assert filing_meta.put_back_off['reason'] == 'Limited Restoration Expired' assert filing_meta.put_back_off['expiryDate'] == LegislationDatetime.format_as_legislation_date(expiry) diff --git a/queue_services/business-filer/tests/unit/test_filer/test_registrars_notation.py b/queue_services/business-filer/tests/unit/test_filer/test_registrars_notation.py index 43bdcf6d8c..c816b96ccb 100644 --- a/queue_services/business-filer/tests/unit/test_filer/test_registrars_notation.py +++ b/queue_services/business-filer/tests/unit/test_filer/test_registrars_notation.py @@ -61,6 +61,7 @@ def tests_filer_registrars_notation(app, session): # Check outcome final_filing = Filing.find_by_id(filing_id) - assert filing['filing']['registrarsNotation']['fileNumber'] == final_filing.court_order_file_number - assert filing['filing']['registrarsNotation']['effectOfOrder'] == final_filing.court_order_effect_of_order - assert filing['filing']['registrarsNotation']['orderDetails'] == final_filing.order_details + court_order = final_filing.court_orders[0] + assert filing['filing']['registrarsNotation']['fileNumber'] == court_order.file_number + assert filing['filing']['registrarsNotation']['effectOfOrder'] == court_order.effect_of_order + assert filing['filing']['registrarsNotation']['orderDetails'] == final_filing.details diff --git a/queue_services/business-filer/tests/unit/test_filer/test_registrars_order.py b/queue_services/business-filer/tests/unit/test_filer/test_registrars_order.py index 11d94ff34d..bebcc2ede9 100644 --- a/queue_services/business-filer/tests/unit/test_filer/test_registrars_order.py +++ b/queue_services/business-filer/tests/unit/test_filer/test_registrars_order.py @@ -64,6 +64,7 @@ def tests_filer_registrars_order(app, session): # Check outcome final_filing = Filing.find_by_id(filing_id) - assert filing['filing']['registrarsOrder']['fileNumber'] == final_filing.court_order_file_number - assert filing['filing']['registrarsOrder']['effectOfOrder'] == final_filing.court_order_effect_of_order - assert filing['filing']['registrarsOrder']['orderDetails'] == final_filing.order_details + court_order = final_filing.court_orders[0] + assert filing['filing']['registrarsOrder']['fileNumber'] == court_order.file_number + assert filing['filing']['registrarsOrder']['effectOfOrder'] == court_order.effect_of_order + assert filing['filing']['registrarsOrder']['orderDetails'] == final_filing.details diff --git a/queue_services/business-filer/tests/unit/test_filer/test_restoration.py b/queue_services/business-filer/tests/unit/test_filer/test_restoration.py index c0c6066caa..3262e1dc75 100644 --- a/queue_services/business-filer/tests/unit/test_filer/test_restoration.py +++ b/queue_services/business-filer/tests/unit/test_filer/test_restoration.py @@ -207,9 +207,10 @@ def test_restoration_court_order(app, session, mocker, approval_type): final_filing = Filing.find_by_id(filing_id) assert filing['filing']['restoration']['approvalType'] == final_filing.approval_type if approval_type == 'courtOrder': - assert filing['filing']['restoration']['courtOrder']['fileNumber'] == final_filing.court_order_file_number + court_order_obj = final_filing.court_orders[0] + assert filing['filing']['restoration']['courtOrder']['fileNumber'] == court_order_obj.file_number else: - assert final_filing.court_order_file_number is None + assert final_filing.court_orders.one_or_none() is None @pytest.mark.parametrize('approval_type', [