entity icon indicating copy to clipboard operation
entity copied to clipboard

Legal API - update logic for populating legalName field in business response

Open argush3 opened this issue 1 year ago • 0 comments

Update business response for GET /businesses/ such that the correct legal name is returned for SP/GPs. The logic to be used to return the correct legal name for firms can be referenced from entity-bn

Logic for legal name:

  • Return businesses.legal name when business type is not a firm
  • Return legal name the way entity-bn does when business is a firm

TODOs

  • [ ] Update json function in business model to return correct legal name for SP/GPs when enable-legal-name-fix feature flag is on. Note that this feature flag should exist already. Ensure to incorporate upcoming changes to entity-bn firm name retrieval logic.
  • [ ] Get business endpoint should return expected legalName for firms
  • [ ] Add/update unit tests to verify legal name is being returned correctly

Sample business response payloads

GET <api_base_url>/api/v2/businesses/FM1044962

{
  "business": {
    ...
    "alternateNames": [
      {
        "entityType": "GP",
        "identifier": "FM1044962",
        "name": "AC GP 2023.JUN.22 13.29 TEST",
        "nameRegisteredDate": "2023-06-22T14:33:39.339955+00:00",
        "nameStartDate": null,
        "nameType": "DBA"
      },
      {
        "entityType": "SP",
        "identifier": "FM1054479",
        "name": "AC SP DBA 2023.SEP.29 14.02 TEST",
        "nameRegisteredDate": "2023-09-29T14:22:12.906507+00:00",
        "nameStartDate": "2023-09-27",
        "nameType": "DBA"
      }
    ],
    "legalName": "AC GP 2022.07.12 17.41 TEST, JANE DOE",
    "legalType": "GP",
    ...
  }
}
GET <api_base_url>/api/v2/businesses/FM1028594

{
  "business": {
    ...
    "alternateNames": [
      {
        "entityType": "SP",
        "identifier": "FM1028594",
        "name": "AC SP 2023.FEB.01 21.13 TEST",
        "nameRegisteredDate": "2023-02-02T23:26:39.716236+00:00",
        "nameStartDate": "2022-10-04",
        "nameType": "DBA"
      }
    ],
    "legalName": "JANE DOE",
    "legalType": "SP",
    ...
  }
}
GET <api_base_url>/api/v2/businesses/FM1054864

{
  "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",
    ...
  }
}
GET <api_base_url>/api/v2/businesses/FM0536920

{
  "business": {
    ...
    "alternateNames": [
      {
        "entityType": "GP",
        "identifier": "FM0536920",
        "name": "XYZ FARMS - IMPORT_TEST",
        "nameRegisteredDate": "2010-12-14T08:00:00+00:00",
        "nameStartDate": null,
        "nameType": "DBA"
      }
    ],
    "legalName": "JANE DOE, JOHN DOE, et al",
    "legalType": "GP"
  }
}

argush3 avatar Apr 10 '24 18:04 argush3