Skip to content

Commit

Permalink
update events to show the corpNum in consumed transaction (#1567)
Browse files Browse the repository at this point in the history
  • Loading branch information
eve-git authored Aug 23, 2024
1 parent 86d810e commit 0a69cd3
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions api/namex/resources/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ def get(nr):
else:
nr_event_info['names'].append(event_json_data)

elif 'state' in event_json_data and event_json_data['state'] == 'CONSUMED':
for name_info in nr_event_info['names']:
if name_info.get('state') in ('APPROVED', 'CONDITION'):
name_info['corpNum'] = event_json_data['corpNum']
# else update nr_event_info with any changed event data (should be formatted same as an NR json)
else:
for key in nr_event_info.keys():
Expand All @@ -107,12 +111,7 @@ def get(nr):
if key == 'stateCd':
continue
# otherwise update nr_event_info
if key == 'corpNum' and nr_event_info['stateCd'] == 'CONSUMED':
for name_info in nr_event_info['names']:
if name_info.get('state') in ('APPROVED', 'CONDITION'):
name_info['corpNum'] = event_json_data[key]
else:
nr_event_info[key] = event_json_data[key]
nr_event_info[key] = event_json_data[key]
# entity_type_cd for namerequest is used to change requestTypeCd in namex (it is being mapped incorrectly)
if 'entity_type_cd' in event_json_data.keys() and 'requestTypeCd' not in event_json_data.keys():
nr_event_info['requestTypeCd'] = event_json_data['entity_type_cd']
Expand Down

0 comments on commit 0a69cd3

Please sign in to comment.