Skip to content

Commit

Permalink
Update amendment reports debtor former name logic.
Browse files Browse the repository at this point in the history
Signed-off-by: Doug Lovett <[email protected]>
  • Loading branch information
doug-lovett committed Mar 12, 2024
1 parent e76378a commit d401922
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions ppr-api/src/ppr_api/models/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,9 @@ def get_former_party_name(self, new_party: Party):
address1 = party.client_code.address
if address2 is None and new_party.client_code:
address2 = new_party.client_code.address
if address1 and address2 and address1.json != address2.json:
if address1 and address2 and address1.json != address2.json and \
(not new_party.previous_party_id or
(new_party.previous_party_id and new_party.previous_party_id == party.id)):
return former_name
# Could only be changing a birthdate (names are identical).
if new_party.previous_party_id and new_party.previous_party_id == party.id:
Expand All @@ -934,9 +936,11 @@ def get_former_party_name(self, new_party: Party):
former_name = self.__get_matching_party_name(new_party, party)
return former_name
if address1 and address2 and address1.json == address2.json:
if party.client_code and party.client_code.name:
if party.client_code and party.client_code.name and new_party.business_name and \
new_party.business_name != party.client_code.name:
former_name = party.client_code.name
elif party.business_name:
elif party.business_name and new_party.business_name and \
new_party.business_name != party.business_name:
former_name = party.business_name
else:
# match if only 1 name is different in addition to same address.
Expand Down

0 comments on commit d401922

Please sign in to comment.