public static function isValid($action, $throw = false)
    {
        if (in_array($action, static::getActions(), true)) {
            return true;
        }

        if ($throw) {
            throw new InvalidArgumentException("Unknown gateway action '$action'.");
        }

        return false;
    }