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

Fix SE reg type amendment set up. #1979

Merged
merged 1 commit into from
Jul 15, 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
8 changes: 8 additions & 0 deletions ppr-api/src/ppr_api/models/financing_statement.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,14 @@ def securities_act_notices_json(self, registration_id):
notice_json['added'] = True
if notice_json:
notices_list.append(notice.json)
if notices_list and self.current_view_json: # Current view remove existing amendment notice/order links.
for notice in notices_list:
if 'amendNoticeId' in notice:
del notice['amendNoticeId']
if notice.get('securitiesActOrders'):
for order in notice.get('securitiesActOrders'):
if 'amendOrderId' in order:
del order['amendOrderId']
return notices_list

def validate_debtor_name(self, debtor_name_json, staff: bool = False):
Expand Down
7 changes: 7 additions & 0 deletions ppr-api/src/ppr_api/reports/v2/report_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,3 +752,10 @@ def set_modified_notice(statement):
# Amend order check
if del_notice and del_notice.get('securitiesActOrders') and add_notice.get('securitiesActOrders'):
set_modified_order(add_notice, del_notice)
elif del_notice and del_notice.get('securitiesActOrders'): # Notice amended, all orders removed.
del_orders = []
for del_order in del_notice.get('securitiesActOrders'):
order = copy.deepcopy(del_order)
order['amendDeleted'] = True
del_orders.append(order)
add_notice['securitiesActOrders'] = del_orders
6 changes: 6 additions & 0 deletions ppr-api/tests/unit/models/test_financing_statement.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,12 @@ def test_find_by_registration_number(session, desc, reg_number, reg_type, accoun
assert result['generalCollateral'][0]
assert result.get('securitiesActNotices')
assert result['securitiesActNotices'][0].get('securitiesActOrders')
if statement.current_view_json:
for notice in result.get('securitiesActNotices'):
assert 'amendNoticeId' not in notice
if notice.get('securitiesActOrders'):
for order in notice.get('securitiesActOrders'):
assert 'amendOrderId' not in order
else:
with pytest.raises(BusinessException) as request_err:
FinancingStatement.find_by_registration_number(reg_number, account_id, staff, create)
Expand Down
Loading