From c13aa15e9cf20e30fb0aa9338164b3dee2f7a272 Mon Sep 17 00:00:00 2001 From: Travis Semple Date: Wed, 1 Mar 2023 13:15:53 -0800 Subject: [PATCH] 15257- Fix for exception not coming back correctly. (#1134) * Fix for exception not coming back correctly. * Fix reference. --- jobs/payment-jobs/requirements.txt | 2 +- pay-api/src/pay_api/resources/account.py | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/jobs/payment-jobs/requirements.txt b/jobs/payment-jobs/requirements.txt index 5a3c3157b..0b0844810 100644 --- a/jobs/payment-jobs/requirements.txt +++ b/jobs/payment-jobs/requirements.txt @@ -1,5 +1,5 @@ -e git+https://github.com/bcgov/sbc-common-components.git@a643801c373063dfa44a2f7213d9122d3ad03851#egg=sbc_common_components&subdirectory=python --e git+https://github.com/seeker25/sbc-pay.git@aafc77ad4b1e0681f44580e14a4f559936c5d96e#egg=pay_api&subdirectory=pay-api +-e git+https://github.com/bcgov/sbc-pay.git@93d0c0955800001e1fb2229de3fd76ede62d4d54#egg=pay_api&subdirectory=pay-api Flask-Caching==2.0.2 Flask-Migrate==2.7.0 Flask-Moment==1.0.5 diff --git a/pay-api/src/pay_api/resources/account.py b/pay-api/src/pay_api/resources/account.py index 0d4b3d1ea..2c54944ee 100644 --- a/pay-api/src/pay_api/resources/account.py +++ b/pay-api/src/pay_api/resources/account.py @@ -264,10 +264,12 @@ def post(account_number: str): # Check if user is authorized to perform this action check_auth(business_identifier=None, account_id=account_number, contains_role=EDIT_ROLE, is_premium=True) - - report = Payment.create_payment_report(account_number, request_json, response_content_type, report_name) - response = Response(report, 201) - response.headers.set('Content-Disposition', 'attachment', filename=report_name) - response.headers.set('Content-Type', response_content_type) - response.headers.set('Access-Control-Expose-Headers', 'Content-Disposition') - return response + try: + report = Payment.create_payment_report(account_number, request_json, response_content_type, report_name) + response = Response(report, 201) + response.headers.set('Content-Disposition', 'attachment', filename=report_name) + response.headers.set('Content-Type', response_content_type) + response.headers.set('Access-Control-Expose-Headers', 'Content-Disposition') + return response + except BusinessException as exception: + return exception.response()