Hi,
Here is a link to the Ifixit guide on how to disassemble your coffee maker. Once you have done this, or done enough to see what you need to, it may be possible to ascertain if it is a wiring connection problem behind the contacts that make the connection with the tray. You state that by banging it, it worked. Therefore it could have been a connection problem, e.g a dry joint solder connection but now perhaps due to the banging, over time the wire has broken off the terminal. This is only a thought as I haven't seen what is behind the contacts.
[guide|13917]