public static function validateAddress(&$element, FormStateInterface $form_state, &$complete_form) {
    $address = $element['#value'];
    $address_review_text = $element['#address_review_text'];
    $address_failed_text = $element['#address_failed_text'];

    // Make sure these fields have values before trying to validate the address.
    $required_fields = [
      'street',
      'city',
      'region',
      'postcode',
    ];

    $skip = FALSE;

    foreach ($required_fields as $required_field) {
      if (empty($address[$required_field])) {
        $skip = TRUE;
        break;
      }
    }

    // Skip validation if not all fields are filled out yet.
    if ($skip) {
      return $element;
    }

    try {
      $response = \Drupal::service('acm.api')
        ->validateCustomerAddress($address);

      // Address is valid and no suggestion came back.
      if (isset($response['result']['valid']) && empty($response['result']['suggested'])) {
        drupal_set_message($address_review_text, 'status');
      }
      // Address is in review and there's a suggestion that we use to pre-fill
      // the address fields.
      elseif (isset($response['result']['suggested']) && !empty($response['result']['suggested'])) {
        $suggested_address = reset($response['result']['suggested']);
        foreach ($suggested_address as $field => $value) {
          if (!empty($value)) {
            if (isset($element[$field])) {
              $form_state->setValueForElement($element[$field], $value);
            }
            elseif (isset($element['dynamic_parts'][$field])) {
              $form_state->setValueForElement($element['dynamic_parts'][$field], $value);
            }
          }
        }

        drupal_set_message($address_review_text, 'status');
      }
      // Address failed validation.
      else {
        $form_state->setError($element, $address_failed_text);
      }
    }
    catch (RouteException $e) {
      $form_state->setError($element, $address_failed_text);
    }

    return $element;
  }