def METHOD_NAME(info, period, channel_slug):
    if channel_slug is None:
        channel_slug = get_default_channel_slug_or_graphql_error()
    channel = Channel.objects.filter(slug=str(channel_slug)).first()
    if not channel:
        return None
    database_connection_name = get_database_connection_name(info.context)
    app = get_app_promise(info.context).get()
    if not app:
        accessible_channels = get_user_accessible_channels(info, info.context.user)
        if channel_slug not in [channel.slug for channel in accessible_channels]:
            raise PermissionDenied(
                message=f"You do not have access to the {channel_slug} channel."
            )
    qs = (
        models.Order.objects.using(database_connection_name)
        .non_draft()
        .exclude(status__in=[OrderStatus.CANCELED, OrderStatus.EXPIRED])
        .filter(channel__slug=str(channel_slug))
    )
    qs = filter_by_period(qs, period, "created_at")
    return sum_order_totals(qs, channel.currency_code)