Allow discount BXGY rule only when the third party coupon is applied in cart

Restrict the BXGY discount rule to be applied only when a third-party coupon is in the cart.

global $wdr_has_third_party_coupon;
add_filter('advanced_woo_discount_rules_filter_passed', function($filter_passed, $rule){
    global $wdr_has_third_party_coupon;
    if (!isset($wdr_has_third_party_coupon)) {
        $wdr_has_third_party_coupon = \Wdr\App\Controllers\ManageDiscount::isCartContainsAnyThirdPartyCoupon();
    }
    if ($wdr_has_third_party_coupon) {
        if($rule->rule->discount_type == 'wdr_buy_x_get_y_discount'){
            return $filter_passed;
        }
        return false;
    }
    return $filter_passed;
}, 10, 2);