def get_shipping_voucher_discount(voucher, total_price, shipping_price):
    """Calculate discount value for a voucher of shipping type."""
    voucher.validate_min_amount_spent(total_price)
    return voucher.get_discount_amount_for(shipping_price)