def get_delivery_voucher_discount(voucher, total_price, delivery_price):
    """Calculate discount value for a voucher of delivery type."""
    voucher.validate_min_amount_spent(total_price)
    return voucher.get_discount_amount_for(delivery_price)