The sentence contains an error. To better reveal the error, let's first simplify the sentence by removing all subordinate clauses: "that I was ... results" and "I made". Also, I'll remove the second independent clause "it turned out to be defective". Your sentence then becomes:
"A complaint was when I bought a new smartphone online from a well-known brand."
and the error becomes clearly visible. When you say "A complaint was ..." you need to follow up by stating WHAT the complaint was. Instead, you state WHEN the complaint was made. To fix the problem, you must first make a choice. Are you going to state WHAT the complaint was, or WHEN the complaint was made?
You could write this:
"When I bought a new smartphone online from a well-known brand, it turned out to be defective so I made a complaint."