def METHOD_NAME(
    order: Order,
    refund_data: RefundData,
) -> Dict[int, int]:
    """Return all refunded product variants for specified order.
    Takes into account previous refunds and current refund mutation parameters.
    :return: Dictionary of variant ids and refunded quantities.
    """
    if not refund_data.refund_amount_is_automatically_calculated:
        order_lines_to_refund = []
        fulfillment_lines_to_refund = []
    else:
        order_lines_to_refund = refund_data.order_lines_to_refund
        fulfillment_lines_to_refund = refund_data.fulfillment_lines_to_refund
    # Refund fulfillments for product refunds with automatic amount
    previous_fulfillment_lines = _get_refunded_fulfillment_lines_with_automatic_amount(
        order
    )
    previous_refund_lines = (
        (p_variant_id, line1.quantity)
        for line1 in previous_fulfillment_lines
        if (p_variant_id := line1.order_line.variant_id)
    )
    current_order_refund_lines = (
        (variant.id, line1.quantity)
        for line1 in order_lines_to_refund
        if (variant := line1.variant)
    )
    current_fulfillment_refund_lines = (
        (f_variant_id, line1.quantity)
        for line1 in fulfillment_lines_to_refund
        if (f_variant_id := line1.line.order_line.variant_id)
    )
    refund_lines = chain(
        previous_refund_lines,
        current_order_refund_lines,
        current_fulfillment_refund_lines,
    )
    summed_refund_lines: Dict[int, int] = defaultdict(int)
    for variant_id, quantity in refund_lines:
        summed_refund_lines[variant_id] += quantity
    return dict(summed_refund_lines)