
    Eiz                     P   d Z ddlmZmZmZ ddlmZmZmZ ddl	m
Z
 ddlmZ ddlmZ  e       Zej!                  deeef   dgd	d
       eddd       edddd       edd       edd       edd       ee      fdededee   dee   dee   de
deeef   fd       Zy) z&
Reports Router - Transaction reports
    )OptionalDictAny)	APIRouterDependsQuery)Session)get_session)servicesz/transactionsREPORTSzGet Transaction ReportszDRetrieve paginated transaction reports with optional field filtering)response_modeltagssummarydescription   zPage number)ger   
   d   zItems per page (max 100))r   ler   NzzComma-separated list of fields to include (merchant, customer, invoices, payment_request, billing_address, payment_method))r   zSearch termzFilter by merchant IDpageper_pagefieldssearchmerchant_iddbreturnc                    K   d}|r=|j                  d      D cg c]#  }|j                         s|j                         % }}t        j                  || ||||      }|ddddS c c}w w)z<Get transaction reports with pagination and field selection.N,)r   r   r   r   r   r      Tz*Transaction reports retrieved successfully)datastatus_codesuccessmessage)splitstripr   get_transaction_reports)	r   r   r   r   r   r   requested_fieldsfreport_datas	            U/var/www/html/hwPaymentPortal-be-dev/hw-payment-portal-api/src/apps/reports/router.pyget_transactions_reportr+      s|     & /5||C/@N!AGGIAGGINN22K ?	  Os   A+A&A&)A+)__doc__typingr   r   r   fastapir   r   r   sqlalchemy.ormr	   src.core.databaser
   src.apps.reportsr   routergetstrintr+        r*   <module>r8      s   ' & - - " ) %	 S>
%V   aA=9"s8RS! Q "$MB!&t9P!Q+&
 SM SM # 	 
#s(^r7   