Skip to content

Commit

Permalink
Add try except for create_cfs_account. That way if it fails it doesn'… (
Browse files Browse the repository at this point in the history
#1084)

* Add try except for create_cfs_account. That way if it fails it doesn't back up the other accounts.

* Remove sbc-common-components

* Update version.py.
  • Loading branch information
seeker25 authored Feb 1, 2023
1 parent 86b3e5f commit f8e6171
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
17 changes: 12 additions & 5 deletions jobs/payment-jobs/tasks/cfs_create_account_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,18 @@ def create_accounts(cls): # pylint: disable=too-many-locals

for pending_account in pending_accounts:
# Find the payment account and create the pay system instance.
pay_account: PaymentAccountModel = PaymentAccountModel.find_by_id(pending_account.account_id)
if pay_account.payment_method in (PaymentMethod.CASH.value, PaymentMethod.CHEQUE.value):
routing_slip.create_cfs_account(pending_account, pay_account)
else:
cls._create_cfs_account(pending_account, pay_account, auth_token)
try:
pay_account: PaymentAccountModel = PaymentAccountModel.find_by_id(pending_account.account_id)
if pay_account.payment_method in (PaymentMethod.CASH.value, PaymentMethod.CHEQUE.value):
routing_slip.create_cfs_account(pending_account, pay_account)
else:
cls._create_cfs_account(pending_account, pay_account, auth_token)
except Exception as e: # NOQA # pylint: disable=broad-except
capture_message(
f'Error on creating cfs_account={pending_account.account_id}, '
f'ERROR : {str(e)}', level='error')
current_app.logger.error(e)
continue

@classmethod
def _get_account_contact(cls, auth_token: str, auth_account_id: str):
Expand Down
2 changes: 1 addition & 1 deletion pay-api/src/pay_api/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
Development release segment: .devN
"""

__version__ = '1.18.2' # pylint: disable=invalid-name
__version__ = '1.18.3' # pylint: disable=invalid-name

0 comments on commit f8e6171

Please sign in to comment.