Skip to content

Commit

Permalink
Add in suspension reason codes
Browse files Browse the repository at this point in the history
  • Loading branch information
seeker25 committed Jul 15, 2024
1 parent f55e034 commit 43e747d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion jobs/payment-jobs/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ readme = "README.md"

[tool.poetry.dependencies]
python = "^3.12"
pay-api = {git = "https://github.com/seeker25/sbc-pay.git", branch = "22063-part2", subdirectory = "pay-api"}
pay-api = {git = "https://github.com/bcgov/sbc-pay.git", branch = "20087", subdirectory = "pay-api"}
gunicorn = "^21.2.0"
flask = "^3.0.2"
flask-sqlalchemy = "^3.1.1"
Expand Down
18 changes: 9 additions & 9 deletions jobs/payment-jobs/utils/auth_event.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""Common code that sends AUTH events."""
from flask import current_app
from pay_api.models import PaymentAccount as PaymentAccountModel
from pay_api.services import gcp_queue_publisher
from pay_api.services.gcp_queue_publisher import QueueMessage
from pay_api.utils.enums import QueueSources
from sbc_common_components.utils.enums import QueueMessageTypes
from pay_api.utils.enums import PaymentMethod, QueueSources
from sbc_common_components.utils.enums import QueueMessageTypes, SuspensionReasonCodes
from sentry_sdk import capture_message


Expand All @@ -25,16 +26,15 @@ def publish_lock_account_event(pay_account: PaymentAccountModel):
)
except Exception as e: # NOQA pylint: disable=broad-except
current_app.logger.error(e)
current_app.logger.warning('Notification to Queue failed for the Account %s - %s',
pay_account.auth_account_id,
pay_account.name)
capture_message('Notification to Queue failed for the Account {auth_account_id}, {msg}.'.format(
auth_account_id=pay_account.auth_account_id, msg=payload), level='error')
current_app.logger.warning(f'Notification to Queue failed for the Account {
pay_account.auth_account_id} - {pay_account.name}')
capture_message(f'Notification to Queue failed for the Account {
pay_account.auth_account_id}, {payload}.', level='error')

@staticmethod
def _create_event_payload(pay_account):
return {
'accountId': pay_account.auth_account_id,
'paymentMethod': 'EFT',
'suspensionReasonCode': '' # TODO
'paymentMethod': PaymentMethod.EFT.value,
'suspensionReasonCode': SuspensionReasonCodes.OVERDUE_EFT.value
}
7 changes: 7 additions & 0 deletions pay-api/src/pay_api/utils/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,3 +383,10 @@ class StatementTemplate(Enum):

EFT_STATEMENT = 'eft_statement'
STATEMENT_REPORT = 'statement_report'


class SuspensionReasonCodes(Enum):
"""Suspension Reason Codes."""

OVERDUE_EFT = 'OVERDUE_EFT'
PAD_NSF = 'PAD_NSF'

0 comments on commit 43e747d

Please sign in to comment.