From 240862ce995fd8f3b2af7bf8e91e986edc966087 Mon Sep 17 00:00:00 2001 From: Ivo Branco Date: Fri, 12 Apr 2024 14:23:42 +0100 Subject: [PATCH] refactor: sent to financial manager returns bool --- nau_extensions/financial_manager.py | 5 +++-- .../management/commands/retry_send_to_financial_manager.py | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/nau_extensions/financial_manager.py b/nau_extensions/financial_manager.py index 6dd7b17..45d01fd 100644 --- a/nau_extensions/financial_manager.py +++ b/nau_extensions/financial_manager.py @@ -137,7 +137,7 @@ def _convert_order_lines(order): def send_to_financial_manager_if_enabled( basket_transaction_integration: BasketTransactionIntegration, -): +) -> bool: """ The service that calls the nau-financial-manager with the request data pre saved on the `BasketTransactionIntegration` instance, then save the response data. @@ -170,7 +170,8 @@ def send_to_financial_manager_if_enabled( basket_transaction_integration.response = response_json basket_transaction_integration.save() - return basket_transaction_integration + return True + return False def get_receipt_link(order): diff --git a/nau_extensions/management/commands/retry_send_to_financial_manager.py b/nau_extensions/management/commands/retry_send_to_financial_manager.py index 7d79a98..13a5ce2 100644 --- a/nau_extensions/management/commands/retry_send_to_financial_manager.py +++ b/nau_extensions/management/commands/retry_send_to_financial_manager.py @@ -53,7 +53,8 @@ def add_arguments(self, parser): def handle(self, *args, **kwargs): """ - Synchronize courses to the Richie marketing site, print to console its sync progress. + Synchronize Basket Transaction Integrations to Financial Manager system, + print to console its sync progress. """ btis: list = None @@ -83,8 +84,8 @@ def handle(self, *args, **kwargs): seconds=delta_to_be_sent_in_seconds ): log.info("Sending to financial manager basket_id=%d", bti.basket.id) - bti_updated = send_to_financial_manager_if_enabled(bti) - if bti_updated.is_sent_with_success: + sent = send_to_financial_manager_if_enabled(bti) + if sent: retry_success_count += 1 else: log.error("Error sending basket_id=%d", bti.basket.id)