entity icon indicating copy to clipboard operation
entity copied to clipboard

Legal API - update business response to return alternateNames list

Open argush3 opened this issue 1 year ago • 0 comments

Update business response for GET /businesses/ such that the correct alternateNames are returned for all business types. The business responses should essentially mirror what we have in the legal name branch right now.

Logic for return alternateNames:

  • Return name translation(alias table) entries if any
  • Return SP DBA entries in alternate name entries if not SP. SP DBA entries can be found by querying for proprietor entries where party_type = ‘organization’ and the identifier matches the business identifier of interest. When match is found, use SP entries business entry info to populate corresponding alternate name entry
  • In the case of a SP or GP, also return an alternate name entry by using info from existing business record
  • Return alternateNames with an empty list if there are no alternate name entries

Note: SPs should only ever have one alternateName entry

TODOs

  • [ ] Update json function in business model to return alternateNames list when enable-legal-name-fix feature flag is on. Note that this feature flag should exist already.
  • [ ] Get business endpoint should return alternateNames
  • [ ] Add/update unit tests to verify legal name is being returned correctly

BEN example business response

{
  "business": {
    ...
    "alternateNames": [
      {
        "name": "LOREM IPSUM",
        "nameStartDate": "2020-10-28",
        "nameType": "TRANSLATION"
      },
      {
        "entityType": "SP",
        "identifier": "FM1032630",
        "name": "FIX",
        "nameRegisteredDate": "2023-03-16T21:36:07.009977+00:00",
        "nameStartDate": "2023-03-15",
        "nameType": "DBA"
      },
      {
        "entityType": "SP",
        "identifier": "FM1032736",
        "name": "SOME DBA TEST",
        "nameRegisteredDate": "2023-03-17T23:39:44.450957+00:00",
        "nameStartDate": "2023-03-16",
        "nameType": "DBA"
      }
    ],
    "legalName": "BC1230010",
    "legalType": "BEN",
    ...
  }
}

SP example business response

{
  "business": {
	...
    "alternateNames": [
      {
        "entityType": "SP",
        "identifier": "FM1054864",
        "name": "AC SP DBA 2023.SEP.29 14.46 TEST",
        "nameRegisteredDate": "2023-10-03T14:11:15.034156+00:00",
        "nameStartDate": "2023-09-07",
        "nameType": "DBA"
      }
    ],
    "legalName": "AC BEN 2023.SEP.19 21.47 TEST CORP.",
    "legalType": "SP",
	...
  }
}

argush3 avatar Apr 10 '24 18:04 argush3