Actually, you're in luck. Normally everything is shut down on Sundays, but right now in Madrid (and I assume Barcelona also) ALL of the stores are open on Sundays (for holiday shopping). I was at some of them yesterday and it was pretty bustling with with holiday spirit.
I'm not sure about the attractions. Do you mean museums? If so, the main one, Museo Del Prado
is open on Sundays as well as all of the parks and plazas.
I think there'll be lots of things for you to check out, in Madrid at least.
As far as which one is better for a 3 night stay. That really depends on you. What your interests are, if you speak any Castillian or Catalan (Barcelona) and want to utilize it to the fullest, if you're into beaches, restaurants, clubs, parks, museums, etc...
I would start with defining your interests and researching which of these two cities would cater to your interests the most.
They're both great cities...