Did you buy it from an authorised Apple reseller online?
An Apple Store will replace or repair any device bought from an authorised reseller. If it is not, your contract is with the store where you bought it from.
It was the on-line Apple store. In store, they refused to refund or replace it.