From 9eb59366900ed1ec30592d5ae20cc5c0993452cd Mon Sep 17 00:00:00 2001 From: SDE Date: Tue, 7 May 2024 16:23:40 +0300 Subject: [PATCH] 1.0.2 subscribe page w dynamically load --- BillingApp/funcs.py | 5 +++-- SubscribesApp/funcs.py | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/BillingApp/funcs.py b/BillingApp/funcs.py index d5a2f5c..a30ef87 100644 --- a/BillingApp/funcs.py +++ b/BillingApp/funcs.py @@ -12,8 +12,8 @@ def get_order_status(order): res_data = get_order_status(order.bank_order_id) res = json.loads(res_data.text) - order.json_data['status'] = res res = res['orders'][0] + order.json_data['status'] = res order.status = res['status'] @@ -69,8 +69,9 @@ def create_subscribe_order(data): order.pay_page = res_data.headers.get('location') res = json.loads(res_data.text) - order.json_data['create_order'] = res res = res['orders'][0] + order.json_data['create_order'] = res + order.modifiedDT = datetime.strptime(res['updated'], '%Y-%m-%d %H:%M:%S') order.status = res['status'] order.bank_order_id = res['id'] diff --git a/SubscribesApp/funcs.py b/SubscribesApp/funcs.py index 7fc4e2c..5efc81f 100644 --- a/SubscribesApp/funcs.py +++ b/SubscribesApp/funcs.py @@ -77,7 +77,10 @@ def get_profile_subscribe_page_content_Dict(request): order = get_order_status(order) subscribes_for_user = check_n_enable_subscribe_by_order(order) if not subscribes_for_user: - subscribes.get(id=order.subscribe.id).order_error = order.status + error = f'{order.status}' + if 'status' in order.json_data and 'failure_message' in order.json_data['status']: + error = f'{error} ({order.json_data["status"]["failure_message"]})' + subscribes.get(id=order.subscribe.id).order_error = error check_orders_required = False else: check_orders_required = True