Business Account KYC Verification — Parts 1–5
Problem statement
Validate each business account through a five-part KYC process. Parts 1–4 are ordered validation checks; Part 5 encodes the result. csvData contains a header followed by business rows with six comma-separated fields:
business_namebusiness_profile_namefull_statement_descriptorshort_statement_descriptorurlproduct_description
Trim surrounding whitespace from every field.
Parts 1–3: Required fields and descriptor checks
- All six fields must be present and non-empty.
full_statement_descriptormust contain 5 through 31 characters inclusive after trimming.- The full descriptor must not equal, case-insensitively,
ONLINE STORE,ECOMMERCE,RETAIL,SHOP, orGENERAL MERCHANDISE.
Part 4: Business-name similarity
Normalize business_name and business_profile_name to distinct uppercase ASCII alphanumeric tokens. Ignore these legal or generic tokens: THE, INC, INCORPORATED, LLC, LTD, LIMITED, CORP, CORPORATION, COMPANY, CO. The names match when both normalized sets are non-empty and the number of shared tokens is at least half the size of the smaller set. The half threshold is inclusive.
Part 5: Error codes
Apply the four checks in order and report only the first failure. Return one string per business:
VERIFIED: <business_name> | OKNOT VERIFIED: <business_name> | MISSING_FIELDNOT VERIFIED: <business_name> | INVALID_DESCRIPTOR_LENGTHNOT VERIFIED: <business_name> | GENERIC_DESCRIPTORNOT VERIFIED: <business_name> | NAME_MISMATCH
Community-shared follow-up: Descriptor-to-name overlap
The full_statement_descriptor must contain at least 50% of the words from either business_name or business_profile_name.
This compares the descriptor against either business name, unlike Part 4, which compares the two names with each other.
Note: This follow-up is community-shared and is not part of the judged Parts 1–5 requirements.
Function
validateBusinesses(csvData: String) → String[]Examples
Example 1
csvData = "business_name,business_profile_name,full_statement_descriptor,short_statement_descriptor,url,product_description\nPawsome Pets Inc.,Pawsome Pets,PAWSOME PETS,Pawsome,pawsome.example,Pet supplies\nBean Bliss Coffee Company,Bean Bliss,,Bean,bean.example,Coffee beans\nGlobal Goods Marketplace Inc.,Global Goods,RETAIL,Global,goods.example,General products"return = ["VERIFIED: Pawsome Pets Inc. | OK","NOT VERIFIED: Bean Bliss Coffee Company | MISSING_FIELD","NOT VERIFIED: Global Goods Marketplace Inc. | GENERIC_DESCRIPTOR"]Pawsome passes all five parts. Bean Bliss fails the first rule, so MISSING_FIELD wins. Global Goods reaches the descriptor blocklist and returns GENERIC_DESCRIPTOR.
Example 2
csvData = "business_name,business_profile_name,full_statement_descriptor,short_statement_descriptor,url,product_description\nAlpha Beta Gamma Delta LLC,Alpha Beta Epsilon Zeta,ALPHA BETA GOODS,Alpha,alpha.example,Analytics\nNorth Star Labs,Totally Different,STAR SERVICES,Star,north.example,Software"return = ["VERIFIED: Alpha Beta Gamma Delta LLC | OK","NOT VERIFIED: North Star Labs | NAME_MISMATCH"]The first row shares exactly two of four normalized tokens and passes the inclusive half-overlap rule. The second shares no normalized name tokens and returns NAME_MISMATCH.
Constraints
- The first line is a header and is not validated.
- Each data row is a simple six-field CSV row with no embedded commas or quoted commas.
- One or more empty lines at the end are ignored as record terminators; an empty interior row is validated and fails Part 1.
- Input fields use ASCII characters, so descriptor lengths and name tokenization are identical across supported languages.
- All fields are trimmed; an empty trimmed value fails Part 1.
- The full descriptor length interval is inclusive at 5 and 31.
- The descriptor blocklist uses case-insensitive exact equality, not substring matching.
- Name tokens are distinct ASCII letters/digits separated by any non-alphanumeric character.
- The four checks are evaluated in Parts 1, 2, 3, then 4 order; return Part 5 results in input order.