From 6dd34f648e52d9aceca8eaf5443b7fb15d8101d5 Mon Sep 17 00:00:00 2001 From: Travis Semple Date: Thu, 7 Nov 2024 09:14:14 -0800 Subject: [PATCH] 20767 - More additional header changes (#1815) --- jobs/ftp-poller/poetry.lock | 10 ++-- jobs/ftp-poller/pyproject.toml | 2 +- jobs/payment-jobs/config.py | 3 +- jobs/payment-jobs/devops/vaults.gcp.env | 1 + jobs/payment-jobs/poetry.lock | 8 ++-- jobs/payment-jobs/pyproject.toml | 2 +- .../tasks/cfs_bank_name_updater.py | 4 +- .../tasks/direct_pay_automated_refund_task.py | 2 +- jobs/payment-jobs/tasks/distribution_task.py | 4 +- pay-admin/poetry.lock | 10 ++-- pay-admin/pyproject.toml | 2 +- pay-api/devops/vaults.gcp.env | 1 + pay-api/src/pay_api/config.py | 4 +- pay-api/src/pay_api/services/cfs_service.py | 46 +++++++++---------- .../pay_api/services/direct_pay_service.py | 4 +- pay-api/src/pay_api/services/paybc_service.py | 4 +- pay-queue/devops/vaults.gcp.env | 1 + pay-queue/poetry.lock | 8 ++-- pay-queue/pyproject.toml | 2 +- pay-queue/src/pay_queue/config.py | 1 + 20 files changed, 61 insertions(+), 58 deletions(-) diff --git a/jobs/ftp-poller/poetry.lock b/jobs/ftp-poller/poetry.lock index 758f578d6..5c78cfd34 100644 --- a/jobs/ftp-poller/poetry.lock +++ b/jobs/ftp-poller/poetry.lock @@ -2051,13 +2051,13 @@ thrift = "0.16.0" tornado = "6.4.1" typing-extensions = "4.10.0" urllib3 = "2.2.2" -werkzeug = "3.0.3" +werkzeug = "^3.0.3" [package.source] type = "git" -url = "https://github.com/bcgov/sbc-pay.git" -reference = "main" -resolved_reference = "726b002cf90082cfbb795c3e7329da9ed8ef1a03" +url = "https://github.com/seeker25/sbc-pay.git" +reference = "20767_p3" +resolved_reference = "8b667944c9f710365984c41ffdd47bf974403758" subdirectory = "pay-api" [[package]] @@ -3224,4 +3224,4 @@ multidict = ">=4.0" [metadata] lock-version = "2.0" python-versions = "^3.12" -content-hash = "597c3c0c00986d37821fece9db35c48a2beb4fb6b19591ba6b034280eddbcc57" +content-hash = "9d0d19b774c76c8851f362882b459321acf06e22d648aeac298fd26c7ae1f93a" diff --git a/jobs/ftp-poller/pyproject.toml b/jobs/ftp-poller/pyproject.toml index b8eb339bf..42413cc2c 100644 --- a/jobs/ftp-poller/pyproject.toml +++ b/jobs/ftp-poller/pyproject.toml @@ -22,7 +22,7 @@ jinja2 = "^3.1.3" protobuf = "4.25.3" launchdarkly-server-sdk = "^8.2.1" sbc-common-components = {git = "https://github.com/bcgov/sbc-common-components.git", subdirectory = "python"} -pay-api = {git = "https://github.com/bcgov/sbc-pay.git", subdirectory = "pay-api", branch = "main"} +pay-api = {git = "https://github.com/seeker25/sbc-pay.git", branch = "20767_p3", subdirectory = "pay-api"} wheel = "^0.43.0" diff --git a/jobs/payment-jobs/config.py b/jobs/payment-jobs/config.py index ca57c2530..5de58d8ad 100644 --- a/jobs/payment-jobs/config.py +++ b/jobs/payment-jobs/config.py @@ -94,6 +94,7 @@ class _Config(object): # pylint: disable=too-few-public-methods CFS_CLIENT_SECRET = os.getenv("CFS_CLIENT_SECRET") CONNECT_TIMEOUT = int(os.getenv("CONNECT_TIMEOUT", 10)) GENERATE_RANDOM_INVOICE_NUMBER = os.getenv("CFS_GENERATE_RANDOM_INVOICE_NUMBER", "False") + PAY_CONNECTOR_AUTH = os.getenv("PAY_CONNECTOR_AUTH", "") # legislative timezone for future effective dating LEGISLATIVE_TIMEZONE = os.getenv("LEGISLATIVE_TIMEZONE", "America/Vancouver") @@ -200,8 +201,6 @@ class _Config(object): # pylint: disable=too-few-public-methods EFT_HOLDING_GL = os.getenv("EFT_HOLDING_GL", "") EFT_TRANSFER_DESC = os.getenv("EFT_TRANSFER_DESC", "BCREGISTRIES {} {} EFT TRANSFER") EFT_OVERDUE_NOTIFY_EMAILS = os.getenv("EFT_OVERDUE_NOTIFY_EMAILS", "") - # Reverse Proxy secret - PAY_CONNECTOR_SECRET = os.getenv("PAY_CONNECTOR_SECRET", "") class DevConfig(_Config): # pylint: disable=too-few-public-methods diff --git a/jobs/payment-jobs/devops/vaults.gcp.env b/jobs/payment-jobs/devops/vaults.gcp.env index 56a1683e6..c37c50584 100644 --- a/jobs/payment-jobs/devops/vaults.gcp.env +++ b/jobs/payment-jobs/devops/vaults.gcp.env @@ -87,3 +87,4 @@ DW_USER="op://database/$APP_ENV/fin-warehouse/DB_READONLY_USER" DW_PASSWORD="op://database/$APP_ENV/fin-warehouse/DB_READONLY_PASSWORD" DW_HOST="op://database/$APP_ENV/fin-warehouse/DATABASE_HOST" DW_PORT="op://database/$APP_ENV/fin-warehouse/DATABASE_PORT" +PAY_CONNECTOR_AUTH="op://relationship/$APP_ENV/pay-api/PAY_CONNECTOR_AUTH" diff --git a/jobs/payment-jobs/poetry.lock b/jobs/payment-jobs/poetry.lock index 18cc9311f..4cf7b1c16 100644 --- a/jobs/payment-jobs/poetry.lock +++ b/jobs/payment-jobs/poetry.lock @@ -2109,13 +2109,13 @@ thrift = "0.16.0" tornado = "6.4.1" typing-extensions = "4.10.0" urllib3 = "2.2.2" -werkzeug = "3.0.3" +werkzeug = "^3.0.3" [package.source] type = "git" url = "https://github.com/seeker25/sbc-pay.git" -reference = "19182" -resolved_reference = "cd9b6fb378ecec1df506e733112caf6431f995dd" +reference = "20767_p3" +resolved_reference = "8b667944c9f710365984c41ffdd47bf974403758" subdirectory = "pay-api" [[package]] @@ -3266,4 +3266,4 @@ multidict = ">=4.0" [metadata] lock-version = "2.0" python-versions = "^3.12" -content-hash = "27531ae658ffd448da9d93eeb2ebdc5a0d0b02a8a1845a26a366d36db3b7af2f" +content-hash = "9600aaae4db56a867451a7437b19b28c2cf9f9aaf762bc2cb06ed6cbafa2e397" diff --git a/jobs/payment-jobs/pyproject.toml b/jobs/payment-jobs/pyproject.toml index 918c5c8a1..e76358cf4 100644 --- a/jobs/payment-jobs/pyproject.toml +++ b/jobs/payment-jobs/pyproject.toml @@ -7,7 +7,7 @@ readme = "README.md" [tool.poetry.dependencies] python = "^3.12" -pay-api = {git = "https://github.com/seeker25/sbc-pay.git", branch = "19182", subdirectory = "pay-api"} +pay-api = {git = "https://github.com/seeker25/sbc-pay.git", branch = "20767_p3", subdirectory = "pay-api"} flask = "^3.0.2" flask-sqlalchemy = "^3.1.1" sqlalchemy = "^2.0.28" diff --git a/jobs/payment-jobs/tasks/cfs_bank_name_updater.py b/jobs/payment-jobs/tasks/cfs_bank_name_updater.py index 258c8926b..ab6ff35c0 100644 --- a/jobs/payment-jobs/tasks/cfs_bank_name_updater.py +++ b/jobs/payment-jobs/tasks/cfs_bank_name_updater.py @@ -123,7 +123,8 @@ def get_bank_info( + f"/cfs/parties/{party_number}/accs/{account_number}/sites/{site_number}/payment/" ) access_token: str = CFSService.get_token().json().get("access_token") - payment_details = CFSService.get(site_payment_url, access_token, AuthHeaderType.BEARER, ContentType.JSON) + payment_details = CFSService.get(site_payment_url, access_token, AuthHeaderType.BEARER, ContentType.JSON, + additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_AUTH")}) return payment_details.json() @@ -161,6 +162,7 @@ def save_bank_details( AuthHeaderType.BEARER, ContentType.JSON, payment_details, + additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_AUTH")} ).json() current_app.logger.debug("<<<<<<") current_app.logger.debug(site_payment_response) diff --git a/jobs/payment-jobs/tasks/direct_pay_automated_refund_task.py b/jobs/payment-jobs/tasks/direct_pay_automated_refund_task.py index 6003f9e4c..76df867f5 100644 --- a/jobs/payment-jobs/tasks/direct_pay_automated_refund_task.py +++ b/jobs/payment-jobs/tasks/direct_pay_automated_refund_task.py @@ -156,7 +156,7 @@ def _query_order_status(cls, invoice: Invoice): access_token, AuthHeaderType.BEARER, ContentType.JSON, - additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_SECRET")}, + additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_AUTH")}, ).json() return payment_response diff --git a/jobs/payment-jobs/tasks/distribution_task.py b/jobs/payment-jobs/tasks/distribution_task.py index 53845a5fa..8f427dfd5 100644 --- a/jobs/payment-jobs/tasks/distribution_task.py +++ b/jobs/payment-jobs/tasks/distribution_task.py @@ -106,7 +106,7 @@ def update_revenue_lines(cls, invoice: InvoiceModel, payment_url: str, access_to AuthHeaderType.BEARER, ContentType.JSON, post_revenue_payload, - additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_SECRET")}, + additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_AUTH")}, ) @classmethod @@ -150,7 +150,7 @@ def get_payment_details(cls, payment_url: str, access_token: str): access_token, AuthHeaderType.BEARER, ContentType.JSON, - additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_SECRET")}, + additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_AUTH")}, ).json() return payment_response diff --git a/pay-admin/poetry.lock b/pay-admin/poetry.lock index 27126d3a2..09180f080 100644 --- a/pay-admin/poetry.lock +++ b/pay-admin/poetry.lock @@ -2003,13 +2003,13 @@ thrift = "0.16.0" tornado = "6.4.1" typing-extensions = "4.10.0" urllib3 = "2.2.2" -werkzeug = "3.0.3" +werkzeug = "^3.0.3" [package.source] type = "git" -url = "https://github.com/bcgov/sbc-pay.git" -reference = "main" -resolved_reference = "726b002cf90082cfbb795c3e7329da9ed8ef1a03" +url = "https://github.com/seeker25/sbc-pay.git" +reference = "20767_p3" +resolved_reference = "8b667944c9f710365984c41ffdd47bf974403758" subdirectory = "pay-api" [[package]] @@ -3110,4 +3110,4 @@ multidict = ">=4.0" [metadata] lock-version = "2.0" python-versions = "^3.12" -content-hash = "449884ee1d86b60ab1c69ddf067d25f1e8a887a71ca16efc2feec4bbc9e97d76" +content-hash = "5d35b71238ec39941f109227d088ad44d79ed6af2d770efec30b74848b06517b" diff --git a/pay-admin/pyproject.toml b/pay-admin/pyproject.toml index f38c129ec..21ee263dc 100644 --- a/pay-admin/pyproject.toml +++ b/pay-admin/pyproject.toml @@ -18,7 +18,7 @@ wtforms = "^3.1.2" werkzeug = "^3.0.1" itsdangerous = "^2.1.2" jinja2 = "^3.1.3" -pay-api = {git = "https://github.com/bcgov/sbc-pay.git", branch = "main", subdirectory = "pay-api"} +pay-api = {git = "https://github.com/seeker25/sbc-pay.git", branch = "20767_p3", subdirectory = "pay-api"} flask-session = {extras = ["filesystem"], version = "^0.8.0"} diff --git a/pay-api/devops/vaults.gcp.env b/pay-api/devops/vaults.gcp.env index 5f5f15f47..e0ab5eed4 100644 --- a/pay-api/devops/vaults.gcp.env +++ b/pay-api/devops/vaults.gcp.env @@ -58,3 +58,4 @@ ACCOUNT_SECRET_KEY="op://relationship/$APP_ENV/pay-api/ACCOUNT_SECRET_KEY" OUTSTANDING_TRANSACTION_DAYS="op://relationship/$APP_ENV/pay-api/OUTSTANDING_TRANSACTION_DAYS" ALLOW_LEGACY_ROUTING_SLIPS="op://relationship/$APP_ENV/pay-api/ALLOW_LEGACY_ROUTING_SLIPS" VUE_APP_AUTH_WEB_URL="op://web-url/$APP_ENV/auth-web/AUTH_WEB_URL" +PAY_CONNECTOR_AUTH="op://relationship/$APP_ENV/pay-api/PAY_CONNECTOR_AUTH" diff --git a/pay-api/src/pay_api/config.py b/pay-api/src/pay_api/config.py index 9e9e969ad..1d09c0142 100755 --- a/pay-api/src/pay_api/config.py +++ b/pay-api/src/pay_api/config.py @@ -113,6 +113,7 @@ class _Config: # pylint: disable=too-few-public-methods CFS_INVOICE_PREFIX = os.getenv("CFS_INVOICE_PREFIX", "REG") CFS_RECEIPT_PREFIX = os.getenv("CFS_RECEIPT_PREFIX", "RCPT") CFS_PARTY_PREFIX = os.getenv("CFS_PARTY_PREFIX", "BCR-") + PAY_CONNECTOR_AUTH = os.getenv("PAY_CONNECTOR_AUTH", "") # EFT Config EFT_INVOICE_PREFIX = os.getenv("EFT_INVOICE_PREFIX", "REG") @@ -199,9 +200,6 @@ class _Config: # pylint: disable=too-few-public-methods # Used for DEV/TEST/SANDBOX only. If True, will skip payment and return success and send queue message. ALLOW_SKIP_PAYMENT = os.getenv("ALLOW_SKIP_PAYMENT", "False").lower() == "true" - # Reverse Proxy secret - PAY_CONNECTOR_SECRET = os.getenv("PAY_CONNECTOR_SECRET", "") - TESTING = False DEBUG = True diff --git a/pay-api/src/pay_api/services/cfs_service.py b/pay-api/src/pay_api/services/cfs_service.py index 5b411fd5e..029f2c105 100644 --- a/pay-api/src/pay_api/services/cfs_service.py +++ b/pay-api/src/pay_api/services/cfs_service.py @@ -104,7 +104,7 @@ def get_site(cfs_account: CfsAccountModel) -> Dict[str, any]: access_token, AuthHeaderType.BEARER, ContentType.JSON, - additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_SECRET")}, + additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_AUTH")}, ) return site_response.json() @@ -125,7 +125,7 @@ def update_site_receipt_method(cfs_account: CfsAccountModel, receipt_method: str ContentType.JSON, pad_stop_payload, is_put=True, - additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_SECRET")}, + additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_AUTH")}, ) return site_update_response.json() @@ -152,7 +152,7 @@ def validate_bank_account(bank_details: Tuple[Dict[str, Any]]) -> Dict[str, str] ContentType.JSON, bank_details, raise_for_error=False, - additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_SECRET")}, + additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_AUTH")}, ) if bank_validation_response_obj.status_code in ( @@ -204,7 +204,7 @@ def _create_party(access_token: str = None, party_name: str = None): AuthHeaderType.BEARER, ContentType.JSON, party, - additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_SECRET")}, + additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_AUTH")}, ) current_app.logger.debug(">Creating party Record") return party_response.json() @@ -234,7 +234,7 @@ def _create_paybc_account(access_token, party, is_fas: bool): AuthHeaderType.BEARER, ContentType.JSON, account, - additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_SECRET")}, + additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_AUTH")}, ) current_app.logger.debug(">Creating CFS account") return account_response.json() @@ -279,7 +279,7 @@ def _create_site( # pylint: disable=too-many-arguments AuthHeaderType.BEARER, ContentType.JSON, site, - additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_SECRET")}, + additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_AUTH")}, ).json() except HTTPError as e: # If the site creation fails with 400, query and return site @@ -290,7 +290,7 @@ def _create_site( # pylint: disable=too-many-arguments access_token, AuthHeaderType.BEARER, ContentType.JSON, - additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_SECRET")}, + additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_AUTH")}, ) .json() .get("items")[0] @@ -336,7 +336,7 @@ def _save_bank_details( # pylint: disable=too-many-arguments AuthHeaderType.BEARER, ContentType.JSON, payment_details, - additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_SECRET")}, + additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_AUTH")}, ).json() payment_details = { @@ -365,7 +365,7 @@ def get_invoice(cls, cfs_account: CfsAccountModel, inv_number: str): access_token, AuthHeaderType.BEARER, ContentType.JSON, - additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_SECRET")}, + additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_AUTH")}, ) return invoice_response.json() @@ -392,7 +392,7 @@ def reverse_rs_receipt_in_cfs(cls, cfs_account, receipt_number, operation: Rever AuthHeaderType.BEARER, ContentType.JSON, payload, - additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_SECRET")}, + additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_AUTH")}, ) @classmethod @@ -425,7 +425,7 @@ def _modify_rs_receipt_in_cfs(cls, cfs_account, invoice_number, receipt_number, AuthHeaderType.BEARER, ContentType.JSON, payload, - additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_SECRET")}, + additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_AUTH")}, ) @classmethod @@ -465,7 +465,7 @@ def get_token(payment_system=PaymentSystem.PAYBC): AuthHeaderType.BASIC, ContentType.FORM_URL_ENCODED, data, - additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_SECRET")}, + additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_AUTH")}, ) current_app.logger.debug(">Getting token") return token_response @@ -504,7 +504,7 @@ def create_account_invoice( AuthHeaderType.BEARER, ContentType.JSON, invoice_payload, - additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_SECRET")}, + additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_AUTH")}, ) return invoice_response.json() @@ -626,7 +626,7 @@ def reverse_invoice(inv_number: str): AuthHeaderType.BEARER, ContentType.JSON, {}, - additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_SECRET")}, + additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_AUTH")}, ) @classmethod @@ -658,7 +658,7 @@ def add_nsf_adjustment(cls, cfs_account: CfsAccountModel, inv_number: str, amoun AuthHeaderType.BEARER, ContentType.JSON, adjustment, - additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_SECRET")}, + additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_AUTH")}, ) current_app.logger.debug(">Created CFS Invoice NSF Adjustment") @@ -709,7 +709,7 @@ def adjust_invoice( AuthHeaderType.BEARER, ContentType.JSON, adjustment, - additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_SECRET")}, + additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_AUTH")}, ) current_app.logger.debug(">Created Invoice Adjustment") @@ -754,7 +754,7 @@ def create_cfs_receipt( # pylint: disable=too-many-arguments AuthHeaderType.BEARER, ContentType.JSON, payload, - additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_SECRET")}, + additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_AUTH")}, ).json() @classmethod @@ -774,7 +774,7 @@ def get_receipt(cls, cfs_account: CfsAccountModel, receipt_number: str) -> Dict[ access_token, AuthHeaderType.BEARER, ContentType.JSON, - additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_SECRET")}, + additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_AUTH")}, ) current_app.logger.debug(">Received receipt response") @@ -797,7 +797,7 @@ def get_cms(cls, cfs_account: CfsAccountModel, cms_number: str) -> Dict[str, any access_token, AuthHeaderType.BEARER, ContentType.JSON, - additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_SECRET")}, + additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_AUTH")}, ) current_app.logger.debug(">Received CMS response") @@ -833,7 +833,7 @@ def create_cms(cls, line_items: List[PaymentLineItemModel], cfs_account: CfsAcco AuthHeaderType.BEARER, ContentType.JSON, cms_payload, - additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_SECRET")}, + additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_AUTH")}, ) current_app.logger.debug(">Received CMS response") @@ -861,7 +861,7 @@ def adjust_receipt_to_zero(cls, cfs_account: CfsAccountModel, receipt_number: st access_token, AuthHeaderType.BEARER, ContentType.JSON, - additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_SECRET")}, + additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_AUTH")}, ) current_app.logger.info(f"Balance on {receipt_number} - {receipt_response.json().get('unapplied_amount')}") if (unapplied_amount := float(receipt_response.json().get("unapplied_amount", 0))) > 0: @@ -876,14 +876,14 @@ def adjust_receipt_to_zero(cls, cfs_account: CfsAccountModel, receipt_number: st AuthHeaderType.BEARER, ContentType.JSON, adjustment, - additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_SECRET")}, + additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_AUTH")}, ) receipt_response = cls.get( receipt_url, access_token, AuthHeaderType.BEARER, ContentType.JSON, - additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_SECRET")}, + additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_AUTH")}, ) current_app.logger.info(f"Balance on {receipt_number} - {receipt_response.json().get('unapplied_amount')}") diff --git a/pay-api/src/pay_api/services/direct_pay_service.py b/pay-api/src/pay_api/services/direct_pay_service.py index cc9169ca4..0b8e563bf 100644 --- a/pay-api/src/pay_api/services/direct_pay_service.py +++ b/pay-api/src/pay_api/services/direct_pay_service.py @@ -343,7 +343,7 @@ def get_token(self): AuthHeaderType.BASIC, ContentType.FORM_URL_ENCODED, data, - additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_SECRET")}, + additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_AUTH")}, ) current_app.logger.debug(">Getting token") return token_response @@ -460,7 +460,7 @@ def query_order_status( access_token, AuthHeaderType.BEARER, ContentType.JSON, - additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_SECRET")}, + additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_AUTH")}, ).json() return Converter().structure(payment_response, OrderStatus) diff --git a/pay-api/src/pay_api/services/paybc_service.py b/pay-api/src/pay_api/services/paybc_service.py index 7c387c4de..5164e1711 100644 --- a/pay-api/src/pay_api/services/paybc_service.py +++ b/pay-api/src/pay_api/services/paybc_service.py @@ -148,7 +148,7 @@ def get_receipt( AuthHeaderType.BEARER, ContentType.JSON, retry_on_failure=True, - additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_SECRET")}, + additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_AUTH")}, ).json() for receipt in receipts_response.get("items"): expanded_receipt = self._get_receipt_by_number(access_token, receipt_url, receipt.get("receipt_number")) @@ -186,7 +186,7 @@ def _get_receipt_by_number( AuthHeaderType.BEARER, ContentType.JSON, True, - additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_SECRET")}, + additional_headers={"Pay-Connector": current_app.config.get("PAY_CONNECTOR_AUTH")}, ).json() def process_cfs_refund( diff --git a/pay-queue/devops/vaults.gcp.env b/pay-queue/devops/vaults.gcp.env index 7e7d573cb..16060a0d8 100644 --- a/pay-queue/devops/vaults.gcp.env +++ b/pay-queue/devops/vaults.gcp.env @@ -30,3 +30,4 @@ IT_OPS_EMAIL='SBC_ITOperationsSupport@gov.bc.ca' NOTIFY_API_URL="op://API/$APP_ENV/notify-api/NOTIFY_API_URL" NOTIFY_API_VERSION="op://API/$APP_ENV/notify-api/NOTIFY_API_VERSION" JWT_OIDC_ISSUER="op://keycloak/$APP_ENV/jwt-base/JWT_OIDC_ISSUER" +PAY_CONNECTOR_AUTH="op://relationship/$APP_ENV/pay-api/PAY_CONNECTOR_AUTH" diff --git a/pay-queue/poetry.lock b/pay-queue/poetry.lock index 2d38097f8..efe8af396 100644 --- a/pay-queue/poetry.lock +++ b/pay-queue/poetry.lock @@ -2061,9 +2061,9 @@ werkzeug = "^3.0.3" [package.source] type = "git" -url = "https://github.com/ochiu/sbc-pay.git" -reference = "24111-EFT-Federal-Payments" -resolved_reference = "cf3fc009657f5859145f71ce6c2425bc8e33258b" +url = "https://github.com/seeker25/sbc-pay.git" +reference = "20767_p3" +resolved_reference = "8b667944c9f710365984c41ffdd47bf974403758" subdirectory = "pay-api" [[package]] @@ -3186,4 +3186,4 @@ multidict = ">=4.0" [metadata] lock-version = "2.0" python-versions = "^3.12" -content-hash = "2dac0a73b35a15ebcbb5b6b5ac9ff28decd8dc9f5f8e01ac5e2bb215cd06ece2" +content-hash = "7771dba14db74dd99aac6f8565373fb670108fd1da860535bc18535520c07f01" diff --git a/pay-queue/pyproject.toml b/pay-queue/pyproject.toml index 90c91053f..d31ba5773 100644 --- a/pay-queue/pyproject.toml +++ b/pay-queue/pyproject.toml @@ -19,7 +19,7 @@ itsdangerous = "^2.1.2" protobuf = "4.25.3" launchdarkly-server-sdk = "^8.2.1" cachecontrol = "^0.14.0" -pay-api = {git = "https://github.com/ochiu/sbc-pay.git", branch = "24111-EFT-Federal-Payments", subdirectory = "pay-api"} +pay-api = {git = "https://github.com/seeker25/sbc-pay.git", branch = "20767_p3", subdirectory = "pay-api"} pg8000 = "^1.30.5" diff --git a/pay-queue/src/pay_queue/config.py b/pay-queue/src/pay_queue/config.py index d91fd6da9..a4147ce8a 100644 --- a/pay-queue/src/pay_queue/config.py +++ b/pay-queue/src/pay_queue/config.py @@ -89,6 +89,7 @@ class _Config: # pylint: disable=too-few-public-methods,protected-access CFS_CLIENT_ID = os.getenv("CFS_CLIENT_ID") CFS_CLIENT_SECRET = os.getenv("CFS_CLIENT_SECRET") CONNECT_TIMEOUT = int(os.getenv("CONNECT_TIMEOUT", "10")) + PAY_CONNECTOR_AUTH = os.getenv("PAY_CONNECTOR_AUTH", "") # EFT Config EFT_TDI17_LOCATION_ID = os.getenv("EFT_TDI17_LOCATION_ID")