I would start with resetting your Mac's System management Controller (SMC) and also checking your battery status.
Reset the SMC
To reset the System management Controller on your particular MBP, follow these steps:
- Shut down your computer
- Keep the power cable plugged in
- Press at the same time shiftoptioncontrol (on the left side of the built-in keyboard) and the power button and hold all these down for at least 10 seconds
- Let go
- Turn your computer back on with the power button.
After resetting the SMC, use your computer to determine if the issue still persists.
I'm also guessing you won't know the history of the battery, so it'd be good to check the status of your battery once the SMC reset is done.
Check battery status
- Ensure your MacBook is connected to a power source
- Go to Apple > About This Mac
- Ensure you have the Overview tab selected
- Click on the System Report... button
- After the System Information window appears, click on the Power option (it's listed in the lefthand menu within the Hardware section)
- Now on the righthand side take note of the following items:
- Under Charge Information: Charging and Full Charge Capacity
- Under Health Information: Cycle Count and Condition
Now report back the results via the comment option below, also letting me know if your MBP is charging properly now.