Skip to main content

Making Street Number / PO Box Mandatory for US Customers

Requirement

As-is state:

  • Currently, in CMD, we don’t have any mechanism for making dependent mandatory fields where if one of the fields is not present, the other becomes mandatory to be added as far as basic address or any other core attributes are concerned.
  • A similar feature has been enabled for Tax Numbers and Customer Identifiers for Brazil and Thailand Customers.

Proposed implementation:

  • Revise the ruleset API to make one of the mandatory fields have its "is mandatory" flag set to true. This will act as an enforcer, ensuring that, although it may not be a strictly mandatory field, the user cannot proceed unless the dependent mandatory field or the field itself is included.

  • Additionally, similar to the tax changes, the condition check column will require a non-null value. This value will represent the relationship between two dependent fields (such as Street Number and PO Box) and will be separated by a pipe symbol for an "or" operation (where either field is required) or an ampersand symbol for an "and" operation (where adding the first field enforces the addition of the second dependent field).

  • To implement the logic in the Ingest Customer API, follow these steps:

    1. Mandatory Field Check:
      • First, check if the field has the "is mandatory" flag set to true.
      • If the flag is false, allow the user to keep the field empty and proceed without further checks.
    2. Conditional Check:
      • If the "is mandatory" flag is true, check if the conditional check field is present.
      • If the conditional check field is null, respond with a validation error indicating that the field is mandatory.
    3. Dependent Field Validation:
      • If the conditional check field is not null, determine the relationship between the dependent fields (as specified by the conditional check).
        • OR Scenario: If the relationship is an "or" operation (indicated by the pipe symbol "|"), check if at least one of the dependent fields is present in the request.
          • If one of the fields is present, proceed.
          • If neither field is added, respond with a validation error.
        • AND Scenario (if applicable): If the relationship is an "and" operation (indicated by the ampersand symbol "&"), ensure that both dependent fields are present in the request.
          • If both fields are present, proceed.
          • If one or both fields are missing, respond with a validation error. This logic ensures that the mandatory checks are correctly enforced according to the specified conditions in the ruleset.
Was this page helpful?