Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

25138 - Update firm affiliation logic to work in sandbox #3196

Merged
merged 2 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions auth-api/devops/vaults.gcp.env
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ NOTIFY_API_VERSION="op://API/$APP_ENV/notify-api/NOTIFY_API_VERSION"
PAY_API_URL="op://API/$APP_ENV/pay-api/PAY_API_URL"
PAY_API_VERSION="op://API/$APP_ENV/pay-api/PAY_API_VERSION"
LEGAL_API_URL="op://API/$APP_ENV/legal-api/LEGAL_API_URL"
LEGAL_SANDBOX_API_URL="op://API/sandbox/legal-api/LEGAL_API_URL"
pwei1018 marked this conversation as resolved.
Show resolved Hide resolved
LEGAL_API_VERSION="op://API/$APP_ENV/legal-api/LEGAL_API_VERSION"
LEGAL_API_VERSION_2="op://API/$APP_ENV/legal-api/LEGAL_API_VERSION_2"
GCP_AUTH_KEY="op://gcp-queue/$APP_ENV/gtksf3/AUTHPAY_GCP_AUTH_KEY"
Expand Down
1 change: 1 addition & 0 deletions auth-api/docs/dotenv_template
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ PAYBC_CLIENT_SECRET=test
PAYBC_PORTAL_URL=http://localhost:8080
NOTIFY_API_URL="https://mock-lear-tools.pathfinder.gov.bc.ca/rest/SBC+Notify+API+Reference/2.0.0/api/v1"
LEGAL_API_URL="https://legal-api-dev.pathfinder.gov.bc.ca/api/v1"
LEGAL_SANDBOX_API_URL="https://legal-api-dev.pathfinder.gov.bc.ca/api/v1"



Expand Down
1 change: 1 addition & 0 deletions auth-api/env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ NOTIFY_API_VERSION="/api/v1"
PAY_API_URL="https://pay-api-dev.apps.silver.devops.gov.bc.ca"
PAY_API_VERSION="/api/v1"
LEGAL_API_URL="https://legal-api-dev.apps.silver.devops.gov.bc.ca"
LEGAL_SANDBOX_API_URL="https://legal-api-dev.apps.silver.devops.gov.bc.ca"
LEGAL_API_VERSION="/api/v1"
LEGAL_API_VERSION_2"/api/v2"

Expand Down
2 changes: 1 addition & 1 deletion auth-api/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions auth-api/src/auth_api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ class _Config: # pylint: disable=too-few-public-methods
PAY_API_URL = os.getenv("PAY_API_URL", "") + os.getenv("PAY_API_VERSION", "")

LEGAL_API_URL = os.getenv("LEGAL_API_URL", "")
LEGAL_SANDBOX_API_URL = os.getenv("LEGAL_SANDBOX_API_URL", "")
LEGAL_API_VERSION = os.getenv("LEGAL_API_VERSION")
LEGAL_API_VERSION_2 = os.getenv("LEGAL_API_VERSION_2", "")

Expand Down Expand Up @@ -300,6 +301,7 @@ class TestConfig(_Config): # pylint: disable=too-few-public-methods
ENTITY_SVC_CLIENT_SECRET = os.getenv("KEYCLOAK_TEST_ADMIN_SECRET")

LEGAL_API_URL = "https://mock-auth-tools.pathfinder.gov.bc.ca/rest/legal-api/2.7"
LEGAL_SANDBOX_API_URL = "https://mock-auth-tools.pathfinder.gov.bc.ca/rest/legal-api/2.7"
LEGAL_API_VERSION_2 = "/api/v1"

NOTIFY_API_URL = "http://localhost:8080/notify-api/api/v1"
Expand Down
10 changes: 9 additions & 1 deletion auth-api/src/auth_api/services/affiliation.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
from auth_api.utils.passcode import validate_passcode
from auth_api.utils.roles import ALL_ALLOWED_ROLES, CLIENT_AUTH_ROLES, STAFF, Role
from auth_api.utils.user_context import UserContext, user_context
from auth_api.utils.util import get_request_environment

from .activity_log_publisher import ActivityLogPublisher
from .rest_service import RestService
Expand Down Expand Up @@ -560,7 +561,14 @@ def _get_nr_details(nr_number: str):

@staticmethod
def _validate_firms_party(token, business_identifier, party_name_str: str):
legal_api_url = current_app.config.get("LEGAL_API_URL") + current_app.config.get("LEGAL_API_VERSION_2")
env = get_request_environment()
if env == "sandbox":
legal_api_url = current_app.config.get("LEGAL_SANDBOX_API_URL") + current_app.config.get(
"LEGAL_API_VERSION_2"
)
else:
legal_api_url = current_app.config.get("LEGAL_API_URL") + current_app.config.get("LEGAL_API_VERSION_2")

parties_url = f"{legal_api_url}/businesses/{business_identifier}/parties"
try:
lear_response = RestService.get(parties_url, token=token, skip_404_logging=True)
Expand Down
Loading