Chosen Solution

The phone works, the problem is just with the charging. The port where the pins of the usb were little curved so i replaced it with a new one and when i plug the charger it goes on and off like i am unplugging and putting the charger back on. It’s the same issue as when i received the phone.

first try a different cable