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

20421 - Add cfs account status to search eft names #1525

Merged
merged 2 commits into from
May 9, 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
4 changes: 3 additions & 1 deletion pay-api/src/pay_api/models/eft_short_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class EFTShortnameSchema: # pylint: disable=too-few-public-methods
short_name: str
statement_id: int
status_code: str
cfs_account_status: str

@classmethod
def from_row(cls, row: EFTShortnames):
Expand All @@ -83,7 +84,8 @@ def from_row(cls, row: EFTShortnames):
created_on=row.created_on,
short_name=row.short_name,
statement_id=getattr(row, 'latest_statement_id', None),
status_code=getattr(row, 'status_code', None)
status_code=getattr(row, 'status_code', None),
cfs_account_status=getattr(row, 'cfs_account_status', None)
)


Expand Down
8 changes: 6 additions & 2 deletions pay-api/src/pay_api/services/eft_short_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

from pay_api.exceptions import BusinessException
from pay_api.factory.payment_system_factory import PaymentSystemFactory
from pay_api.models import CfsAccount as CfsAccountModel
from pay_api.models import EFTShortnames as EFTShortnameModel
from pay_api.models import EFTShortnameLinks as EFTShortnameLinksModel
from pay_api.models import EFTShortnameLinkSchema
Expand Down Expand Up @@ -258,10 +259,13 @@ def get_search_query(cls, search_criteria: EFTShortnamesSearch, is_count: bool =
EFTShortnameStatus.UNLINKED.value
),
else_=EFTShortnameLinksModel.status_code
).label('status_code'))
).label('status_code'),
CfsAccountModel.status.label('cfs_account_status'))
.outerjoin(EFTShortnameLinksModel, EFTShortnameLinksModel.eft_short_name_id == EFTShortnameModel.id)
.outerjoin(PaymentAccountModel,
PaymentAccountModel.auth_account_id == EFTShortnameLinksModel.auth_account_id))
PaymentAccountModel.auth_account_id == EFTShortnameLinksModel.auth_account_id)
.outerjoin(CfsAccountModel,
CfsAccountModel.account_id == PaymentAccountModel.id))

# Join payment information if this is NOT the count query
if not is_count:
Expand Down
Loading