code: protected function validatePaymentTermAndOutstandingLimit(SaleInterface $sale, Constraint $constraint)
      {
          if (0 >= $sale->getOutstandingLimit()) {
              return;
          }
  
          if (null === $term = $sale->getPaymentTerm()) {
              if (null !== $customer = $sale->getCustomer()) {
                  // From parent if available
                  if ($customer->hasParent()) {
                      $term = $customer->getParent()->getPaymentTerm();
                  } else {
                      $term = $customer->getPaymentTerm();
                  }
              }
          }
  
          if (null === $term) {
              /** @var Sale $constraint */
              $this->context
                  ->buildViolation($constraint->outstanding_limit_require_term)
                  ->atPath('outstandingLimit')
                  ->addViolation();
          }
      }
docs: Validates the sale payment term and outstanding limit.
  
  @param SaleInterface $sale
  @param Constraint    $constraint