Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

20087 - Add suspension reason from queue payload #2815

Merged
merged 3 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions queue_services/events-listener/src/events_listener/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,14 @@ async def process_event(event_message, flask_app):
if message_type == LOCK_ACCOUNT_MESSAGE_TYPE:
org.status_code = OrgStatus.NSF_SUSPENDED.value
org.suspended_on = datetime.now()
org.suspension_reason_code = data.get('suspensionReasonCode', None)
data = {
'accountId': org_id,
}
await publish_mailer_events(LOCK_ACCOUNT_MESSAGE_TYPE, org_id, data)
elif message_type == UNLOCK_ACCOUNT_MESSAGE_TYPE:
org.status_code = OrgStatus.ACTIVE.value
org.suspension_reason_code = None
await publish_mailer_events(UNLOCK_ACCOUNT_MESSAGE_TYPE, org_id, data)
else:
logger.error('Unknown Message Type : %s', message_type)
Expand Down
4 changes: 3 additions & 1 deletion queue_services/events-listener/tests/integration/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import json

import stan
from auth_api.utils.enums import SuspensionReasonCode


async def helper_add_event_to_queue(stan_client: stan.aio.client.Client,
Expand All @@ -31,7 +32,8 @@ async def helper_add_event_to_queue(stan_client: stan.aio.client.Client,
'datacontenttype': 'application/json',
'data': {
'accountId': org_id,
'accountName': 'DEV - PAD01'
'accountName': 'DEV - PAD01',
'suspensionReasonCode': SuspensionReasonCode.OVERDUE_EFT.name
}
}

Expand Down
Loading