Voronoï summation for cusp forms with characters In an attempt to solve an unrelated problem, I was led to the task of estimating/bounding from above sums of the form
$$\sum_{m=1}^\infty\lambda(m)e\left(-\frac{am}{q}\right)h(m)$$
where $\sum_{m=1}^\infty\lambda(m)e(mz)$ is the Fourier expansion of a cusp form of weight $1$ and a certain level $N$, with respect to some Dirichlet character $\chi$, and $h$ is some smooth compactly supported function. Note that the modulus of $\chi$ is NOT (necessarily) $q$; I need to work with the above display for a general positive integer $q$.
Now, my knowledge of all things modular is rather limited, but my understanding is that sums like the above are best handled via some variation of Voronoï summation. However, I have not been able to find a specific formulation of Voronoï summation in the literature that suits my situation. For example, in https://arxiv.org/pdf/math/0304187.pdf, Theorem 4.12 only deals with cusp forms with respect to the full modular group (or at least this is my understanding - I do not master the language used at the beginning of Section 4). In Iwaniec and Kowalski's Analytic Number Theory, Exercise 9 in Chapter 4 deals with the case of modular forms twisted by characters, but still, as far as I understand, only with respect to the full modular group (e.g. level $1$) and when the modulus of $\chi$ divides $q$.
It is possible that, for experts, it is clear how to handle the sum I presented via one of these two versions, but I do not see how to do it and I would appreciate any suggestion on general principles regarding approaches to this sum.
 A: Consider the cuspidal representation $\pi:=\pi_f\otimes\pi_\infty$ of $\mathrm{GL}_2(\mathbb{A})$ with the central character $\omega_\chi$, the Hecke character attached to $\chi$, such that $\pi_f$ has level $N$ and $\pi_\infty$ is isomorphic to the Discrete series of weight $k$. Let $\phi\in\pi$ be a Hecke-normalized factorizable even newform with the Whittaker function $W_\phi=\otimes_{p\le\infty}W_p$ (in this case, $W_p$ is the normalized (that is $W_p(1)=1$) newvector of $\pi_p$) such that $$W_\infty\left[\begin{pmatrix}y&\\&1\end{pmatrix}\right]=f(y),$$
where $f$ is the test function mentioned in the comment. The last restriction is possible via the Theory of the Kirillov model: $$C_c^\infty(\mathbb{R}^\times)\subset\left\lbrace W\left[\begin{pmatrix}\cdot&\\&1\end{pmatrix}\right]\mid W\in\pi_\infty\right\rbrace.$$
The Fourier expansion of $\phi$ is given by
$$\phi(g)=\sum_{\gamma\in\mathbb{Q}^\times}W\left[\begin{pmatrix}\gamma&\\&1\end{pmatrix}g\right].$$
If $$g=\left(1,\begin{pmatrix}1&-a/q\\&1\end{pmatrix}\begin{pmatrix}1/B&\\&1\end{pmatrix}\right)\in\mathrm{GL}_2(\mathbb{A}_f)\times\mathrm{GL}_2(\mathbb{R}),$$
then
$$\phi(g) = \sum_{m=1}^\infty\frac{\lambda(m)}{\sqrt{m}}e\left(-\frac{am}{q}\right)f(m/B).$$
Note that using $\lambda(m)\ll m^{O(1)}$ one can truncate the above sum by $m\le B^{1+\epsilon}$ with $O(B^{-N})$ error.
Using the bound $\|\phi\|_\infty\ll_\pi 1$ we conclude that the sum in the OP is $O(B^{1/2+\epsilon})$.
