code: func (ssa *SQLStorageAuthority) GetOrderForNames(
  	ctx context.Context,
  	req *sapb.GetOrderForNamesRequest) (*corepb.Order, error) {
  
  	// Hash the names requested for lookup in the orderFqdnSets table
  	fqdnHash := hashNames(req.Names)
  
  	var orderID int64
  	err := ssa.dbMap.WithContext(ctx).SelectOne(&orderID, `
  	SELECT orderID
  	FROM orderFqdnSets
  	WHERE setHash = ?
  	AND registrationID = ?
  	AND expires > ?`,
  		fqdnHash, *req.AcctID, ssa.clk.Now())
  
  	// There isn't an unexpired order for the provided AcctID that has the
  	// fqdnHash requested.
  	if err == sql.ErrNoRows {
  		return nil, berrors.NotFoundError("no order matching request found")
  	} else if err != nil {
  		// An unexpected error occurred
  		return nil, err
  	}
  
  	// Get the order
  	order, err := ssa.GetOrder(ctx, &sapb.OrderRequest{Id: &orderID, UseV2Authorizations: req.UseV2Authorizations})
  	if err != nil {
  		return nil, err
  	}
  	// Only return a pending or ready order
  	if *order.Status != string(core.StatusPending) &&
  		*order.Status != string(core.StatusReady) {
  		return nil, berrors.NotFoundError("no order matching request found")
  	}
  	return order, nil
  }
docs: // GetOrderForNames tries to find a **pending** or **ready** order with the
  // exact set of names requested, associated with the given accountID. Only
  // unexpired orders are considered. If no order meeting these requirements is
  // found a nil corepb.Order pointer is returned.