A German court has ruled Carles Puigdemont can be extradited to Spain, but only on a charge of misuse of public funds rather than rebellion.