Apple pledges to invest $30bn and pay $38bn tax bill