From dd4500d5327831538082f7c17e2ed8f70238f4fc Mon Sep 17 00:00:00 2001 From: Tiago-da-Silva23 Date: Thu, 14 Dec 2023 11:27:24 +0000 Subject: [PATCH] fix: added the entity parameter to the ilink connection header --- apps/billing/services/receipt_host_service.py | 2 ++ apps/billing/tests/test_invoice_host_service.py | 1 + nau_financial_manager/settings.py | 1 + 3 files changed, 4 insertions(+) diff --git a/apps/billing/services/receipt_host_service.py b/apps/billing/services/receipt_host_service.py index e211ab5..33849e9 100644 --- a/apps/billing/services/receipt_host_service.py +++ b/apps/billing/services/receipt_host_service.py @@ -9,6 +9,7 @@ def __init__(self) -> None: self.__receipt_host_url = getattr(settings, "RECEIPT_HOST_URL") self.__receipt_host_auth = getattr(settings, "RECEIPT_HOST_AUTH") self.__receipt_host_password = getattr(settings, "RECEIPT_HOST_PASSWORD") + self.__receipt_entity_public_key = getattr(settings, "RECEIPT_ENTITY_PUBLIC_KEY") def get_document(self, document_id: str): """ @@ -21,6 +22,7 @@ def get_document(self, document_id: str): try: response = requests.get( url=f"{self.__receipt_host_url}/{document_id}", + headers={"entity": self.__receipt_entity_public_key}, auth=( self.__receipt_host_auth, self.__receipt_host_password, diff --git a/apps/billing/tests/test_invoice_host_service.py b/apps/billing/tests/test_invoice_host_service.py index 938faa5..62b524c 100644 --- a/apps/billing/tests/test_invoice_host_service.py +++ b/apps/billing/tests/test_invoice_host_service.py @@ -18,6 +18,7 @@ def __init__(self) -> None: self.__receipt_host_url = "https://receipt-fake.com/" self.__receipt_host_auth = "test_auth" self.__receipt_host_password = "pwd_test" + self.__receipt_entity_public_key = "receipt_entity_public_key" class MockResponse(Response): diff --git a/nau_financial_manager/settings.py b/nau_financial_manager/settings.py index c99dcd1..22e6c18 100644 --- a/nau_financial_manager/settings.py +++ b/nau_financial_manager/settings.py @@ -271,6 +271,7 @@ def get_env_setting(env_variable, default=None): RECEIPT_HOST_URL = CONFIG.get("RECEIPT_HOST_URL", "") RECEIPT_HOST_AUTH = CONFIG.get("RECEIPT_HOST_AUTH", "") RECEIPT_HOST_PASSWORD = CONFIG.get("RECEIPT_HOST_PASSWORD", "") +RECEIPT_ENTITY_PUBLIC_KEY = CONFIG.get("RECEIPT_ENTITY_PUBLIC_KEY", "") SWAGGER_PROJECT_NAME = CONFIG.get("SWAGGER_PROJECT_NAME", "Nau Financial Manager") SWAGGER_PROJECT_VERSION = CONFIG.get("SWAGGER_PROJECT_VERSION", "1.0.0")