Depending on the barrier, you may take damage, you might not.
Example, BAR8 wall is in between you and the 4 AP / 3BD attack.
The BAR/AP difference is -4, so the 3 BD attack is reduced to 0.
Let's say you were behind a BAR 4 wall instead.
The BAR/AP difference is 0, so the shot will do 4AP/3BD damage to you, as the attack's AP is equal to (or more) than the BAR.
Let's say you were behind a BAR 6 wall when this attack hit.
The difference is now -2, so the 4AP/3BD attack now becomes a 2AP/1BD attack against you.
All of that's covered on p.185.
The integrity comes in to play whenever a barrier is hit, as each hit will degrade it. It's separate from the question if a given attack will hurt the person behind the barrier.
Using the above AP 4/3BD attack against a BAR 4, 6 or 8 wall will reduce its integrity by 1, 0 and 0 respectively. Yet you still took (potential) damage in the case of the BAR 6 wall. (Odds are decent your armor was able to deal with the AP 2 / 1BD attack).
As noted on p.187, integrity and BAR are two separate things, such that something with a high BAR might have a low integrity, or vice versa. Sandbags, as you note, likely have substantial integrity, even if they only provide a BAR of 4, you could justify 10 integrity points.